Enum RoleWithHierarchy
- java.lang.Object
-
- java.lang.Enum<RoleWithHierarchy>
-
- ch.systemsx.cisd.openbis.generic.shared.basic.dto.RoleWithHierarchy
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<RoleWithHierarchy>
public enum RoleWithHierarchy extends java.lang.Enum<RoleWithHierarchy> implements java.io.Serializable
Hierarchical role. CombinesRoleWithHierarchy.RoleCode
withRoleWithHierarchy.RoleLevel
and a set ofRoleWithHierarchy
s that are stronger.Available roles can:
- be presented to the user
- be easily mapped to database structure
- be used to restrict access to server methods
- define the role hierarchy by specifying which roles are stronger (users that have only the "stronger" role will also be able to access given server method)
Example:
To annotate an interface method with a new role e.g.SECRET_AGENT
:- Add
SECRET_AGENT
toRoleWithHierarchy.RoleCode
enumerator. - Add
SECRET_AGENT
toauthorization_role
domain in the database (and prepare migration). - Add
INSTANCE_SECRET_AGENT
(orSPACE_SECRET_AGENT
) toRoleWithHierarchy
enumerator and define the "stronger" roles. - Use the new
RoleWithHierarchy
to annotate the interface method.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
RoleWithHierarchy.RoleCode
Role codes corresponding to values stored in the database.static class
RoleWithHierarchy.RoleLevel
-
Enum Constant Summary
Enum Constants Enum Constant Description INSTANCE_ADMIN
INSTANCE_DISABLED
INSTANCE_ETL_SERVER
INSTANCE_OBSERVER
PROJECT_ADMIN
PROJECT_OBSERVER
PROJECT_POWER_USER
PROJECT_USER
SPACE_ADMIN
SPACE_ETL_SERVER
SPACE_OBSERVER
SPACE_POWER_USER
SPACE_USER
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description RoleWithHierarchy.RoleCode
getRoleCode()
RoleWithHierarchy.RoleLevel
getRoleLevel()
java.util.Set<RoleWithHierarchy>
getRoles()
boolean
isInstanceLevel()
boolean
isProjectLevel()
boolean
isSpaceLevel()
java.lang.String
toString()
static RoleWithHierarchy
valueOf(RoleWithHierarchy.RoleLevel roleLevel, RoleWithHierarchy.RoleCode roleCode)
Returns theRoleWithHierarchy
defined by givenRoleWithHierarchy.RoleLevel
andRoleWithHierarchy.RoleCode
static RoleWithHierarchy
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static RoleWithHierarchy[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
INSTANCE_DISABLED
public static final RoleWithHierarchy INSTANCE_DISABLED
-
INSTANCE_ADMIN
public static final RoleWithHierarchy INSTANCE_ADMIN
-
INSTANCE_OBSERVER
public static final RoleWithHierarchy INSTANCE_OBSERVER
-
INSTANCE_ETL_SERVER
public static final RoleWithHierarchy INSTANCE_ETL_SERVER
-
SPACE_ADMIN
public static final RoleWithHierarchy SPACE_ADMIN
-
SPACE_POWER_USER
public static final RoleWithHierarchy SPACE_POWER_USER
-
SPACE_USER
public static final RoleWithHierarchy SPACE_USER
-
SPACE_OBSERVER
public static final RoleWithHierarchy SPACE_OBSERVER
-
SPACE_ETL_SERVER
public static final RoleWithHierarchy SPACE_ETL_SERVER
-
PROJECT_ADMIN
public static final RoleWithHierarchy PROJECT_ADMIN
-
PROJECT_POWER_USER
public static final RoleWithHierarchy PROJECT_POWER_USER
-
PROJECT_USER
public static final RoleWithHierarchy PROJECT_USER
-
PROJECT_OBSERVER
public static final RoleWithHierarchy PROJECT_OBSERVER
-
-
Method Detail
-
values
public static RoleWithHierarchy[] 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 (RoleWithHierarchy c : RoleWithHierarchy.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static RoleWithHierarchy valueOf(java.lang.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:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
valueOf
public static RoleWithHierarchy valueOf(RoleWithHierarchy.RoleLevel roleLevel, RoleWithHierarchy.RoleCode roleCode)
Returns theRoleWithHierarchy
defined by givenRoleWithHierarchy.RoleLevel
andRoleWithHierarchy.RoleCode
-
getRoles
public java.util.Set<RoleWithHierarchy> getRoles()
-
isInstanceLevel
public boolean isInstanceLevel()
-
isSpaceLevel
public boolean isSpaceLevel()
-
isProjectLevel
public boolean isProjectLevel()
-
getRoleLevel
public RoleWithHierarchy.RoleLevel getRoleLevel()
-
getRoleCode
public final RoleWithHierarchy.RoleCode getRoleCode()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Enum<RoleWithHierarchy>
-
-