Class Profile
- Direct Known Subclasses:
Role
,UserReference
- A built-in role gives generic permissions in EBX®.
- A specific role is defined by a specific instance of
Directory
. For example, product manager, accountant. - A user reference identifies a specific user by its login.
The relationship between each user and the roles he has is defined by the method
DirectoryHandler.isProfileIncluded(Profile, Profile)
.
- See Also:
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
static Role
forBuiltInRole
(String roleName) Returns the built-in role identified by the name specified.format()
Serializes a profile reference to aString
.static Role
forSpecificRole
(String roleName) Returns the specific role identified by the name specified.static UserReference
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.getLabel()
Returns the label of this profile.int
hashCode()
boolean
Returnstrue
if this profile is a built-in role.boolean
Returnstrue
if thisProfile
is the built-in "Administrator" role.boolean
Returnstrue
if this Profile is the built-in "Everyone" role.boolean
Returnstrue
if this Profile is the built-in "Owner" role.boolean
Returnstrue
if this Profile is the built-in read-only role.boolean
Returnstrue
if this profile is a specific role.boolean
Returnstrue
if this profile references a user.static Profile
Analyzes a string that has been created usingformat()
and returns the corresponding profile.toString()
-
Field Details
-
ADMINISTRATOR
Built-in 'Administrator' role. The administrator role allows performing general administration tasks. -
READ_ONLY
Built-in read-only role.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)
). -
OWNER
The dynamic built-in 'Owner' role. A user is in the 'Owner' role when in a given datasetA
and is in the "owner" profile defined by the root dataset ofA
. -
EVERYONE
Built-in role, all users have this role.
-
-
Method Details
-
forBuiltInRole
Returns the built-in role identified by the name specified.Note: the recommended method of accessing a built-in role is through the available constants defined by this class:
EVERYONE
,ADMINISTRATOR
,READ_ONLY
, etc.- Parameters:
roleName
- unique and persistent identifier of the specific role in the directory- Throws:
IllegalArgumentException
- if the name specified does not correspond to a built-in role- See Also:
-
forSpecificRole
Returns the specific role identified by the name specified.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)
(orDirectoryHandler.isProfileDefined(Profile)
).- Parameters:
roleName
- unique and persistent identifier of the specific role in the directory, corresponds toRole.getRoleName()
.- Throws:
IllegalArgumentException
- See Also:
-
forUser
Returns the specified user reference.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)
.- Parameters:
aUserId
- a unique identifier of a user (usually its login), corresponds toUserReference.getUserId()
.- See Also:
-
forUserWithSpecificPrivilege
public static UserReference forUserWithSpecificPrivilege(String userId, ServiceKey servicePrivilegeGranted) Returns the user reference specified, with the specific privilege granted.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(jakarta.servlet.http.HttpServletRequest)
orDirectory.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.
- Parameters:
userId
- a unique identifier of a user (usually its login)servicePrivilegeGranted
- grants the user the privilege of executing the service specified
-
forUserWithSpecificPrivileges
public static UserReference forUserWithSpecificPrivileges(String userId, Set<ServiceKey> servicePrivileges) Returns the user reference specified, with the specific privileges granted.See the method
forUserWithSpecificPrivilege(String, ServiceKey)
for the list of the supported privileges.- Parameters:
userId
- the unique identifier of a user (usually its login)servicePrivileges
- set ofServiceKey
s, grants the user the privilege of executing the services specified
-
parse
Analyzes a string that has been created usingformat()
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)
.- Throws:
IllegalArgumentException
- IfaString
is invalid.- See Also:
-
equals
-
hashCode
public int hashCode() -
isBuiltIn
public boolean isBuiltIn()Returnstrue
if this profile is a built-in role.- See Also:
-
isBuiltInAdministrator
public boolean isBuiltInAdministrator()Returnstrue
if thisProfile
is the built-in "Administrator" role.- See Also:
-
isBuiltInReadOnly
public boolean isBuiltInReadOnly()Returnstrue
if this Profile is the built-in read-only role.- See Also:
-
isBuiltInEveryone
public boolean isBuiltInEveryone()Returnstrue
if this Profile is the built-in "Everyone" role.- See Also:
-
isBuiltInOwner
public boolean isBuiltInOwner()Returnstrue
if this Profile is the built-in "Owner" role.- See Also:
-
isSpecificRole
public boolean isSpecificRole()Returnstrue
if this profile is a specific role.- See Also:
-
getLabel
Returns the label of this profile.- For a built-in role or a specific role, returns the role name.
- For a user reference, returns the user identifier.
format()
). -
isUserReference
public boolean isUserReference()Returnstrue
if this profile references a user.- See Also:
-
toString
-
format
Serializes a profile reference to aString
.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.- See Also:
-