Interface GradebookPermissionService


  • public interface GradebookPermissionService
    • Method Detail

      • getCategoriesForUser

        List<Long> getCategoriesForUser​(Long gradebookId,
                                        String userId,
                                        List<Long> categoryIdList)
                                 throws IllegalArgumentException
        Get all available categories for a user that the user can either view or grade. (For overview page)
        Parameters:
        gradebookId - Gradebook ID
        userId - grader ID
        categoryList - List of Category. (should be all categories for this gradebook)
        Returns:
        List of categories
        Throws:
        IllegalArgumentException
      • getPermissionForUserForAllAssignment

        boolean getPermissionForUserForAllAssignment​(Long gradebookId,
                                                     String userId)
                                              throws IllegalArgumentException
        Get true/false value for current user which indicats if he has permission for all assignments in a gradebook with category turned off or he has permission for assignments without category associated with in a gradebook with category turned on. (For overview page)
        Parameters:
        gradebookId - Gradebook ID
        userId - grader ID
        Returns:
        boolean of true/false
        Throws:
        IllegalArgumentException
      • getPermissionForUserForAllAssignmentForStudent

        boolean getPermissionForUserForAllAssignmentForStudent​(Long gradebookId,
                                                               String userId,
                                                               String studentId,
                                                               List sectionIds)
                                                        throws IllegalArgumentException
        Get true/false value for current user which indicates if he has permission for all gb items for a given student
        Parameters:
        gradebookId -
        userId -
        studentId -
        sectionIds -
        Returns:
        Throws:
        IllegalArgumentException
      • getStudentsForItem

        Map<String,​String> getStudentsForItem​(Long gradebookId,
                                                    String userId,
                                                    List<String> studentIds,
                                                    int cateType,
                                                    Long categoryId,
                                                    List courseSections)
                                             throws IllegalArgumentException
        Get students IDs that the current grader can either view or grade. When categoryId is null and cateType is with category - return students' map that the grader can grade/view any category for course sections. (this is mostly for items that have no category associated with them in a gradebook with category turned on) (For item detail page)
        Parameters:
        gradebookId - Gradebook ID
        userId - grader ID
        studentIds - List of student IDs
        cateType - gradebook category type
        categoryId - current category ID that the permission check is based on. it can be null.
        courseSections - List of course sections for current site
        Returns:
        Map of student IDs with grade/view as function value
        Throws:
        IllegalArgumentException
      • getStudentsForItem

        Map<String,​String> getStudentsForItem​(String gradebookUid,
                                                    String userId,
                                                    List<String> studentIds,
                                                    int cateType,
                                                    Long categoryId,
                                                    List courseSections)
                                             throws IllegalArgumentException
        Get students IDs that the current grader can either view or grade. When categoryId is null and cateType is with category - return students' map that the grader can grade/view any category for course sections. (this is mostly for items that have no category associated with them in a gradebook with category turned on) (For item detail page)
        Parameters:
        gradebookUid - gradebook uid
        userId - grader ID
        studentIds - List of student IDs
        cateType - gradebook category type
        categoryId - current category ID that the permission check is based on. it can be null.
        courseSections - List of course sections for current site
        Returns:
        Map of student IDs with grade/view as function value
        Throws:
        IllegalArgumentException
      • getAvailableItemsForStudent

        Map getAvailableItemsForStudent​(String gradebookUid,
                                        String userId,
                                        String studentId,
                                        Collection courseSections)
                                 throws IllegalArgumentException
        Get a map of itemId/permission(grade/view) of a student for a grader that he can grade or view for gradebook. (For a student's roster page)
        Parameters:
        gradebookUid - Gradebook UID
        userId - grader ID
        studentId - student ID
        courseSections - List of course sections for current site
        Returns:
        Map of item IDs with grade/view as function value
        Throws:
        IllegalArgumentException
      • getAvailableItemsForStudent

        Map getAvailableItemsForStudent​(Long gradebookId,
                                        String userId,
                                        String studentId,
                                        Collection courseSections)
                                 throws IllegalArgumentException
        Get a map of itemId/permission(grade/view) of a student for a grader that he can grade or view for gradebook. (For a student's roster page)
        Parameters:
        gradebookId - Gradebook ID
        userId - grader ID
        studentId - student ID
        courseSections - List of course sections for current site
        Returns:
        Map of item IDs with grade/view as function value
        Throws:
        IllegalArgumentException
      • getAvailableItemsForStudents

        Map getAvailableItemsForStudents​(Long gradebookId,
                                         String userId,
                                         List studentIds,
                                         Collection courseSections)
                                  throws IllegalArgumentException
        Get a map of map for students whose IDs are in studentIds with id as key and another map as value: itemId/permission(grade/view) for a grader that he can grade or view for gradebook. (For a student's roster page)
        Parameters:
        gradebookId - Gradebook ID
        userId - grader ID
        studentIds - List of student IDs
        courseSections - List of course sections for current site
        Returns:
        Map
        Throws:
        IllegalArgumentException
      • getAvailableItemsForStudents

        Map getAvailableItemsForStudents​(String gradebookUid,
                                         String userId,
                                         List studentIds,
                                         Collection courseSections)
                                  throws IllegalArgumentException
        Get a map of map for students whose IDs are in studentIds with id as key and another map as value: itemId/permission(grade/view) for a grader that he can grade or view for gradebook. (For a student's roster page)
        Parameters:
        gradebookUid - Gradebook UID
        userId - grader ID
        studentIds - List of student IDs
        courseSections - List of course sections for current site
        Returns:
        Map
        Throws:
        IllegalArgumentException
      • getCourseGradePermission

        Map getCourseGradePermission​(Long gradebookId,
                                     String userId,
                                     List studentIds,
                                     List courseSections)
                              throws IllegalArgumentException
        Get a map with student IDs as key and view/grade as value for their course grade. (For course grade page)
        Parameters:
        gradebookId - Gradebook ID
        userId - grader ID
        studentIds - List of student IDs
        courseSections - List of course sections for current site (Should be all course sections the current site has.)
        Returns:
        Map of student IDs with view/grade as function value
        Throws:
        IllegalArgumentException
      • getCourseGradePermission

        Map getCourseGradePermission​(String gradebookUid,
                                     String userId,
                                     List studentIds,
                                     List courseSections)
                              throws IllegalArgumentException
        Get a map with student IDs as key and view/grade as value for their course grade. (For course grade page)
        Parameters:
        gradebookUid - Gradebook Uid
        userId - grader ID
        studentIds - List of student IDs
        courseSections - List of course sections for current site (Should be all course sections the current site has.)
        Returns:
        Map of student IDs with view/grade as function value
        Throws:
        IllegalArgumentException
      • getGraderPermissionsForUser

        List getGraderPermissionsForUser​(Long gradebookId,
                                         String userId)
        Get all Permission records associated with this user and gradebook
        Parameters:
        gradebookId -
        userId -
        Returns:
        List of Permission records for user and gradebook
      • getGraderPermissionsForUser

        List getGraderPermissionsForUser​(String gradebookUid,
                                         String userId)
        Get all Permission records associated with this user and gradebook
        Parameters:
        gradebookUid -
        userId -
        Returns:
        List of Permission records for user and gradebook
      • getViewableGroupsForUser

        List<String> getViewableGroupsForUser​(Long gradebookId,
                                              String userId,
                                              List<String> groupIds)
        Get all group ids associated with groups that contain at least one member that the user is authorized to view/grade
        Parameters:
        gradebookId -
        userId -
        groupIds -
        Returns:
        List of group ids that user has some authorization to view
      • getViewableGroupsForUser

        List<String> getViewableGroupsForUser​(String gradebookUid,
                                              String userId,
                                              List<String> groupIds)
        Get all group ids associated with groups that contain at least one member that the user is authorized to view/grade
        Parameters:
        gradebookUid -
        userId -
        groupIds -
        Returns:
        List of group ids that user has some authorization to view
      • getViewableStudentsForUser

        List getViewableStudentsForUser​(Long gradebookId,
                                        String userId,
                                        List studentIds,
                                        List sections)
        Get a unique list of students that the current user has grader permissions to view in some capacity
        Parameters:
        gradebookId -
        userId -
        studentIds -
        sections -
        Returns:
        List of student ids
      • getViewableStudentsForUser

        List getViewableStudentsForUser​(String gradebookUid,
                                        String userId,
                                        List studentIds,
                                        List sections)
        Get a unique list of students that the current user has grader permissions to view in some capacity
        Parameters:
        gradebookUid -
        userId -
        studentIds -
        sections -
        Returns:
        List of student ids
      • getPermissionsForUser

        List<PermissionDefinition> getPermissionsForUser​(String gradebookUid,
                                                         String userId)
        Get the grader specific permissions for the given user
        Parameters:
        gradebookUid -
        userId -
        Returns:
      • updatePermissionsForUser

        void updatePermissionsForUser​(String gradebookUid,
                                      String userId,
                                      List<PermissionDefinition> permissionDefinitions)
        Update the set of grader specific permissions for the given user
        Parameters:
        gradebookUid -
        userId -
        permissionDefinitions -
      • clearPermissionsForUser

        void clearPermissionsForUser​(String gradebookUid,
                                     String userId)
        Remove all grader specific permissions for the given user
        Parameters:
        gradebookUid -
        userId -
      • getRealmsPermissionsForUser

        List<PermissionDefinition> getRealmsPermissionsForUser​(String userUuid,
                                                               String siteId,
                                                               Role role)
        Get a list of permissions defined for the given user based on section and role or all sections if allowed. This method checks realms permissions for role/section and is independent of the gb_permissions_t permissions. note: If user has the grade privilege, they are given the GraderPermission.VIEW_COURSE_GRADE permission to match GB classic functionality. This needs to be reviewed.
        Parameters:
        userUuid -
        siteId -
        Returns:
        list of PermissionDefinitions or empty list if none