Table plus |
---|
applyColStyleToCell | true |
---|
heading | 0 |
---|
columnTypes | s,s,s,s |
---|
multiple | false |
---|
columnAttributes | style="background:#e5e7ea;font-weight:bold,,style="background:#e5e7ea;font-weight:bold, |
---|
enableSorting | false |
---|
|
Syntax | usersInGroups(groups | [, activeUsersOnly] |
Description
Excerpt |
---|
|
Returns a list of users common to all the specified groups. |
Returns a list of users common to all the specified groups.
...
Table plus |
---|
applyColStyleToCell | true |
---|
columnTypes | s,s,s,s |
---|
heading | 0 |
---|
multiple | false |
---|
enableSorting | false |
---|
|
Parameter name | Type | Required | Description |
---|
groups | StringĀ String [] | Yes | Array containing the groups names to retrieve the common users from | .activeUsersOnly | Boolean | No | If true only active users will be returned. If false both active an inactive users will be returned |
Return Type
String []
Returns a list with the usernames of the common users for all the specified groups. The result of the routine is the intersection of the sets of users for each specified group, not the union.
Examples
Example 1
Code Block |
---|
|
//The following users belong to both groups jira-developers and jira-administrators: user1, user2
string [] groups = {"jira-developers", "jira-administrators"};
string [] usersByGroups;
usersByGroups = usersInGroups(groups);
print("The following users belong to both groups jira-administrators and jira-developers: ");
print(usersByGroups); |
...
Example 2: Union of groups
Code Block |
---|
|
function getUsers(string [] groups){
string [] users;
for(string group in groups){
string [] currentGrp;
currentGrp = addElement(currentGrp, group);
for(string user in usersInGroups(currentGrp)){
users = addElementIfNotExist(users, user);
}
}
return users;
}
string [] groups = {"jira-developers", "jira-administrators"};
description = getUsers(groups); |
...
The code above (example 2) can be rewritten with the following code:
Code Block |
---|
|
string [] developers = usersInGroups({"jira -developers"});
string [] administrators = usersInGroups ({"jira-administrators"});
return arrayUnion (developers, administrators ); |
See also
Filter by label (Content by label) |
---|
showLabels | false |
---|
max | 25 |
---|
showSpace | false |
---|
cql | label = " |
---|
|
...
jira_group_routine" and space = currentSpace ( ) | labels | array_routines |
---|
|