/** * 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); }