Enum SilverpeasRole
- java.lang.Object
-
- java.lang.Enum<SilverpeasRole>
-
- org.silverpeas.core.admin.user.model.SilverpeasRole
-
- All Implemented Interfaces:
Serializable
,Comparable<SilverpeasRole>
public enum SilverpeasRole extends Enum<SilverpeasRole>
The core predefined user roles in Silverpeas. Each role has a name and is attached to a predefined set of privileges. Those privileges are common to all the applications in Silverpeas, but they can be extended in the applications themselves. As a reminder, a privilege is the ability to perform a given action and in Silverpeas the privileges are hard-coded.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description ADMIN
ADMIN means a component instance administrator (also called manager of component instance)MANAGER
MANAGER means administrator of spaces or groups of users.PRIVILEGED_USER
PRIVILEGED_USER means a reader with additional rights specific to some component instances.PUBLISHER
PUBLISHER means a user having rights to publish and to validate contributions into a component instance.READER
READER has same meaning thanUSER
.SUPERVISOR
Special role used essentially into workflows to supervise all tasks managed by in instance.USER
USER means a user having only access rights to resources without any modification rights.WRITER
WRITER means a user having rights to create, update and delete his own contributions into a component instance.
-
Field Summary
Fields Modifier and Type Field Description static Set<SilverpeasRole>
READER_ROLES
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static String
asString(Set<SilverpeasRole> roles)
Gets the role name as used in Silverpeas for each of the specifiedSilverpeasRole
instances.static boolean
exists(String name)
Is the specified role name is one of the predefined roles in Silverpeas.static SilverpeasRole
fromString(String name)
Gets theSilverpeasRole
instance that matches the specified role name.static Set<SilverpeasRole>
fromStrings(String[] roles)
Gets for each of the specified roles the matchingSilverpeasRole
instance.static SilverpeasRole
getHighestFrom(Collection<SilverpeasRole> roles)
Gets the highest role from the given ones.static SilverpeasRole
getHighestFrom(SilverpeasRole... roles)
Gets the highest role from the given ones.String
getName()
Gets the name of the role as used in Silverpeas.boolean
isGreaterThan(SilverpeasRole role)
Indicates if a role is greater than an other one.boolean
isGreaterThanOrEquals(SilverpeasRole role)
Indicates if a role is greater than or equals an other one.boolean
isInRole(String... roles)
Is the specified role names are a predefinedSilverpeasRole
.static Set<SilverpeasRole>
listFrom(String roles)
Gets for each of the specified roles the matchingSilverpeasRole
instance.String
toString()
Same asgetName()
static SilverpeasRole
valueOf(String name)
Returns the enum constant of this type with the specified name.static SilverpeasRole[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
ADMIN
public static final SilverpeasRole ADMIN
ADMIN means a component instance administrator (also called manager of component instance)
-
SUPERVISOR
public static final SilverpeasRole SUPERVISOR
Special role used essentially into workflows to supervise all tasks managed by in instance.
-
MANAGER
public static final SilverpeasRole MANAGER
MANAGER means administrator of spaces or groups of users.
-
PUBLISHER
public static final SilverpeasRole PUBLISHER
PUBLISHER means a user having rights to publish and to validate contributions into a component instance.
-
WRITER
public static final SilverpeasRole WRITER
WRITER means a user having rights to create, update and delete his own contributions into a component instance.
-
PRIVILEGED_USER
public static final SilverpeasRole PRIVILEGED_USER
PRIVILEGED_USER means a reader with additional rights specific to some component instances.
-
USER
public static final SilverpeasRole USER
USER means a user having only access rights to resources without any modification rights.
-
READER
public static final SilverpeasRole READER
READER has same meaning thanUSER
.
-
-
Field Detail
-
READER_ROLES
public static final Set<SilverpeasRole> READER_ROLES
-
-
Method Detail
-
values
public static SilverpeasRole[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (SilverpeasRole c : SilverpeasRole.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static SilverpeasRole valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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 type has no constant with the specified nameNullPointerException
- if the argument is null
-
fromString
public static SilverpeasRole fromString(String name)
Gets theSilverpeasRole
instance that matches the specified role name.About the
SilverpeasRole
decoding from WEB services, @JsonCreator
is used by jackson APIs, whereas RestEasy is looking at a static method called like this method.
So, this method is compatible with both mechanisms- Parameters:
name
- the name of a predefined user role in Silverpeas.- Returns:
- the
SilverpeasRole
instance having as name the specified role name or null if no such role exists.
-
exists
public static boolean exists(String name)
Is the specified role name is one of the predefined roles in Silverpeas.- Parameters:
name
- the name of a user role.- Returns:
- true if the role name matches a
SilverpeasRole
instance. False otherwise.
-
listFrom
public static Set<SilverpeasRole> listFrom(String roles)
Gets for each of the specified roles the matchingSilverpeasRole
instance.- Parameters:
roles
- a comma-separated array of user role names.- Returns:
- a set of
SilverpeasRole
instance matching each of the roles specified as parameter. If one of the role name doesn't match aSilverpeasRole
instance, then it is skipped.
-
fromStrings
public static Set<SilverpeasRole> fromStrings(String[] roles)
Gets for each of the specified roles the matchingSilverpeasRole
instance.- Parameters:
roles
- an array of user role names.- Returns:
- a set of
SilverpeasRole
instance matching each of the specified role names. If one of the role name doesn't match aSilverpeasRole
instance, then it is skipped.
-
asString
public static String asString(Set<SilverpeasRole> roles)
Gets the role name as used in Silverpeas for each of the specifiedSilverpeasRole
instances.- Parameters:
roles
- a set ofSilverpeasRole
instances.- Returns:
- a comma-separated array of role names, each of them matching the specified
SilverpeasRole
instances. If the set is null, then null is returned. If the set is empty then an emptyString
is returned.
-
getHighestFrom
public static SilverpeasRole getHighestFrom(SilverpeasRole... roles)
Gets the highest role from the given ones.- Parameters:
roles
- one or severalSilverpeasRole
instances.- Returns:
- the
SilverpeasRole
instance that is the highest privileged among the roles passed as argument.
-
getHighestFrom
public static SilverpeasRole getHighestFrom(Collection<SilverpeasRole> roles)
Gets the highest role from the given ones.- Parameters:
roles
- a collection ofSilverpeasRole
instances.- Returns:
- the
SilverpeasRole
instance that is the highest privileged among the roles passed as argument.
-
getName
public String getName()
Gets the name of the role as used in Silverpeas.- Returns:
- the role name.
-
isGreaterThan
public boolean isGreaterThan(@Nonnull SilverpeasRole role)
Indicates if a role is greater than an other one.- Parameters:
role
- aSilverpeasRole
instance.- Returns:
- true if this role is greater than the specified one.
-
isGreaterThanOrEquals
public boolean isGreaterThanOrEquals(@Nonnull SilverpeasRole role)
Indicates if a role is greater than or equals an other one.- Parameters:
role
- aSilverpeasRole
instance.- Returns:
- true if this role is greater or equal than the specified one.
-
isInRole
public boolean isInRole(String... roles)
Is the specified role names are a predefinedSilverpeasRole
.- Parameters:
roles
- one or more role names.- Returns:
- true if at least one of the specified role names is a predefined role as defined in
SilverpeasRole
.
-
toString
public String toString()
Same asgetName()
- Overrides:
toString
in classEnum<SilverpeasRole>
- Returns:
- the role name of this
SilverpeasRole
instance.
-
-