Browse Source

Minor fixes to fix many compile problems

Yentl Van Tendeloo 8 years ago
parent
commit
dd0215fa44
1 changed files with 19 additions and 6 deletions
  1. 19 6
      core/core_algorithm.alc

+ 19 - 6
core/core_algorithm.alc

@@ -108,15 +108,15 @@ Boolean function allow_change_metadata(user_id : String, model_id : String):
 		// Is admin, so always allow
 		return True!
 	else:
-		if (get_relation_to_model(user_id, model_id) == "0"):
+		if (get_relation_to_model(user_id, model_id) == 0):
 			// Only owner can chmod
 			return True!
 		else:
 			return False!
 
-Void function check_login(user_id : String):
+Boolean function check_login(user_id : String):
 	// TODO
-	return !
+	return False!
 
 Element function user_function():
 	String username
@@ -142,7 +142,7 @@ Element function user_function():
 			user_function_skip_init(user_id)
 
 	// User destroyed already, so just stop execution
-	return !
+	return create_node()!
 
 String function get_model_id(name : String):
 	Element models
@@ -151,11 +151,23 @@ String function get_model_id(name : String):
 	models = allInstances(core, "Model")
 	while (read_nr_out(models) > 0):
 		model = set_pop(models)
-		if (read_attribute(core, model, "name") == name):
+		if (value_eq(name, read_attribute(core, model, "name"))):
 			return model!
 	
 	return ""!
 
+String function get_user_id(name : String):
+	Element users
+	String user
+
+	users = allInstances(core, "User")
+	while (read_nr_out(users) > 0):
+		user = set_pop(users)
+		if (value_eq(read_attribute(core, user, "name"), name)):
+			return user!
+	
+	return ""!
+
 Void function user_function_skip_init(user_id : String):
 	Boolean do_continue
 	String cmd
@@ -212,6 +224,7 @@ Void function user_function_skip_init(user_id : String):
 			String name
 			String type
 			String location
+			String type_id
 			Element new_model
 
 			output("Creating new model!")
@@ -674,4 +687,4 @@ Void function user_function_skip_init(user_id : String):
 	model_delete_element(core, user_id)
 	output("Goodbye!")
 
-	return create_node()!
+	return !