|
@@ -154,6 +154,9 @@ Boolean function is_admin(user_id : String):
|
|
|
else:
|
|
|
return False!
|
|
|
|
|
|
+Boolean function allow_execute(user_id : String, model_id : String):
|
|
|
+ return allow_read(user_id, model_id)!
|
|
|
+
|
|
|
Boolean function allow_read(user_id : String, model_id : String):
|
|
|
if (is_admin(user_id)):
|
|
|
// Is admin, so always allow
|
|
@@ -1111,17 +1114,17 @@ String function cmd_model_add(type : String, name : String, code : String):
|
|
|
|
|
|
new_model = compile_model(code, mm)
|
|
|
|
|
|
- if (element_eq(new_model, read_root())):
|
|
|
- return "Compilation error"!
|
|
|
+ if (is_physical_string(new_model)):
|
|
|
+ return "Compilation error: " + cast_string(new_model)!
|
|
|
|
|
|
model_create(new_model, name, type_id, "Model")
|
|
|
return "Success"!
|
|
|
else:
|
|
|
return "Model exists: " + name!
|
|
|
else:
|
|
|
- return "Permission denied to model: " + type!
|
|
|
+ return "Read permission denied to: " + type!
|
|
|
else:
|
|
|
- return "Model not found: " + type!
|
|
|
+ return "Location not found: " + type!
|
|
|
|
|
|
String function cmd_process_execute(process : String, mapping : Element):
|
|
|
// Execute a process model until it reaches termination
|
|
@@ -1129,7 +1132,7 @@ String function cmd_process_execute(process : String, mapping : Element):
|
|
|
|
|
|
process_id = get_entry_id(process)
|
|
|
if (process_id != ""):
|
|
|
- if (allow_read(current_user_id, process_id)):
|
|
|
+ if (allow_execute(current_user_id, process_id)):
|
|
|
Element pm
|
|
|
pm = get_full_model(process_id, get_entry_id("formalisms/ProcessModel"))
|
|
|
if (element_eq(pm, read_root())):
|
|
@@ -1138,9 +1141,9 @@ String function cmd_process_execute(process : String, mapping : Element):
|
|
|
enact_PM(pm, mapping)
|
|
|
return "Success"!
|
|
|
else:
|
|
|
- return "Permission denied to model: " + process!
|
|
|
+ return "Execute permission denied to: " + process!
|
|
|
else:
|
|
|
- return "Model not found: " + process!
|
|
|
+ return "Location not found: " + process!
|
|
|
|
|
|
String function cmd_process_signature(process : String):
|
|
|
// Execute a process model until it reaches termination
|
|
@@ -1152,7 +1155,7 @@ String function cmd_process_signature(process : String):
|
|
|
|
|
|
process_id = get_entry_id(process)
|
|
|
if (process_id != ""):
|
|
|
- if (allow_read(current_user_id, process_id)):
|
|
|
+ if (allow_execute(current_user_id, process_id)):
|
|
|
Element pm
|
|
|
pm = get_full_model(process_id, get_entry_id("formalisms/ProcessModel"))
|
|
|
if (element_eq(pm, read_root())):
|
|
@@ -1167,9 +1170,9 @@ String function cmd_process_signature(process : String):
|
|
|
|
|
|
return result!
|
|
|
else:
|
|
|
- return "Permission denied to model: " + process!
|
|
|
+ return "Execute permission denied to model: " + process!
|
|
|
else:
|
|
|
- return "Model not found: " + process!
|
|
|
+ return "Location not found: " + process!
|
|
|
|
|
|
String function cmd_transformation_between(source_dict : String, target_dict : String):
|
|
|
Element result
|
|
@@ -1200,7 +1203,7 @@ String function cmd_transformation_between(source_dict : String, target_dict : S
|
|
|
// Correct tag, so make transformation a possibility
|
|
|
set_add(subresult, readAssociationSource(core, link))
|
|
|
else:
|
|
|
- return "Model not found: " + mm!
|
|
|
+ return "Location not found: " + mm!
|
|
|
|
|
|
// Got a set of subresults now, which we use to find the overlap
|
|
|
result = set_overlap(result, subresult)
|
|
@@ -1221,7 +1224,7 @@ String function cmd_transformation_between(source_dict : String, target_dict : S
|
|
|
// Correct tag, so make transformation a possibility
|
|
|
set_add(subresult, readAssociationSource(core, link))
|
|
|
else:
|
|
|
- return "Model not found: " + mm!
|
|
|
+ return "Location not found: " + mm!
|
|
|
|
|
|
// Got a set of subresults now, which we use to find the overlap
|
|
|
result = set_overlap(result, subresult)
|
|
@@ -1283,7 +1286,7 @@ String function cmd_model_render(model_name : String, mapper_name : String, rend
|
|
|
|
|
|
if (allow_read(current_user_id, model_ID)):
|
|
|
if (mapper_ID != ""):
|
|
|
- if (allow_read(current_user_id, mapper_ID)):
|
|
|
+ if (allow_execute(current_user_id, mapper_ID)):
|
|
|
// Everything is fine; start the actual operation
|
|
|
// Find metamodel to render to
|
|
|
tracability_name = "tracability/" + rendered_name
|
|
@@ -1353,13 +1356,13 @@ String function cmd_model_render(model_name : String, mapper_name : String, rend
|
|
|
value = JSON_print(result["rendered"])
|
|
|
return ("Success: " + value) !
|
|
|
else:
|
|
|
- return "Permission denied to model: " + mapper_name!
|
|
|
+ return "Execute permission denied to: " + mapper_name!
|
|
|
else:
|
|
|
- return "Model not found: " + mapper_name!
|
|
|
+ return "Location not found: " + mapper_name!
|
|
|
else:
|
|
|
- return "Permission denied to model: " + model_name!
|
|
|
+ return "Read permission denied to: " + model_name!
|
|
|
else:
|
|
|
- return "Model not found: " + model_name!
|
|
|
+ return "Location not found: " + model_name!
|
|
|
|
|
|
Boolean function do_spawn_modify(model_name : String, write : Boolean):
|
|
|
output("Please edit this model before sending next input: " + model_name)
|
|
@@ -1465,7 +1468,7 @@ String function cmd_transformation_execute(transformation_name : String, source_
|
|
|
|
|
|
transformation_id = get_entry_id(transformation_name)
|
|
|
if (transformation_id != ""):
|
|
|
- if (allow_read(current_user_id, transformation_id)):
|
|
|
+ if (allow_execute(current_user_id, transformation_id)):
|
|
|
if (is_nominal_instance(core, transformation_id, "Transformation")):
|
|
|
// Read out source and target links
|
|
|
inputs = dict_create()
|
|
@@ -1486,9 +1489,9 @@ String function cmd_transformation_execute(transformation_name : String, source_
|
|
|
dict_add(inputs, assoc_name, source_model_name)
|
|
|
continue!
|
|
|
else:
|
|
|
- return "Permission denied to model: " + source_model_name!
|
|
|
+ return "Read permission denied to: " + source_model_name!
|
|
|
else:
|
|
|
- return "Model not found: " + source_model_name!
|
|
|
+ return "Location not found: " + source_model_name!
|
|
|
|
|
|
targets = allOutgoingAssociationInstances(core, transformation_id, "transformOutput")
|
|
|
outputs = dict_create()
|
|
@@ -1502,31 +1505,31 @@ String function cmd_transformation_execute(transformation_name : String, source_
|
|
|
if (get_entry_id(target_model_name) == ""):
|
|
|
// Doesn't exist yet, so we can easily create
|
|
|
if (get_entry_id(get_foldername(target_model_name)) == ""):
|
|
|
- return "Folder not found: " + get_foldername(target_model_name)!
|
|
|
+ return "Location not found: " + get_foldername(target_model_name)!
|
|
|
else:
|
|
|
if (allow_write(current_user_id, get_entry_id(get_foldername(target_model_name)))):
|
|
|
dict_add(output_map, assoc_name, full_name(readAssociationDestination(core, target)))
|
|
|
dict_add(outputs, assoc_name, target_model_name)
|
|
|
else:
|
|
|
- return "Permission denied to folder: " + get_foldername(target_model_name)!
|
|
|
+ return "Write permission denied to: " + get_foldername(target_model_name)!
|
|
|
else:
|
|
|
// Already exists, so we need to check for write access
|
|
|
if (allow_write(current_user_id, get_entry_id(target_model_name))):
|
|
|
dict_add(output_map, assoc_name, read_attribute(core, readAssociationDestination(core, target), "name"))
|
|
|
dict_add(outputs, assoc_name, target_model_name)
|
|
|
else:
|
|
|
- return "Permission denied to model: " + target_model_name!
|
|
|
+ return "Write permission denied to: " + target_model_name!
|
|
|
|
|
|
if (do_spawn_activity(transformation_id, tracability_name, inputs, outputs, output_map)):
|
|
|
return "Success"!
|
|
|
else:
|
|
|
return "Failure"!
|
|
|
else:
|
|
|
- return "Model is not executable: " + transformation_name!
|
|
|
+ return "Execute permission denied to: " + transformation_name!
|
|
|
else:
|
|
|
- return "Permission denied to model: " + transformation_name!
|
|
|
+ return "Execute permission denied to: " + transformation_name!
|
|
|
else:
|
|
|
- return "Model not found: " + transformation_name!
|
|
|
+ return "Location not found: " + transformation_name!
|
|
|
|
|
|
String function cmd_verify(model_name : String, metamodel_name : String):
|
|
|
// Check whether a model conforms to its specification (with the selected type mapping)
|
|
@@ -1546,13 +1549,13 @@ String function cmd_verify(model_name : String, metamodel_name : String):
|
|
|
|
|
|
return string_join("Success: ", conformance_scd(m))!
|
|
|
else:
|
|
|
- return "Permission denied to model: " + metamodel_name!
|
|
|
+ return "Read permission denied to: " + metamodel_name!
|
|
|
else:
|
|
|
- return "Model not found: " + metamodel_name!
|
|
|
+ return "Location not found: " + metamodel_name!
|
|
|
else:
|
|
|
- return "Permission denied to model: " + model_name!
|
|
|
+ return "Read permission denied to: " + model_name!
|
|
|
else:
|
|
|
- return "Model not found: " + model_name!
|
|
|
+ return "Location not found: " + model_name!
|
|
|
|
|
|
String function cmd_model_overwrite(model_name : String, metamodel_name : String):
|
|
|
// Overwrites an existing model without changing any metadata
|
|
@@ -1573,17 +1576,17 @@ String function cmd_model_overwrite(model_name : String, metamodel_name : String
|
|
|
output("Waiting for model constructors...")
|
|
|
new_model = compile_model(input(), mm)
|
|
|
|
|
|
- if (element_eq(new_model, read_root())):
|
|
|
- return "Compilation error"!
|
|
|
+ if (is_physical_string(new_model)):
|
|
|
+ return "Compilation error: " + cast_string(new_model)!
|
|
|
|
|
|
model_overwrite(new_model, model_id, get_entry_id(metamodel_name))
|
|
|
return "Success"!
|
|
|
else:
|
|
|
- return string_join("Permission denied to model: ", full_name(type_id))!
|
|
|
+ return string_join("Read permission denied to: ", full_name(type_id))!
|
|
|
else:
|
|
|
- return "Permission denied to model: " + model_name!
|
|
|
+ return "Write permission denied to: " + model_name!
|
|
|
else:
|
|
|
- return "Model not found: " + model_name!
|
|
|
+ return "Location not found: " + model_name!
|
|
|
|
|
|
String function cmd_model_modify(model_name : String, metamodel_name : String):
|
|
|
// Model modify operation, which uses the mini_modify.alc operations, though with extensions for access control
|
|
@@ -1606,11 +1609,11 @@ String function cmd_model_modify(model_name : String, metamodel_name : String):
|
|
|
model_overwrite(new_model, model_id, get_entry_id(metamodel_name))
|
|
|
return "Success"!
|
|
|
else:
|
|
|
- return string_join("Permission denied to model: ", full_name(type_id))!
|
|
|
+ return string_join("Read permission denied to: ", full_name(type_id))!
|
|
|
else:
|
|
|
- return "Permission denied to model: " + model_name!
|
|
|
+ return "Read permission denied to: " + model_name!
|
|
|
else:
|
|
|
- return "Model not found: " + model_name!
|
|
|
+ return "Location not found: " + model_name!
|
|
|
|
|
|
Void function model_delete(model_id : String):
|
|
|
if (read_type(core, model_id) == "Folder"):
|
|
@@ -1637,9 +1640,9 @@ String function cmd_model_delete(model_name : String):
|
|
|
model_delete(model_id)
|
|
|
return "Success"!
|
|
|
else:
|
|
|
- return "Permission denied to model: " + model_name!
|
|
|
+ return "Write permission denied to: " + model_name!
|
|
|
else:
|
|
|
- return "Model not found: " + model_name!
|
|
|
+ return "Location not found: " + model_name!
|
|
|
|
|
|
String function cmd_model_list(location : String):
|
|
|
// List all models
|
|
@@ -1659,7 +1662,7 @@ String function cmd_model_list(location : String):
|
|
|
result = result + (get_filename(read_attribute(core, m, "name")) + "\n")
|
|
|
return result!
|
|
|
else:
|
|
|
- return "Permission denied to folder: " + location!
|
|
|
+ return "Read permission denied to: " + location!
|
|
|
else:
|
|
|
return "Location not found: " + location!
|
|
|
|
|
@@ -1690,7 +1693,7 @@ String function cmd_model_list_full(location : String):
|
|
|
result = result + permissions + " " + owner + " " + group + " " + name + "\n"
|
|
|
return result!
|
|
|
else:
|
|
|
- return "Permission denied to folder: " + location!
|
|
|
+ return "Read permission denied to: " + location!
|
|
|
else:
|
|
|
return "Location not found: " + location!
|
|
|
|
|
@@ -1746,9 +1749,9 @@ String function transformation_add(source_models : Element, target_models : Elem
|
|
|
else:
|
|
|
return "Name already selected for source: " + key!
|
|
|
else:
|
|
|
- return "Permission denied to model: " + name!
|
|
|
+ return "Read permission denied to: " + name!
|
|
|
else:
|
|
|
- return "Model not found: " + name!
|
|
|
+ return "Location not found: " + name!
|
|
|
|
|
|
keys = dict_keys(target_models)
|
|
|
while (set_len(keys) > 0):
|
|
@@ -1772,9 +1775,9 @@ String function transformation_add(source_models : Element, target_models : Elem
|
|
|
else:
|
|
|
return "Name already selected for target: " + key!
|
|
|
else:
|
|
|
- return "Permission denied to model: " + name!
|
|
|
+ return "Read permission denied to: " + name!
|
|
|
else:
|
|
|
- return "Model not found: " + name!
|
|
|
+ return "Location not found: " + name!
|
|
|
|
|
|
if (get_entry_id(operation_name) == ""):
|
|
|
// Write out a merged metamodel containing all these models: this is the MM for the manual operation
|
|
@@ -1802,8 +1805,8 @@ String function transformation_add(source_models : Element, target_models : Elem
|
|
|
output("Waiting for code constructors...")
|
|
|
Element compiled
|
|
|
compiled = compile_code(input())
|
|
|
- if (element_eq(compiled, read_root())):
|
|
|
- return "Compilation error"!
|
|
|
+ if (is_physical_string(compiled)):
|
|
|
+ return "Compilation error: " + cast_string(compiled)!
|
|
|
|
|
|
add_code_model(get_full_model(get_entry_id("formalisms/ActionLanguage"), get_entry_id("formalisms/SimpleClassDiagrams")), "AL/" + operation_name, compiled)
|
|
|
model_create(import_node("AL/" + operation_name), operation_name, get_entry_id("formalisms/ActionLanguage"), "ActionLanguage")
|
|
@@ -1893,9 +1896,9 @@ String function cmd_transformation_add_MT(source_models : Element, target_models
|
|
|
else:
|
|
|
return "Model not supported for RAMification: " + name!
|
|
|
else:
|
|
|
- return "Permission denied: " + name!
|
|
|
+ return "Read permission denied to: " + name!
|
|
|
else:
|
|
|
- return "Model not found: " + name!
|
|
|
+ return "Location not found: " + name!
|
|
|
|
|
|
keys = dict_keys(target_models)
|
|
|
while (set_len(keys) > 0):
|
|
@@ -1923,9 +1926,9 @@ String function cmd_transformation_add_MT(source_models : Element, target_models
|
|
|
else:
|
|
|
return "Model not supported for RAMification: " + name!
|
|
|
else:
|
|
|
- return "Permission denied: " + name!
|
|
|
+ return "Read permission denied to: " + name!
|
|
|
else:
|
|
|
- return "Model not found: " + name!
|
|
|
+ return "Location not found: " + name!
|
|
|
|
|
|
merged_formalism = model_fuse(to_ramify)
|
|
|
model_create(merged_formalism, "merged/" + operation_name, get_entry_id("formalisms/SimpleClassDiagrams"), "Model")
|
|
@@ -1943,8 +1946,8 @@ String function cmd_transformation_add_MT(source_models : Element, target_models
|
|
|
// Finished with all information, now create the model itself!
|
|
|
output("Waiting for model constructors...")
|
|
|
new_model = compile_model(input(), get_full_model(ramified_metamodel_id, get_entry_id("formalisms/SimpleClassDiagrams")))
|
|
|
- if (element_eq(new_model, read_root())):
|
|
|
- return "Compilation error"!
|
|
|
+ if (is_physical_string(new_model)):
|
|
|
+ return "Compilation error: " + cast_string(new_model)!
|
|
|
model_create(new_model, operation_name, ramified_metamodel_id, "ModelTransformation")
|
|
|
model_id = get_entry_id(operation_name)
|
|
|
|
|
@@ -2008,11 +2011,11 @@ String function cmd_permission_modify(model_name : String, permissions : String)
|
|
|
instantiate_attribute(core, model_id, "permissions", permissions)
|
|
|
return "Success"!
|
|
|
else:
|
|
|
- return "Permission has incorrect format: must be a string of three characters, with each character being a digit between 0 and 2"!
|
|
|
+ return "Incorrect format: must be a string of three characters, with each character being a digit between 0 and 2"!
|
|
|
else:
|
|
|
- return "Permission denied to model: " + model_name!
|
|
|
+ return "User permission denied to: " + model_name!
|
|
|
else:
|
|
|
- return "Model not found: " + model_name!
|
|
|
+ return "Location not found: " + model_name!
|
|
|
|
|
|
String function cmd_permission_owner(model_name : String, new_user_name : String):
|
|
|
String model_id
|
|
@@ -2029,9 +2032,9 @@ String function cmd_permission_owner(model_name : String, new_user_name : String
|
|
|
else:
|
|
|
return "No such user: " + new_user_name!
|
|
|
else:
|
|
|
- return "Permission denied to model: " + model_name!
|
|
|
+ return "User permission denied to: " + model_name!
|
|
|
else:
|
|
|
- return "Model not found: " + model_name!
|
|
|
+ return "Location not found: " + model_name!
|
|
|
|
|
|
String function cmd_permission_group(model_name : String, new_group_name : String):
|
|
|
String model_id
|
|
@@ -2048,9 +2051,9 @@ String function cmd_permission_group(model_name : String, new_group_name : Strin
|
|
|
else:
|
|
|
return "No such group: " + new_group_name!
|
|
|
else:
|
|
|
- return "Permission denied to model: " + model_name!
|
|
|
+ return "User permission denied to: " + model_name!
|
|
|
else:
|
|
|
- return "Model not found: " + model_name!
|
|
|
+ return "Location not found: " + model_name!
|
|
|
|
|
|
String function cmd_group_create(group_name : String):
|
|
|
// Create a new group and become its owner
|
|
@@ -2077,7 +2080,7 @@ String function cmd_group_delete(group_name : String):
|
|
|
model_delete_element(core, group_id)
|
|
|
return "Success"!
|
|
|
else:
|
|
|
- return "Permission denied to group: " + group_name!
|
|
|
+ return "Group permission denied to: " + group_name!
|
|
|
else:
|
|
|
return "Group not found: " + group_name!
|
|
|
|
|
@@ -2103,7 +2106,7 @@ String function cmd_group_owner_add(group_name : String, other_user_name : Strin
|
|
|
else:
|
|
|
return "User not found: " + other_user_name!
|
|
|
else:
|
|
|
- return "Permission denied to group: " + group_name!
|
|
|
+ return "Group permission denied to: " + group_name!
|
|
|
else:
|
|
|
return "Group not found: " + group_name!
|
|
|
|
|
@@ -2130,7 +2133,7 @@ String function cmd_group_owner_delete(group_name : String, other_user_name : St
|
|
|
else:
|
|
|
return "User not found: " + other_user_name!
|
|
|
else:
|
|
|
- return "Permission denied to group: " + group_name!
|
|
|
+ return "Group permission denied to: " + group_name!
|
|
|
else:
|
|
|
return "Group not found: " + group_name!
|
|
|
|
|
@@ -2152,7 +2155,7 @@ String function cmd_group_join(group_name : String, other_user_name : String):
|
|
|
else:
|
|
|
return "User not found: " + other_user_name!
|
|
|
else:
|
|
|
- return "Permission denied to group: " + group_name!
|
|
|
+ return "Group permission denied to: " + group_name!
|
|
|
else:
|
|
|
return "Group not found: " + group_name!
|
|
|
|
|
@@ -2182,7 +2185,7 @@ String function cmd_group_kick(group_name : String, other_user_name : String):
|
|
|
else:
|
|
|
return "User not found: " + other_user_name!
|
|
|
else:
|
|
|
- return "Permission denied to group: " + group_name!
|
|
|
+ return "Group permission denied to: " + group_name!
|
|
|
else:
|
|
|
return "Group not found: " + group_name!
|
|
|
|
|
@@ -2219,7 +2222,7 @@ String function cmd_admin_promote(other_user_name : String):
|
|
|
else:
|
|
|
return "User not found: " + other_user_name!
|
|
|
else:
|
|
|
- return "Permission denied to administrate: " + other_user_name!
|
|
|
+ return "Admin permission denied"!
|
|
|
|
|
|
String function cmd_admin_demote(other_user_name : String):
|
|
|
// Demote a user to normal status
|
|
@@ -2234,7 +2237,7 @@ String function cmd_admin_demote(other_user_name : String):
|
|
|
else:
|
|
|
return "User not found: " + other_user_name!
|
|
|
else:
|
|
|
- return "Permission denied to administrate: " + other_user_name!
|
|
|
+ return "Admin permission denied"!
|
|
|
|
|
|
String function cmd_service_register(service_name : String):
|
|
|
// Active a service for this specific user
|
|
@@ -2264,7 +2267,7 @@ String function cmd_user_password(user_name : String, new_password : String):
|
|
|
else:
|
|
|
return "No such user: " + user_name!
|
|
|
else:
|
|
|
- return "Permission denied to user: " + user_name!
|
|
|
+ return "User permission denied: " + user_name!
|
|
|
|
|
|
String function cmd_transformation_signature(transformation_name : String):
|
|
|
String model_id
|
|
@@ -2272,7 +2275,7 @@ String function cmd_transformation_signature(transformation_name : String):
|
|
|
|
|
|
if (model_id != ""):
|
|
|
if (is_nominal_instance(core, model_id, "Transformation")):
|
|
|
- if (allow_read(current_user_id, transformation_name)):
|
|
|
+ if (allow_execute(current_user_id, transformation_name)):
|
|
|
String result
|
|
|
String elem
|
|
|
Element inputs
|
|
@@ -2291,7 +2294,7 @@ String function cmd_transformation_signature(transformation_name : String):
|
|
|
|
|
|
return result!
|
|
|
else:
|
|
|
- return "Permission denied to operation: " + transformation_name!
|
|
|
+ return "Execute permission denied to: " + transformation_name!
|
|
|
else:
|
|
|
return "Model is not an operation: " + transformation_name!
|
|
|
else:
|
|
@@ -2321,7 +2324,7 @@ String function cmd_folder_create(folder_name : String):
|
|
|
if (element_neq(create_folders(current_user_id, folder_name), read_root())):
|
|
|
return "Success"!
|
|
|
else:
|
|
|
- return "Permission denied to folder: " + folder_name!
|
|
|
+ return "Write permission denied to: " + folder_name!
|
|
|
else:
|
|
|
return "Folder alreay exists: " + folder_name!
|
|
|
|