org.xwiki.security.authorization
Class Right

java.lang.Object
  extended by 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$
See Also:
Serialized Form

Field Summary
static Right ADMIN
          The Admin access right.
static Right COMMENT
          The comment access right.
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 Right LOGIN
          The login access right.
static Right PROGRAM
          The program access right.
static Right REGISTER
          The register 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
 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()
           
 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()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

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.


ADMIN

public static final Right ADMIN
The Admin access right.


PROGRAM

public static final Right PROGRAM
The program access right.


REGISTER

public static final Right REGISTER
The register access right.


COMMENT

public static final Right COMMENT
The comment access right.


ILLEGAL

public static final Right ILLEGAL
Illegal value.


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

values

public static List<Right> values()
Returns:
an unmodifiable list of available Right

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.

ordinal

public int ordinal()
Returns:
The numeric value of this access right.

getName

public String getName()
Specified by:
getName in interface RightDescription
Returns:
The string representation of this right.

toString

public String toString()
Overrides:
toString in class Object

getImpliedRights

public Set<Right> getImpliedRights()
Specified by:
getImpliedRights in interface RightDescription
Returns:
a set of additional rights implied by this right.

getTargetedEntityType

public Set<EntityType> getTargetedEntityType()
Specified by:
getTargetedEntityType in interface RightDescription
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 interface RightDescription
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 interface RightDescription
Returns:
Whether this right should be allowed or denied in case of a tie.

getDefaultState

public RuleState getDefaultState()
Specified by:
getDefaultState in interface RightDescription
Returns:
The default state, in case no matching right is found at any level. Should be either RuleState.ALLOW or RuleState.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 interface RightDescription
Returns:
true if this right allow a read-only access to the wiki.

compareTo

public int compareTo(Right other)
Specified by:
compareTo in interface Comparable<Right>


Copyright © 2004-2012 XWiki. All Rights Reserved.