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 UserIdentity
Provides the login of the current user.Creates a Uservoid
contextualize
(Context context) void
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 modifiableisRemovable
(String login, String populationId) Checks if the user is removablevoid
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- 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- 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
-
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
Deletes users- Parameters:
users
- The users to delete- 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
.
-