public interface LicenseService
Modifier and Type | Method and Description |
---|---|
boolean |
canLogin(Principal principal)
Check if a user is active and licensed to use the application.
|
com.atlassian.extras.api.bitbucket.BitbucketServerLicense |
get()
Get the license of this instance.
|
String |
getAsString()
Get the encoded license for this instance.
|
int |
getLicensedUsersCount()
Get the number of licensed users currently in the system.
|
KeyedMessage |
getOverLimitMessage()
Get a message if the license is over its limits
|
KeyedMessage |
getStatus()
Checks both the license validity and its limits.
|
KeyedMessage |
getValidityMessage()
Get a message regarding the validity of the currently configured license
|
boolean |
isDataCenter()
Check whether a Data Center license is installed.
|
boolean |
isLicenseForged()
Check whether the license is potentially forged.
|
boolean |
isLicenseValid()
Check whether the license is valid, and operations are permitted.
|
boolean |
isPresent()
Check whether the current instance has a license.
|
boolean |
isTestingLicense()
Checks whether the
LicenseType of the license is LicenseType.TESTING |
com.atlassian.extras.api.bitbucket.BitbucketServerLicense |
set(String license)
Add or replace the license of this instance.
|
void |
validateCanAddUserToGroup(String username,
String group)
Validate if the named user can be added to the specified group without violating license limits.
|
void |
validateCanLicenseGroup(String group,
Permission permission)
Validate if the specified group can be licensed without violating license limits.
|
void |
validateCanLicenseUser(ApplicationUser user,
Permission permission)
Validate if the given user can be licensed without violating license limits
|
boolean isDataCenter()
true
if a Data Center license is installed; otherwise, false
boolean isLicenseForged()
true
if the license does not pass the necessary checks appearing to look potentially forged,
false
otherwiseboolean isLicenseValid()
true
if the license is valid and not exceeded, or in a grace period, false
otherwiseboolean isPresent()
true
if the instance has an license (note: this will also return
true
if the license has expired.)boolean isTestingLicense()
LicenseType
of the license is LicenseType.TESTING
true
if the license is of type LicenseType.TESTING
, false
otherwise@Nullable com.atlassian.extras.api.bitbucket.BitbucketServerLicense get()
@Nullable String getAsString()
null
.null
if no license is setint getLicensedUsersCount()
@Nonnull com.atlassian.extras.api.bitbucket.BitbucketServerLicense set(@Nonnull String license)
license
- new license of this instanceKeyedMessage getValidityMessage()
KeyedMessage getOverLimitMessage()
KeyedMessage getStatus()
boolean canLogin(Principal principal)
principal
- identifier for the usertrue
if the user is both active and licensed
void validateCanLicenseUser(ApplicationUser user, Permission permission) throws LicenseLimitException
user
- the user to be licensedpermission
- the permission to be granted to the userLicenseLimitException
- if granting the permission to the specified user would exceed the number of
licensed users allowed by the current licensevoid validateCanLicenseGroup(String group, Permission permission) throws LicenseLimitException
group
- the group to be licensedpermission
- the permission to be granted to the groupLicenseLimitException
- if granting the permission to the specified group, and all the users is contains,
would exceed the number of licensed users allowed by the current licensevoid validateCanAddUserToGroup(String username, String group) throws LicenseLimitException
If the group is not does not grant LICENSED_USER
, this check will always
pass. Otherwise, it validates that licensing an additional user would comply with license limits and will
throw a LicenseLimitException
if not.
username
- the user to be added to the groupgroup
- the group the user is to be added toLicenseLimitException
- if adding the user to the group would exceed the number of licensed users allowed
by the current licenseCopyright © 2022 Atlassian. All rights reserved.