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 SummaryNested ClassesModifier and TypeClassDescriptionstatic classA fake credential provider used by the impersonate process
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected ContextThe Avalon contextprotected CurrentUserProviderThe current user provider.protected GroupManagerThe group managerprotected PopulationContextHelperThe population context helperprotected RightManagerThe right managerprotected ServiceManagerThe service managerprotected UserHelperThe user helperprotected UserManagerThe user managerprotected UserPopulationDAOThe user population DAOstatic final StringThe avalon role
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected boolean_canHandle(String populationId) Check current user can handle the population of usersprotected UserIdentityProvides the login of the current user._getSearchParameters(String searchCriteria) Get the search parametersCreates a Uservoidcontextualize(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 modelgetStoredUser(String login, String populationId) Get user's informationGet user's informationgetUsersByUserIdentitiesAndContexts(List<String> userIdentities, List<String> contexts, Boolean limitedToStoredUserData) Get the list of users for given user identities in given contextsimpersonate(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 itsearchUsersByContexts(List<String> contexts, Integer limit, Integer offset, String searchCriteria, Boolean limitedToStoredUserData) Search for users in given contextssearchUsersByDirectory(String userDirectoryId, String userPopulationId, Integer limit, Integer offset, String searchCriteria, Boolean limitedToStoredUserData) Search for users in given user directorysearchUsersByPopulation(String userPopulationId, Integer limit, Integer offset, String searchCriteria, Boolean limitedToStoredUserData) Search for users in given user populationvoidservice(ServiceManager smanager) Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabledenableLogging, getLogger, setupLogger, setupLogger, setupLogger
- 
Field Details- 
ROLEThe avalon role
- 
_smanagerThe service manager
- 
_userManagerThe user manager
- 
_userPopulationDAOThe user population DAO
- 
_populationContextHelperThe population context helper
- 
_currentUserProviderThe current user provider.
- 
_contextThe Avalon context
- 
_userHelperThe user helper
- 
_rightManagerThe right manager
- 
_groupManagerThe group manager
 
- 
- 
Constructor Details- 
UserDAOpublic UserDAO()
 
- 
- 
Method Details- 
contextualize- Specified by:
- contextualizein interface- Contextualizable
- Throws:
- ContextException
 
- 
service- Specified by:
- servicein interface- Serviceable
- Throws:
- ServiceException
 
- 
getUsersByUserIdentitiesAndContextspublic List<Map<String,Object>> getUsersByUserIdentitiesAndContexts(List<String> userIdentities, List<String> contexts, Boolean limitedToStoredUserData) Get the list of users for given user identities in given contexts- Parameters:
- userIdentities- The user identities to search for
- contexts- The contexts The context in which to find the users. Can be null. Defaults to the current context. If no contexts are found, the current user need to have admin rights.
- limitedToStoredUserData-- trueto only retrieve the data from stored user,- falseto retrieve everything. Can be null. Defaults to "false"
- Returns:
- a non-null list of users
 
- 
searchUsersByContextspublic List<Map<String,Object>> searchUsersByContexts(List<String> contexts, Integer limit, Integer offset, String searchCriteria, Boolean limitedToStoredUserData) Search for users in given contexts- Parameters:
- contexts- The context in which to find the users. Cannot be null.
- limit- The limit of results. Can be null. Defaults to value- _DEFAULT_SEARCH_COUNT_VALUE.
- offset- The offset, where to start returning results (offset). Can be null. Defaults to value- _DEFAULT_SEARCH_OFFSET_VALUE
- searchCriteria- The criteria (pattern) for the search. Can be null.
- limitedToStoredUserData-- trueto only retrieve the data from stored user,- falseto retrieve everything. Can be null. Defaults to "false"
- Returns:
- a non-null list of users
 
- 
searchUsersByDirectorypublic List<Map<String,Object>> searchUsersByDirectory(String userDirectoryId, String userPopulationId, Integer limit, Integer offset, String searchCriteria, Boolean limitedToStoredUserData) Search for users in given user directory- Parameters:
- userDirectoryId- The id of the user directory in which to find the users. Cannot be null.
- userPopulationId- The id of the user population in which to find the users. Cannot be null.
- limit- The limit of results. Can be null. Defaults to value- _DEFAULT_SEARCH_COUNT_VALUE.
- offset- The offset, where to start returning results (offset). Can be null. Defaults to value- _DEFAULT_SEARCH_OFFSET_VALUE
- searchCriteria- The criteria (pattern) for the search. Can be null.
- limitedToStoredUserData-- trueto only retrieve the data from stored user,- falseto retrieve everything. Can be null. Defaults to "false"
- Returns:
- a non-null list of users
 
- 
searchUsersByPopulationpublic List<Map<String,Object>> searchUsersByPopulation(String userPopulationId, Integer limit, Integer offset, String searchCriteria, Boolean limitedToStoredUserData) Search for users in given user population- Parameters:
- userPopulationId- The id of the user population in which to find the users. Cannot be null.
- limit- The limit of results. Can be null. Defaults to value- _DEFAULT_SEARCH_COUNT_VALUE.
- offset- The offset, where to start returning results (offset). Can be null. Defaults to value- _DEFAULT_SEARCH_OFFSET_VALUE
- searchCriteria- The criteria (pattern) for the search. Can be null.
- limitedToStoredUserData-- trueto only retrieve the data from stored user,- falseto retrieve everything. Can be null. Defaults to "false"
- Returns:
- a non-null list of users
 
- 
_getSearchParametersGet the search parameters- Parameters:
- searchCriteria- The search pattern
- Returns:
- the search parameters
 
- 
getUserGet user's information- Parameters:
- login- The user's login
- populationId- The id of the population
- Returns:
- The user's information
 
- 
getStoredUserGet user's information- Parameters:
- login- The user's login
- populationId- The id of the population
- Returns:
- The user's information
 
- 
isModifiableChecks if the user is modifiable and if current user is allowed to edit it- Parameters:
- login- The users's login
- populationId- The id of the population of the user
- Returns:
- A map with the "isModifiable" at true if the user is modifiable
 
- 
isRemovableChecks if the user is removable and if current user is allowed to remove it- Parameters:
- login- The users's login
- populationId- The id of the population of the user
- Returns:
- A map with the "isRemovable" at true if the user is removable
 
- 
addUserpublic Map<String,Object> addUser(String populationId, String userDirectoryId, Map<String, String> untypedValues) throws InvalidModificationExceptionCreates a User- Parameters:
- populationId- The id of the user population
- userDirectoryId- The id of the user directory
- untypedValues- The untyped user's parameters
- Returns:
- The created user as JSON object
- Throws:
- InvalidModificationException- If modification is not possible
 
- 
_canHandleCheck current user can handle the population of users- Parameters:
- populationId- the id of population
- Returns:
- true if user is allowed to handle this population
 
- 
editUserpublic 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 edit
- untypedValues- The untyped user's parameters
- Returns:
- The update user as JSON object
- Throws:
- InvalidModificationException- If modification is not possible
 
- 
deleteUserspublic 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
 
- 
getEditionModelForUSerpublic Map<String,Object> getEditionModelForUSer(String login, String populationId) throws InvalidModificationException Get the users edition model- Parameters:
- login- The user's login to edit
- populationId- The id of the population of the user to edit
- Returns:
- The edition model as an object
- Throws:
- InvalidModificationException- If modification is not possible
 
- 
getEditionModelForDirectorypublic Map<String,Object> getEditionModelForDirectory(String populationId, String userDirectoryId) throws InvalidModificationException Get the users edition model- Parameters:
- populationId- The id of the population where to add a user
- userDirectoryId- The id of the user directory where to add a user
- Returns:
- The edition model as an object
- Throws:
- InvalidModificationException- If modification is not possible
 
- 
impersonatepublic Map<String,String> impersonate(String login, String populationId) throws AccessDeniedException Impersonate the selected user- Parameters:
- login- the login of the user to impersonate
- populationId- 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
 
- 
_getCurrentUserProvides the login of the current user.- Returns:
- the login which cannot be null.
 
 
-