public class Role extends StorableObject
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ACCESS_PATH
The dictionary key for the path in the access dictionary.
|
static java.lang.String |
ACCESS_PERMISSION
The dictionary key for the permission list in the access
dictionary.
|
static java.lang.String |
ACCESS_REGEX
The dictionary key for the regex path in the access
dictionary.
|
static java.lang.String |
KEY_ACCESS
The dictionary key for the role access array.
|
static java.lang.String |
KEY_AUTO
The dictionary key for automatic user match.
|
static java.lang.String |
KEY_DESCRIPTION
The dictionary key for the role description.
|
static java.lang.String |
KEY_NAME
The dictionary key for the role name.
|
static Path |
PATH
The role object storage path.
|
static java.lang.String |
PERM_ALL
The permission key for full access.
|
static java.lang.String |
PERM_INTERNAL
The permission key for internal access.
|
static java.lang.String |
PERM_NONE
The permission key for no access.
|
static java.lang.String |
PERM_READ
The permission key for read access.
|
static java.lang.String |
PERM_SEARCH
The permission key for search access.
|
static java.lang.String |
PERM_WRITE
The permission key for write access.
|
dict, KEY_CLASSNAME, KEY_ID, KEY_TYPE
Constructor and Description |
---|
Role(java.lang.String id,
java.lang.String type,
Dict dict)
Creates a new role from a serialized representation.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
auto()
Returns the automatic role attachment type.
|
java.lang.String |
description()
Returns the role description.
|
static Role[] |
findAll(Storage storage)
Searches for all roles in the storage.
|
boolean |
hasAccess(java.lang.String path,
java.lang.String permission)
Checks if the role has access permission for a storage path.
|
boolean |
hasUser(User user)
Checks if the specified user has this role.
|
java.lang.String |
name()
Returns the role name.
|
public static final java.lang.String KEY_NAME
public static final java.lang.String KEY_DESCRIPTION
public static final java.lang.String KEY_AUTO
public static final java.lang.String KEY_ACCESS
public static final java.lang.String ACCESS_PATH
public static final java.lang.String ACCESS_REGEX
public static final java.lang.String ACCESS_PERMISSION
PERM_NONE
,
PERM_INTERNAL
,
PERM_READ
,
PERM_SEARCH
,
PERM_WRITE
,
PERM_ALL
,
Constant Field Valuespublic static final java.lang.String PERM_NONE
public static final java.lang.String PERM_INTERNAL
public static final java.lang.String PERM_READ
public static final java.lang.String PERM_SEARCH
public static final java.lang.String PERM_WRITE
public static final java.lang.String PERM_ALL
public static final Path PATH
public Role(java.lang.String id, java.lang.String type, Dict dict)
id
- the object identifiertype
- the object type namedict
- the serialized representationpublic static Role[] findAll(Storage storage)
storage
- the storage to search inpublic java.lang.String name()
public java.lang.String description()
public java.lang.String auto()
public boolean hasUser(User user)
user
- the user to check, or nullpublic boolean hasAccess(java.lang.String path, java.lang.String permission)
path
- the object storage pathpermission
- the requested permission