Class UserGroupsConfig

java.lang.Object
com.polarion.platform.spi.security.UserGroupsConfig

public class UserGroupsConfig extends Object
Object encapsulation of the user-groups.xml configuration file. This class it NOT thread safe!
Since:
3.19.3
  • Constructor Details

    • UserGroupsConfig

      public UserGroupsConfig()
      Creates an empty configuration.
    • UserGroupsConfig

      public UserGroupsConfig(@NotNull UserGroupsConfig userGroupsConfig)
      Creates a copy of an existing configuration.
    • UserGroupsConfig

      public UserGroupsConfig(@NotNull InputStream in, @Nullable ILocation loc)
      Parses the XML configuration from the input stream & closes it.
  • Method Details

    • getGroupsForUser

      @NotNull public Set<String> getGroupsForUser(@NotNull String userId)
      Returns the Group(s) containing the given User.
      Parameters:
      userId - The User's ID.
      Returns:
      set of Group IDs.
    • getUsersForGroups

      @NotNull public Map<String,Set<String>> getUsersForGroups(@NotNull Set<String> groupIds)
      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

      @NotNull public Set<String> getUsersForGroup(@NotNull String groupId)
      Returns the User(s) assigned to the given Group.
      Parameters:
      groupId - The Groups ID.
      Returns:
      unordered set of User IDs.
    • serialize

      @NotNull public Document serialize()
    • removeGroup

      public boolean removeGroup(@NotNull String groupId)
      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

      public boolean addUsersToGroup(@NotNull Collection<String> userIds, @NotNull String groupId)
      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

      public boolean removeUsersFromGroup(@NotNull Collection<String> userIds, @NotNull String groupId)
      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

      public boolean removeUser(@NotNull String userId)
      Removes the User from all Groups.
      Parameters:
      userId - ID of the User to remove.
      Returns:
      true if the User existed.
    • addGroupsToUser

      public boolean addGroupsToUser(@NotNull Collection<String> groupIds, @NotNull String userId)
      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

      public boolean removeGroupsFromUser(@NotNull Collection<String> groupIds, @NotNull String userId)
      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

      @Nullable public String getRevision()
      Returns:
      Revision number that this configuration was based upon
      Since:
      3.21.2
    • setRevision

      public void setRevision(@Nullable String revision)
      Internal use only. Sets the revision number that this configuration was based upon
      Parameters:
      revision - Revision number
      Since:
      3.21.2