Package org.ametys.plugins.core.user
Class UserDAO
java.lang.Object
org.apache.avalon.framework.logger.AbstractLogEnabled
org.ametys.plugins.core.user.UserDAO
- All Implemented Interfaces:
Component
,Contextualizable
,LogEnabled
,Serviceable
DAO for manipulating
User
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
A fake credential provider used by the impersonate process -
Field Summary
Modifier and TypeFieldDescriptionprotected Context
The Avalon contextprotected CurrentUserProvider
The current user provider.protected RightManager
The right managerprotected ServiceManager
The service managerprotected UserHelper
The user helperprotected UserManager
The user managerprotected UserPopulationDAO
The user population DAOstatic final String
The avalon role -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
_canHandle
(String populationId) Check current user can handle the population of usersprotected UserIdentity
Provides the login of the current user.Creates a Uservoid
contextualize
(Context context) deleteUsers
(List<Map<String, String>> users) Deletes usersEdits a UsergetEditionModelForDirectory
(String populationId, String userDirectoryId) Get the users edition modelgetEditionModelForUSer
(String login, String populationId) Get the users edition modelGet user's informationimpersonate
(String login, String populationId) Impersonate the selected userisModifiable
(String login, String populationId) Checks if the user is modifiable and if current user is allowed to edit itisRemovable
(String login, String populationId) Checks if the user is removable and if current user is allowed to remove itvoid
service
(ServiceManager smanager) Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
Field Details
-
ROLE
The avalon role -
_smanager
The service manager -
_userManager
The user manager -
_userPopulationDAO
The user population DAO -
_currentUserProvider
The current user provider. -
_context
The Avalon context -
_userHelper
The user helper -
_rightManager
The right manager
-
-
Constructor Details
-
UserDAO
public UserDAO()
-
-
Method Details
-
contextualize
- Specified by:
contextualize
in interfaceContextualizable
- Throws:
ContextException
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
getUser
Get user's information- Parameters:
login
- The user's loginpopulationId
- The id of the population- Returns:
- The user's information
-
isModifiable
Checks if the user is modifiable and if current user is allowed to edit it- Parameters:
login
- The users's loginpopulationId
- The id of the population of the user- Returns:
- A map with the "isModifiable" at true if the user is modifiable
-
isRemovable
Checks if the user is removable and if current user is allowed to remove it- Parameters:
login
- The users's loginpopulationId
- The id of the population of the user- Returns:
- A map with the "isRemovable" at true if the user is removable
-
addUser
public Map<String,Object> addUser(String populationId, String userDirectoryId, Map<String, String> untypedValues) throws InvalidModificationExceptionCreates a User- Parameters:
populationId
- The id of the user populationuserDirectoryId
- The id of the user directoryuntypedValues
- The untyped user's parameters- Returns:
- The created user as JSON object
- Throws:
InvalidModificationException
- If modification is not possible
-
_canHandle
Check current user can handle the population of users- Parameters:
populationId
- the id of population- Returns:
- true if user is allowed to handle this population
-
editUser
public Map<String,Object> editUser(String populationId, Map<String, String> untypedValues) throws InvalidModificationExceptionEdits a User- Parameters:
populationId
- The id of the population of the user to edituntypedValues
- The untyped user's parameters- Returns:
- The update user as JSON object
- Throws:
InvalidModificationException
- If modification is not possible
-
deleteUsers
public Map<String,Object> deleteUsers(List<Map<String, String>> users) throws InvalidModificationExceptionDeletes users- Parameters:
users
- The users to delete- Returns:
- the result with deleted users and undeleted users
- Throws:
InvalidModificationException
- If modification is not possible
-
getEditionModelForUSer
public Map<String,Object> getEditionModelForUSer(String login, String populationId) throws InvalidModificationException, ProcessingException Get the users edition model- Parameters:
login
- The user's login to editpopulationId
- The id of the population of the user to edit- Returns:
- The edition model as an object
- Throws:
InvalidModificationException
- If modification is not possibleProcessingException
- If there is another exception
-
getEditionModelForDirectory
public Map<String,Object> getEditionModelForDirectory(String populationId, String userDirectoryId) throws InvalidModificationException, ProcessingException Get the users edition model- Parameters:
populationId
- The id of the population where to add a useruserDirectoryId
- The id of the user directory where to add a user- Returns:
- The edition model as an object
- Throws:
InvalidModificationException
- If modification is not possibleProcessingException
- If there is another exception
-
impersonate
public Map<String,String> impersonate(String login, String populationId) throws AccessDeniedException Impersonate the selected user- Parameters:
login
- the login of the user to impersonatepopulationId
- The id of the population- Returns:
- a map of information on the user
- Throws:
AccessDeniedException
- If the currently connected user has no right to do so
-
_getCurrentUser
Provides the login of the current user.- Returns:
- the login which cannot be
null
.
-