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
public class UserDAO extends AbstractLogEnabled implements Component, Contextualizable, Serviceable
DAO for manipulatingUser
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
UserDAO.ImpersonateCredentialProvider
A fake credential provider used by the impersonate process
-
Field Summary
Fields Modifier and Type Field Description protected Context
_context
The Avalon contextprotected CurrentUserProvider
_currentUserProvider
The current user provider.protected RightManager
_rightManager
The right managerprotected ServiceManager
_smanager
The service managerprotected UserHelper
_userHelper
The user helperprotected UserManager
_userManager
The user managerprotected UserPopulationDAO
_userPopulationDAO
The user population DAOstatic String
ROLE
The avalon role
-
Constructor Summary
Constructors Constructor Description UserDAO()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected UserIdentity
_getCurrentUser()
Provides the login of the current user.Map<String,Object>
addUser(String populationId, String userDirectoryId, Map<String,String> untypedValues)
Creates a Uservoid
contextualize(Context context)
void
deleteUsers(List<Map<String,String>> users)
Deletes usersMap<String,Object>
editUser(String populationId, Map<String,String> untypedValues)
Edits a UserMap<String,Object>
getEditionModelForDirectory(String populationId, String userDirectoryId)
Get the users edition modelMap<String,Object>
getEditionModelForUSer(String login, String populationId)
Get the users edition modelMap<String,Object>
getUser(String login, String populationId)
Get user's informationMap<String,String>
impersonate(String login, String populationId)
Impersonate the selected userMap<String,Object>
isModifiable(String login, String populationId)
Checks if the user is modifiableMap<String,Object>
isRemovable(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 Detail
-
_smanager
protected ServiceManager _smanager
The service manager
-
_userManager
protected UserManager _userManager
The user manager
-
_userPopulationDAO
protected UserPopulationDAO _userPopulationDAO
The user population DAO
-
_currentUserProvider
protected CurrentUserProvider _currentUserProvider
The current user provider.
-
_userHelper
protected UserHelper _userHelper
The user helper
-
_rightManager
protected RightManager _rightManager
The right manager
-
-
Constructor Detail
-
UserDAO
public UserDAO()
-
-
Method Detail
-
contextualize
public void contextualize(Context context) throws ContextException
- Specified by:
contextualize
in interfaceContextualizable
- Throws:
ContextException
-
service
public void service(ServiceManager smanager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
getUser
public Map<String,Object> getUser(String login, String populationId)
Get user's information- Parameters:
login
- The user's loginpopulationId
- The id of the population- Returns:
- The user's information
-
isModifiable
public Map<String,Object> isModifiable(String login, String populationId)
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
public Map<String,Object> isRemovable(String login, String populationId)
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 InvalidModificationException
Creates 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 InvalidModificationException
Edits 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 void deleteUsers(List<Map<String,String>> users) throws InvalidModificationException
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
protected UserIdentity _getCurrentUser()
Provides the login of the current user.- Returns:
- the login which cannot be
null
.
-
-