public class MockApplicationRoleManager extends Object implements ApplicationRoleManager
| Constructor and Description |
|---|
MockApplicationRoleManager() |
| Modifier and Type | Method and Description |
|---|---|
MockApplicationRole |
createRole(com.atlassian.application.api.ApplicationKey key) |
Set<com.atlassian.application.api.ApplicationKey> |
getDefaultApplicationKeys()
Returns an immutable
Set of ApplicationKeys 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
Groups associated with the ApplicationRole
backed by a (potentially exceeded) license. |
Set<ApplicationRole> |
getDefaultRoles()
Returns an immutable
Set of ApplicationRoles that are configured be default for new users. |
Set<com.atlassian.crowd.embedded.api.Group> |
getGroupsForLicensedRoles()
Get the
Set of group names that have been associated with all the ApplicationRoles
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. |
io.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 ApplicationRoles that are backed by a (potentially exceeded)
license. |
Set<ApplicationRole> |
getRolesForGroup(com.atlassian.crowd.embedded.api.Group group)
Returns the
Set of ApplicationRoles 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
ApplicationRoles 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
ApplicationRoles
(irrespective of whether the ApplicationRoles is backed by a license). |
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. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitrolesEnabled@Nonnull public io.atlassian.fugue.Option<ApplicationRole> getRole(@Nonnull com.atlassian.application.api.ApplicationKey key)
ApplicationRoleManagerApplicationRole identified by the given ApplicationKey,
or Option.none() if no such ApplicationRole exists.
Note: ApplicationRoles 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.
getRole in interface ApplicationRoleManagerkey - the ApplicationKey of the role to search for.ApplicationRole associated with the passed role identifier, or Option.none().@Nonnull public Set<ApplicationRole> getRoles()
ApplicationRoleManagerSet of all ApplicationRoles that are backed by a (potentially exceeded)
license.getRoles in interface ApplicationRoleManagerSet of all ApplicationRoles that are backed by a (potentially exceeded) license.@Nonnull public Set<ApplicationRole> getDefaultRoles()
ApplicationRoleManagerSet of ApplicationRoles that are configured be default for new users.getDefaultRoles in interface ApplicationRoleManagerSet of ApplicationRoles that are configured be default for new users.@Nonnull public Set<com.atlassian.application.api.ApplicationKey> getDefaultApplicationKeys()
ApplicationRoleManagerSet of ApplicationKeys that are configured as the default applications for new users.getDefaultApplicationKeys in interface ApplicationRoleManagerSet of ApplicationKeys that are configured as the default applications for new users.for defaul roles.public boolean hasAnyRole(@Nullable ApplicationUser user)
ApplicationRoleManagerApplicationRole that is backed by a
(potentially exceeded) license.hasAnyRole in interface ApplicationRoleManagerApplicationRole
that is backed by a (potentially exceeded) license.public boolean userHasRole(@Nullable ApplicationUser user, com.atlassian.application.api.ApplicationKey key)
ApplicationRoleManagertrue 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.userHasRole in interface ApplicationRoleManageruser - the user to check - if this is null, returns falsekey - the key corresponding to the ApplicationRolepublic boolean userOccupiesRole(@Nullable ApplicationUser user, com.atlassian.application.api.ApplicationKey key)
ApplicationRoleManagertrue if the passed user occupies a seat in the ApplicationRole associated with the given key.userOccupiesRole in interface ApplicationRoleManageruser - the user to check - if this is null, returns falsekey - the key corresponding to the ApplicationRolepublic boolean hasExceededAllRoles(@Nonnull ApplicationUser user)
ApplicationRoleManagerApplicationRoles 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.
hasExceededAllRoles in interface ApplicationRoleManageruser - 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.public boolean isAnyRoleLimitExceeded()
ApplicationRoleManagerApplicationRole 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.
isAnyRoleLimitExceeded in interface ApplicationRoleManagerpublic boolean isRoleLimitExceeded(@Nonnull com.atlassian.application.api.ApplicationKey role)
ApplicationRoleManagertrue 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.
isRoleLimitExceeded in interface ApplicationRoleManagerrole - the identifier of the ApplicationRole.true if the installed ApplicationRole is exceeded or false otherwise.public Set<ApplicationRole> getRolesForUser(@Nonnull ApplicationUser user)
ApplicationRoleManagergetRolesForUser in interface ApplicationRoleManageruser - the user whose roles will be checked.Set of ApplicationRoles for the given user.public Set<ApplicationRole> getOccupiedLicenseRolesForUser(@Nonnull ApplicationUser user)
ApplicationRoleManagerSet of ApplicationRoles that the given ApplicationUser occupies seats in.
ApplicationUser has to actively take a seat in the returned ApplicationRoles
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.getOccupiedLicenseRolesForUser in interface ApplicationRoleManageruser - the user whose roles will be checked.Set of ApplicationRoles that the given user is actively taking seats.public Set<ApplicationRole> getRolesForGroup(@Nonnull com.atlassian.crowd.embedded.api.Group group)
ApplicationRoleManagerSet of ApplicationRoles associated with the given Group, or groups for
which the given group is a nested group (sub-group).getRolesForGroup in interface ApplicationRoleManagergroup - the group which roles will be checked.Set of ApplicationRoles associated with the group or its super-groups.@Nonnull public Set<com.atlassian.crowd.embedded.api.Group> getGroupsForLicensedRoles()
ApplicationRoleManagerSet of group names that have been associated with all the ApplicationRoles
that have a backing (but potentially exceeded) license.getGroupsForLicensedRoles in interface ApplicationRoleManagerApplicationRoles that have a backing (but potentially
exceeded) license.public void removeGroupFromRoles(@Nonnull com.atlassian.crowd.embedded.api.Group group)
ApplicationRoleManagerApplicationRoles
(irrespective of whether the ApplicationRoles is backed by a license).removeGroupFromRoles in interface ApplicationRoleManagergroup - the group to remove.public boolean isRoleInstalledAndLicensed(@Nonnull com.atlassian.application.api.ApplicationKey key)
ApplicationRoleManager
Determines whether an application identified by the given ApplicationKey
is installed and running in this JIRA instance AND has a backing license key.
isRoleInstalledAndLicensed in interface ApplicationRoleManagerkey - 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 public ApplicationRole setRole(@Nonnull ApplicationRole role)
ApplicationRoleManagerApplicationRole information to the database.
This method will only accept the passed role if:
setRole in interface ApplicationRoleManagerrole - the role to save.public int getUserCount(@Nonnull com.atlassian.application.api.ApplicationKey key)
ApplicationRoleManagerApplicationRole.
It will uniquely count all users who are found in the groups associated with the application.getUserCount in interface ApplicationRoleManagerkey - the key that identifies the ApplicationRole.ApplicationRole, or zero if the
ApplicationRole does not exist.public int getRemainingSeats(@Nonnull com.atlassian.application.api.ApplicationKey key)
ApplicationRoleManagerApplicationRole
backed by a (potentially exceeded) license.getRemainingSeats in interface ApplicationRoleManagerkey - 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.public boolean hasSeatsAvailable(@Nonnull com.atlassian.application.api.ApplicationKey key, int seatCount)
ApplicationRoleManagerApplicationRole backed by a license
has the requested number of user seats available.hasSeatsAvailable in interface ApplicationRoleManagerkey - 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 public Set<com.atlassian.crowd.embedded.api.Group> getDefaultGroups(@Nonnull com.atlassian.application.api.ApplicationKey key)
ApplicationRoleManagerGroups associated with the ApplicationRole
backed by a (potentially exceeded) license.getDefaultGroups in interface ApplicationRoleManagerkey - the key that identifies the ApplicationRole.Set of default groups associated with the ApplicationRole.public MockApplicationRole createRole(com.atlassian.application.api.ApplicationKey key)
Copyright © 2002-2019 Atlassian. All Rights Reserved.