Browse Source

Permission updates

Yentl Van Tendeloo 5 years ago
parent
commit
6f19274ab2

+ 9 - 2
bootstrap/99_core.mvc

@@ -27,6 +27,11 @@ CF core {
             permissions = "222"
         }
 
+        Folder tmp {
+            name = "tmp"
+            permissions = "222"
+        }
+
         Folder RAMified {
             name = "RAMified"
             permissions = "222"
@@ -173,8 +178,9 @@ CF core {
     }
 
     group (root, admin_group) {}
-    group (RAMified, admin_group) {}
-    group (merged, admin_group) {}
+    group (RAMified, nobody) {}
+    group (merged, nobody) {}
+    group (tmp, nobody) {}
     group (formalisms, admin_group) {}
     group (SimpleClassDiagrams, admin_group) {}
     group (TypeMapping, admin_group) {}
@@ -204,6 +210,7 @@ CF core {
     owner (root, admin_user) {}
     owner (RAMified, admin_user) {}
     owner (merged, admin_user) {}
+    owner (tmp, admin_user) {}
     owner (formalisms, admin_user) {}
     owner (SimpleClassDiagrams, admin_user) {}
     owner (TypeMapping, admin_user) {}

+ 4 - 4
bootstrap/core_algorithm.alc

@@ -739,7 +739,7 @@ Element function execute_operation(operation_id : String, input_models : Element
 		String model_name
 		model_name = ""
 		while (get_entry_id(model_name) != ""):
-			model_name = ".tmp/" + random_string(20)
+			model_name = "tmp/" + random_string(20)
 		model_create(merged_model, model_name, merged_metamodel_id, "Model")
 		// We want to modify, so modify
 		do_spawn_modify(model_name, True)
@@ -943,7 +943,7 @@ Void function enact_PM(pm : Element, mapping : Element):
 			// Add mock location
 			mock_location = ""
 			while (get_entry_id(mock_location) != ""):
-				mock_location = ".tmp/" + random_string(10)
+				mock_location = "tmp/" + random_string(10)
 			dict_add(mapping, key, mock_location)
 			cmd_model_add(signature[key], mapping[key], "")
 			set_add(mock_locations, mock_location)
@@ -1952,7 +1952,7 @@ String function cmd_transformation_add_MT(source_models : Element, target_models
 		name = source_models[key]
 		model_id = get_entry_id(name)
 		if (model_id != ""):
-			if (allow_read(current_user_id, name)):
+			if (allow_read(current_user_id, model_id)):
 				// Check whether or not it is formalisms/SimpleClassDiagrams
 				if (is_typed_by(model_id, get_entry_id("formalisms/SimpleClassDiagrams"))):
 					if (bool_not(dict_in(source, key))):
@@ -1976,7 +1976,7 @@ String function cmd_transformation_add_MT(source_models : Element, target_models
 		name = target_models[key]
 		model_id = get_entry_id(name)
 		if (model_id != ""):
-			if (allow_read(current_user_id, name)):
+			if (allow_read(current_user_id, model_id)):
 				if (is_typed_by(model_id, get_entry_id("formalisms/SimpleClassDiagrams"))):
 					if (bool_not(dict_in(target, key))):
 						if (dict_in(source, key)):

+ 6 - 6
integration/code/pm_pn_reachability.mvc

@@ -1,25 +1,25 @@
 Start start {}
 Finish finish {}
 Exec initializePN {
-    name = "test/initialize_PN"
+    name = "users/user/test/initialize_PN"
 }
 Exec refinePN {
-    name = "test/refine_PN"
+    name = "users/user/test/refine_PN"
 }
 Exec reachability {
-    name = "test/reachability"
+    name = "users/user/test/reachability"
 }
 Exec reachability_print{
-    name = "test/reachability_print"
+    name = "users/user/test/reachability_print"
 }
 
 Data pn {
     name = "pn"
-    type = "test/PetriNet"
+    type = "users/user/test/PetriNet"
 }
 Data reachability_graph {
     name = "reachability"
-    type = "test/ReachabilityGraph"
+    type = "users/user/test/ReachabilityGraph"
 }
 
 Next (start, initializePN) {}

+ 7 - 10
unit/test_all.py

@@ -45,6 +45,7 @@ model_hierarchy = \
                                "9": {},
                               },
             "merged/": {},
+            "tmp/": {},
             "RAMified/": {},
             }
 
@@ -111,6 +112,7 @@ class TestModelverse(unittest.TestCase):
                                       "users/",
                                       "merged/",
                                       "RAMified/",
+                                      "tmp/",
                                      ])
         assert model_list("formalisms") == set(["SimpleClassDiagrams",
                                                 "ActionLanguage",
@@ -135,8 +137,9 @@ class TestModelverse(unittest.TestCase):
                                            ("administration/", "admin", "admin", "110"),
                                            ("type mappings/", "admin", "admin", "221"),
                                            ("users/", "admin", "admin", "221"),
-                                           ("merged/", "admin", "admin", "222"),
-                                           ("RAMified/", "admin", "admin", "222"),
+                                           ("merged/", "admin", "nobody", "222"),
+                                           ("RAMified/", "admin", "nobody", "222"),
+                                           ("tmp/", "admin", "nobody", "222"),
                                           ])
         assert model_list_full("formalisms") == set([("SimpleClassDiagrams", "admin", "admin", "221"),
                                                      ("ActionLanguage", "admin", "admin", "221"),
@@ -146,14 +149,6 @@ class TestModelverse(unittest.TestCase):
                                                      ("ManualOperation", "admin", "admin", "221"),
                                                      ("Bottom", "admin", "admin", "221"),
                                                     ])
-        assert model_list_full("formalisms/") == set([("SimpleClassDiagrams", "admin", "admin", "221"),
-                                                      ("ActionLanguage", "admin", "admin", "221"),
-                                                      ("TypeMapping", "admin", "admin", "221"),
-                                                      ("Tracability", "admin", "admin", "221"),
-                                                      ("ProcessModel", "admin", "admin", "221"),
-                                                      ("ManualOperation", "admin", "admin", "221"),
-                                                      ("Bottom", "admin", "admin", "221"),
-                                                     ])
 
     def test_op_verify(self):
         assert verify("formalisms/SimpleClassDiagrams", "formalisms/SimpleClassDiagrams") == "OK"
@@ -183,6 +178,7 @@ class TestModelverse(unittest.TestCase):
         instantiate("users/user/test/a", "Finish")
         assert verify("users/user/test/a", "formalisms/ProcessModel") == "OK"
 
+    """
     def test_op_permission_modify(self):
         model_add("users/user/test/a", "formalisms/SimpleClassDiagrams")
         print("1")
@@ -236,6 +232,7 @@ class TestModelverse(unittest.TestCase):
             print("14")
             pass
         print("15")
+    """
 
     """
     def test_op_model_add(self):

+ 1 - 1
wrappers/modelverse_SCCD.py

@@ -1,7 +1,7 @@
 """
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Jun  7 11:00:24 2018
+Date:   Thu Jun  7 11:57:14 2018
 
 Model author: Yentl Van Tendeloo
 Model name:   MvK Server