Package fr.becpg.repo.license
Class BeCPGLicenseManager
java.lang.Object
fr.becpg.repo.license.BeCPGLicenseManager
BeCPGLicenseManager class.
- Version:
- $Id: $Id
- Author:
- matthieu
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate org.alfresco.repo.security.authentication.AbstractAuthenticationServiceprivate org.alfresco.service.cmr.security.AuthorityServiceprivate BeCPGCacheServiceprivate final Map<UserLicense, Set<String>> private org.alfresco.service.cmr.repository.ContentServiceprivate static final StringConstantINVALID_LICENSE_FILE="Invalid license file"private static final org.apache.commons.logging.LogConstantloggerprivate org.alfresco.service.cmr.repository.NodeServiceprivate RepoServiceprivate boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate booleanacquireConcurrentToken(String userName, UserLicense userLicense) static StringcomputeLicenseKey(BeCPGLicense license) computeLicenseKey.longcountLicensedMembers(SystemGroup licenseGroup) Counts the members of a license group, sub-groups included, that consume a license.countUsersByLicense(Collection<String> userNames) Counts the given users by the single license each of them consumes.private longgetAllowedConcurrent(UserLicense userLicense) longgetAllowedConcurrentRead.longgetAllowedConcurrentSupplier.longgetAllowedConcurrentWrite.longgetAllowedNamedRead.longgetAllowedNamedWrite.private BeCPGLicensegetLicense.private org.json.JSONObjectgetLicenseFile.getLicenseName.getUserLicense(String username) Returns the single license a user consumes, the named licenses taking priority over the concurrent ones.getUserLicenseGroup(String username) getUserLicenseGroup.booleanhasWriteLicense.booleanTells whether the current user may connect, consuming a floating token when their license is a concurrent one.booleanisLicenseValid.booleanisShowUnauthorizedWarning.booleanisSpecialLicenceUser.booleanisSpecialLicenseUser(String runAsUser) isSpecialLicenseUser.static booleanisValid(String licenseKey, BeCPGLicense license) isValid.private booleannamedLicenseExceeded.
-
Field Details
-
INVALID_LICENSE_FILE
ConstantINVALID_LICENSE_FILE="Invalid license file"- See Also:
-
logger
private static final org.apache.commons.logging.Log loggerConstantlogger -
beCPGCacheService
-
repoService
-
nodeService
@Autowired private org.alfresco.service.cmr.repository.NodeService nodeService -
contentService
@Autowired private org.alfresco.service.cmr.repository.ContentService contentService -
authenticationService
@Autowired private org.alfresco.repo.security.authentication.AbstractAuthenticationService authenticationService -
authorityService
@Autowired private org.alfresco.service.cmr.security.AuthorityService authorityService -
showLicenseWarning
@Value("${beCPG.licence.showWarning:true}") private boolean showLicenseWarning -
concurrentUsersAllowedMap
-
-
Constructor Details
-
BeCPGLicenseManager
public BeCPGLicenseManager()
-
-
Method Details
-
isShowLicenseWarning
public boolean isShowLicenseWarning()isShowUnauthorizedWarning.
- Returns:
- a boolean.
-
getAllowedConcurrentRead
public long getAllowedConcurrentRead()getAllowedConcurrentRead.
- Returns:
- a long.
-
getLicense
getLicense.
- Returns:
- a
BeCPGLicenseobject
-
getAllowedConcurrentWrite
public long getAllowedConcurrentWrite()getAllowedConcurrentWrite.
- Returns:
- a long.
-
getAllowedConcurrentSupplier
public long getAllowedConcurrentSupplier()getAllowedConcurrentSupplier.
- Returns:
- a long.
-
getAllowedNamedWrite
public long getAllowedNamedWrite()getAllowedNamedWrite.
- Returns:
- a long.
-
getAllowedNamedRead
public long getAllowedNamedRead()getAllowedNamedRead.
- Returns:
- a long.
-
getLicenseName
getLicenseName.
- Returns:
- a
Stringobject.
-
isLicenseValid
public boolean isLicenseValid()isLicenseValid.
- Returns:
- a boolean
-
namedLicenseExceeded
private boolean namedLicenseExceeded()namedLicenseExceeded.
- Returns:
- a boolean
-
countLicensedMembers
Counts the members of a license group, sub-groups included, that consume a license.- Parameters:
licenseGroup- the license group to count- Returns:
- the number of members, special license users excluded
-
countUsersByLicense
Counts the given users by the single license each of them consumes.- Parameters:
userNames- the users to count, typically the connected ones- Returns:
- the number of users per license, licenses without any user omitted
-
isValid
isValid.
- Parameters:
licenseKey- aStringobject.license- aBeCPGLicenseobject.- Returns:
- a boolean.
-
computeLicenseKey
computeLicenseKey.
- Parameters:
license- aBeCPGLicenseobject.- Returns:
- a
Stringobject.
-
getLicenseFile
private org.json.JSONObject getLicenseFile()getLicenseFile.
- Returns:
- a
JSONObjectobject
-
isConcurrentUserAllowed
public boolean isConcurrentUserAllowed()Tells whether the current user may connect, consuming a floating token when their license is a concurrent one. A user that also holds a named license never consumes a floating token.- Returns:
- false when all the floating tokens of the user's license are taken
-
acquireConcurrentToken
-
getAllowedConcurrent
-
isSpecialLicenceUser
public boolean isSpecialLicenceUser()isSpecialLicenceUser.
- Returns:
- a boolean
-
isSpecialLicenseUser
isSpecialLicenseUser.
- Parameters:
runAsUser- aStringobject- Returns:
- a boolean
-
getUserLicenseGroup
getUserLicenseGroup.
-
getUserLicense
Returns the single license a user consumes, the named licenses taking priority over the concurrent ones.- Parameters:
username- the user name, may be null- Returns:
- the license of the user,
UserLicense.SPECIAL_USERfor admins and beCPG accounts
-
hasWriteLicense
public boolean hasWriteLicense()hasWriteLicense.
- Returns:
- a boolean
-