org.sakaiproject.component.gradebook
Class GradebookPermissionServiceImpl

java.lang.Object
  extended by org.springframework.dao.support.DaoSupport
      extended by org.springframework.orm.hibernate3.support.HibernateDaoSupport
          extended by org.sakaiproject.component.gradebook.BaseHibernateManager
              extended by org.sakaiproject.component.gradebook.GradebookPermissionServiceImpl
All Implemented Interfaces:
GradebookPermissionService, org.springframework.beans.factory.InitializingBean

public class GradebookPermissionServiceImpl
extends BaseHibernateManager
implements GradebookPermissionService


Field Summary
 
Fields inherited from class org.sakaiproject.component.gradebook.BaseHibernateManager
authn, eventTrackingService, MAX_NUMBER_OF_SQL_PARAMETERS_IN_LIST, propertiesMap
 
Fields inherited from class org.springframework.dao.support.DaoSupport
logger
 
Constructor Summary
GradebookPermissionServiceImpl()
           
 
Method Summary
 Map getAvailableItemsForStudent(Long gradebookId, String userId, String studentId, Collection courseSections)
          Get a map of itemId/permission(grade/view) of a student for a grader that he can grade or view for gradebook.
 Map getAvailableItemsForStudent(String gradebookUid, String userId, String studentId, Collection courseSections)
          Get a map of itemId/permission(grade/view) of a student for a grader that he can grade or view for gradebook.
 Map getAvailableItemsForStudents(Long gradebookId, String userId, List studentIds, Collection courseSections)
          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.
 Map getAvailableItemsForStudents(String gradebookUid, String userId, List studentIds, Collection courseSections)
          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.
 List getCategoriesForUser(Long gradebookId, String userId, List<Long> categoryIdList, int cateType)
          Get all available categories for a user that the user can either view or grade.
 List<Long> getCategoriesForUserForStudentView(Long gradebookId, String userId, String studentId, List<Long> categoriesIds, int cateType, List sectionIds)
          Returns viewable categorie id's for a user for a specific student
 Map getCourseGradePermission(Long gradebookId, String userId, List studentIds, List courseSections)
          Get a map with student IDs as key and view/grade as value for their course grade.
 Map getCourseGradePermission(String gradebookUid, String userId, List studentIds, List courseSections)
          Get a map with student IDs as key and view/grade as value for their course grade.
 List getGraderPermissionsForUser(Long gradebookId, String userId)
          Get all Permission records associated with this user and gradebook
 List getGraderPermissionsForUser(String gradebookUid, String userId)
          Get all Permission records associated with this user and gradebook
 boolean getPermissionForUserForAllAssignment(Long gradebookId, String userId)
          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.
 boolean getPermissionForUserForAllAssignmentForStudent(Long gradebookId, String userId, String studentId, List sectionIds)
          Get true/false value for current user which indicates if he has permission for all gb items for a given student
 SectionAwareness getSectionAwareness()
           
 Map getStudentsForItem(Long gradebookId, String userId, List studentIds, int cateType, Long categoryId, List courseSections)
          Get students IDs that the current grader can either view or grade.
 Map getStudentsForItem(String gradebookUid, String userId, List studentIds, int cateType, Long categoryId, List courseSections)
          Get students IDs that the current grader can either view or grade.
 List getViewableGroupsForUser(Long gradebookId, String userId, List groupIds)
          Get all group ids associated with groups that contain at least one member that the user is authorized to view/grade
 List getViewableGroupsForUser(String gradebookUid, String userId, List groupIds)
          Get all group ids associated with groups that contain at least one member that the user is authorized to view/grade
 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
 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
 void setSectionAwareness(SectionAwareness sectionAwareness)
           
 
Methods inherited from class org.sakaiproject.component.gradebook.BaseHibernateManager
addPermission, calculateEquivalentPercent, calculateEquivalentPointValueForPercent, convertPointsToLetterGrade, convertPointsToPercentage, createAssignment, createAssignmentForCategory, createCategory, createDefaultLetterGradePercentMapping, createOrUpdateDefaultLetterGradePercentMapping, createUngradedAssignment, createUngradedAssignmentForCategory, deletePermission, filterGradeRecordsByStudents, finalizeNullGradeRecords, getAllStudentUids, getAssignment, getAssignmentGradeRecord, getAssignments, getAssignmentsForCategory, getAssignmentWithoutStats, getAssignmentWithoutStats, getAuthn, getCategories, getCategoriesWithAssignments, getCategory, getComments, getCountedStudentGradeRecords, getCourseGrade, getCourseGradeRecord, getDefaultLetterGradePercentMapping, getEventTrackingService, getGradebook, getGradebookUid, getLetterGradePercentMapping, getPermissionsForGB, getPermissionsForGBForCategoryIds, getPermissionsForUser, getPermissionsForUserAnyCategory, getPermissionsForUserAnyGroup, getPermissionsForUserAnyGroupAnyCategory, getPermissionsForUserAnyGroupForCategory, getPermissionsForUserForCategory, getPermissionsForUserForGoupsAnyCategory, getPermissionsForUserForGroup, getPropertiesMap, getPropertyValue, getUserUid, isAssignmentDefined, isExplicitlyEnteredCourseGradeRecords, isGradebookDefined, postEvent, removeCategory, saveOrUpdateLetterGradePercentMapping, setAuthn, setEventTrackingService, setPropertyValue, updateAssignment, updateCategory, updateGradebook, updatePermission, updatePermission, validateLetterGradeMapping
 
Methods inherited from class org.springframework.orm.hibernate3.support.HibernateDaoSupport
checkDaoConfig, convertHibernateAccessException, createHibernateTemplate, getHibernateTemplate, getSession, getSession, getSessionFactory, releaseSession, setHibernateTemplate, setSessionFactory
 
Methods inherited from class org.springframework.dao.support.DaoSupport
afterPropertiesSet, initDao
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GradebookPermissionServiceImpl

public GradebookPermissionServiceImpl()
Method Detail

getCategoriesForUser

public List getCategoriesForUser(Long gradebookId,
                                 String userId,
                                 List<Long> categoryIdList,
                                 int cateType)
                          throws IllegalArgumentException
Description copied from interface: GradebookPermissionService
Get all available categories for a user that the user can either view or grade. (For overview page)

Specified by:
getCategoriesForUser in interface GradebookPermissionService
Parameters:
gradebookId - Gradebook ID
userId - grader ID
cateType - gradebook category type
Returns:
List of categories
Throws:
IllegalArgumentException

getCategoriesForUserForStudentView

public List<Long> getCategoriesForUserForStudentView(Long gradebookId,
                                                     String userId,
                                                     String studentId,
                                                     List<Long> categoriesIds,
                                                     int cateType,
                                                     List sectionIds)
                                              throws IllegalArgumentException
Description copied from interface: GradebookPermissionService
Returns viewable categorie id's for a user for a specific student

Specified by:
getCategoriesForUserForStudentView in interface GradebookPermissionService
Returns:
Throws:
IllegalArgumentException

getPermissionForUserForAllAssignment

public boolean getPermissionForUserForAllAssignment(Long gradebookId,
                                                    String userId)
                                             throws IllegalArgumentException
Description copied from interface: GradebookPermissionService
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)

Specified by:
getPermissionForUserForAllAssignment in interface GradebookPermissionService
Parameters:
gradebookId - Gradebook ID
userId - grader ID
Returns:
boolean of true/false
Throws:
IllegalArgumentException

getPermissionForUserForAllAssignmentForStudent

public boolean getPermissionForUserForAllAssignmentForStudent(Long gradebookId,
                                                              String userId,
                                                              String studentId,
                                                              List sectionIds)
                                                       throws IllegalArgumentException
Description copied from interface: GradebookPermissionService
Get true/false value for current user which indicates if he has permission for all gb items for a given student

Specified by:
getPermissionForUserForAllAssignmentForStudent in interface GradebookPermissionService
Returns:
Throws:
IllegalArgumentException

getStudentsForItem

public Map getStudentsForItem(Long gradebookId,
                              String userId,
                              List studentIds,
                              int cateType,
                              Long categoryId,
                              List courseSections)
                       throws IllegalArgumentException
Description copied from interface: GradebookPermissionService
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)

Specified by:
getStudentsForItem in interface GradebookPermissionService
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

public Map getStudentsForItem(String gradebookUid,
                              String userId,
                              List studentIds,
                              int cateType,
                              Long categoryId,
                              List courseSections)
                       throws IllegalArgumentException
Description copied from interface: GradebookPermissionService
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)

Specified by:
getStudentsForItem in interface GradebookPermissionService
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

getViewableGroupsForUser

public List getViewableGroupsForUser(Long gradebookId,
                                     String userId,
                                     List groupIds)
Description copied from interface: GradebookPermissionService
Get all group ids associated with groups that contain at least one member that the user is authorized to view/grade

Specified by:
getViewableGroupsForUser in interface GradebookPermissionService
Returns:
List of group ids that user has some authorization to view

getViewableGroupsForUser

public List getViewableGroupsForUser(String gradebookUid,
                                     String userId,
                                     List groupIds)
Description copied from interface: GradebookPermissionService
Get all group ids associated with groups that contain at least one member that the user is authorized to view/grade

Specified by:
getViewableGroupsForUser in interface GradebookPermissionService
Returns:
List of group ids that user has some authorization to view

getGraderPermissionsForUser

public List getGraderPermissionsForUser(Long gradebookId,
                                        String userId)
Description copied from interface: GradebookPermissionService
Get all Permission records associated with this user and gradebook

Specified by:
getGraderPermissionsForUser in interface GradebookPermissionService
Returns:
List of Permission records for user and gradebook

getGraderPermissionsForUser

public List getGraderPermissionsForUser(String gradebookUid,
                                        String userId)
Description copied from interface: GradebookPermissionService
Get all Permission records associated with this user and gradebook

Specified by:
getGraderPermissionsForUser in interface GradebookPermissionService
Returns:
List of Permission records for user and gradebook

getAvailableItemsForStudent

public Map getAvailableItemsForStudent(Long gradebookId,
                                       String userId,
                                       String studentId,
                                       Collection courseSections)
                                throws IllegalArgumentException
Description copied from interface: GradebookPermissionService
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)

Specified by:
getAvailableItemsForStudent in interface GradebookPermissionService
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

getAvailableItemsForStudent

public Map getAvailableItemsForStudent(String gradebookUid,
                                       String userId,
                                       String studentId,
                                       Collection courseSections)
                                throws IllegalArgumentException
Description copied from interface: GradebookPermissionService
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)

Specified by:
getAvailableItemsForStudent in interface GradebookPermissionService
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

getAvailableItemsForStudents

public Map getAvailableItemsForStudents(Long gradebookId,
                                        String userId,
                                        List studentIds,
                                        Collection courseSections)
                                 throws IllegalArgumentException
Description copied from interface: GradebookPermissionService
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)

Specified by:
getAvailableItemsForStudents in interface GradebookPermissionService
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

public Map getAvailableItemsForStudents(String gradebookUid,
                                        String userId,
                                        List studentIds,
                                        Collection courseSections)
                                 throws IllegalArgumentException
Description copied from interface: GradebookPermissionService
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)

Specified by:
getAvailableItemsForStudents in interface GradebookPermissionService
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

public Map getCourseGradePermission(Long gradebookId,
                                    String userId,
                                    List studentIds,
                                    List courseSections)
                             throws IllegalArgumentException
Description copied from interface: GradebookPermissionService
Get a map with student IDs as key and view/grade as value for their course grade. (For course grade page)

Specified by:
getCourseGradePermission in interface GradebookPermissionService
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

public Map getCourseGradePermission(String gradebookUid,
                                    String userId,
                                    List studentIds,
                                    List courseSections)
                             throws IllegalArgumentException
Description copied from interface: GradebookPermissionService
Get a map with student IDs as key and view/grade as value for their course grade. (For course grade page)

Specified by:
getCourseGradePermission in interface GradebookPermissionService
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

getViewableStudentsForUser

public List getViewableStudentsForUser(Long gradebookId,
                                       String userId,
                                       List studentIds,
                                       List sections)
Description copied from interface: GradebookPermissionService
Get a unique list of students that the current user has grader permissions to view in some capacity

Specified by:
getViewableStudentsForUser in interface GradebookPermissionService
Returns:
List of student ids

getViewableStudentsForUser

public List getViewableStudentsForUser(String gradebookUid,
                                       String userId,
                                       List studentIds,
                                       List sections)
Description copied from interface: GradebookPermissionService
Get a unique list of students that the current user has grader permissions to view in some capacity

Specified by:
getViewableStudentsForUser in interface GradebookPermissionService
Returns:
List of student ids

getSectionAwareness

public SectionAwareness getSectionAwareness()
Overrides:
getSectionAwareness in class BaseHibernateManager

setSectionAwareness

public void setSectionAwareness(SectionAwareness sectionAwareness)
Overrides:
setSectionAwareness in class BaseHibernateManager


Copyright © 2011 Sakai Project. All Rights Reserved.