예제 #1
0
 /** @inheritDoc */
 public List getSectionMembersInRole(final String sectionUuid, final Role role) {
   if (role.isTeachingAssistant()) {
     return getSectionTeachingAssistants(sectionUuid);
   } else if (role.isStudent()) {
     return getSectionEnrollments(sectionUuid);
   } else {
     log.error("Can't get section members in role " + role);
     return new ArrayList();
   }
 }
예제 #2
0
 private String getLock(Role role) {
   if (role.isInstructor()) {
     return SectionAwareness.INSTRUCTOR_MARKER;
   } else if (role.isTeachingAssistant()) {
     return SectionAwareness.TA_MARKER;
   } else if (role.isStudent()) {
     return SectionAwareness.STUDENT_MARKER;
   } else {
     return null;
   }
 }
예제 #3
0
 /** @inheritDoc */
 public List getSiteMembersInRole(final String siteContext, final Role role) {
   if (role.isInstructor()) {
     return getSiteInstructors(siteContext);
   } else if (role.isTeachingAssistant()) {
     return getSiteTeachingAssistants(siteContext);
   } else if (role.isStudent()) {
     return getSiteEnrollments(siteContext);
   } else {
     log.error("Can not get site members in role " + role);
     return new ArrayList();
   }
 }
예제 #4
0
 /**
  * Checks whether a user is in a role in any learningContext (site or section)
  *
  * @param userUid
  * @param role
  * @param authzRef
  * @return
  */
 private boolean isUserInRole(String userUid, Role role, String authzRef) {
   org.sakaiproject.user.api.User user;
   try {
     user = userDirectoryService.getUser(userUid);
   } catch (UserNotDefinedException ide) {
     log.error("Could not find user with id " + userUid);
     return false;
   }
   if (role.isNone()) {
     // Make sure that the user is in fact NOT in any role with a role marker
     if (securityService.unlock(user, SectionAwareness.INSTRUCTOR_MARKER, authzRef)
         || securityService.unlock(user, SectionAwareness.STUDENT_MARKER, authzRef)
         || securityService.unlock(user, SectionAwareness.TA_MARKER, authzRef)) {
       return false;
     } else {
       return true;
     }
   }
   return securityService.unlock(user, getLock(role), authzRef);
 }