|
@@ -12,6 +12,9 @@ include "metamodels.alh"
|
|
|
|
|
|
Element core = ?
|
|
|
|
|
|
+String admin_username = "admin"
|
|
|
+String admin_password = "admin"
|
|
|
+
|
|
|
String core_location = "models/CoreFormalism"
|
|
|
String core_model_location = "core"
|
|
|
|
|
@@ -68,7 +71,7 @@ String function JSON_print(model : Element):
|
|
|
|
|
|
return result!
|
|
|
|
|
|
-Void function main():
|
|
|
+Void function initialize_core():
|
|
|
// Initialize the Core Formalism
|
|
|
String core_model
|
|
|
String core_formalism_model
|
|
@@ -108,18 +111,6 @@ Void function main():
|
|
|
export_node(core_model_location, core)
|
|
|
export_node(coreM_model_location, core["model"])
|
|
|
|
|
|
- // Switch all new users to the user_function
|
|
|
- // This accesses the bootstrap level, so do not change this unless you know what you are doing
|
|
|
- Element root
|
|
|
- Element prev
|
|
|
- root = read_root()
|
|
|
- root = root["__hierarchy"]["__IP"]
|
|
|
- while (value_neq(root, !call)):
|
|
|
- prev = root
|
|
|
- root = root["next"]
|
|
|
- dict_delete(prev, "next")
|
|
|
- dict_add(prev, "next", user_function["body"])
|
|
|
-
|
|
|
// Create admin group
|
|
|
admin_group = instantiate_node(core, "Group", "")
|
|
|
instantiate_attribute(core, admin_group, "name", "admin")
|
|
@@ -130,23 +121,10 @@ Void function main():
|
|
|
|
|
|
// Create admin user
|
|
|
admin_user = instantiate_node(core, "User", "")
|
|
|
- output("Desired username for admin user?")
|
|
|
- instantiate_attribute(core, admin_user, "name", input())
|
|
|
+ instantiate_attribute(core, admin_user, "name", admin_username)
|
|
|
instantiate_attribute(core, admin_user, "admin", True)
|
|
|
|
|
|
- String password
|
|
|
-
|
|
|
- while (True):
|
|
|
- output("Desired password for admin user?")
|
|
|
- password = hash(input())
|
|
|
-
|
|
|
- output("Please repeat the password")
|
|
|
- if (password == hash(input())):
|
|
|
- output("Passwords match!")
|
|
|
- instantiate_attribute(core, admin_user, "password", password)
|
|
|
- break!
|
|
|
- else:
|
|
|
- output("Not the same password, please try again!")
|
|
|
+ instantiate_attribute(core, admin_user, "password", hash(admin_password))
|
|
|
|
|
|
// Create link between admin user and group
|
|
|
instantiate_link(core, "ownedBy", "", admin_group, admin_user)
|
|
@@ -241,12 +219,7 @@ Void function main():
|
|
|
instantiate_link(core, "owner", "", core_model, admin_user)
|
|
|
|
|
|
// Call this for ourselves as well
|
|
|
- log("MvC is ready!")
|
|
|
- user_function_skip_init(admin_user)
|
|
|
-
|
|
|
- // Done, so finish up
|
|
|
- // Admin user will have been deleted by the user_function as usual
|
|
|
- // Note that if there are no admin users left, it will be very difficult to manage, as nobody will have admin permissions!
|
|
|
+ //log("MvC is ready!")
|
|
|
return !
|
|
|
|
|
|
String function get_instanceOf_link(model_id : String):
|
|
@@ -370,28 +343,11 @@ Element function extract_ftg(user_id : String):
|
|
|
|
|
|
return create_node()!
|
|
|
|
|
|
-Element function user_function():
|
|
|
+Void function new_task():
|
|
|
String username
|
|
|
String user_id
|
|
|
String password
|
|
|
|
|
|
- // Load in all global variables, as this code is hotloaded!
|
|
|
- Element root
|
|
|
- root = read_root()
|
|
|
- root = root["__hierarchy"]["objects"]
|
|
|
- exec(root["bootstrap/modelling.alc"]["initializers"])
|
|
|
- exec(root["bootstrap/library.alc"]["initializers"])
|
|
|
- exec(root["bootstrap/constructors.alc"]["initializers"])
|
|
|
- exec(root["bootstrap/object_operations.alc"]["initializers"])
|
|
|
- exec(root["core/mini_modify.alc"]["initializers"])
|
|
|
- exec(root["bootstrap/model_management.alc"]["initializers"])
|
|
|
- exec(root["bootstrap/ramify.alc"]["initializers"])
|
|
|
- exec(root["bootstrap/transform.alc"]["initializers"])
|
|
|
- exec(root["bootstrap/conformance_scd.alc"]["initializers"])
|
|
|
- exec(root["bootstrap/metamodels.alc"]["initializers"])
|
|
|
- exec(root["bootstrap/random.alc"]["initializers"])
|
|
|
- exec(root["core/core_algorithm.alc"]["initializers"])
|
|
|
-
|
|
|
// Load in a hard-reference to the previously created model
|
|
|
core = import_node(core_model_location)
|
|
|
|
|
@@ -426,8 +382,7 @@ Element function user_function():
|
|
|
user_function_skip_init(user_id)
|
|
|
|
|
|
// User destroyed already, so just stop execution
|
|
|
- // TODO return a fresh node as otherwise the compiler doesn't take this
|
|
|
- return create_node()!
|
|
|
+ return!
|
|
|
|
|
|
String function get_model_id(name : String):
|
|
|
Element models
|
|
@@ -1159,7 +1114,6 @@ String function cmd_model_delete(user_id : String, model_name : String):
|
|
|
|
|
|
String function cmd_model_list():
|
|
|
// List all models
|
|
|
- log("Start model list @ " + cast_v2s(time()))
|
|
|
Element models
|
|
|
String result
|
|
|
String m
|
|
@@ -1169,7 +1123,6 @@ String function cmd_model_list():
|
|
|
while (read_nr_out(models) > 0):
|
|
|
m = set_pop(models)
|
|
|
result = (result + string_join((string_join(" ", read_attribute(core, m, "name")) + " : "), read_attribute(core, set_pop(allAssociationDestinations(core, m, "instanceOf")), "name"))) + "\n"
|
|
|
- log("Finish model list @ " + cast_v2s(time()))
|
|
|
return result!
|
|
|
|
|
|
String function cmd_model_list_full():
|