public abstract class Profile extends Object
Directory
. For example,
product manager, accountant.
The relationship between each user and the roles he has is defined by the method
DirectoryHandler.isProfileIncluded(Profile, Profile)
.
Session
Modifier and Type | Field and Description |
---|---|
static Role |
ADMINISTRATOR
Built-in 'Administrator' role.
|
static Role |
EVERYONE
Built-in role, all users have this role.
|
static Role |
OWNER
The dynamic built-in 'Owner' role.
|
static Role |
READ_ONLY
Built-in read-only role.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object anObject) |
static Role |
forBuiltInRole(String roleName)
Returns the built-in role identified by the name specified.
|
String |
format()
Serializes a profile reference to a
String . |
static Role |
forSpecificRole(String roleName)
Returns the specific role identified by the name specified.
|
static UserReference |
forUser(String aUserId)
Returns the specified user reference.
|
static UserReference |
forUserWithSpecificPrivilege(String userId,
ServiceKey servicePrivilegeGranted)
Returns the user reference specified, with the specific privilege granted.
|
static UserReference |
forUserWithSpecificPrivileges(String userId,
Set<ServiceKey> servicePrivileges)
Returns the user reference specified, with the specific privileges granted.
|
String |
getLabel()
Returns the label of this profile.
|
int |
hashCode() |
boolean |
isBuiltIn()
Returns
true if this profile is a built-in role. |
boolean |
isBuiltInAdministrator()
Returns
true if this Profile is the built-in "Administrator" role. |
boolean |
isBuiltInEveryone()
Returns
true if this Profile is the built-in "Everyone" role. |
boolean |
isBuiltInOwner()
Returns
true if this Profile is the built-in "Owner" role. |
boolean |
isBuiltInReadOnly()
Returns
true if this Profile is the built-in read-only role. |
boolean |
isSpecificRole()
Returns
true if this profile is a specific role. |
boolean |
isUserReference()
Returns
true if this profile references a user. |
static Profile |
parse(String aString)
Analyzes a string that has been created using
format() and returns
the corresponding profile. |
String |
toString() |
public static final Role ADMINISTRATOR
public static final Role READ_ONLY
A user with the role read-only generally has no rights to perform any
modifications in the EBX® repository (unless a procedure has explicitly deactivated
access right controls, see ProcedureContext.setAllPrivileges(boolean)
).
public static final Role OWNER
A
and is in the "owner"
profile defined by the root dataset of A
.public static final Role EVERYONE
public static Role forBuiltInRole(String roleName) throws IllegalArgumentException
Note: the recommended method of accessing a built-in role is through the available constants
defined by this class:
EVERYONE
, ADMINISTRATOR
, READ_ONLY
, etc.
roleName
- unique and persistent identifier of the specific role in the directoryIllegalArgumentException
- if the name specified does not correspond to a built-in roleparse(String)
public static Role forSpecificRole(String roleName) throws IllegalArgumentException
Note: Calling this method does not imply that it returns
a role that is actually defined in the current directory. The actual
existence of a role is actually checked by the method
DirectoryHandler.isSpecificRoleDefined(Role)
(or DirectoryHandler.isProfileDefined(Profile)
).
roleName
- unique and persistent identifier of the specific role in the directory,
corresponds to Role.getRoleName()
.IllegalArgumentException
parse(String)
public static UserReference forUser(String aUserId)
Note: Calling this method does not imply that it returns
a user that is actually defined in the current directory. The actual
existence of a user is actually checked by the method
DirectoryHandler.isUserDefined(UserReference)
.
aUserId
- a unique identifier of a user (usually its login), corresponds to
UserReference.getUserId()
.parse(String)
public static UserReference forUserWithSpecificPrivilege(String userId, ServiceKey servicePrivilegeGranted)
A privilege is useful when a user usually does not have the permissions
to perform an operation, except in the context of a particular session.
Concretely, such a session must have been granted the specific privilege
in the method
Directory.authenticateUserFromHttpRequest(javax.servlet.http.HttpServletRequest)
or
Directory.authenticateUserFromArray(Object[])
.
The following services can be specified for granting actual privileges:
ServiceKey.CREATE
: the privilege to create a dataspace or snapshot
(not to create a table record);ServiceKey.CLOSE
: the privilege to close a dataspace or snapshot;ServiceKey.MERGE
: the privilege to merge a dataspace.userId
- a unique identifier of a user (usually its login)servicePrivilegeGranted
- grants the user the privilege of executing the service specifiedpublic static UserReference forUserWithSpecificPrivileges(String userId, Set<ServiceKey> servicePrivileges)
See the method forUserWithSpecificPrivilege(String, ServiceKey)
for the list of the supported privileges.
userId
- the unique identifier of a user (usually its login)servicePrivileges
- set of ServiceKey
s, grants the user the privilege of executing the services
specifiedpublic static Profile parse(String aString) throws IllegalArgumentException
format()
and returns
the corresponding profile.
Note: To explicitly get either a specific role or a user reference, the following methods must
be called instead of this one: forSpecificRole(String)
, forUser(String)
.
IllegalArgumentException
- If aString
is invalid.format()
public boolean isBuiltIn()
true
if this profile is a built-in role.Role
public boolean isBuiltInAdministrator()
true
if this Profile
is the built-in "Administrator" role.
ADMINISTRATOR
public boolean isBuiltInReadOnly()
true
if this Profile is the built-in read-only role.
READ_ONLY
public boolean isBuiltInEveryone()
true
if this Profile is the built-in "Everyone" role.
EVERYONE
public boolean isBuiltInOwner()
true
if this Profile is the built-in "Owner" role.
OWNER
public boolean isSpecificRole()
true
if this profile is a specific role.Role
public String getLabel()
format()
).public boolean isUserReference()
true
if this profile references a user.UserReference
public String format()
String
.
The string returned by this method can be persisted and should be
used as an argument of the method parse(String)
in order to recreate
profile references.
parse(String)