public class GroupDAO extends AbstractLogEnabled implements Serviceable, Component
Group
Modifier and Type | Field and Description |
---|---|
protected CurrentUserProvider |
_currentUserProvider
The current user provider.
|
protected GroupDirectoryDAO |
_groupDirectoryDAO
The DAO for group directories
|
protected GroupManager |
_groupManager
The group manager
|
protected ServiceManager |
_smanager
The service manager
|
protected UserHelper |
_userHelper
The user helper
|
Constructor and Description |
---|
GroupDAO() |
Modifier and Type | Method and Description |
---|---|
protected UserIdentity |
_getCurrentUser()
Provides the current user.
|
private Map<String,Object> |
_updateUsersGroup(String groupDirectoryId,
String groupId,
List<Map<String,String>> users,
boolean remove) |
Map<String,Object> |
addGroup(String groupDirectoryId,
String name)
Creates a new group
|
Map<String,Object> |
addUsersGroup(String groupDirectoryId,
String groupId,
List<Map<String,String>> users)
Add users to group
|
void |
deleteGroups(String groupDirectoryId,
List<String> groupIds)
Deletes groups
|
Map<String,Object> |
getGroup(String groupDirectoryId,
String id)
Get group's information
|
List<Map<String,Object>> |
getUsersGroup(Map<String,String> user)
Get the list of groups of a user
|
protected Map<String,Object> |
group2Json(Group group)
Get the JSON representation of a group
|
boolean |
isModifiable(String groupDirectoryId,
String id)
Checks if the group is modifiable
|
Map<String,Object> |
removeUsersGroup(String groupDirectoryId,
String groupId,
List<Map<String,String>> users)
Remove users from group
|
Map<String,Object> |
renameGroup(String groupDirectoryId,
String groupId,
String name)
Renames a group
|
void |
service(ServiceManager smanager) |
Map<String,Object> |
setUsersGroup(String groupDirectoryId,
String groupId,
List<Map<String,String>> users)
Set the users' group
|
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
protected ServiceManager _smanager
protected CurrentUserProvider _currentUserProvider
protected GroupManager _groupManager
protected GroupDirectoryDAO _groupDirectoryDAO
protected UserHelper _userHelper
public GroupDAO()
public void service(ServiceManager smanager) throws ServiceException
service
in interface Serviceable
ServiceException
public Map<String,Object> addGroup(String groupDirectoryId, String name) throws InvalidModificationException
groupDirectoryId
- The id of the group directoryname
- The group's nameInvalidModificationException
- If modification are not possiblepublic Map<String,Object> setUsersGroup(String groupDirectoryId, String groupId, List<Map<String,String>> users) throws InvalidModificationException
groupDirectoryId
- The id of the group directorygroupId
- The group's idusers
- The group's usersInvalidModificationException
- If modification are not possiblepublic Map<String,Object> addUsersGroup(String groupDirectoryId, String groupId, List<Map<String,String>> users) throws InvalidModificationException
groupDirectoryId
- The id of the group directorygroupId
- The group's idusers
- The users to addInvalidModificationException
- If modification are not possiblepublic Map<String,Object> removeUsersGroup(String groupDirectoryId, String groupId, List<Map<String,String>> users) throws InvalidModificationException
groupDirectoryId
- The id of the group directorygroupId
- The group's idusers
- The users to addInvalidModificationException
- If modification are not possibleprivate Map<String,Object> _updateUsersGroup(String groupDirectoryId, String groupId, List<Map<String,String>> users, boolean remove) throws InvalidModificationException
InvalidModificationException
public List<Map<String,Object>> getUsersGroup(Map<String,String> user)
user
- The user (using the format of UserHelper.json2userIdentity(Map)
public Map<String,Object> renameGroup(String groupDirectoryId, String groupId, String name) throws InvalidModificationException
groupDirectoryId
- The id of the group directorygroupId
- The group'sidname
- The new nameInvalidModificationException
- If modification are not possiblepublic void deleteGroups(String groupDirectoryId, List<String> groupIds) throws InvalidModificationException
groupDirectoryId
- The id of the group directorygroupIds
- The ids of groups to deleteInvalidModificationException
- If modification are not possiblepublic Map<String,Object> getGroup(String groupDirectoryId, String id)
groupDirectoryId
- The id of the group directoryid
- the group idpublic boolean isModifiable(String groupDirectoryId, String id)
groupDirectoryId
- The id of the group directoryid
- The group idprotected Map<String,Object> group2Json(Group group)
group
- The groupprotected UserIdentity _getCurrentUser()
null
.