|
@@ -1133,6 +1133,7 @@ String function cmd_model_add(type : String, name : String, code : String):
|
|
|
String function cmd_process_execute(process : String, mapping : Element):
|
|
|
// Execute a process model until it reaches termination
|
|
|
String process_id
|
|
|
+ String name
|
|
|
|
|
|
process_id = get_entry_id(process)
|
|
|
if (process_id != ""):
|
|
@@ -1146,6 +1147,48 @@ String function cmd_process_execute(process : String, mapping : Element):
|
|
|
String ver
|
|
|
ver = conformance_scd(pm)
|
|
|
if (ver == "OK"):
|
|
|
+ Element all_data
|
|
|
+ String data
|
|
|
+ Element names
|
|
|
+ all_data = allInstances(pm, "Data")
|
|
|
+ names = set_create()
|
|
|
+ while (set_len(all_data) > 0):
|
|
|
+ data = set_pop(all_data)
|
|
|
+ set_add(names, read_attribute(pm, data, "name"))
|
|
|
+ if (set_len(allIncomingAssociationInstances(pm, data, "Consumes")) > 0):
|
|
|
+ name = read_attribute(pm, data, "name")
|
|
|
+ // It is used somewhere for consumption: require read permissions
|
|
|
+ // First check if this is a defined name
|
|
|
+ if (dict_in(mapping, name)):
|
|
|
+ // Yes, it is defined seperately, so we have to check
|
|
|
+ if (get_entry_id(mapping[name]) != ""):
|
|
|
+ // Existing model, so have to check
|
|
|
+ if (bool_not(allow_read(current_user_id, get_entry_id(mapping[name])))):
|
|
|
+ // Not readable model, while it has to be read: error
|
|
|
+ return "Read permission denied to: " + cast_string(mapping[name])!
|
|
|
+ if (read_type(core, mapping[name]) == "Folder"):
|
|
|
+ return "Not a model: " + cast_string(mapping[name])!
|
|
|
+ if (set_len(allIncomingAssociationInstances(pm, data, "Produces")) > 0):
|
|
|
+ name = read_attribute(pm, data, "name")
|
|
|
+ // It is used somewhere for consumption: require read permissions
|
|
|
+ // First check if this is a defined name
|
|
|
+ if (dict_in(mapping, name)):
|
|
|
+ // Yes, it is defined seperately, so we have to check
|
|
|
+ if (get_entry_id(mapping[name]) != ""):
|
|
|
+ // Existing model, so have to check
|
|
|
+ if (bool_not(allow_write(current_user_id, get_entry_id(mapping[name])))):
|
|
|
+ // Not readable model, while it has to be read: error
|
|
|
+ return "Write permission denied to: " + cast_string(mapping[name])!
|
|
|
+ if (read_type(core, mapping[name]) == "Folder"):
|
|
|
+ return "Not a model: " + cast_string(mapping[name])!
|
|
|
+
|
|
|
+ // Now check all keys in the mapping
|
|
|
+ Element map_keys
|
|
|
+ map_keys = dict_keys(mapping)
|
|
|
+ if (set_len(set_difference(map_keys, names)) > 0):
|
|
|
+ return "Signature mismatch: " + cast_string(set_pop(set_difference(map_keys, names)))!
|
|
|
+
|
|
|
+ // Now execute!
|
|
|
enact_PM(pm, mapping)
|
|
|
return "Success"!
|
|
|
else:
|