Print

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.

Syntax

SetGroupMembers(usersList, groupName);

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

This function returns Boolean.
The SetGroupMembers() function returns true if group members are set correctly, false otherwise.

Examples

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

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");

 

Czy artykuł był pomocny?
0 na 5 gwiazdek
5 Stars 0%
4 Stars 0%
3 Stars 0%
2 Stars 0%
1 Stars 0%
5
How can we improve this article?
How Can We Improve This Article?