Search in sources :

Example 71 with CourseGroupManager

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";
}
Also used : CourseGroupManager(org.olat.course.groupsandrights.CourseGroupManager)

Example 72 with CourseGroupManager

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);
}
Also used : CourseGroupManager(org.olat.course.groupsandrights.CourseGroupManager) BusinessGroup(org.olat.group.BusinessGroup) GTACoachedGroupListController(org.olat.course.nodes.gta.ui.GTACoachedGroupListController)

Example 73 with CourseGroupManager

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;
}
Also used : CourseGroupManager(org.olat.course.groupsandrights.CourseGroupManager) CalendarManager(org.olat.commons.calendar.CalendarManager) ICourse(org.olat.course.ICourse) Roles(org.olat.core.id.Roles) CalendarUserConfiguration(org.olat.commons.calendar.model.CalendarUserConfiguration) KalendarRenderWrapper(org.olat.commons.calendar.ui.components.KalendarRenderWrapper) Identity(org.olat.core.id.Identity)

Example 74 with CourseGroupManager

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);
}
Also used : CourseGroupManager(org.olat.course.groupsandrights.CourseGroupManager) BusinessGroup(org.olat.group.BusinessGroup) ArrayList(java.util.ArrayList) ICourse(org.olat.course.ICourse) CourseLinkProviderController(org.olat.course.run.calendar.CourseLinkProviderController) KalendarRenderWrapper(org.olat.commons.calendar.ui.components.KalendarRenderWrapper) Identity(org.olat.core.id.Identity)

Example 75 with CourseGroupManager

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;
}
Also used : CourseGroupManager(org.olat.course.groupsandrights.CourseGroupManager) BusinessGroup(org.olat.group.BusinessGroup) RepositoryEntry(org.olat.repository.RepositoryEntry)

Aggregations

CourseGroupManager (org.olat.course.groupsandrights.CourseGroupManager)84 Identity (org.olat.core.id.Identity)28 ICourse (org.olat.course.ICourse)28 BusinessGroup (org.olat.group.BusinessGroup)26 RepositoryEntry (org.olat.repository.RepositoryEntry)22 HashSet (java.util.HashSet)12 Roles (org.olat.core.id.Roles)12 ArrayList (java.util.ArrayList)10 BusinessGroupService (org.olat.group.BusinessGroupService)10 KalendarRenderWrapper (org.olat.commons.calendar.ui.components.KalendarRenderWrapper)8 UserRequest (org.olat.core.gui.UserRequest)8 CourseEditorEnv (org.olat.course.editor.CourseEditorEnv)8 PersistingCourseGroupManager (org.olat.course.groupsandrights.PersistingCourseGroupManager)8 OLATResource (org.olat.resource.OLATResource)8 File (java.io.File)6 Date (java.util.Date)6 CalendarManager (org.olat.commons.calendar.CalendarManager)6 Publisher (org.olat.core.commons.services.notifications.Publisher)6 OLATResourceable (org.olat.core.id.OLATResourceable)6 AssertException (org.olat.core.logging.AssertException)6