SetGroupMembers()
A SetGroupMembers() function sets a group member role to a specified list of users for a given group. In other words, provided users are added to the given group and the previous ones are removed.
SetGroupMembers(usersList, groupName);Function arguments
Dział zatytułowany „Function arguments”- usersList – (String) a list of user logins separated by , or ; or as an ObjectList with users logins;
- groupName – (String) a name of the group.
Return value
Dział zatytułowany „Return value”This function returns Boolean. The SetGroupMembers() function returns true if group members are set correctly, false otherwise.
Examples
Dział zatytułowany „Examples”Example 1
Dział zatytułowany „Example 1”This will add users with logins „user1” and „user2” to „Managers” group and remove any other users from this group.
SetGroupMembers("user1;user2","Managers");Example 2
Dział zatytułowany „Example 2”This will synchronize members of „Managers” group with the list of users chosen from „User” field/column in a table named „Users list”.
usersList=CreateObject("ObjectList");foreachrow("Users list"){ AddObjectToList(usersList, [User]);}SetGroupMembers(usersList,"Managers");