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.RoleCodewithRoleWithHierarchy.RoleLeveland a set ofRoleWithHierarchys 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_AGENTtoRoleWithHierarchy.RoleCodeenumerator. - Add
SECRET_AGENTtoauthorization_roledomain in the database (and prepare migration). - Add
INSTANCE_SECRET_AGENT(orSPACE_SECRET_AGENT) toRoleWithHierarchyenumerator and define the "stronger" roles. - Use the new
RoleWithHierarchyto annotate the interface method.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classRoleWithHierarchy.RoleCodeRole codes corresponding to values stored in the database.static classRoleWithHierarchy.RoleLevel
-
Enum Constant Summary
Enum Constants Enum Constant Description INSTANCE_ADMININSTANCE_DISABLEDINSTANCE_ETL_SERVERINSTANCE_OBSERVERPROJECT_ADMINPROJECT_OBSERVERPROJECT_POWER_USERPROJECT_USERSPACE_ADMINSPACE_ETL_SERVERSPACE_OBSERVERSPACE_POWER_USERSPACE_USER
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description RoleWithHierarchy.RoleCodegetRoleCode()RoleWithHierarchy.RoleLevelgetRoleLevel()java.util.Set<RoleWithHierarchy>getRoles()booleanisInstanceLevel()booleanisProjectLevel()booleanisSpaceLevel()java.lang.StringtoString()static RoleWithHierarchyvalueOf(RoleWithHierarchy.RoleLevel roleLevel, RoleWithHierarchy.RoleCode roleCode)Returns theRoleWithHierarchydefined by givenRoleWithHierarchy.RoleLevelandRoleWithHierarchy.RoleCodestatic RoleWithHierarchyvalueOf(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 theRoleWithHierarchydefined by givenRoleWithHierarchy.RoleLevelandRoleWithHierarchy.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:
toStringin classjava.lang.Enum<RoleWithHierarchy>
-
-