public class ApplicationAuthorizationServiceImpl extends Object implements ApplicationAuthorizationService
Constructor and Description |
---|
ApplicationAuthorizationServiceImpl(ApplicationRoleManager applicationRoleManager,
JiraLicenseManager jiraLicenseManager,
LicenseMaintenancePredicate licenseMaintenancePredicate) |
Modifier and Type | Method and Description |
---|---|
boolean |
canUseApplication(ApplicationUser user,
com.atlassian.application.api.ApplicationKey key)
Determines whether the given user is allowed to access the passed application.
|
Set<com.atlassian.application.api.ApplicationAccess.AccessError> |
getAccessErrors(ApplicationUser user,
com.atlassian.application.api.ApplicationKey key)
Gets the errors that would occur if the passed user accessed the passed application.
|
Set<com.atlassian.application.api.ApplicationAccess.AccessError> |
getLicensingAccessErrors(com.atlassian.application.api.ApplicationKey key)
Get any errors that would occur when accessing the passed application.
|
int |
getUserCount(com.atlassian.application.api.ApplicationKey key)
Retrieve the number of active users for an application as identified by the
ApplicationKey . |
boolean |
hasNoLicensingAccessErrors(com.atlassian.application.api.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(com.atlassian.application.api.ApplicationKey key)
Determines whether an application is installed (running in this JIRA instance) and has a backing
(potentially exceeded) license.
|
boolean |
isExceeded(com.atlassian.application.api.ApplicationKey key)
Determines whether an application's license user limit have been exceeded.
|
boolean |
rolesEnabled()
Determines whether
ApplicationRole s are enabled. |
public ApplicationAuthorizationServiceImpl(ApplicationRoleManager applicationRoleManager, JiraLicenseManager jiraLicenseManager, LicenseMaintenancePredicate licenseMaintenancePredicate)
public boolean isApplicationInstalledAndLicensed(@Nonnull com.atlassian.application.api.ApplicationKey key)
ApplicationAuthorizationService
Note: This method still returns true
if the application's license has expired or has been exceeded.
isApplicationInstalledAndLicensed
in interface ApplicationAuthorizationService
key
- the key that uniquely identifies the application.true
if the application is installed (running in this JIRA instance) and has a backing
(potentially exceeded) license.ApplicationAuthorizationService.canUseApplication(com.atlassian.jira.user.ApplicationUser, com.atlassian.application.api.ApplicationKey)
public boolean isAnyRoleLimitExceeded()
ApplicationAuthorizationService
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 LicenseDetails.isExpired()
.
isAnyRoleLimitExceeded
in interface ApplicationAuthorizationService
true
if any of the licenses in this JIRA instance have exceeded their respective license user
limit.public boolean isExceeded(@Nonnull com.atlassian.application.api.ApplicationKey key)
ApplicationAuthorizationService
Note: Does NOT check that license is within expiry limits;
see LicenseDetails.isExpired()
.
Returns false
when the application is not installed.
isExceeded
in interface ApplicationAuthorizationService
key
- the key that uniquely identifies the application.true
if the application's license user limit have been exceeded or false
otherwise.public boolean canUseApplication(@Nullable ApplicationUser user, @Nonnull com.atlassian.application.api.ApplicationKey key)
ApplicationAuthorizationService
return getAccessError(user, key).isEmpty()
.
You can get more fine grained control using
ApplicationAuthorizationService.getAccessErrors(com.atlassian.jira.user.ApplicationUser, com.atlassian.application.api.ApplicationKey)
canUseApplication
in interface ApplicationAuthorizationService
user
- the user to check for access rights - if this is null, this method returns falsekey
- the key that uniquely identifies the application.public Set<com.atlassian.application.api.ApplicationAccess.AccessError> getAccessErrors(@Nullable ApplicationUser user, @Nonnull com.atlassian.application.api.ApplicationKey key)
ApplicationAuthorizationService
getAccessErrors
in interface ApplicationAuthorizationService
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.ApplicationAccess.AccessError
. An empty set is returned
if no errors would occur.public boolean hasNoLicensingAccessErrors(@Nonnull com.atlassian.application.api.ApplicationKey key)
ApplicationAuthorizationService
ApplicationAuthorizationService.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
ApplicationAuthorizationService.getLicensingAccessErrors(com.atlassian.application.api.ApplicationKey)
hasNoLicensingAccessErrors
in interface ApplicationAuthorizationService
key
- the key that uniquely identifies the application.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 Set<com.atlassian.application.api.ApplicationAccess.AccessError> getLicensingAccessErrors(@Nonnull com.atlassian.application.api.ApplicationKey key)
ApplicationAuthorizationService
ApplicationAuthorizationService.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.getLicensingAccessErrors
in interface ApplicationAuthorizationService
key
- the key that uniquely identifies the application.ApplicationAccess.AccessError
. An empty set is returned
if no errors would occur.public int getUserCount(@Nonnull com.atlassian.application.api.ApplicationKey key)
ApplicationAuthorizationService
ApplicationKey
.
It will uniquely count all users who are found in the groups associated with the application.
getUserCount
in interface ApplicationAuthorizationService
key
- the key that uniquely identifies the application.ApplicationRole
when the application
does not exist (0) would be returned.public boolean rolesEnabled()
ApplicationAuthorizationService
ApplicationRole
s are enabled.rolesEnabled
in interface ApplicationAuthorizationService
true
when ApplicationRole
are enabled, false
otherwise.Copyright © 2002-2017 Atlassian. All Rights Reserved.