|
@@ -1744,6 +1744,56 @@ String function cmd_service_register(user_id : String, service_name : String):
|
|
|
else:
|
|
|
return "Service already exists: " + service_name!
|
|
|
|
|
|
+String function cmd_user_password(user_id : String, user_name : String, new_password : String):
|
|
|
+ if (bool_or(user_id == get_user_id(user_name), is_admin(user_id))):
|
|
|
+ if (get_user_id(user_name) != ""):
|
|
|
+ instantiate_attribute(core, get_user_id(user_name), "password", hash(new_password))
|
|
|
+ return "Success"!
|
|
|
+ else:
|
|
|
+ return "No such user: " + user_name!
|
|
|
+ else:
|
|
|
+ return "Permission denied to user: " + user_name!
|
|
|
+
|
|
|
+String function cmd_transformation_signature(user_id : String, transformation_name : String):
|
|
|
+ String model_id
|
|
|
+ model_id = get_model_id(transformation_name)
|
|
|
+
|
|
|
+ if (model_id != ""):
|
|
|
+ if (is_nominal_instance(core, model_id, "Transformation")):
|
|
|
+ if (allow_read(user_id, transformation_name)):
|
|
|
+ String result
|
|
|
+ String elem
|
|
|
+ Element inputs
|
|
|
+ Element outputs
|
|
|
+
|
|
|
+ result = "Success: "
|
|
|
+ inputs = allOutgoingAssociationInstances(core, model_id, "transformInput")
|
|
|
+ while (read_nr_out(inputs) > 0):
|
|
|
+ elem = set_pop(inputs)
|
|
|
+ result = string_join(string_join(string_join(string_join("I ", read_attribute(core, elem, "name")), " "), read_attribute(core, readAssociationDestination(core, elem), "name")), "\n")
|
|
|
+
|
|
|
+ outputs = allOutgoingAssociationInstances(core, model_id, "transformOutput")
|
|
|
+ while (read_nr_out(outputs) > 0):
|
|
|
+ elem = set_pop(outputs)
|
|
|
+ result = string_join(string_join(string_join(string_join("O ", read_attribute(core, elem, "name")), " "), read_attribute(core, readAssociationDestination(core, elem), "name")), "\n")
|
|
|
+
|
|
|
+ return result!
|
|
|
+ else:
|
|
|
+ return "Permission denied to transformation: " + transformation_name!
|
|
|
+ else:
|
|
|
+ return "Model is not a transformation: " + transformation_name!
|
|
|
+ else:
|
|
|
+ return "No such transformation: " + transformation_name!
|
|
|
+
|
|
|
+String function cmd_element_list_nice(user_id : String, model_name : String):
|
|
|
+ if (get_model_id(model_name) != ""):
|
|
|
+ if (allow_read(user_id, get_model_id(model_name))):
|
|
|
+ return "Success: " + JSON_print(get_full_model(get_model_id(model_name)))!
|
|
|
+ else:
|
|
|
+ return "Permission denied to model: " + model_name!
|
|
|
+ else:
|
|
|
+ return "No such model: " + model_name!
|
|
|
+
|
|
|
Void function user_function_skip_init(user_id : String):
|
|
|
String cmd
|
|
|
String result
|
|
@@ -1815,6 +1865,12 @@ Void function user_function_skip_init(user_id : String):
|
|
|
output(cmd_admin_demote(user_id, single_input("User name?")))
|
|
|
elif (cmd == "service_register"):
|
|
|
output(cmd_service_register(user_id, single_input("Service name?")))
|
|
|
+ elif (cmd == "user_password"):
|
|
|
+ output(cmd_user_password(user_id, single_input("User name?"), single_input("New password?")))
|
|
|
+ elif (cmd == "transformation_read_signature"):
|
|
|
+ output(cmd_transformation_signature(user_id, single_input("Transformation name?")))
|
|
|
+ elif (cmd == "element_list_nice"):
|
|
|
+ output(cmd_element_list_nice(user_id, single_input("Model name?")))
|
|
|
elif (cmd == "verbose"):
|
|
|
set_verbose(True)
|
|
|
elif (cmd == "quiet"):
|