Interface GroupDataWebService

  • All Known Implementing Classes:
    GroupDataWebServiceImpl

    public interface GroupDataWebService
    GroupDataWebService provides a web service interface to manage groups as well as related objects such as Users. Groups are stored in an hierarchical relationship. A user belongs to one or more groups.
    Groups are often modeled after an organizations structure.
    Version:
    2.0
    Author:
    Suneet Shah
    • Method Detail

      • saveGroup

        Response saveGroup​(Group group)
        This method creates a new group or update existed one. For example:

        Group grp = new Group(); grp.setGrpId(groupId); grp.setGrpName("Test Group");

        grpManager.addGroup(grpValue);

        Parameters:
        group - - the Group object, which should be created or updated
        Returns:
        - a Response Object. If operation succeed then Response object contains the primary key of saved group otherwise it contains error code.
      • getGroup

        Group getGroup​(String groupId)
        This method retrieves an existing group object. Dependent objects such as users are not retrieved. Null is returned if the groupId is not found.
        Parameters:
        groupId - - the Group ID
        Returns:
        - a Group Object if it is found, otherwise null will be returned.
      • suggestById

        Group suggestById​(String id)
        Find a group in Elasticsearch. Significantly faster than going to the database. Use this method when performance is important and/or data integrity is not 100% required, as the database and ES may be out of sync for a period of time
        Parameters:
        id - the role id
        Returns:
        group
      • deleteGroup

        Response deleteGroup​(String groupId)
        This method removes group from openIAM database for a particular groupId.
        Parameters:
        groupId - The id to be removed.
        Returns:
        - a Response Object which contains operation status.
      • findBeans

        GroupListResponse findBeans​(GroupSearchBean searchBean,
                                    EntitlementsCollection[] dependants,
                                    int from,
                                    int size)
        Return a paged List of Groups based on parameters, which are specified in GroupSearchBean object
        Parameters:
        searchBean - - GroupSearchBean object
        dependants - - collection instead of deep copy flag for AccessRights processor
        from - - where to start in the list
        size - - how many to return
        Returns:
        List of Group objects. Returns null if no groups are found.
      • findGroupsForOwner

        List<Group> findGroupsForOwner​(GroupSearchBean searchBean,
                                       String ownerId,
                                       int from,
                                       int size)
        Return a paged List of Groups for given groupOwner based on parameters, which are specified in GroupSearchBean object
        Parameters:
        searchBean - - GroupSearchBean object
        ownerId - - the User ID who is the owner for the searching groups
        from - - where to start in the list
        size - - how many to return
        Returns:
        List of Group objects. Returns null if no groups are found.
      • countBeans

        int countBeans​(GroupSearchBean searchBean)
        Returns total number of Groups based on parameters, which are specified in GroupSearchBean object
        Parameters:
        searchBean - - GroupSearchBean object
        Returns:
        - Integer, total number of groups based on parameters, which are specified in GroupSearchBean object
      • countGroupsForOwner

        int countGroupsForOwner​(GroupSearchBean searchBean,
                                String ownerId)
        Returns total number of Groups for given groupOwner based on parameters, which are specified in GroupSearchBean object
        Parameters:
        searchBean - - GroupSearchBean object
        ownerId - - the User ID who is the owner for the searching groups
        Returns:
        - Integer, total number of groups based on parameters, which are specified in GroupSearchBean object
      • addChildGroup

        Response addChildGroup​(String groupId,
                               String childGroupId,
                               Set<String> rights,
                               Date startDate,
                               Date endDate)
        Makes Group specified by childGroupId a child of Group specified by groupId
        Parameters:
        groupId - - the Group ID to which another group specified by childGroupId will be added
        childGroupId - - the Group ID which will be added to the group specified by groupId
        Returns:
        a Response Object, containing the status of this operation.
      • removeChildGroup

        Response removeChildGroup​(String groupId,
                                  String childGroupId)
        Remove Group specified by childGroupId from the membership list of Group specified by groupId
        Parameters:
        groupId - - the Group ID from which another group specified by childGroupId will be deleted
        childGroupId - - the Group ID which will be deleted from the group specified by groupId
        Returns:
        a Response Object, containing the status of this operation.
      • canAddUserToGroup

        Response canAddUserToGroup​(String userId,
                                   String groupId)
        Checks if User specified by userId can be added to the Group specified by groupId as a member
        Parameters:
        userId - - the User ID
        groupId - - the Group ID
        Returns:
        a Response Object, containing the status of this operation. if status is SUCCESS then the User can be added to this Croup
      • canRemoveUserFromGroup

        Response canRemoveUserFromGroup​(String userId,
                                        String groupId)
        Checks if User specified by userId can be removed from the Group specified by groupId as a member
        Parameters:
        userId - - the User ID
        groupId - - the Group ID
        Returns:
        a Response Object, containing the status of this operation. if status is SUCCESS then the User can be removed from this Group
      • hasAttachedEntities

        boolean hasAttachedEntities​(String groupId)
        Does this group have any children?
        Parameters:
        groupId -
        Returns:
      • getAllGroupIds

        List<String> getAllGroupIds()
        Method to get all Group IDs This method should not be called at run-time. It is here only for testing purpose.

        At the time of writing, this method is called by the ui-test/stress-test module.

        Returns:
      • reindexGroup

        Response reindexGroup​(String id)
        Parameters:
        id - - Group id for reindex
        Returns:
      • getDetachedForUser

        GroupListResponse getDetachedForUser​(String userId,
                                             String name,
                                             int from,
                                             int size)
        method is used to detect all user's groups that are not linked with any resources.
        Parameters:
        userId - - id of User to check detached groups
        name - - name for case INSENSITIVE CONTAINS match search.
        from - - zero based very first result
        Returns:
        - GroupListResponse
      • getWithResources

        GroupListResponse getWithResources​(String userId,
                                           GroupSearchBean searchBean,
                                           Set<String> resourceTypeIds,
                                           int from,
                                           int size)
        method is used to get user's groups with entitled resources, filtered by #resourceTypeIds. Resources are returned in Group#getResources() container (only ids).
        Parameters:
        userId - - user id
        searchBean - - searchBean for objects
        resourceTypeIds - - types of resources to fetch
        from - - zero based very first result
        size - - total size of page.
        Returns:
        GroupListResponse with requested objects
      • getPossibleAttributeNames

        List<String> getPossibleAttributeNames()
      • saveBulkGroup

        Response saveBulkGroup​(EntitlementBulkRequest entitlementBulkRequest)
        Bulk operation on Group objects, this method with save groups in bulk
        Parameters:
        entitlementBulkRequest - - EntitlementBulkRequest object that will be processed.
      • forceSweepUserCountCache

        void forceSweepUserCountCache()
        force refresh cache which holds count of users assigned to groups and max number limit