|
@@ -169,7 +169,7 @@ Boolean function allow_group_modify(user_id : String, group_id : String):
|
|
|
// Is admin, so always allow
|
|
|
return True!
|
|
|
else:
|
|
|
- if (set_len(set_overlap(allIncomingAssociationInstances(core, user_id, "owner"), allOutgoingAssociationInstances(core, group_id, "owner"))) > 0):
|
|
|
+ if (set_in(allAssociationDestinations(core, group_id, "owner"), user_id)):
|
|
|
// We are an owner
|
|
|
return True!
|
|
|
else:
|
|
@@ -1569,15 +1569,10 @@ String function cmd_group_owner_add(user_id : String, group_name : String, other
|
|
|
if (allow_group_modify(user_id, group_id)):
|
|
|
other_user_id = get_user_id(other_user_name)
|
|
|
if (other_user_id != ""):
|
|
|
- Element overlap
|
|
|
-
|
|
|
- overlap = set_overlap(allIncomingAssociationInstances(core, other_user_id, "owner"), allOutgoingAssociationInstances(core, group_id, "owner"))
|
|
|
- if (set_len(overlap) == 0):
|
|
|
+ if (set_in(allAssociationDestinations(core, group_id, "owner"), other_user_id)):
|
|
|
instantiate_link(core, "owner", "", group_id, other_user_id)
|
|
|
|
|
|
- overlap = set_overlap(allOutgoingAssociationInstances(core, other_user_id, "belongsTo"), allIncomingAssociationInstances(core, group_id, "belongsTo"))
|
|
|
-
|
|
|
- if (set_len(overlap) == 0):
|
|
|
+ if (set_in(allAssociationDestinations(core, other_user_id, "belongsTo"), group_id)):
|
|
|
instantiate_link(core, "belongsTo", "", other_user_id, group_id)
|
|
|
|
|
|
return "Success"!
|
|
@@ -1600,12 +1595,10 @@ String function cmd_group_owner_delete(user_id : String, group_name : String, ot
|
|
|
if (allow_group_modify(user_id, group_id)):
|
|
|
other_user_id = get_user_id(other_user_name)
|
|
|
if (other_user_id != ""):
|
|
|
- Element overlap
|
|
|
-
|
|
|
- overlap = set_overlap(allOutgoingAssociationInstances(core, other_user_id, "belongsTo"), allIncomingAssociationInstances(core, group_id, "belongsTo"))
|
|
|
- if (set_len(overlap) > 0):
|
|
|
- overlap = set_overlap(allIncomingAssociationInstances(core, other_user_id, "owner"), allOutgoingAssociationInstances(core, group_id, "owner"))
|
|
|
- if (set_len(overlap) > 0):
|
|
|
+ if (set_in(allAssociationDestinations(core, other_user_id, "belongsTo"), group_id)):
|
|
|
+ if (set_in(allAssociationDestinations(core, group_id, "owner"), other_user_id)):
|
|
|
+ Element overlap
|
|
|
+ overlap = set_overlap(allIncomingAssociationInstances(core, group_id, "owner"), allOutgoingAssociationInstances(core, other_user_id, "owner"))
|
|
|
model_delete_element(core, set_pop(overlap))
|
|
|
return "Success"!
|
|
|
else:
|
|
@@ -1629,10 +1622,7 @@ String function cmd_group_join(user_id : String, group_name : String, other_user
|
|
|
if (allow_group_modify(user_id, group_id)):
|
|
|
other_user_id = get_user_id(other_user_name)
|
|
|
if (other_user_id != ""):
|
|
|
- Element overlap
|
|
|
- overlap = set_overlap(allOutgoingAssociationInstances(core, other_user_id, "belongsTo"), allIncomingAssociationInstances(core, group_id, "belongsTo"))
|
|
|
-
|
|
|
- if (set_len(overlap) == 0):
|
|
|
+ if (set_in(allOutgoingAssociationInstances(core, other_user_id, "belongsTo"), group_id)):
|
|
|
instantiate_link(core, "belongsTo", "", other_user_id, group_id)
|
|
|
return "Success"!
|
|
|
else:
|
|
@@ -1655,14 +1645,13 @@ String function cmd_group_kick(user_id : String, group_name : String, other_user
|
|
|
other_user_id = get_user_id(other_user_name)
|
|
|
if (other_user_id != ""):
|
|
|
Element overlap
|
|
|
- overlap = set_overlap(allOutgoingAssociationInstances(core, other_user_id, "belongsTo"), allIncomingAssociationInstances(core, group_id, "belongsTo"))
|
|
|
-
|
|
|
- if (set_len(overlap) > 0):
|
|
|
- model_delete_element(core, set_pop(overlap))
|
|
|
+ if (set_in(allAssociationDestinations(core, other_user_id, "belongsTo"), group_id)):
|
|
|
+ overlap = set_overlap(allIncomingAssociationInstances(core, group_id, "belongsTo"), allOutgoingAssociationInstances(core, other_user_id, "belongsTo"))
|
|
|
+ model_delete_element(core,set_pop(overlap))
|
|
|
|
|
|
// Check if user was an owner as well
|
|
|
- overlap = set_overlap(allIncomingAssociationInstances(core, other_user_id, "owner"), allOutgoingAssociationInstances(core, group_id, "owner"))
|
|
|
- if (set_len(overlap) > 0):
|
|
|
+ if (set_in(allAssociationDestinations(core, group_id, "owner"), other_user_id)):
|
|
|
+ overlap = set_overlap(allIncomingAssociationInstances(core, other_user_id, "owner"), allOutgoingAssociationInstances(core, group_id, "owner"))
|
|
|
model_delete_element(core, set_pop(overlap))
|
|
|
|
|
|
return "Success"!
|
|
@@ -1686,7 +1675,7 @@ String function cmd_group_list(user_id : String):
|
|
|
groups = allAssociationDestinations(core, user_id, "belongsTo")
|
|
|
while (set_len(groups) > 0):
|
|
|
group_id = set_pop(groups)
|
|
|
- if (set_in(allOutgoingAssociationInstances(core, group_id, "owner"), user_id)):
|
|
|
+ if (set_in(allAssociationDestinations(core, group_id, "owner"), user_id)):
|
|
|
admin = " A "
|
|
|
else:
|
|
|
admin = " "
|