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 RightADMINThe Admin access right.static RightCOMMENTThe comment access right.static RightCREATE_WIKIThe creation of a Wiki right.static RightCREATORImply rights provided to creator of a document.static RightDELETEThe delete access right.static RightEDITThe edit access right.static Set<EntityType>FARM_ONLYTargeted entity type list to target only the main wiki.static RightILLEGALIllegal value.static StringILLEGAL_RIGHT_NAMEIllegal right name.static RightLOGINThe login access right.static RightPROGRAMThe program access right.static RightREGISTERThe register access right.static RightSCRIPTThe script access right.static RightVIEWThe view access right.static Set<EntityType>WIKI_ONLYTargeted entity type list to target only wikis (including main wiki).static Set<EntityType>WIKI_SPACETargeted entity type list to target wikis and spaces.static Set<EntityType>WIKI_SPACE_DOCUMENTTargeted entity type list to target wikis, spaces and documents.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(Right other)static Rightget(int ordinal)Retrieve a right based on its ordinal.static List<String>getAllRightsAsString()RuleStategetDefaultState()static Set<Right>getEnabledRights(EntityType entityType)Returns the list of rights available for a given entity type.Set<Right>getImpliedRights()booleangetInheritanceOverridePolicy()StringgetName()static List<Right>getStandardRights()Set<EntityType>getTargetedEntityType()RuleStategetTieResolutionPolicy()booleanisReadOnly()Used to check if this right should be allowed when the wiki is in read-only mode.intordinal()static intsize()static RighttoRight(String string)Convert a string to a right.StringtoString()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
Rightenabled 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:
getNamein interfaceRightDescription- Returns:
- The string representation of this right.
-
getImpliedRights
public Set<Right> getImpliedRights()
- Specified by:
getImpliedRightsin interfaceRightDescription- Returns:
- a set of additional rights implied by this right. Note that this method should
return
nullinstead of an empty set.
-
getTargetedEntityType
public Set<EntityType> getTargetedEntityType()
- Specified by:
getTargetedEntityTypein 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:
getInheritanceOverridePolicyin 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:
getTieResolutionPolicyin interfaceRightDescription- Returns:
- Whether this right should be allowed or denied in case of a tie.
-
getDefaultState
public RuleState getDefaultState()
- Specified by:
getDefaultStatein interfaceRightDescription- Returns:
- The default state, in case no matching right is found
at any level. Should be either
RuleState.ALLOWorRuleState.DENY.
-
isReadOnly
public boolean isReadOnly()
Description copied from interface:RightDescriptionUsed 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:
isReadOnlyin interfaceRightDescription- Returns:
- true if this right allow a read-only access to the wiki.
-
compareTo
public int compareTo(Right other)
- Specified by:
compareToin interfaceComparable<Right>
-
-