Package com.atlassian.bitbucket.license
Interface LicenseService
public interface LicenseService
Provides license related functions.
- 
Method SummaryModifier and TypeMethodDescriptionbooleanCheck if a user is active and licensed to use the application.com.atlassian.extras.api.bitbucket.BitbucketServerLicenseget()Get the license of this instance.Get the encoded license for this instance.intGet the number of licensed users currently in the system.Get a message if the license is over its limitsChecks both the license validity and its limits.Get a message regarding the validity of the currently configured licensebooleanCheck whether the license is potentially forged.booleanCheck whether the license is valid, and operations are permitted.booleanCheck whether the current instance has a license.booleanChecks whether theLicenseTypeof the license isLicenseType.TESTINGcom.atlassian.extras.api.bitbucket.BitbucketServerLicenseAdd or replace the license of this instance.voidvalidateCanAddUserToGroup(String username, String group) Validate if the named user can be added to the specified group without violating license limits.voidvalidateCanLicenseGroup(String group, Permission permission) Validate if the specified group can be licensed without violating license limits.voidvalidateCanLicenseUser(ApplicationUser user, Permission permission) Validate if the given user can be licensed without violating license limits
- 
Method Details- 
isLicenseForgedboolean isLicenseForged()Check whether the license is potentially forged.- Returns:
- trueif the license does not pass the necessary checks appearing to look potentially forged,- falseotherwise
- Since:
- 7.13
 
- 
isLicenseValidboolean isLicenseValid()Check whether the license is valid, and operations are permitted.- Returns:
- trueif the license is valid and not exceeded, or in a grace period,- falseotherwise
- Since:
- 4.8
 
- 
isPresentboolean isPresent()Check whether the current instance has a license.- Returns:
- trueif the instance has an license (note: this will also return- trueif the license has expired.)
 
- 
isTestingLicenseboolean isTestingLicense()Checks whether theLicenseTypeof the license isLicenseType.TESTING- Returns:
- trueif the license is of type- LicenseType.TESTING,- falseotherwise
- Since:
- 7.13
 
- 
get@Nullable com.atlassian.extras.api.bitbucket.BitbucketServerLicense get()Get the license of this instance.- Returns:
- license of this instance
 
- 
getAsStringGet the encoded license for this instance. If no license has been set, this will returnnull.- Returns:
- the encoded license string, or nullif no license is set
 
- 
getLicensedUsersCountint getLicensedUsersCount()Get the number of licensed users currently in the system.- Returns:
- The count of licensed users.
 
- 
setAdd or replace the license of this instance.- Parameters:
- license- new license of this instance
- Returns:
- the new license
 
- 
getValidityMessageKeyedMessage getValidityMessage()Get a message regarding the validity of the currently configured license- Returns:
- null if the license is valid, otherwise a descriptive message about why the license is invalid
 
- 
getOverLimitMessageKeyedMessage getOverLimitMessage()Get a message if the license is over its limits- Returns:
- null if the system is within the license limits, otherwise a descriptive message about how the license limits have been exceeeded
 
- 
getStatusKeyedMessage getStatus()Checks both the license validity and its limits.- Returns:
- a message if the license is invalid or is over its limits.
 
- 
canLoginCheck if a user is active and licensed to use the application.- Parameters:
- principal- identifier for the user
- Returns:
- trueif the user is both active and- licensed
 
- 
validateCanLicenseUservoid validateCanLicenseUser(ApplicationUser user, Permission permission) throws LicenseLimitException Validate if the given user can be licensed without violating license limits- Parameters:
- user- the user to be licensed
- permission- the permission to be granted to the user
- Throws:
- LicenseLimitException- if granting the permission to the specified user would exceed the number of licensed users allowed by the current license
 
- 
validateCanLicenseGroupValidate if the specified group can be licensed without violating license limits. Licensing a group licenses all of the users the group contains.- Parameters:
- group- the group to be licensed
- permission- the permission to be granted to the group
- Throws:
- LicenseLimitException- 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 license
 
- 
validateCanAddUserToGroupValidate if the named user can be added to the specified group without violating license limits.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 aLicenseLimitExceptionif not.- Parameters:
- username- the user to be added to the group
- group- the group the user is to be added to
- Throws:
- LicenseLimitException- if adding the user to the group would exceed the number of licensed users allowed by the current license
 
 
-