org.sakaiproject.tool.gradebook.facades.sections
Class AuthzSectionsImpl

java.lang.Object
  extended by org.sakaiproject.tool.gradebook.facades.sections.AuthzSectionsImpl
All Implemented Interfaces:
Authz
Direct Known Subclasses:
AuthzSakai2Impl

public class AuthzSectionsImpl
extends Object
implements Authz

An implementation of Gradebook-specific authorization needs based on the shared Section Awareness API.


Constructor Summary
AuthzSectionsImpl()
           
 
Method Summary
 Map findMatchingEnrollmentsForItem(String gradebookUid, Long categoryId, int gbCategoryType, String optionalSearchString, String optionalSectionUid)
           
 Map findMatchingEnrollmentsForItemForUser(String userUid, String gradebookUid, Long categoryId, int gbCategoryType, String optionalSearchString, String optionalSectionUid)
           
 Map findMatchingEnrollmentsForViewableCourseGrade(String gradebookUid, int gbCategoryType, String optionalSearchString, String optionalSectionUid)
           
 Map findMatchingEnrollmentsForViewableItems(String gradebookUid, List allGbItems, String optionalSearchString, String optionalSectionUid)
           
 List findStudentSectionMemberships(String gradebookUid, String studentUid)
           
 List getAllSections(String gradebookUid)
           
 Authn getAuthn()
           
 GradebookPermissionService getGradebookPermissionService()
           
 String getGradeViewFunctionForUserForStudentForItem(String gradebookUid, Long itemId, String studentUid)
          Check to see if current user may grade or view the given student for the given item in the given gradebook.
 SectionAwareness getSectionAwareness()
           
 List getStudentSectionMembershipNames(String gradebookUid, String studentUid)
           
 List getViewableSections(String gradebookUid)
           
 boolean isUserAbleToEditAssessments(String gradebookUid)
           
 boolean isUserAbleToGrade(String gradebookUid)
           
 boolean isUserAbleToGrade(String gradebookUid, String userUid)
           
 boolean isUserAbleToGradeAll(String gradebookUid)
           
 boolean isUserAbleToGradeAll(String gradebookUid, String userUid)
           
 boolean isUserAbleToGradeItemForStudent(String gradebookUid, Long itemId, String studentUid)
           
 boolean isUserAbleToViewItemForStudent(String gradebookUid, Long itemId, String studentUid)
           
 boolean isUserAbleToViewOwnGrades(String gradebookUid)
           
 boolean isUserHasGraderPermissions(Long gradebookId)
           
 boolean isUserHasGraderPermissions(Long gradebookId, String userUid)
           
 boolean isUserHasGraderPermissions(String gradebookUid)
           
 boolean isUserHasGraderPermissions(String gradebookUid, String userUid)
           
 void setAuthn(Authn authn)
           
 void setGradebookPermissionService(GradebookPermissionService gradebookPermissionService)
           
 void setSectionAwareness(SectionAwareness sectionAwareness)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AuthzSectionsImpl

public AuthzSectionsImpl()
Method Detail

isUserAbleToGrade

public boolean isUserAbleToGrade(String gradebookUid)
Specified by:
isUserAbleToGrade in interface Authz

isUserAbleToGrade

public boolean isUserAbleToGrade(String gradebookUid,
                                 String userUid)
Specified by:
isUserAbleToGrade in interface Authz

isUserAbleToGradeAll

public boolean isUserAbleToGradeAll(String gradebookUid)
Specified by:
isUserAbleToGradeAll in interface Authz

isUserAbleToGradeAll

public boolean isUserAbleToGradeAll(String gradebookUid,
                                    String userUid)
Specified by:
isUserAbleToGradeAll in interface Authz

isUserHasGraderPermissions

public boolean isUserHasGraderPermissions(String gradebookUid)
Specified by:
isUserHasGraderPermissions in interface Authz

isUserHasGraderPermissions

public boolean isUserHasGraderPermissions(Long gradebookId)
Specified by:
isUserHasGraderPermissions in interface Authz

isUserHasGraderPermissions

public boolean isUserHasGraderPermissions(String gradebookUid,
                                          String userUid)
Specified by:
isUserHasGraderPermissions in interface Authz

isUserHasGraderPermissions

public boolean isUserHasGraderPermissions(Long gradebookId,
                                          String userUid)
Specified by:
isUserHasGraderPermissions in interface Authz

isUserAbleToEditAssessments

public boolean isUserAbleToEditAssessments(String gradebookUid)
Specified by:
isUserAbleToEditAssessments in interface Authz

isUserAbleToViewOwnGrades

public boolean isUserAbleToViewOwnGrades(String gradebookUid)
Specified by:
isUserAbleToViewOwnGrades in interface Authz

getGradeViewFunctionForUserForStudentForItem

public String getGradeViewFunctionForUserForStudentForItem(String gradebookUid,
                                                           Long itemId,
                                                           String studentUid)
Description copied from interface: Authz
Check to see if current user may grade or view the given student for the given item in the given gradebook. Returns string representation of function per GradebookService vars (view/grade) or null if no permission

Specified by:
getGradeViewFunctionForUserForStudentForItem in interface Authz
Returns:
GradebookService.gradePermission, GradebookService.viewPermission, or null if no permission

isUserAbleToGradeItemForStudent

public boolean isUserAbleToGradeItemForStudent(String gradebookUid,
                                               Long itemId,
                                               String studentUid)
                                        throws IllegalArgumentException
Specified by:
isUserAbleToGradeItemForStudent in interface Authz
Returns:
is user authorized to grade this gradebook item for this student? first checks for special grader perms. if none, uses default perms
Throws:
IllegalArgumentException

isUserAbleToViewItemForStudent

public boolean isUserAbleToViewItemForStudent(String gradebookUid,
                                              Long itemId,
                                              String studentUid)
                                       throws IllegalArgumentException
Specified by:
isUserAbleToViewItemForStudent in interface Authz
Returns:
is user authorized to view this gradebook item for this student? first checks for special grader perms. if none, uses default perms
Throws:
IllegalArgumentException

getViewableSections

public List getViewableSections(String gradebookUid)
Specified by:
getViewableSections in interface Authz
Returns:
all CourseSections that the current user may view or grade

getAllSections

public List getAllSections(String gradebookUid)
Specified by:
getAllSections in interface Authz
Returns:
all of the CourseSections for this site

findMatchingEnrollmentsForItem

public Map findMatchingEnrollmentsForItem(String gradebookUid,
                                          Long categoryId,
                                          int gbCategoryType,
                                          String optionalSearchString,
                                          String optionalSectionUid)
Specified by:
findMatchingEnrollmentsForItem in interface Authz
categoryId - The category id that the desired item is associated with
gbCategoryType - The category type setting for this gradebook
optionalSearchString - a substring search for student name or display UID; the exact rules are up to the implementation - leave null to use all students
optionalSectionUid - null if the search should be made across all sections
Returns:
a map of EnrollmentRecords to grade/view permission that the current user is authorized to view or grade for the given gradebook item

findMatchingEnrollmentsForItemForUser

public Map findMatchingEnrollmentsForItemForUser(String userUid,
                                                 String gradebookUid,
                                                 Long categoryId,
                                                 int gbCategoryType,
                                                 String optionalSearchString,
                                                 String optionalSectionUid)
Specified by:
findMatchingEnrollmentsForItemForUser in interface Authz
categoryId - The category id that the desired item is associated with
gbCategoryType - The category type setting for this gradebook
optionalSearchString - a substring search for student name or display UID; the exact rules are up to the implementation - leave null to use all students
optionalSectionUid - null if the search should be made across all sections
Returns:
a map of EnrollmentRecords to grade/view permission that the given user is authorized to view or grade for the given gradebook item

findMatchingEnrollmentsForViewableCourseGrade

public Map findMatchingEnrollmentsForViewableCourseGrade(String gradebookUid,
                                                         int gbCategoryType,
                                                         String optionalSearchString,
                                                         String optionalSectionUid)
Specified by:
findMatchingEnrollmentsForViewableCourseGrade in interface Authz
gbCategoryType - The category type setting for this gradebook
Returns:
Map of EnrollmentRecord --> function (grade/view) for all students that the current user has permission to view/grade every item in the gradebook. If he/she can grade everything, GRADE function is returned. Otherwise, function is VIEW. May only modify course grade if he/she can grade everything in the gradebook for that student. If he/she can grade only a subset of the items, the student is not returned.

findMatchingEnrollmentsForViewableItems

public Map findMatchingEnrollmentsForViewableItems(String gradebookUid,
                                                   List allGbItems,
                                                   String optionalSearchString,
                                                   String optionalSectionUid)
Specified by:
findMatchingEnrollmentsForViewableItems in interface Authz
allGbItems - List of all Assignments associated with this gradebook
optionalSearchString - a substring search for student name or display UID; the exact rules are up to the implementation - leave null to use all students
optionalSectionUid - null if the search should be made across all sections
Returns:
a map of EnrollmentRecords to a map of item id and function (grade/view) that the user is authorized to view/grade

findStudentSectionMemberships

public List findStudentSectionMemberships(String gradebookUid,
                                          String studentUid)
Specified by:
findStudentSectionMemberships in interface Authz
Returns:
a list of all section memberships for the given studentUid

getStudentSectionMembershipNames

public List getStudentSectionMembershipNames(String gradebookUid,
                                             String studentUid)
Specified by:
getStudentSectionMembershipNames in interface Authz
Returns:
a list of the section membership names for the give studentUid

getAuthn

public Authn getAuthn()

setAuthn

public void setAuthn(Authn authn)

getSectionAwareness

public SectionAwareness getSectionAwareness()

setSectionAwareness

public void setSectionAwareness(SectionAwareness sectionAwareness)

getGradebookPermissionService

public GradebookPermissionService getGradebookPermissionService()

setGradebookPermissionService

public void setGradebookPermissionService(GradebookPermissionService gradebookPermissionService)


Copyright © 2011 Sakai Project. All Rights Reserved.