Package fr.becpg.repo.license
Enum Class UserLicense
- All Implemented Interfaces:
Serializable,Comparable<UserLicense>,Constable
The single license a user consumes, whatever the number of license groups they belong to.
The license groups are declared by priority: the first one the user belongs to wins.
- Author:
- valentin
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescription -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final booleanprivate final Stringprivate final SystemGroup -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateUserLicense(SystemGroup licenseGroup, boolean concurrent, String key) -
Method Summary
Modifier and TypeMethodDescriptiongetKey()Returns the key displayed by the admin console for this license.booleanTells whether this license consumes a floating token while the user is connected.private booleanisGrantedBy(Set<String> userAuthorities) static UserLicenseResolves the license consumed by a user from all the authorities they belong to, sub-groups included.static UserLicenseReturns the enum constant of this class with the specified name.static UserLicense[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
WRITE_NAMED
-
WRITE_CONCURRENT
-
READ_NAMED
-
READ_CONCURRENT
-
SUPPLIER_CONCURRENT
-
SPECIAL_USER
-
NO_LICENSE
-
-
Field Details
-
licenseGroup
-
concurrent
private final boolean concurrent -
key
-
-
Constructor Details
-
UserLicense
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
resolve
Resolves the license consumed by a user from all the authorities they belong to, sub-groups included.- Parameters:
userAuthorities- the authorities of the user, as returned byAuthorityService.getAuthoritiesForUser- Returns:
- the license of highest priority, or
NO_LICENSEwhen the user is in no license group
-
isGrantedBy
-
isConcurrent
public boolean isConcurrent()Tells whether this license consumes a floating token while the user is connected.- Returns:
- true for the concurrent licenses
-
getKey
Returns the key displayed by the admin console for this license.- Returns:
- the license key
-