Enum 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 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.
    • 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 name
        NullPointerException - if the argument is null
      • fromString

        public static SilverpeasRole fromString​(String name)
        Gets the SilverpeasRole 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 matching SilverpeasRole 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 a SilverpeasRole instance, then it is skipped.
      • fromStrings

        public static Set<SilverpeasRole> fromStrings​(String[] roles)
        Gets for each of the specified roles the matching SilverpeasRole 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 a SilverpeasRole 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 specified SilverpeasRole instances.
        Parameters:
        roles - a set of SilverpeasRole 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 empty String is returned.
      • getHighestFrom

        public static SilverpeasRole getHighestFrom​(SilverpeasRole... roles)
        Gets the highest role from the given ones.
        Parameters:
        roles - one or several SilverpeasRole 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 - a SilverpeasRole 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 - a SilverpeasRole 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 predefined SilverpeasRole.
        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.