interface Group
Represents a Jira group, providing methods to inspect and manage its membership.
A Jira group is a collection of users that can be leveraged for assigning permissions, managing notifications, and controlling access. Through this interface, you can:
def group = Groups.getByName("jira-administrators")
println "Group Name: ${group.name
"
println "Group ID: ${group.groupId}"
println "Group URL: ${group.self}"
def user = Users.getByAccountId("5b10a2844c20165700ede21g")
println group.contains(user) ? "User is in the group." : "User is not in the group."
}
Type Params | Return Type | Name and description |
---|---|---|
|
abstract boolean |
add(User user) |
|
abstract boolean |
add(java.lang.String accountId) |
|
abstract boolean |
contains(User user) Checks if the specified User is a member of the group. |
|
abstract boolean |
contains(java.lang.String accountId) Checks if a user with the specified account ID is a member of the group. |
|
abstract java.lang.String |
getGroupId() Returns the unique identifier for the group. |
|
abstract java.util.Iterator<User> |
getMembers() Returns an iterator over all members of the group. |
|
abstract java.lang.String |
getName() Returns the display name of the group. |
|
abstract java.lang.String |
getSelf() Returns the URL referencing this group in the Jira API. |
Checks if the specified User is a member of the group.
This method is useful when you already have a User object at hand, such as from a prior user lookup. If you don’t have a User object, consider using contains(String) with an account ID instead.
Note: To maintain security and privacy, avoid hardcoding user details. Always retrieve user objects or
account IDs dynamically, for example from the Jira Cloud people directory (https://<your-domain>.atlassian.net/people
).
def user = Users.getLoggedInUser()
def group = Groups.getByName("jira-software-users")
if (group.contains(user)) {
println "The user is a member of the group."
else {
println "The user is not a member of the group."
}
}
user
- the User object representing the user to checktrue
if the user is a member, false
otherwiseChecks if a user with the specified account ID is a member of the group.
Use this method when you have the user's account ID but not a User object.
Account IDs can be retrieved programmatically, or found in the Jira Cloud people directory:
https://<your-domain>.atlassian.net/people
.
Note: You can retrieve user account IDs from the Jira Cloud people directory (https://<your-domain>.atlassian.net/people
).
def group = Groups.getByName("jira-software-users")
if (group.contains("5b10a2844c20165700ede21g")) {
println "The user is a member of the group."
else {
println "The user is not a member of the group."
}
}
accountId
- the account ID of the user to checktrue
if the user is a member, false
otherwiseReturns the unique identifier for the group.
This ID is stable and can be used across Atlassian products.
Returns an iterator over all members of the group.
Members are retrieved in pages as needed. Use the iterator's hasNext()
and next()
methods to process members without loading them all at once.
Returns the display name of the group.
Returns the URL referencing this group in the Jira API.