Class DirectoryHandler
The current directory of a repository is returned by the static
method getInstance(Repository)
.
Note: Normal use of EBX® APIs does not require accessing this class, since authentication and permissions management are transparent from the developer point of view (they are "container-managed"). However, this class may be useful when data governance has specific functional dependencies on the directory (for example, a service needs access to all defined users, or if it must display a specific profile).
-
Method Summary
Modifier and TypeMethodDescriptionauthenticateUserFromArray
(Object[] args) authenticateUserFromLoginPassword
(String aLogin, String aPassword) displayBuiltInRole
(Role aBuiltInRole, Locale aLocale) displayProfile
(Profile aProfile, Locale aLocale) Returns a label for the profile specified.displaySpecificRole
(Role aSpecificRole, Locale aLocale) displayUser
(UserReference aUserReference, Locale aLocale) displayUserWithSalutation
(UserReference aUserReference, Locale aLocale) getBackedUpUsers
(UserReference aUserReference) If theDirectory
implementation returnsnull
, this method returns an empty List.getBackingUpUsers
(UserReference aUserReference) If theDirectory
implementation returnsnull
, this method returns an empty List.Returns the underlying implementation of the directory.static DirectoryHandler
getInstance
(Repository aRepository) Returns the directory instance that is associated with the specified repository.getProfiles
(ProfileListContext aProfileContext) getRoleEmail
(Role aRole) If not null, the email address is considered as the mailing list of all the users in this role.getUserAuthenticationURI
(Session aSession) Deprecated.getUserEmail
(UserReference aUserReference) getUsersInRole
(Role aRole) boolean
hasUsersInRole
(Role aRole) final boolean
Returnstrue
if the built-in administrator role has been disabled.boolean
isProfileDefined
(Profile aProfile) Returnstrue
if the specified profile is defined in the directory.boolean
isProfileIncluded
(Profile aProfile, Profile anotherProfile) Returnstrue
whenaProfile
is equal to or included inanotherProfile
.boolean
isRoleStrictlyIncluded
(Role aRole, Role anotherRole) Returnstrue
ifaRole
is included inanotherRole
.boolean
isSpecificRoleDefined
(Role aSpecificRole) boolean
isUserDefined
(UserReference aUserReference) boolean
isUserInRole
(UserReference aUser, Role aRole) Returnstrue
if the user has the specified role.
-
Method Details
-
getInstance
Returns the directory instance that is associated with the specified repository.Warning: a normal use of EBX® APIs does not require to access this class, since authentication and permissions management are transparent from the developer point of view (they are "container-managed"). However, this class may be useful when Master Data Management has specific functional dependencies on the directory (for example, a service needs all of the defined users, or it has to display a specific profile).
- See Also:
-
authenticateUserFromLoginPassword
public UserReference authenticateUserFromLoginPassword(String aLogin, String aPassword) throws AuthenticationException -
authenticateUserFromHttpRequest
public UserReference authenticateUserFromHttpRequest(HttpServletRequest request) throws AuthenticationException -
authenticateUserFromSOAPHeader
- Throws:
AuthenticationException
- See Also:
-
authenticateUserFromArray
-
isProfileDefined
Returnstrue
if the specified profile is defined in the directory.The implementation of this method does the following:
- if the specified profile is a user reference, it calls method
isUserDefined(UserReference)
; - if the specified profile is a built-in role, it returns
true
; - if the specified profile is a specific role, it calls method
isSpecificRoleDefined(Role)
.
- if the specified profile is a user reference, it calls method
-
isUserDefined
- See Also:
-
isSpecificRoleDefined
- See Also:
-
isProfileIncluded
Returnstrue
whenaProfile
is equal to or included inanotherProfile
.The implementation of this method returns
true
:- If
aProfile
references a userU
, and:- either
anotherProfile
references the same user, - or
anotherProfile
is a role and userU
has this role (this calls methodisUserInRole(UserReference, Role)
).
- either
-
If
aProfile
references a roleR
, and:- either
anotherProfile
references the same role, - or
anotherProfile
is a role and roleR
is, included inanotherProfile
(this calls methodisRoleStrictlyIncluded(Role, Role)
).
- either
If the specified profile has been authenticated and the corresponding Session object is available, it is recommended to invoke
Session.isUserInRole(Profile)
instead of this method, for performance purposes.- See Also:
- If
-
isRoleStrictlyIncluded
Returnstrue
ifaRole
is included inanotherRole
.This method invokes
Directory.isRoleStrictlyIncluded(Role, Role)
, unless:-
the specified
aRole
isProfile.ADMINISTRATOR
and that role is disabled, in which case returnsfalse
, -
the specified
aRole
isProfile.EVERYONE
and that role is a specific one, in which case returnstrue
.
- See Also:
-
the specified
-
isUserInRole
Returnstrue
if the user has the specified role.This method invokes
Directory.isUserInRole(UserReference, Role)
, unless the specified role isbuilt-in administrator role
and that role is disabled, in which case returnsfalse
.If the specified user has been authenticated and the corresponding Session object is available, it is recommended to invoke
Session.isUserInRole(Profile)
instead of this method, for performance purposes. -
isBuiltInAdministratorDisabled
public final boolean isBuiltInAdministratorDisabled()Returnstrue
if the built-in administrator role has been disabled.- Since:
- 5.4.0
- See Also:
-
getProfiles
- Throws:
RuntimeException
- If the list returned by the directory implementation has incorrect elements.- See Also:
-
getUsersInRole
- Throws:
RuntimeException
- If the list returned by the directory implementation has incorrect elements.- See Also:
-
hasUsersInRole
- Since:
- 6.0.6
- See Also:
-
getUserEmail
- See Also:
-
getRoleEmail
If not null, the email address is considered as the mailing list of all the users in this role.- Since:
- 5.7.0
- See Also:
-
displayProfile
Returns a label for the profile specified. This label is displayed in the EBX® user interface.The implementation of this method does the following:
- if the specified profile is a user reference, it calls method
displayUser(UserReference, Locale)
; - if the specified profile is a built-in role, it calls method
displayBuiltInRole(Role, Locale)
; - if the specified profile is a specific role, it calls method
displaySpecificRole(Role, Locale)
.
- if the specified profile is a user reference, it calls method
-
displaySpecificRole
-
displayUser
-
displayUserWithSalutation
- Throws:
IllegalArgumentException
- if user is not actually defined.- See Also:
-
getBackedUpUsers
If theDirectory
implementation returnsnull
, this method returns an empty List.- Throws:
RuntimeException
- If the list returned by the directory implementation has incorrect elements. It also checks that a user cannot be backed up by himself.- See Also:
-
getBackingUpUsers
If theDirectory
implementation returnsnull
, this method returns an empty List.- Throws:
RuntimeException
- If the list returned by the directory implementation has incorrect elements.- See Also:
-
getDirectoryImplementation
Returns the underlying implementation of the directory. -
displayBuiltInRole
-
getUserAuthenticationURI
Deprecated.Since 6.1.3, seeDirectory.getUserAuthenticationURI(Session)
.- Since:
- 5.2.0
- See Also:
-
Directory.getUserAuthenticationURI(Session)
.