use of org.olat.course.groupsandrights.CourseGroupManager in project openolat by klemens.
the class LTIRunController method getLTIRoles.
private String getLTIRoles() {
if (roles.isGuestOnly()) {
return "Guest";
}
CourseGroupManager groupManager = courseEnv.getCourseGroupManager();
boolean admin = groupManager.isIdentityCourseAdministrator(getIdentity());
if (admin || roles.isOLATAdmin()) {
String authorRole = config.getStringValue(BasicLTICourseNode.CONFIG_KEY_AUTHORROLE);
if (StringHelper.containsNonWhitespace(authorRole)) {
return authorRole;
}
return "Instructor,Administrator";
}
boolean coach = groupManager.isIdentityCourseCoach(getIdentity());
if (coach) {
String coachRole = config.getStringValue(BasicLTICourseNode.CONFIG_KEY_COACHROLE);
if (StringHelper.containsNonWhitespace(coachRole)) {
return coachRole;
}
return "Instructor";
}
String participantRole = config.getStringValue(BasicLTICourseNode.CONFIG_KEY_PARTICIPANTROLE);
if (StringHelper.containsNonWhitespace(participantRole)) {
return participantRole;
}
return "Learner";
}
use of org.olat.course.groupsandrights.CourseGroupManager in project openolat by klemens.
the class GTACourseNode method getCoachedGroupListController.
public GTACoachedGroupListController getCoachedGroupListController(UserRequest ureq, WindowControl wControl, BreadcrumbPanel stackPanel, UserCourseEnvironment coachCourseEnv, boolean admin, List<BusinessGroup> coachedGroups) {
List<BusinessGroup> groups;
CourseGroupManager gm = coachCourseEnv.getCourseEnvironment().getCourseGroupManager();
if (admin) {
groups = gm.getAllBusinessGroups();
} else {
groups = coachedGroups;
}
groups = CoreSpringFactory.getImpl(GTAManager.class).filterBusinessGroups(groups, this);
return new GTACoachedGroupListController(ureq, wControl, stackPanel, coachCourseEnv, this, groups);
}
use of org.olat.course.groupsandrights.CourseGroupManager in project openolat by klemens.
the class CourseCalendars method getCourseCalendarWrapper.
/**
* Return only the course calendar without any group calendar
* @param ureq
* @param wControl
* @param ores
* @param ne
* @return
*/
public static KalendarRenderWrapper getCourseCalendarWrapper(UserRequest ureq, UserCourseEnvironment courseEnv, NodeEvaluation ne) {
CalendarManager calendarManager = CoreSpringFactory.getImpl(CalendarManager.class);
// add course calendar
ICourse course = CourseFactory.loadCourse(courseEnv.getCourseEnvironment().getCourseResourceableId());
KalendarRenderWrapper courseKalendarWrapper = calendarManager.getCourseCalendar(course);
CourseGroupManager cgm = course.getCourseEnvironment().getCourseGroupManager();
Identity identity = ureq.getIdentity();
Roles roles = ureq.getUserSession().getRoles();
boolean isPrivileged = !courseEnv.isCourseReadOnly() && (roles.isOLATAdmin() || courseEnv.isAdmin() || (ne != null && ne.isCapabilityAccessible(CalCourseNode.EDIT_CONDITION_ID)) || RepositoryManager.getInstance().isInstitutionalRessourceManagerFor(identity, roles, cgm.getCourseEntry()));
if (isPrivileged) {
courseKalendarWrapper.setAccess(KalendarRenderWrapper.ACCESS_READ_WRITE);
courseKalendarWrapper.setPrivateEventsVisible(true);
} else {
courseKalendarWrapper.setAccess(KalendarRenderWrapper.ACCESS_READ_ONLY);
courseKalendarWrapper.setPrivateEventsVisible(courseEnv.isAdmin() || courseEnv.isCoach() || courseEnv.isParticipant());
}
CalendarUserConfiguration config = calendarManager.findCalendarConfigForIdentity(courseKalendarWrapper.getKalendar(), ureq.getIdentity());
if (config != null) {
courseKalendarWrapper.setConfiguration(config);
}
return courseKalendarWrapper;
}
use of org.olat.course.groupsandrights.CourseGroupManager in project openolat by klemens.
the class CourseCalendars method createCourseCalendarsWrapper.
public static CourseCalendars createCourseCalendarsWrapper(UserRequest ureq, WindowControl wControl, UserCourseEnvironment courseEnv, NodeEvaluation ne) {
List<KalendarRenderWrapper> calendars = new ArrayList<>();
ICourse course = CourseFactory.loadCourse(courseEnv.getCourseEnvironment().getCourseResourceableId());
KalendarRenderWrapper courseKalendarWrapper = getCourseCalendarWrapper(ureq, courseEnv, ne);
// add link provider
CourseLinkProviderController clpc = new CourseLinkProviderController(course, Collections.singletonList(course), ureq, wControl);
courseKalendarWrapper.setLinkProvider(clpc);
calendars.add(courseKalendarWrapper);
Identity identity = ureq.getIdentity();
CourseGroupManager cgm = course.getCourseEnvironment().getCourseGroupManager();
// add course group calendars
boolean isGroupManager = ureq.getUserSession().getRoles().isOLATAdmin() || ureq.getUserSession().getRoles().isGroupManager() || cgm.isIdentityCourseAdministrator(identity) || cgm.hasRight(identity, CourseRights.RIGHT_GROUPMANAGEMENT);
boolean readOnly = courseEnv.isCourseReadOnly();
if (isGroupManager) {
// learning groups
List<BusinessGroup> allGroups = cgm.getAllBusinessGroups();
addCalendars(ureq, courseEnv, allGroups, !readOnly, clpc, calendars);
} else {
// learning groups
List<BusinessGroup> ownerGroups = cgm.getOwnedBusinessGroups(identity);
addCalendars(ureq, courseEnv, ownerGroups, !readOnly, clpc, calendars);
List<BusinessGroup> attendedGroups = cgm.getParticipatingBusinessGroups(identity);
for (BusinessGroup ownerGroup : ownerGroups) {
if (attendedGroups.contains(ownerGroup)) {
attendedGroups.remove(ownerGroup);
}
}
addCalendars(ureq, courseEnv, attendedGroups, false, clpc, calendars);
}
return new CourseCalendars(courseKalendarWrapper, calendars);
}
use of org.olat.course.groupsandrights.CourseGroupManager in project openolat by klemens.
the class ProjectGroupManagerImpl method createProjectGroupFor.
// //////////////////////////
// PROJECT GROUP MANAGEMENT
// //////////////////////////
@Override
public BusinessGroup createProjectGroupFor(Long projectBrokerId, Identity identity, String groupName, String groupDescription, Long courseId) {
CourseGroupManager cgm = CourseFactory.loadCourse(courseId).getCourseEnvironment().getCourseGroupManager();
RepositoryEntry re = cgm.getCourseEntry();
log.debug("createProjectGroupFor groupName=" + groupName);
BusinessGroup projectGroup = businessGroupService.createBusinessGroup(identity, groupName, groupDescription, -1, -1, false, false, re);
// projectGroup could be null when a group with name already exists
int counter = 2;
while (projectGroup == null) {
// name already exist try another one
String newGroupName = groupName + " _" + counter;
projectGroup = businessGroupService.createBusinessGroup(identity, newGroupName, groupDescription, -1, -1, false, false, re);
counter++;
}
log.debug("Created a new projectGroup=" + projectGroup);
return projectGroup;
}
Aggregations