usersInGroups

Syntax

usersInGroups(groups)

Description

Returns a list of users common to all the specified groups.

Parameters

Parameter name

Type

Required

Description

groups

string[]

Yes

Array containing the groups names to retrieve the common users from.

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.

Example

Example 1

Result: The following users belong to both groups jira-administrators and jira-developers: user1|user2

Example 2: Union of groups

This example uses the usersInGroups routine to get all users in each group individually and then adding them into a predefined array. So the usersInGroups routine will be called twice: once for jira-administrators and once for jira-developers. Since each time it will be called with a single group, it will return all users from the specified group.

Starting with katl-commons 2.5.7, the code above can be rewritten with the following code:

See also