Class ApplicationAuthorizationServiceImpl
- All Implemented Interfaces:
ApplicationAuthorizationService
-
Constructor Summary
ConstructorsConstructorDescriptionApplicationAuthorizationServiceImpl(ApplicationRoleManager applicationRoleManager, JiraLicenseManager jiraLicenseManager, LicenseMaintenancePredicate licenseMaintenancePredicate) -
Method Summary
Modifier and TypeMethodDescriptionbooleancanUseApplication(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.intgetUserCount(com.atlassian.application.api.ApplicationKey key) Retrieve the number of active users for an application as identified by theApplicationKey.booleanhasNoLicensingAccessErrors(com.atlassian.application.api.ApplicationKey key) Determines whether it is possible to access the passed application.booleanReturnstrueif any of the licenses in this JIRA instance have exceeded their respective license user limit.booleanisApplicationInstalledAndLicensed(com.atlassian.application.api.ApplicationKey key) Determines whether an application is installed (running in this JIRA instance) and has a backing (potentially exceeded) license.booleanisExceeded(com.atlassian.application.api.ApplicationKey key) Determines whether an application's license user limit have been exceeded.
-
Constructor Details
-
ApplicationAuthorizationServiceImpl
public ApplicationAuthorizationServiceImpl(ApplicationRoleManager applicationRoleManager, JiraLicenseManager jiraLicenseManager, LicenseMaintenancePredicate licenseMaintenancePredicate)
-
-
Method Details
-
isApplicationInstalledAndLicensed
public boolean isApplicationInstalledAndLicensed(@Nonnull com.atlassian.application.api.ApplicationKey key) Description copied from interface:ApplicationAuthorizationServiceDetermines whether an application is installed (running in this JIRA instance) and has a backing (potentially exceeded) license.Note: This method still returns
trueif the application's license has expired or has been exceeded.- Specified by:
isApplicationInstalledAndLicensedin interfaceApplicationAuthorizationService- Parameters:
key- the key that uniquely identifies the application.- Returns:
trueif the application is installed (running in this JIRA instance) and has a backing (potentially exceeded) license.- See Also:
-
isAnyRoleLimitExceeded
public boolean isAnyRoleLimitExceeded()Description copied from interface:ApplicationAuthorizationServiceReturnstrueif 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().- Specified by:
isAnyRoleLimitExceededin interfaceApplicationAuthorizationService- Returns:
trueif any of the licenses in this JIRA instance have exceeded their respective license user limit.
-
isExceeded
public boolean isExceeded(@Nonnull com.atlassian.application.api.ApplicationKey key) Description copied from interface:ApplicationAuthorizationServiceDetermines whether an application's license user limit have been exceeded.Note: Does NOT check that license is within expiry limits; see
LicenseDetails.isExpired().Returns
falsewhen the application is not installed.- Specified by:
isExceededin interfaceApplicationAuthorizationService- Parameters:
key- the key that uniquely identifies the application.- Returns:
trueif the application's license user limit have been exceeded orfalseotherwise.
-
canUseApplication
public boolean canUseApplication(@Nullable ApplicationUser user, @Nonnull com.atlassian.application.api.ApplicationKey key) Description copied from interface:ApplicationAuthorizationServiceDetermines 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 callsreturn getAccessError(user, key).isEmpty().You can get more fine grained control using
ApplicationAuthorizationService.getAccessErrors(com.atlassian.jira.user.ApplicationUser, com.atlassian.application.api.ApplicationKey)- Specified by:
canUseApplicationin interfaceApplicationAuthorizationService- Parameters:
user- the user to check for access rights - if this is null, this method returns falsekey- 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.
-
getAccessErrors
public Set<com.atlassian.application.api.ApplicationAccess.AccessError> getAccessErrors(@Nullable ApplicationUser user, @Nonnull com.atlassian.application.api.ApplicationKey key) Description copied from interface:ApplicationAuthorizationServiceGets 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.- Specified by:
getAccessErrorsin interfaceApplicationAuthorizationService- Parameters:
user- the user to check for access rights - if null this will give aAccessError.NO_ACCESS.key- the key that uniquely identifies the application.- Returns:
- the set of
ApplicationAccess.AccessError. An empty set is returned if no errors would occur.
-
hasNoLicensingAccessErrors
public boolean hasNoLicensingAccessErrors(@Nonnull com.atlassian.application.api.ApplicationKey key) Description copied from interface:ApplicationAuthorizationServiceDetermines 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. UseApplicationAuthorizationService.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)- Specified by:
hasNoLicensingAccessErrorsin interfaceApplicationAuthorizationService- Parameters:
key- the key that uniquely identifies the application.- Returns:
trueif the application has a license that is not exceeded, expired, or with a version mismatch. A return offalseindicates that users will not be able to access the application. A return oftrueindicates it might be possible for a user to access the application.
-
getLicensingAccessErrors
public Set<com.atlassian.application.api.ApplicationAccess.AccessError> getLicensingAccessErrors(@Nonnull com.atlassian.application.api.ApplicationKey key) Description copied from interface:ApplicationAuthorizationServiceGet 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 byApplicationAuthorizationService.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.- Specified by:
getLicensingAccessErrorsin interfaceApplicationAuthorizationService- Parameters:
key- the key that uniquely identifies the application.- Returns:
- the set of
ApplicationAccess.AccessError. An empty set is returned if no errors would occur.
-
getUserCount
public int getUserCount(@Nonnull com.atlassian.application.api.ApplicationKey key) Description copied from interface:ApplicationAuthorizationServiceRetrieve the number of active users for an application as identified by theApplicationKey.It will uniquely count all users who are found in the groups associated with the application.
- Specified by:
getUserCountin interfaceApplicationAuthorizationService- Parameters:
key- the key that uniquely identifies the application.- Returns:
- the number of active users for the passed
ApplicationRolewhen the application does not exist (0) would be returned.
-