Package org.xwiki.security.authorization
Class Right
- java.lang.Object
-
- org.xwiki.security.authorization.Right
-
- All Implemented Interfaces:
Serializable
,Comparable<Right>
,RightDescription
public class Right extends Object implements RightDescription, Serializable, Comparable<Right>
Enumeration of the possible rights.- Since:
- 4.0M2
- Version:
- $Id: e1832f7dd7ddd10649fd57d2d504cb4055c04e59 $
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static Right
ADMIN
The Admin access right.static Right
COMMENT
The comment access right.static Right
CREATE_WIKI
The creation of a Wiki right.static Right
CREATOR
Imply rights provided to creator of a document.static Right
DELETE
The delete access right.static Right
EDIT
The edit access right.static Set<EntityType>
FARM_ONLY
Targeted entity type list to target only the main wiki.static Right
ILLEGAL
Illegal value.static String
ILLEGAL_RIGHT_NAME
Illegal right name.static Right
LOGIN
The login access right.static Right
PROGRAM
The program access right.static Right
REGISTER
The register access right.static Right
SCRIPT
The script access right.static Right
VIEW
The view access right.static Set<EntityType>
WIKI_ONLY
Targeted entity type list to target only wikis (including main wiki).static Set<EntityType>
WIKI_SPACE
Targeted entity type list to target wikis and spaces.static Set<EntityType>
WIKI_SPACE_DOCUMENT
Targeted entity type list to target wikis, spaces and documents.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(Right other)
static Right
get(int ordinal)
Retrieve a right based on its ordinal.static List<String>
getAllRightsAsString()
RuleState
getDefaultState()
static Set<Right>
getEnabledRights(EntityType entityType)
Returns the list of rights available for a given entity type.Set<Right>
getImpliedRights()
boolean
getInheritanceOverridePolicy()
String
getName()
static List<Right>
getStandardRights()
Set<EntityType>
getTargetedEntityType()
RuleState
getTieResolutionPolicy()
boolean
isReadOnly()
Used to check if this right should be allowed when the wiki is in read-only mode.int
ordinal()
static int
size()
static Right
toRight(String string)
Convert a string to a right.String
toString()
static List<Right>
values()
-
-
-
Field Detail
-
LOGIN
public static final Right LOGIN
The login access right.
-
VIEW
public static final Right VIEW
The view access right.
-
EDIT
public static final Right EDIT
The edit access right.
-
DELETE
public static final Right DELETE
The delete access right.
-
CREATOR
public static final Right CREATOR
Imply rights provided to creator of a document.
-
ADMIN
public static final Right ADMIN
The Admin access right.
-
PROGRAM
public static final Right PROGRAM
The program access right.
-
SCRIPT
public static final Right SCRIPT
The script access right.
-
REGISTER
public static final Right REGISTER
The register access right.
-
COMMENT
public static final Right COMMENT
The comment access right.
-
CREATE_WIKI
public static final Right CREATE_WIKI
The creation of a Wiki right.
-
ILLEGAL
public static final Right ILLEGAL
Illegal value.
-
ILLEGAL_RIGHT_NAME
public static final String ILLEGAL_RIGHT_NAME
Illegal right name.- See Also:
- Constant Field Values
-
FARM_ONLY
public static final Set<EntityType> FARM_ONLY
Targeted entity type list to target only the main wiki.
-
WIKI_ONLY
public static final Set<EntityType> WIKI_ONLY
Targeted entity type list to target only wikis (including main wiki).
-
WIKI_SPACE
public static final Set<EntityType> WIKI_SPACE
Targeted entity type list to target wikis and spaces.
-
WIKI_SPACE_DOCUMENT
public static final Set<EntityType> WIKI_SPACE_DOCUMENT
Targeted entity type list to target wikis, spaces and documents.
-
-
Method Detail
-
toRight
public static Right toRight(String string)
Convert a string to a right.- Parameters:
string
- String representation of right.- Returns:
- The corresponding Right instance, or
ILLEGAL
.
-
getEnabledRights
public static Set<Right> getEnabledRights(EntityType entityType)
Returns the list of rights available for a given entity type.- Parameters:
entityType
- the entity type, or null for main wiki.- Returns:
- a list of
Right
enabled of this entity type
-
get
public static Right get(int ordinal)
Retrieve a right based on its ordinal.- Parameters:
ordinal
- the ordinal of the right- Returns:
- the
Right
-
size
public static int size()
- Returns:
- the count of all existing rights
-
getAllRightsAsString
public static List<String> getAllRightsAsString()
- Returns:
- a list of the string representation of all valid rights.
-
getStandardRights
@Unstable public static List<Right> getStandardRights()
- Returns:
- the list of statically registered rights.
- Since:
- 13.5RC1
-
ordinal
public int ordinal()
- Returns:
- The numeric value of this access right.
-
getName
public String getName()
- Specified by:
getName
in interfaceRightDescription
- Returns:
- The string representation of this right.
-
getImpliedRights
public Set<Right> getImpliedRights()
- Specified by:
getImpliedRights
in interfaceRightDescription
- Returns:
- a set of additional rights implied by this right. Note that this method should
return
null
instead of an empty set.
-
getTargetedEntityType
public Set<EntityType> getTargetedEntityType()
- Specified by:
getTargetedEntityType
in interfaceRightDescription
- Returns:
- a set of entity type for which this right should be enabled. Special type Right.FARM (==null) could be used to target the EntityType.WIKI for the main wiki only (i.e. PROGRAM)
-
getInheritanceOverridePolicy
public boolean getInheritanceOverridePolicy()
- Specified by:
getInheritanceOverridePolicy
in interfaceRightDescription
- Returns:
- Policy on how this right should be overridden by lower levels in the entity reference hierarchy. When true, this right on a document override this right on a wiki.
-
getTieResolutionPolicy
public RuleState getTieResolutionPolicy()
- Specified by:
getTieResolutionPolicy
in interfaceRightDescription
- Returns:
- Whether this right should be allowed or denied in case of a tie.
-
getDefaultState
public RuleState getDefaultState()
- Specified by:
getDefaultState
in interfaceRightDescription
- Returns:
- The default state, in case no matching right is found
at any level. Should be either
RuleState.ALLOW
orRuleState.DENY
.
-
isReadOnly
public boolean isReadOnly()
Description copied from interface:RightDescription
Used to check if this right should be allowed when the wiki is in read-only mode. From the native right, only EDIT, DELETE, COMMENT and REGISTER returns false.- Specified by:
isReadOnly
in interfaceRightDescription
- Returns:
- true if this right allow a read-only access to the wiki.
-
compareTo
public int compareTo(Right other)
- Specified by:
compareTo
in interfaceComparable<Right>
-
-