Package org.ametys.core.user.population
Class UserPopulationDAO
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.core.user.population.UserPopulationDAO
- All Implemented Interfaces:
LogEnabled
,Disposable
,Initializable
,Component
,Serviceable
public class UserPopulationDAO
extends AbstractLogEnabled
implements Component, Serviceable, Initializable, Disposable
DAO for accessing
UserPopulation
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The id of the "admin" populationstatic final String
Avalon Rolestatic final UserIdentity
The id of the "user system" populationstatic final String
The id of the "user system" login -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionadd
(String id, String label, List<Map<String, String>> userDirectories, List<Map<String, String>> credentialProviders) Adds a new populationDetermines if a population can be removedvoid
dispose()
edit
(String id, String label, List<Map<String, String>> userDirectories, List<Map<String, String>> credentialProviders) Edits the given population.Enables/Disables the given populationGets the "admin" populationReturn the configuration file.Gets the configuration for creating/editing a user population.getEnabledUserPopulations
(boolean withAdmin) Gets all the enabled populations of this applicationReturns the id of population which have a fatal invalid configuration.Returns the id of population which have at least one user directory or one credential provider misconfigured These populations can be used by application.Gets the values of the parameters of the given populationGets a population with its id.getUserPopulationAsJson
(UserPopulation userPopulation) Gets a population to JSON formatgetUserPopulations
(boolean includeAdminPopulation) Gets all the populations of this applicationgetUserPopulationsAsJson
(boolean withAdmin) Gets all the populations to JSON formatGets the list of the ids of all the population of the applicationvoid
Returns the enabled state of the given populationboolean
Determines if a population has a valid configurationRemoves the given population.Removes the given population.void
service
(ServiceManager manager) Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Field Details
-
ROLE
Avalon Role -
ADMIN_POPULATION_ID
The id of the "admin" population- See Also:
-
SYSTEM_USER_LOGIN
The id of the "user system" login- See Also:
-
SYSTEM_USER_IDENTITY
The id of the "user system" population
-
-
Constructor Details
-
UserPopulationDAO
public UserPopulationDAO()
-
-
Method Details
-
initialize
- Specified by:
initialize
in interfaceInitializable
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
getUserPopulationsAsJson
Gets all the populations to JSON format- Parameters:
withAdmin
- True to include the "admin" population- Returns:
- A list of object representing the
UserPopulation
s
-
getUserPopulationAsJson
Gets a population to JSON format- Parameters:
userPopulation
- The user population to get- Returns:
- An object representing a
UserPopulation
-
getUserPopulations
Gets all the populations of this application- Parameters:
includeAdminPopulation
- True to include the "admin" population- Returns:
- A list of
UserPopulation
-
getEnabledUserPopulations
Gets all the enabled populations of this application- Parameters:
withAdmin
- True to include the "admin" population- Returns:
- A list of enabled
UserPopulation
-
getUserPopulation
Gets a population with its id.- Parameters:
id
- The id of the population- Returns:
- The
UserPopulation
, or null if not found
-
getUserPopulationsIds
Gets the list of the ids of all the population of the application- Returns:
- The list of the ids of all the populations
-
getIgnoredPopulations
Returns the id of population which have a fatal invalid configuration. These populations can NOT be used by application.- Returns:
- The ignored populations
-
getMisconfiguredPopulations
Returns the id of population which have at least one user directory or one credential provider misconfigured These populations can be used by application.- Returns:
- The misconfigured populations.
-
getConfigurationFile
Return the configuration file.- Returns:
- the configuration file.
-
getEditionConfiguration
Gets the configuration for creating/editing a user population.- Returns:
- A map containing information about what is needed to create/edit a user population
- Throws:
Exception
- If an error occurs.
-
getPopulationParameterValues
Gets the values of the parameters of the given population- Parameters:
id
- The id of the population- Returns:
- The values of the parameters
-
getAdminPopulation
Gets the "admin" population- Returns:
- The "admin" population
-
add
public Map<String,Object> add(String id, String label, List<Map<String, String>> userDirectories, List<Map<String, String>> credentialProviders) Adds a new population- Parameters:
id
- The unique id of the populationlabel
- The label of the populationuserDirectories
- A list of user directory parameterscredentialProviders
- A list of credential provider parameters- Returns:
- A map containing the id of the created population, or the kind of error that occured
-
edit
public Map<String,Object> edit(String id, String label, List<Map<String, String>> userDirectories, List<Map<String, String>> credentialProviders) Edits the given population.- Parameters:
id
- The id of the population to editlabel
- The label of the populationuserDirectories
- A list of user directory parameterscredentialProviders
- A list of credential provider parameters- Returns:
- A map containing the id of the edited population, or the kind of error that occured
-
remove
Removes the given population.- Parameters:
id
- The id of the population to remove- Returns:
- A map containing the id of the removed population
-
remove
Removes the given population.- Parameters:
id
- The id of the population to removeforceDeletion
- Delete the population even if it is still in use- Returns:
- A map containing the id of the removed population
-
enable
Enables/Disables the given population- Parameters:
populationId
- The id of the population to enable/disableenabled
- True to enable the population, false to disable it.- Returns:
- A map containing the id of the enabled/disabled population, or with an error.
-
isValid
Determines if a population has a valid configuration- Parameters:
populationId
- The id of the population to retrieve state- Returns:
- A map, with the response as a boolean, or an error.
-
isEnabled
Returns the enabled state of the given population- Parameters:
populationId
- The id of the population to retrieve state- Returns:
- A map, with the response as a booolean, or an error.
-
canRemove
Determines if a population can be removed- Parameters:
populationId
- The id of the population- Returns:
- A map, with the response as a boolean, or an error.
-
dispose
- Specified by:
dispose
in interfaceDisposable
-