org.opencms.security
Interface I_CmsPrincipal

All Superinterfaces:
java.security.Principal
All Known Implementing Classes:
CmsGroup, CmsHistoryPrincipal, CmsPrincipal, CmsUser

public interface I_CmsPrincipal
extends java.security.Principal

Representation of an identity in the cms (currently user or group), used to define permissions on a resource.

Since:
6.0.0
Version:
$Revision: 1.22 $
Author:
Alexander Kandzior, Carsten Weinholz

Field Summary
static int FLAG_CORE_LIMIT
          Upper limit for core flags, any principal object with flags greater than this value will be filtered out.
static int FLAG_DISABLED
          This flag is set for disabled principals in the database.
static int FLAG_ENABLED
          This flag is set for enabled principals in the database.
static int FLAG_GROUP_PROJECT_MANAGER
          Flag to indicate a group is a potential project manager group.
static int FLAG_GROUP_PROJECT_USER
          Flag to indicate a group is a potential project user group.
static int FLAG_GROUP_ROLE
          Flag to indicate a role group.
static int FLAG_GROUP_VIRTUAL
          Flag to indicate a virtual group role, after this bit we need to encode a number between 0 and CmsRole.getSystemRoles().size()-1 so we will need up to 4 more bits.
static int FLAG_USER_MANAGED
          Flag to indicate a user is not able to manage himself.
static int FLAG_USER_WEBUSER
          Flag to indicate a user is a webuser.
static java.lang.String PRINCIPAL_GROUP
          Identifier for group principals.
static java.lang.String PRINCIPAL_USER
          Identifier for user principals.
 
Method Summary
 void checkName(java.lang.String name)
          Checks if the provided principal name is valid and can be used as an argument value for setName(String).
 boolean equals(java.lang.Object obj)
          Compares the given object with this principal.
 java.lang.String getDescription()
          Returns the description of this principal.
 int getFlags()
          Returns the flags of this principal.
 CmsUUID getId()
          Returns the unique id of this principal.
 java.lang.String getName()
          Returns the unique name of this principal.
 java.lang.String getOuFqn()
          Returns the fully qualified name of the associated organizational unit.
 java.lang.String getPrefixedName()
          Returns this principals unique name prefixed with it's type.
 java.lang.String getSimpleName()
          Returns the simple name of this organizational unit.
 int hashCode()
          Returns the hash code of this object.
 boolean isEnabled()
          Returns true if this principal is enabled.
 boolean isGroup()
          Returns true if this principal is of type CmsGroup.
 boolean isUser()
          Returns true if this principal is of type CmsUser.
 void setDescription(java.lang.String description)
          Sets the description of this principal.
 void setEnabled(boolean enabled)
          Enables (or disables) this principal, depending on the given status.
 void setFlags(int value)
          Sets this principals flags to the specified value.
 void setName(java.lang.String name)
          Sets the unique name of this principal.
 
Methods inherited from interface java.security.Principal
toString
 

Field Detail

FLAG_CORE_LIMIT

static final int FLAG_CORE_LIMIT
Upper limit for core flags, any principal object with flags greater than this value will be filtered out.

See Also:
Constant Field Values

FLAG_DISABLED

static final int FLAG_DISABLED
This flag is set for disabled principals in the database.

See Also:
Constant Field Values

FLAG_ENABLED

static final int FLAG_ENABLED
This flag is set for enabled principals in the database.

See Also:
Constant Field Values

FLAG_GROUP_PROJECT_MANAGER

static final int FLAG_GROUP_PROJECT_MANAGER
Flag to indicate a group is a potential project manager group.

See Also:
Constant Field Values

FLAG_GROUP_PROJECT_USER

static final int FLAG_GROUP_PROJECT_USER
Flag to indicate a group is a potential project user group.

See Also:
Constant Field Values

FLAG_GROUP_ROLE

static final int FLAG_GROUP_ROLE
Flag to indicate a role group.

See Also:
Constant Field Values

FLAG_GROUP_VIRTUAL

static final int FLAG_GROUP_VIRTUAL
Flag to indicate a virtual group role, after this bit we need to encode a number between 0 and CmsRole.getSystemRoles().size()-1 so we will need up to 4 more bits.

See Also:
Constant Field Values

FLAG_USER_MANAGED

static final int FLAG_USER_MANAGED
Flag to indicate a user is not able to manage himself.

See Also:
Constant Field Values

FLAG_USER_WEBUSER

static final int FLAG_USER_WEBUSER
Flag to indicate a user is a webuser.

See Also:
Constant Field Values

PRINCIPAL_GROUP

static final java.lang.String PRINCIPAL_GROUP
Identifier for group principals.

See Also:
Constant Field Values

PRINCIPAL_USER

static final java.lang.String PRINCIPAL_USER
Identifier for user principals.

See Also:
Constant Field Values
Method Detail

checkName

void checkName(java.lang.String name)
Checks if the provided principal name is valid and can be used as an argument value for setName(String).

Parameters:
name - the principal name to check

equals

boolean equals(java.lang.Object obj)
Compares the given object with this principal.

Specified by:
equals in interface java.security.Principal
Overrides:
equals in class java.lang.Object
Parameters:
obj - object to compare
Returns:
true if the object is equal

getDescription

java.lang.String getDescription()
Returns the description of this principal.

Returns:
the description of this principal

getFlags

int getFlags()
Returns the flags of this principal.

The principal flags are used to store special information about the principals state encoded bitwise. Usually the flags int value should not be directly accessed. Utility methods like isEnabled() provide a much easier way to access the information contained in the flags.

Returns:
the flags of this principal

getId

CmsUUID getId()
Returns the unique id of this principal.

Returns:
the unique id of this principal

getName

java.lang.String getName()
Returns the unique name of this principal.

Specified by:
getName in interface java.security.Principal
Returns:
the unique name of this principal

getOuFqn

java.lang.String getOuFqn()
Returns the fully qualified name of the associated organizational unit.

Returns:
the fully qualified name of the associated organizational unit

getPrefixedName

java.lang.String getPrefixedName()
Returns this principals unique name prefixed with it's type.

The type prefix can either be PRINCIPAL_GROUP. (for groups) or PRINCIPAL_USER. (for users).

Returns:
this principals unique name prefixed with this principals type

getSimpleName

java.lang.String getSimpleName()
Returns the simple name of this organizational unit.

Returns:
the simple name of this organizational unit.

hashCode

int hashCode()
Returns the hash code of this object.

Specified by:
hashCode in interface java.security.Principal
Overrides:
hashCode in class java.lang.Object
Returns:
the hash code

isEnabled

boolean isEnabled()
Returns true if this principal is enabled.

A principal may be disabled in order to disable it, for example to prevent logins of a user. If a principal is just disabled but not deleted, the credentials of the principal in the VFS are still valid.

Returns:
true if this principal is enabled

isGroup

boolean isGroup()
Returns true if this principal is of type CmsGroup.

Returns:
true if this principal is of type CmsGroup

isUser

boolean isUser()
Returns true if this principal is of type CmsUser.

Returns:
true if this principal is of type CmsUser

setDescription

void setDescription(java.lang.String description)
Sets the description of this principal.

Parameters:
description - the principal description to set

setEnabled

void setEnabled(boolean enabled)
Enables (or disables) this principal, depending on the given status.

Parameters:
enabled - the principal status to set

setFlags

void setFlags(int value)
Sets this principals flags to the specified value.

The principal flags are used to store special information about the principals state encoded bitwise. Usually the flags integer value should not be directly accessed. Utility methods like setEnabled(boolean) provide a much easier way to manipulate the information contained in the flags.

Parameters:
value - the value to set this principals flags to

setName

void setName(java.lang.String name)
Sets the unique name of this principal.

Parameters:
name - the unique name of this principal to set