Class GroupRolesConfig

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

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

    • GroupRolesConfig

      public GroupRolesConfig()
      Creates an empty configuration.
    • GroupRolesConfig

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

    • getGroupRoles

      @NotNull public Set<String> getGroupRoles(@NotNull String groupId)
      Returns the Role(s) assigned to the given Group by the currently loaded group-roles.xml file.
      Parameters:
      groupId - The Group's ID.
      Returns:
      set of Role IDs.
    • getGroupsForRole

      @NotNull public Set<String> getGroupsForRole(@NotNull String roleId)
      Returns The Group(s) with the Role that's assigned by the currently loaded group-roles.xml file.
      Parameters:
      roleId - The Role's ID.
      Returns:
      set of Group IDs.
    • removeGroup

      public boolean removeGroup(@NotNull String groupId)
      Removes User Group from the current configuration.
      Parameters:
      groupId -
      Returns:
      true if the User Group existed.
    • serialize

      @NotNull public Document serialize()
    • addRolesToGroup

      public boolean addRolesToGroup(@NotNull Collection<String> roleIds, @NotNull String groupId)
      Adds Role(s) to the given Group.
      Parameters:
      roleIds - IDs of the Roles to add.
      groupId - ID of the target Group.
      Returns:
      true if at least one mapping was added.
    • removeRolesFromGroup

      public boolean removeRolesFromGroup(@NotNull Collection<String> roleIds, @NotNull String groupId)
      Removes Role(s) from the given Group.
      Parameters:
      roleIds - IDs of the Roles to remove.
      groupId - ID of the target Group.
      Returns:
      true if at least one mapping was removed.
    • removeRoleFromGroups

      public boolean removeRoleFromGroups(@NotNull String roleId)
      Removes the Role from all Groups.
      Parameters:
      roleId - ID of the Role to remove.
      Returns:
      true if the Role existed in the mapping.