Browse Source

Add check for reading the type when creating a model

Yentl Van Tendeloo 8 years ago
parent
commit
d2e2ed25a6
1 changed files with 7 additions and 2 deletions
  1. 7 2
      core/core_algorithm.alc

+ 7 - 2
core/core_algorithm.alc

@@ -158,7 +158,8 @@ Void function user_function_skip_init(user_id : String)
 			output("    model_list_full					-- List all models with full info")
 			output("")
 			output("Transformation-specific operations")
-			output("    transformation_add				-- TODO")
+			output("    transformation_add_MT			-- TODO")
+			output("    transformation_add_AL			-- TODO")
 			output("    transformation_source_add		-- TODO")
 			output("    transformation_source_delete	-- TODO")
 			output("    transformation_target_add		-- TODO")
@@ -235,7 +236,11 @@ Void function user_function_skip_init(user_id : String)
 
 			if (model_id != ""):
 				if (allow_read(user_id, model_id)):
-					mini_modify(import_node(read_attribute(core, model_id, "location")), allow_write(user_id, model_id))
+					type_id = set_pop(allAssociationDestinations(core, model_id, "instanceOf"))
+					if (allow_read(user_id, type_id)):
+						mini_modify(import_node(read_attribute(core, model_id, "location")), allow_write(user_id, model_id))
+					else:
+						output("You are not allowed to read the type model!")
 				else:
 					output("You are not allowed to read this model!")
 			else: