Interface GroupsManagerImplApi

All Known Implementing Classes:
GroupsManagerImpl

public interface GroupsManagerImplApi
Author:
Michal Prochazka, Slavek Licehammer
See Also:
Perun
  • Method Details

    • createGroup

      Group createGroup(PerunSession perunSession, Vo vo, Group group) throws GroupExistsException
      Creates a new top-level group and associates it with the VO from parameter. For this method the new group has always same shortName like Name. Important: voId in object group is ignored This method sets ids and uuid to the given group object but returns a new group object loaded from the DB.
      Parameters:
      perunSession -
      vo - to associates group with
      group - new group with name without ":"
      Returns:
      newly created top-level group
      Throws:
      InternalErrorException - if group.name contains ':' or other internal error occured
      GroupExistsException
    • createGroup

      Group createGroup(PerunSession perunSession, Vo vo, Group parentGroup, Group group) throws GroupExistsException
      Creates a new subgroup of the existing group. (Stores group to underlaying data source)
      Parameters:
      perunSession -
      parentGroup -
      group - group.name must contain only shortName (without ":"). Hierarchy is defined by parentGroup parameter.
      Returns:
      newly created sub group with full group.Name with ":"
      Throws:
      InternalErrorException - if group.name contains ':' or other internal error occured
      GroupExistsException
    • deleteGroup

      void deleteGroup(PerunSession perunSession, Vo vo, Group group) throws GroupAlreadyRemovedException
      Deletes group. Delete it from table of parentgroups, table of groups_members and groups table.
      Parameters:
      perunSession -
      vo -
      group - group to delete
      Throws:
      InternalErrorException
      GroupAlreadyRemovedException - if there are 0 rows affected by deleting from DB
    • updateGroup

      Group updateGroup(PerunSession perunSession, Group group) throws GroupExistsException
      Updates group by ID. Update shortName and description. Return Group with correctly set parameters
      Parameters:
      perunSession -
      group - to update (use only ID, shortName and description)
      Returns:
      updated group with correctly set parameters
      Throws:
      InternalErrorException
      GroupExistsException - if group with same name already exists in the same VO
    • updateGroupName

      Group updateGroupName(PerunSession perunSession, Group group)
      Updates group by ID. !! IMPORTANT This method allows to change group name the way it doesn't correspond with the groups hierarchy !! Meant for updating subgroups after parent group name is updated !! Update name (with ":"). Return Group with correctly set parameters
      Parameters:
      perunSession -
      group - to update (use only ID and name)
      Returns:
      updated group with correctly set parameters
      Throws:
      InternalErrorException
    • updateParentGroupId

      Group updateParentGroupId(PerunSession perunSession, Group group)
      Updates parentGroupId. !! IMPORTANT This method allows to change parentGroupId, but it doesn't update group and subGroup names !!
      Parameters:
      perunSession -
      group - to update
      Returns:
      group with updated parentGroupId
      Throws:
      InternalErrorException
    • getGroupById

      Group getGroupById(PerunSession perunSession, int id) throws GroupNotExistsException
      Search for the group with specified id in all VOs.
      Parameters:
      id -
      perunSession -
      Returns:
      group with specified id or throws GroupNotExistsException
      Throws:
      GroupNotExistsException
      InternalErrorException
    • getGroupByName

      Group getGroupByName(PerunSession perunSession, Vo vo, String name) throws GroupNotExistsException
      Search for the group with specified name in specified VO IMPORTANT: need to use full name of group (ex. 'toplevel:a:b', not the shortname which is in this example 'b')
      Parameters:
      perunSession -
      vo -
      name -
      Returns:
      group with specified name or throws GroupNotExistsException in specified VO
      Throws:
      GroupNotExistsException
      InternalErrorException
    • getGroupsByIds

      List<Group> getGroupsByIds(PerunSession perunSession, List<Integer> ids)
      Gets groups by their ids. Silently skips non-existing groups.
      Parameters:
      ids -
      perunSession -
      Returns:
      list of groups with specified ids
      Throws:
      InternalErrorException
    • addMember

      Member addMember(PerunSession perunSession, Group group, Member member, MembershipType type, int sourceGroupId) throws AlreadyMemberException
      Adds member of the VO to the group in the same VO.
      Parameters:
      perunSession -
      group -
      member -
      type -
      sourceGroupId -
      Returns:
      Member with specific MembershipType
      Throws:
      InternalErrorException
      AlreadyMemberException
    • removeMember

      void removeMember(PerunSession perunSession, Group group, Member member) throws NotGroupMemberException
      Removes member form the group. The member object MUST have sourceGroupId parameter.
      Parameters:
      perunSession - perun session
      group - group
      member - member
      Throws:
      InternalErrorException
      NotGroupMemberException
    • getAssignedGroupsToResource

      List<Group> getAssignedGroupsToResource(PerunSession perunSession, Resource resource)
      Return list of assigned groups on the resource.
      Parameters:
      perunSession -
      resource -
      Returns:
      list of groups, which are assigned on the resource
      Throws:
      InternalErrorException
    • getAssignedGroupsToResource

      List<Group> getAssignedGroupsToResource(PerunSession perunSession, Resource resource, Member member)
      Return list of assigned groups on the resource with specified member.
      Parameters:
      perunSession -
      resource -
      member -
      Returns:
      list of groups, which are assigned on the resource with specified member
      Throws:
      InternalErrorException
    • getAssignedGroupsToFacility

      List<Group> getAssignedGroupsToFacility(PerunSession perunSession, Facility facility)
      Return list of assigned groups from all facility resources
      Parameters:
      perunSession -
      facility -
      Returns:
      list of groups, which are assigned on all facility resources
      Throws:
      InternalErrorException
    • getGroupUsers

      List<User> getGroupUsers(PerunSession sess, Group group)
      Return group users sorted by name.
      Parameters:
      sess -
      group -
      Returns:
      list users sorted or empty list if there are no users on specified page
      Throws:
      InternalErrorException
    • isUserMemberOfGroup

      boolean isUserMemberOfGroup(PerunSession sess, User user, Group group)
      Checks whether the user is member of the group.
      Parameters:
      sess -
      user -
      group -
      Returns:
      true if the user is member of the group
      Throws:
      InternalErrorException
    • getAllMemberGroups

      List<Group> getAllMemberGroups(PerunSession sess, Member member)
      Return all members groups. Included 'members' group.
      Parameters:
      sess -
      member -
      Returns:
      Throws:
      InternalErrorException
    • getAllGroupsWhereMemberIsActive

      List<Group> getAllGroupsWhereMemberIsActive(PerunSession sess, Member member)
      Returns all member's groups where member is in active state (is valid there) Included members group.
      Parameters:
      sess - perun session
      member - member to get groups for
      Returns:
      list of groups where member is in active state (valid)
      Throws:
      InternalErrorException
    • getGroupMembers

      List<Member> getGroupMembers(PerunSession sess, Group group, List<Status> statuses, boolean excludeStatusInsteadOfIncludeStatus)
      Return group members.
      Parameters:
      sess -
      group -
      statuses - list of statuses, if status is null then return all members
      excludeStatusInsteadOfIncludeStatus - does the list of statuses means exclude members or include members with these statuses
      Returns:
      list of members
      Throws:
      InternalErrorException
    • getGroupMembers

      List<Member> getGroupMembers(PerunSession sess, Group group)
      Get all group members ignoring theirs status.
      Parameters:
      sess -
      group -
      Returns:
      list of members
      Throws:
      InternalErrorException
    • getGroupMembersById

      List<Member> getGroupMembersById(PerunSession sess, Group group, int memberId)
      Get group members by member ID -> meaning we will get all (DIRECT/INDIRECT) group memberships for specified member (or user, since it will be the same).
      Parameters:
      sess -
      group -
      memberId -
      Returns:
      list of members
      Throws:
      InternalErrorException
    • getGroupMembersByMembership

      List<Member> getGroupMembersByMembership(PerunSession sess, Group group, MembershipType membershipType)
      Get only group members which has given membership type ignoring their status.
      Parameters:
      sess - session
      group - group
      membershipType - type of membership
      Returns:
      list of direct members
      Throws:
      InternalErrorException - internal error
    • getAllGroups

      List<Group> getAllGroups(PerunSession perunSession, Vo vo)
      Get all groups of the VO.
      Parameters:
      perunSession -
      vo -
      Returns:
      list of groups
      Throws:
      InternalErrorException
    • getParentGroup

      Group getParentGroup(PerunSession sess, Group group) throws ParentGroupNotExistsException
      Get parent group.
      Parameters:
      sess -
      group -
      Returns:
      parent group
      Throws:
      InternalErrorException
      ParentGroupNotExistsException
    • getSubGroups

      List<Group> getSubGroups(PerunSession perunSession, Group parentGroup)
      Get all immediate subgroups of the parent group under the VO.
      Parameters:
      perunSession -
      parentGroup -
      Returns:
      list of groups
      Throws:
      InternalErrorException
    • getAdmins

      List<User> getAdmins(PerunSession perunSession, Group group)
      Gets list of all administrators of this group. If some group is administrator of the given group, all members are included in the list.
      Parameters:
      perunSession -
      group -
      Returns:
      list of all administrators
      Throws:
      InternalErrorException
    • getDirectAdmins

      List<User> getDirectAdmins(PerunSession perunSession, Group group)
      Gets list of direct user administrators of this group. 'Direct' means, there aren't included users, who are members of group administrators, in the returned list.
      Parameters:
      perunSession -
      group -
      Returns:
      list of direct administrators
      Throws:
      InternalErrorException
    • getGroupAdmins

      List<Group> getGroupAdmins(PerunSession perunSession, Group group)
      Gets list of all group administrators of this group.
      Parameters:
      perunSession -
      group -
      Returns:
      list of all group administrators
      Throws:
      InternalErrorException
    • groupExists

      boolean groupExists(PerunSession perunSession, Group group)
      Check if group exists in underlaying data source.
      Parameters:
      perunSession -
      group -
      Returns:
      true if group exists in underlaying data source, false otherwise
      Throws:
      InternalErrorException
    • checkGroupExists

      void checkGroupExists(PerunSession perunSession, Group group) throws GroupNotExistsException
      Check if group exists in underlaying data source.
      Parameters:
      perunSession -
      group -
      Throws:
      InternalErrorException
      GroupNotExistsException
    • getGroups

      List<Group> getGroups(PerunSession perunSession, Vo vo)
      Get all groups of users under the VO.
      Parameters:
      perunSession -
      vo -
      Returns:
      list of groups
      Throws:
      InternalErrorException
    • getGroupsCount

      int getGroupsCount(PerunSession perunSession, Vo vo)
      Parameters:
      perunSession -
      vo -
      Returns:
      count of VO's groups
      Throws:
      InternalErrorException
    • getGroupsCount

      int getGroupsCount(PerunSession perunSession)
      Get count of all groups.
      Parameters:
      perunSession -
      Returns:
      count of all groups
      Throws:
      InternalErrorException
    • getSubGroupsCount

      int getSubGroupsCount(PerunSession perunSession, Group parentGroup)
      Returns number of immediate subgroups of the parent group.
      Parameters:
      perunSession -
      parentGroup -
      Returns:
      count of parent group immediate subgroups
      Throws:
      InternalErrorException
    • getVoId

      int getVoId(PerunSession perunSession, Group group)
      Get the id of the VO which is owner of the group.
      Parameters:
      perunSession -
      group -
      Returns:
      id of the VO
      Throws:
      InternalErrorException
    • getGroupsToSynchronize

      List<Group> getGroupsToSynchronize(PerunSession sess)
      Gets all groups which have enabled synchronization.
      Parameters:
      sess -
      Returns:
      list of groups to synchronize
      Throws:
      InternalErrorException
    • getGroupsStructuresToSynchronize

      List<Group> getGroupsStructuresToSynchronize(PerunSession sess)
      Gets all groups which have enabled group structure synchronization.
      Parameters:
      sess -
      Returns:
      list of groups structures to synchronize
      Throws:
      InternalErrorException
    • getGroupsByAttribute

      List<Group> getGroupsByAttribute(PerunSession sess, Attribute attribute)
      Returns all groups which have set the attribute with the value. Searching only def and opt attributes.
      Parameters:
      sess -
      attribute -
      Returns:
      list of groups
      Throws:
      InternalErrorException
    • getGroupResourcePairsByAttribute

      List<Pair<Group,​Resource>> getGroupResourcePairsByAttribute(PerunSession sess, Attribute attribute)
      Returns all group-resource which have set the attribute with the value. Searching only def and opt attributes.
      Parameters:
      sess -
      attribute -
      Returns:
      Throws:
      InternalErrorException
    • isGroupMember

      boolean isGroupMember(PerunSession sess, Group group, Member member)
      Return true if Member is member of the Group
      Parameters:
      sess -
      group -
      member -
      Returns:
      true if Member is member of the Group
      Throws:
      InternalErrorException
    • isDirectGroupMember

      boolean isDirectGroupMember(PerunSession sess, Group group, Member member)
      Return true if Member is direct member of the Group
      Parameters:
      sess -
      group -
      member -
      Returns:
      true if Member is direct member of the Group
      Throws:
      InternalErrorException
    • getGroupApplicationIds

      List<Integer> getGroupApplicationIds(PerunSession sess, Group group)
      Return list of IDs of all applications, which belongs to Group.
      Parameters:
      sess -
      group -
      Returns:
      list of all group applications ids
      Throws:
      InternalErrorException
    • getApplicationReservedLogins

      List<Pair<String,​String>> getApplicationReservedLogins(Integer appId)
      Return list of all reserved logins for specific application (pair is namespace and login)
      Parameters:
      appId - from which application get reserved logins
      Returns:
      list of pairs namespace and login
      Throws:
      InternalErrorException
    • deleteGroupReservedLogins

      void deleteGroupReservedLogins(PerunSession sess, Group group)
      Delete all Group login reservations Reserved logins must be removed from external systems (e.g. KDC) BEFORE calling this method via deletePassword() in UsersManager.
      Parameters:
      sess -
      group - Group to delete all login reservations for
      Throws:
      InternalErrorException
    • getGroupsWithAssignedExtSourceInVo

      List<Group> getGroupsWithAssignedExtSourceInVo(PerunSession sess, ExtSource source, Vo vo)
      Get all groups in specific vo with assigned extSource
      Parameters:
      sess -
      source -
      vo -
      Returns:
      l
      Throws:
      InternalErrorException
    • removeGroupUnion

      void removeGroupUnion(PerunSession sess, Group resultGroup, Group operandGroup) throws GroupRelationDoesNotExist
      Removes a union between two groups.
      Parameters:
      sess - perun session
      resultGroup - result group
      operandGroup - operand group
      Throws:
      InternalErrorException
      GroupRelationDoesNotExist - if the union between the two groups does not exist
    • removeResultGroupRelations

      void removeResultGroupRelations(PerunSession sess, Group resultGroup)
      Removes all relations of this result group.
      Parameters:
      sess - perun session
      resultGroup - result group
      Throws:
      InternalErrorException
    • saveGroupRelation

      void saveGroupRelation(PerunSession sess, Group resultGroup, Group operandGroup, boolean parentFlag)
      Saves union operation between result group and operand group.
      Parameters:
      sess - perun session
      resultGroup - group to which members are added
      operandGroup - group from which members are taken
      parentFlag - if true union cannot be deleted; false otherwise (it flags relations created by hierarchical structure)
      Throws:
      InternalErrorException
    • isRelationBetweenGroups

      boolean isRelationBetweenGroups(Group group1, Group group2)
      Checks if relation between groups exists. It checks both ways. Does not matter which one is result group and which one is operand group.
      Parameters:
      group1 - group
      group2 - group
      Returns:
      true if there is a relation, false otherwise
      Throws:
      InternalErrorException
    • isRelationRemovable

      boolean isRelationRemovable(PerunSession sess, Group resultGroup, Group operandGroup)
      Check if the relation between given groups can be deleted. Determined by parent flag (it flags relations created by hierarchical structure). It matters which group is resultGroup and which is operandGroup!!!
      Returns:
      true if it can be deleted; false otherwise
      Throws:
      InternalErrorException
    • isOneWayRelationBetweenGroups

      boolean isOneWayRelationBetweenGroups(Group resultGroup, Group operandGroup)
      Checks if relation exists between result group and operand group. It matters which one is result group and which one is operand group.
      Parameters:
      resultGroup - result group
      operandGroup - operand group
      Returns:
      true if there is a one-way relation, false otherwise
      Throws:
      InternalErrorException
    • getResultGroups

      List<Group> getResultGroups(PerunSession sess, int groupId)
      Return all result groups of requested operand group.
      Parameters:
      sess - perun session
      groupId - group id
      Returns:
      list of Group objects
      Throws:
      InternalErrorException
    • getOperandGroups

      List<Group> getOperandGroups(PerunSession sess, int groupId)
      Return all operand groups of requested result group.
      Parameters:
      sess - perun session
      groupId - group id
      Returns:
      list of Group objects
    • getResultGroupsIds

      List<Integer> getResultGroupsIds(PerunSession sess, int groupId)
      Return list of all result groups ids of requested operand group.
      Parameters:
      sess - perun session
      groupId - group id
      Returns:
      list of group ids
      Throws:
      InternalErrorException
    • setIndirectGroupStatus

      void setIndirectGroupStatus(PerunSession sess, Member member, Group group, MemberGroupStatus status)
      Set status of the member to specified status for indirect relations where the given group is the source group.
      Parameters:
      member - member whose status will be changed
      group - group where member's status will be changed
      status - status that will be set
      Throws:
      InternalErrorException - internal error
    • setDirectGroupStatus

      void setDirectGroupStatus(PerunSession sess, Member member, Group group, MemberGroupStatus status)
      Set direct status of the member to specified status in given group.
      Parameters:
      member - member whose status will be changed
      group - group where member's status will be changed
      status - status that will be set
      Throws:
      InternalErrorException - internal error
    • getDirectMemberGroupStatus

      MemberGroupStatus getDirectMemberGroupStatus(PerunSession session, Member member, Group group)
      Returns direct members status in given group. If there is no relation, null is returned.
      Parameters:
      session - session
      member - member
      group - group
      Returns:
      status of member in given group, if there is no relation, null is returned
      Throws:
      InternalErrorException - internal error
    • getTotalMemberGroupStatus

      MemberGroupStatus getTotalMemberGroupStatus(PerunSession session, Member member, Group group)
      Returns total member's status in given group. If there is no relation, null is returned.
      Parameters:
      session - session
      member - member
      group - group
      Returns:
      total status of member in given group, if there is no relation, null is returned
      Throws:
      InternalErrorException - internal error
    • getTotalGroupStatusForMembers

      Map<Integer,​MemberGroupStatus> getTotalGroupStatusForMembers(PerunSession session, Group group, List<Member> members)
      Returns total member's status of given members in given group.
      Parameters:
      session - session
      group - group
      members - members
      Returns:
      total status of members in given group
    • getFacilitiesWhereGroupIsAdmin

      List<Facility> getFacilitiesWhereGroupIsAdmin(PerunSession session, Group group)
      Returns all facilities where given group si FACILITYADMIN.
      Parameters:
      session - session
      group - group
      Returns:
      list of all facilities where given group si FACILITYADMIN
      Throws:
      InternalErrorException
    • getGroupsWhereGroupIsAdmin

      List<Group> getGroupsWhereGroupIsAdmin(PerunSession session, Group group)
      Returns all groups where given group si GROUPADMIN.
      Parameters:
      session - session
      group - group
      Returns:
      list of all groups where given group is GROUPADMIN
      Throws:
      InternalErrorException
    • getResourcesWhereGroupIsAdmin

      List<Resource> getResourcesWhereGroupIsAdmin(PerunSession session, Group group)
      Returns all resources where given group si RESOURCEADMIN.
      Parameters:
      session - session
      group - group
      Returns:
      list of all resources where given group is RESOURCEADMIN
      Throws:
      InternalErrorException
    • getResourcesWhereGroupIsResourceSelfService

      List<Resource> getResourcesWhereGroupIsResourceSelfService(PerunSession session, Group group)
      Returns all resources where given group si RESOURCESELFSERVICE.
      Parameters:
      session - session
      group - group
      Returns:
      list of all resources where given group is RESOURCESELFSERVICE
      Throws:
      InternalErrorException
    • getSecurityTeamsWhereGroupIsAdmin

      List<SecurityTeam> getSecurityTeamsWhereGroupIsAdmin(PerunSession session, Group group)
      Returns all security teams where given group si SECURITYADMIN.
      Parameters:
      session - session
      group - group
      Returns:
      list of all security teams where given group is SECURITYADMIN
      Throws:
      InternalErrorException
    • getVosWhereGroupIsAdmin

      List<Vo> getVosWhereGroupIsAdmin(PerunSession session, Group group)
      Returns all vos where given group si VOADMIN.
      Parameters:
      session - session
      group - group
      Returns:
      list of all vos where given group is VOADMIN
      Throws:
      InternalErrorException
    • getGroupsForAutoRegistration

      List<Group> getGroupsForAutoRegistration(PerunSession sess, Vo vo)
      Returns all groups which can be registered into during vo registration.
      Parameters:
      sess - session
      vo - vo
      Returns:
      list of groups
    • deleteGroupFromAutoRegistration

      void deleteGroupFromAutoRegistration(PerunSession sess, Group group)
      Deletes group from list of groups which can be registered into during vo registration.
      Parameters:
      sess - session
      group - group to delete
    • addGroupToAutoRegistration

      void addGroupToAutoRegistration(PerunSession sess, Group group)
      Adds group to the list of groups which can be registered into during vo registration.
      Parameters:
      sess - session
      group - group to add
    • isGroupForAutoRegistration

      boolean isGroupForAutoRegistration(PerunSession sess, Group group)
      Check if group has automatic registration enabled.
      Parameters:
      sess - session
      group - group to check