public interface ApplicationRoleManager
ApplicationRole
s. It is generally recommended to use
ApplicationAuthorizationService
or ApplicationRoleAdminService
rather than this class, as the service
layer contains additional validation and business logic.ApplicationAuthorizationService
,
ApplicationRoleAdminService
,
ApplicationRole
Modifier and Type | Method and Description |
---|---|
Set<com.atlassian.application.api.ApplicationKey> |
getDefaultApplicationKeys()
Returns an immutable
Set of ApplicationKey s that are configured as the default applications for new users. |
Set<com.atlassian.crowd.embedded.api.Group> |
getDefaultGroups(com.atlassian.application.api.ApplicationKey key)
Get the default
Group s associated with the ApplicationRole
backed by a (potentially exceeded) license. |
Set<ApplicationRole> |
getDefaultRoles()
Deprecated.
Use
getDefaultApplicationKeys() instead. Since v7.0 |
Set<com.atlassian.crowd.embedded.api.Group> |
getGroupsForLicensedRoles()
Get the
Set of group names that have been associated with all the ApplicationRole s
that have a backing (but potentially exceeded) license. |
Set<ApplicationRole> |
getOccupiedLicenseRolesForUser(ApplicationUser user)
|
int |
getRemainingSeats(com.atlassian.application.api.ApplicationKey key)
Retrieve the number of available (unoccupied) user seats for the
ApplicationRole
backed by a (potentially exceeded) license. |
com.atlassian.fugue.Option<ApplicationRole> |
getRole(com.atlassian.application.api.ApplicationKey key)
Returns the
ApplicationRole identified by the given ApplicationKey ,
or Option.none() if no such ApplicationRole exists. |
Set<ApplicationRole> |
getRoles()
Returns an immutable
Set of all ApplicationRole s that are backed by a (potentially exceeded)
license. |
Set<ApplicationRole> |
getRolesForGroup(com.atlassian.crowd.embedded.api.Group group)
Returns the
Set of ApplicationRole s associated with the given Group , or groups for
which the given group is a nested group (sub-group). |
Set<ApplicationRole> |
getRolesForUser(ApplicationUser user)
|
int |
getUserCount(com.atlassian.application.api.ApplicationKey key)
Retrieve the number of active users for the given
ApplicationRole . |
boolean |
hasAnyRole(ApplicationUser user)
Returns true if the given user has been assigned to any
ApplicationRole that is backed by a
(potentially exceeded) license. |
boolean |
hasExceededAllRoles(ApplicationUser user)
Returns true if the user limits of all of the given user's assigned
ApplicationRole s have been exceeded. |
boolean |
hasSeatsAvailable(com.atlassian.application.api.ApplicationKey key,
int seatCount)
Determines whether the
ApplicationRole backed by a license
has the requested number of user seats available. |
boolean |
isAnyRoleLimitExceeded()
Returns true if the number of users assigned to any
ApplicationRole exceeds the number of seats granted
to that role by its license. |
boolean |
isRoleInstalledAndLicensed(com.atlassian.application.api.ApplicationKey key)
Determines whether an application identified by the given
ApplicationKey
is installed and running in this JIRA instance AND has a backing license key. |
boolean |
isRoleLimitExceeded(com.atlassian.application.api.ApplicationKey role)
Returns
true if the number of users assigned to the given ApplicationRole exceeds the
number of seats granted by its license. |
void |
removeGroupFromRoles(com.atlassian.crowd.embedded.api.Group group)
Removes any/all associations of the given group from all
ApplicationRole s
(irrespective of whether the ApplicationRole s is backed by a license). |
default boolean |
rolesEnabled()
Deprecated.
since 7.0.1 as this always returns true in JIRA 7
|
ApplicationRole |
setRole(ApplicationRole role)
Save the passed
ApplicationRole information to the database. |
boolean |
userHasRole(ApplicationUser user,
com.atlassian.application.api.ApplicationKey key)
Returns
true if the passed user belongs to the ApplicationRole associated with the given key. |
boolean |
userOccupiesRole(ApplicationUser user,
com.atlassian.application.api.ApplicationKey key)
Returns
true if the passed user occupies a seat in the ApplicationRole associated with the given key. |
@Nonnull com.atlassian.fugue.Option<ApplicationRole> getRole(@Nonnull com.atlassian.application.api.ApplicationKey key)
ApplicationRole
identified by the given ApplicationKey
,
or Option.none()
if no such ApplicationRole
exists.
Note: ApplicationRole
s returned by this method are guaranteed to be backed by a (potentially exceeded)
license, however the installation state of the plugin/product that uses this role may not necessarily
physically installed.
key
- the ApplicationKey
of the role to search for.ApplicationRole
associated with the passed role identifier, or Option.none()
.@Nonnull Set<ApplicationRole> getRoles()
Set
of all ApplicationRole
s that are backed by a (potentially exceeded)
license.Set
of all ApplicationRole
s that are backed by a (potentially exceeded) license.@Nonnull @Deprecated @ExperimentalApi Set<ApplicationRole> getDefaultRoles()
getDefaultApplicationKeys()
instead. Since v7.0Set
of ApplicationRole
s that are configured be default for new users.Set
of ApplicationRole
s that are configured be default for new users.@Nonnull Set<com.atlassian.application.api.ApplicationKey> getDefaultApplicationKeys()
Set
of ApplicationKey
s that are configured as the default applications for new users.Set
of ApplicationKey
s that are configured as the default applications for new users.for defaul roles.
boolean hasAnyRole(@Nullable ApplicationUser user)
ApplicationRole
that is backed by a
(potentially exceeded) license.ApplicationRole
that is backed by a (potentially exceeded) license.boolean userHasRole(@Nullable ApplicationUser user, com.atlassian.application.api.ApplicationKey key)
true
if the passed user belongs to the ApplicationRole
associated with the given key.
NOTE: This does not check that the application is licensed with a valid license.user
- the user to check - if this is null, returns false
key
- the key corresponding to the ApplicationRole
boolean userOccupiesRole(@Nullable ApplicationUser user, com.atlassian.application.api.ApplicationKey key)
true
if the passed user occupies a seat in the ApplicationRole
associated with the given key.user
- the user to check - if this is null, returns false
key
- the key corresponding to the ApplicationRole
boolean hasExceededAllRoles(@Nonnull ApplicationUser user)
ApplicationRole
s have been exceeded.
The user limit of an ApplicationRole
is exceeded when the combined number of users assigned to that role
(through assigned groups) exceeds the number of seats granted for that role in its license.
Note: this method does NOT take into account whether licenses for application roles are
expired
; this must be tested separately.
user
- the user whose roles will be checked.true
if all of the user
's roles have user counts that exceed the number of seats
granted by licenses.boolean isAnyRoleLimitExceeded()
ApplicationRole
exceeds the number of seats granted
to that role by its license.
Note: this method does NOT take into account whether licenses for installed roles are
expired
; this must be tested separately.
boolean isRoleLimitExceeded(@Nonnull com.atlassian.application.api.ApplicationKey role)
true
if the number of users assigned to the given ApplicationRole
exceeds the
number of seats granted by its license. This method unconditionally returns false
if the passed role
is not considered to be installed (ie: backed by a license).
Note: this method does NOT take into account whether licenses for installed roles are
expired
; this must be tested separately.
role
- the identifier of the ApplicationRole
.true
if the installed ApplicationRole
is exceeded or false
otherwise.Set<ApplicationRole> getRolesForUser(@Nonnull ApplicationUser user)
user
- the user whose roles will be checked.Set
of ApplicationRole
s for the given user
.Set<ApplicationRole> getOccupiedLicenseRolesForUser(@Nonnull ApplicationUser user)
Set
of ApplicationRole
s that the given ApplicationUser
occupies seats in.
ApplicationUser
has to actively take a seat in the returned ApplicationRole
s
eg. for an ApplicationUser
who has access to SOFTWARE and implicitly (or explicitly) CORE, they will only have SOFTWARE returned.
For an ApplicationUser
who has explicit access to SOFTWARE and CORE - with the SOFTWARE license exceeded,
this will return both as the user effectively occupies a seat in both CORE and SOFTWARE now.user
- the user whose roles will be checked.Set
of ApplicationRole
s that the given user
is actively taking seats.Set<ApplicationRole> getRolesForGroup(@Nonnull com.atlassian.crowd.embedded.api.Group group)
Set
of ApplicationRole
s associated with the given Group
, or groups for
which the given group is a nested group (sub-group).group
- the group which roles will be checked.Set
of ApplicationRole
s associated with the group or its super-groups.@Nonnull Set<com.atlassian.crowd.embedded.api.Group> getGroupsForLicensedRoles()
Set
of group names that have been associated with all the ApplicationRole
s
that have a backing (but potentially exceeded) license.ApplicationRole
s that have a backing (but potentially
exceeded) license.void removeGroupFromRoles(@Nonnull com.atlassian.crowd.embedded.api.Group group)
ApplicationRole
s
(irrespective of whether the ApplicationRole
s is backed by a license).group
- the group to remove.boolean isRoleInstalledAndLicensed(@Nonnull com.atlassian.application.api.ApplicationKey key)
Determines whether an application identified by the given ApplicationKey
is installed and running in this JIRA instance AND has a backing license key.
key
- the key that identifies the ApplicationRole
backed by a (potentially exceeded) license.true
when the ApplicationRole
backed by a (potentially exceeded) license
has an associated application installed and running in this JIRA instance.@Nonnull ApplicationRole setRole(@Nonnull ApplicationRole role)
ApplicationRole
information to the database.
This method will only accept the passed role if:
role
- the role to save.IllegalArgumentException
- if passed role does not contain valid groups, valid default groups
or if the role does not have a backing license.int getUserCount(@Nonnull com.atlassian.application.api.ApplicationKey key)
ApplicationRole
.
It will uniquely count all users who are found in the groups associated with the application.key
- the key that identifies the ApplicationRole
.ApplicationRole
, or zero if the
ApplicationRole
does not exist.int getRemainingSeats(@Nonnull com.atlassian.application.api.ApplicationKey key)
ApplicationRole
backed by a (potentially exceeded) license.key
- the key that identifies the licensed ApplicationRole
.ApplicationRole
is not valid or there are as many active users as seats in the license.
When the license is unlimited, it will return minus one (-1)for finding occupied user seats.
boolean hasSeatsAvailable(@Nonnull com.atlassian.application.api.ApplicationKey key, int seatCount)
ApplicationRole
backed by a license
has the requested number of user seats available.key
- the key that identifies the ApplicationRole
.seatCount
- the number of user seats that this ApplicationRole
should have capacity for.true
if the ApplicationRole
for the provided ApplicationKey
has the number of user seats available.
false
if the there are not enough seats available.@Nonnull Set<com.atlassian.crowd.embedded.api.Group> getDefaultGroups(@Nonnull com.atlassian.application.api.ApplicationKey key)
Group
s associated with the ApplicationRole
backed by a (potentially exceeded) license.key
- the key that identifies the ApplicationRole
.Set
of default groups associated with the ApplicationRole
.@Internal @Deprecated default boolean rolesEnabled()
ApplicationRole
s are enabled.true
when ApplicationRole
are enabled, false
otherwise.Copyright © 2002-2015 Atlassian. All Rights Reserved.