public interface

ApplicationAuthorizationService

com.atlassian.jira.application.ApplicationAuthorizationService
Known Indirect Subclasses

Class Overview

A utility service to determine if a user has access to a specific application (as identified by its com.atlassian.application.api.ApplicationKey).

See Also
  • {@link com.atlassian.jira.application.ApplicationRoleAdminService}
  • {@link com.atlassian.jira.license.JiraLicenseManager}

Summary

Public Methods
boolean canUseApplication(ApplicationUser user, ApplicationKey key)
Determines whether the given user is allowed to access the passed application.
Set<ApplicationAccess.AccessError> getAccessErrors(ApplicationUser user, ApplicationKey key)
Gets the errors that would occur if the passed user accessed the passed application.
Set<ApplicationAccess.AccessError> getLicensingAccessErrors(ApplicationKey key)
Get any errors that would occur when accessing the passed application.
int getUserCount(ApplicationKey key)
Retrieve the number of active users for an application as identified by the com.atlassian.application.api.ApplicationKey.
boolean hasNoLicensingAccessErrors(ApplicationKey key)
Determines whether it is possible to access the passed application.
boolean isAnyRoleLimitExceeded()
Returns true if any of the licenses in this JIRA instance have exceeded their respective license user limit.
boolean isApplicationInstalledAndLicensed(ApplicationKey key)
Determines whether an application is installed (running in this JIRA instance) and has a backing (potentially exceeded) license.
boolean isExceeded(ApplicationKey key)
Determines whether an application's license user limit have been exceeded.
@Internal @Deprecated boolean rolesEnabled()
This method is deprecated. since 7.0.1 as this always returns true in JIRA 7

Public Methods

public boolean canUseApplication (ApplicationUser user, ApplicationKey key)

Determines whether the given user is allowed to access the passed application. This simply checks if there are any access errors caused by the user accessing the application. That is, it calls return getAccessError(user, key).isEmpty().

You can get more fine grained control using getAccessErrors(com.atlassian.jira.user.ApplicationUser, com.atlassian.application.api.ApplicationKey)

Parameters
user the user to check for access rights - if this is null, this method returns false
key the key that uniquely identifies the application.
Returns
  • true if the user has been assigned to the specified application and the application is backed by a license.

public Set<ApplicationAccess.AccessError> getAccessErrors (ApplicationUser user, ApplicationKey key)

Gets the errors that would occur if the passed user accessed the passed application. This includes checking errors from both the license and user access. Note, this is not a specific licensing check, as long as there is a license that can grant access present then there will be no access errors. That is, the access may not come from the license of the specific application you are checking.

Parameters
user the user to check for access rights - if null this will give a AccessError.NO_ACCESS.
key the key that uniquely identifies the application.
Returns
  • the set of com.atlassian.application.api.ApplicationAccess.AccessError. An empty set is returned if no errors would occur.

public Set<ApplicationAccess.AccessError> getLicensingAccessErrors (ApplicationKey key)

Get any errors that would occur when accessing the passed application. Note, this only checks access errors resulting from licensing, not from particular users accessing the application. User access errors are given by getAccessErrors(com.atlassian.jira.user.ApplicationUser, com.atlassian.application.api.ApplicationKey). Furthermore, this is not a specific licensing check, as long as there is a license that can grant access present then there will be no access errors. That is, the access may not come from the license of the specific application you are checking.

Parameters
key the key that uniquely identifies the application.
Returns
  • the set of com.atlassian.application.api.ApplicationAccess.AccessError. An empty set is returned if no errors would occur.

public int getUserCount (ApplicationKey key)

Retrieve the number of active users for an application as identified by the com.atlassian.application.api.ApplicationKey.

It will uniquely count all users who are found in the groups associated with the application.

Parameters
key the key that uniquely identifies the application.
Returns
  • the number of active users for the passed ApplicationRole when the application does not exist (0) would be returned.

public boolean hasNoLicensingAccessErrors (ApplicationKey key)

Determines whether it is possible to access the passed application. Importantly, it does not indicate if a particular user would be able to access the application. Use canUseApplication(com.atlassian.jira.user.ApplicationUser, com.atlassian.application.api.ApplicationKey) to work out access permission for a particular user.

Note, this simply calls getLicensingAccessErrors(key).isEmpty().

You can get more fine grained control using getLicensingAccessErrors(com.atlassian.application.api.ApplicationKey)

Parameters
key the key that uniquely identifies the application.
Returns
  • true if the application has a license that is not exceeded, expired, or with a version mismatch. A return of false indicates that users will not be able to access the application. A return of true indicates it might be possible for a user to access the application.

public boolean isAnyRoleLimitExceeded ()

Returns true if any of the licenses in this JIRA instance have exceeded their respective license user limit.

Note: does NOT check that license is within expiry limits; see isExpired().

Returns
  • true if any of the licenses in this JIRA instance have exceeded their respective license user limit.

public boolean isApplicationInstalledAndLicensed (ApplicationKey key)

Determines whether an application is installed (running in this JIRA instance) and has a backing (potentially exceeded) license.

Note: This method still returns true if the application's license has expired or has been exceeded.

Parameters
key the key that uniquely identifies the application.
Returns
  • true if the application is installed (running in this JIRA instance) and has a backing (potentially exceeded) license.

public boolean isExceeded (ApplicationKey key)

Determines whether an application's license user limit have been exceeded.

Note: Does NOT check that license is within expiry limits; see isExpired().

Returns false when the application is not installed.

Parameters
key the key that uniquely identifies the application.
Returns
  • true if the application's license user limit have been exceeded or false otherwise.

@Internal @Deprecated public boolean rolesEnabled ()

@Internal

This method is an internal implementation detail and will change without notice.

Clients that depend on @Internal classes and interfaces can not expect to be compatible with any version other than the version they were compiled against (even minor version and milestone releases may break binary compatibility with respect to @Internal elements).

This method is deprecated.
since 7.0.1 as this always returns true in JIRA 7

Determines whether ApplicationRoles are enabled.

Returns
  • true when ApplicationRole are enabled, false otherwise.