Package org.ametys.plugins.core.group
Class GroupDAO
java.lang.Object
org.apache.avalon.framework.logger.AbstractLogEnabled
org.ametys.plugins.core.group.GroupDAO
- All Implemented Interfaces:
Component
,LogEnabled
,Serviceable
DAO for manipulating
Group
-
Field Summary
Modifier and TypeFieldDescriptionprotected CurrentUserProvider
The current user provider.protected GroupDirectoryDAO
The DAO for group directoriesprotected GroupManager
The group managerprotected ServiceManager
The service managerprotected UserHelper
The user helper -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected UserIdentity
Provides the current user.Creates a new groupAdd users to groupvoid
deleteGroups
(String groupDirectoryId, List<String> groupIds) Deletes groupsGet group's informationgetUsersGroup
(Map<String, String> user) Get the list of groups of a usergroup2Json
(Group group) Get the JSON representation of a groupboolean
isModifiable
(String groupDirectoryId, String id) Checks if the group is modifiableRemove users from grouprenameGroup
(String groupDirectoryId, String groupId, String name) Renames a groupvoid
service
(ServiceManager smanager) Set the users' groupMethods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
Field Details
-
_smanager
The service manager -
_currentUserProvider
The current user provider. -
_groupManager
The group manager -
_groupDirectoryDAO
The DAO for group directories -
_userHelper
The user helper
-
-
Constructor Details
-
GroupDAO
public GroupDAO()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
addGroup
public Map<String,Object> addGroup(String groupDirectoryId, String name) throws InvalidModificationException Creates a new group- Parameters:
groupDirectoryId
- The id of the group directoryname
- The group's name- Returns:
- The group's information
- Throws:
InvalidModificationException
- If modification are not possible
-
setUsersGroup
public Map<String,Object> setUsersGroup(String groupDirectoryId, String groupId, List<Map<String, String>> users) throws InvalidModificationExceptionSet the users' group- Parameters:
groupDirectoryId
- The id of the group directorygroupId
- The group's idusers
- The group's users- Returns:
- The group's information
- Throws:
InvalidModificationException
- If modification are not possible
-
addUsersGroup
public Map<String,Object> addUsersGroup(String groupDirectoryId, String groupId, List<Map<String, String>> users) throws InvalidModificationExceptionAdd users to group- Parameters:
groupDirectoryId
- The id of the group directorygroupId
- The group's idusers
- The users to add- Returns:
- The group's information
- Throws:
InvalidModificationException
- If modification are not possible
-
removeUsersGroup
public Map<String,Object> removeUsersGroup(String groupDirectoryId, String groupId, List<Map<String, String>> users) throws InvalidModificationExceptionRemove users from group- Parameters:
groupDirectoryId
- The id of the group directorygroupId
- The group's idusers
- The users to add- Returns:
- The group's information
- Throws:
InvalidModificationException
- If modification are not possible
-
getUsersGroup
Get the list of groups of a user- Parameters:
user
- The user (using the format ofUserHelper.json2userIdentity(Map)
- Returns:
- The list of groups information
-
renameGroup
public Map<String,Object> renameGroup(String groupDirectoryId, String groupId, String name) throws InvalidModificationException Renames a group- Parameters:
groupDirectoryId
- The id of the group directorygroupId
- The group'sidname
- The new name- Returns:
- The group's information
- Throws:
InvalidModificationException
- If modification are not possible
-
deleteGroups
public void deleteGroups(String groupDirectoryId, List<String> groupIds) throws InvalidModificationException Deletes groups- Parameters:
groupDirectoryId
- The id of the group directorygroupIds
- The ids of groups to delete- Throws:
InvalidModificationException
- If modification are not possible
-
getGroup
Get group's information- Parameters:
groupDirectoryId
- The id of the group directoryid
- the group id- Returns:
- group's information
-
isModifiable
Checks if the group is modifiable- Parameters:
groupDirectoryId
- The id of the group directoryid
- The group id- Returns:
- True if the group is modifiable
-
group2Json
Get the JSON representation of a group- Parameters:
group
- The group- Returns:
- The group
-
_getCurrentUser
Provides the current user.- Returns:
- the user which cannot be
null
.
-