Class UserGroupsConfig
java.lang.Object
com.polarion.platform.spi.security.UserGroupsConfig
Object encapsulation of the user-groups.xml configuration file.
This class it NOT thread safe!
- Since:
- 3.19.3
-
Constructor Summary
ConstructorDescriptionCreates an empty configuration.UserGroupsConfig
(UserGroupsConfig userGroupsConfig) Creates a copy of an existing configuration.UserGroupsConfig
(InputStream in, ILocation loc) Parses the XML configuration from the input stream & closes it. -
Method Summary
Modifier and TypeMethodDescriptionboolean
addGroupsToUser
(Collection<String> groupIds, String userId) Adds Groups to the given User.boolean
addUsersToGroup
(Collection<String> userIds, String groupId) Adds Users to the given Group.getGroupsForUser
(String userId) Returns the Group(s) containing the given User.getUsersForGroup
(String groupId) Returns the User(s) assigned to the given Group.getUsersForGroups
(Set<String> groupIds) Finds the User(s) assigned to at least one of the given Groups.boolean
removeGroup
(String groupId) Removes the Group from all Users that are contained in the Group.boolean
removeGroupsFromUser
(Collection<String> groupIds, String userId) Removes Groups from the given User.boolean
removeUser
(String userId) Removes the User from all Groups.boolean
removeUsersFromGroup
(Collection<String> userIds, String groupId) Removes Users from the given Group.void
setRevision
(String revision) Internal use only.
-
Constructor Details
-
UserGroupsConfig
public UserGroupsConfig()Creates an empty configuration. -
UserGroupsConfig
Creates a copy of an existing configuration. -
UserGroupsConfig
Parses the XML configuration from the input stream & closes it.
-
-
Method Details
-
getGroupsForUser
Returns the Group(s) containing the given User.- Parameters:
userId
- The User's ID.- Returns:
- set of Group IDs.
-
getUsersForGroups
Finds the User(s) assigned to at least one of the given Groups.- Parameters:
groupIds
- The IDs of the Groups whose Users are processed in this method.
-
getUsersForGroup
Returns the User(s) assigned to the given Group.- Parameters:
groupId
- The Groups ID.- Returns:
- unordered set of User IDs.
-
serialize
-
removeGroup
Removes the Group from all Users that are contained in the Group.- Parameters:
groupId
- ID of the Group to remove.- Returns:
true
if the Group existed in the mapping.
-
addUsersToGroup
Adds Users to the given Group.- Parameters:
userIds
- IDs of the Users to add.groupId
- ID of the target Group.- Returns:
true
if at least one mapping was added.
-
removeUsersFromGroup
Removes Users from the given Group.- Parameters:
userIds
- IDs of the Users to remove.groupId
- ID of the target Group.- Returns:
true
if at least one mapping was removed.
-
removeUser
Removes the User from all Groups.- Parameters:
userId
- ID of the User to remove.- Returns:
true
if the User existed.
-
addGroupsToUser
Adds Groups to the given User.- Parameters:
groupIds
- IDs of the Groups to add.userId
- ID of the target User.- Returns:
true
if at least one mapping was added.- Since:
- 3.21.2
-
removeGroupsFromUser
Removes Groups from the given User.- Parameters:
groupIds
- IDs of the Groups to remove.userId
- ID of the target User.- Returns:
true
if at least one mapping was removed.- Since:
- 3.21.2
-
getRevision
- Returns:
- Revision number that this configuration was based upon
- Since:
- 3.21.2
-
setRevision
Internal use only. Sets the revision number that this configuration was based upon- Parameters:
revision
- Revision number- Since:
- 3.21.2
-