Search in sources :

Example 1 with CourseGroupManager

use of org.olat.course.groupsandrights.CourseGroupManager in project OpenOLAT by OpenOLAT.

the class GTACoachedParticipantListController method collectIdentities.

private void collectIdentities(Consumer<Identity> participantCollector) {
    Set<Identity> duplicateKiller = new HashSet<>();
    CourseGroupManager cgm = coachCourseEnv.getCourseEnvironment().getCourseGroupManager();
    boolean admin = coachCourseEnv.isAdmin();
    List<BusinessGroup> coachedGroups = admin ? cgm.getAllBusinessGroups() : coachCourseEnv.getCoachedGroups();
    List<Identity> participants = businessGroupService.getMembers(coachedGroups, GroupRoles.participant.name());
    for (Identity participant : participants) {
        if (!duplicateKiller.contains(participant)) {
            participantCollector.accept(participant);
            duplicateKiller.add(participant);
        }
    }
    RepositoryEntry re = coachCourseEnv.getCourseEnvironment().getCourseGroupManager().getCourseEntry();
    boolean repoTutor = admin || (coachedGroups.isEmpty() && repositoryService.hasRole(getIdentity(), re, GroupRoles.coach.name()));
    if (repoTutor) {
        List<Identity> courseParticipants = repositoryService.getMembers(re, GroupRoles.participant.name());
        for (Identity participant : courseParticipants) {
            if (!duplicateKiller.contains(participant)) {
                participantCollector.accept(participant);
                duplicateKiller.add(participant);
            }
        }
    }
}
Also used : CourseGroupManager(org.olat.course.groupsandrights.CourseGroupManager) BusinessGroup(org.olat.group.BusinessGroup) RepositoryEntry(org.olat.repository.RepositoryEntry) Identity(org.olat.core.id.Identity) HashSet(java.util.HashSet)

Example 2 with CourseGroupManager

use of org.olat.course.groupsandrights.CourseGroupManager in project OpenOLAT by OpenOLAT.

the class RunMainController method loadUserCourseEnvironment.

private UserCourseEnvironmentImpl loadUserCourseEnvironment(UserRequest ureq, RepositoryEntrySecurity reSecurity) {
    CourseGroupManager cgm = course.getCourseEnvironment().getCourseGroupManager();
    List<BusinessGroup> coachedGroups;
    if (reSecurity.isGroupCoach()) {
        coachedGroups = cgm.getOwnedBusinessGroups(ureq.getIdentity());
    } else {
        coachedGroups = Collections.emptyList();
    }
    List<BusinessGroup> participatedGroups;
    if (reSecurity.isGroupParticipant()) {
        participatedGroups = cgm.getParticipatingBusinessGroups(ureq.getIdentity());
    } else {
        participatedGroups = Collections.emptyList();
    }
    List<BusinessGroup> waitingLists;
    if (reSecurity.isGroupWaiting()) {
        waitingLists = cgm.getWaitingListGroups(ureq.getIdentity());
    } else {
        waitingLists = Collections.emptyList();
    }
    return new UserCourseEnvironmentImpl(ureq.getUserSession().getIdentityEnvironment(), course.getCourseEnvironment(), getWindowControl(), coachedGroups, participatedGroups, waitingLists, reSecurity.isCourseCoach() || reSecurity.isGroupCoach(), reSecurity.isEntryAdmin(), reSecurity.isCourseParticipant() || reSecurity.isGroupParticipant(), reSecurity.isReadOnly());
}
Also used : CourseGroupManager(org.olat.course.groupsandrights.CourseGroupManager) UserCourseEnvironmentImpl(org.olat.course.run.userview.UserCourseEnvironmentImpl) BusinessGroup(org.olat.group.BusinessGroup)

Example 3 with CourseGroupManager

use of org.olat.course.groupsandrights.CourseGroupManager in project OpenOLAT by OpenOLAT.

the class UserCourseEnvironmentImpl method isParticipantOfAnyCourse.

@Override
public boolean isParticipantOfAnyCourse() {
    if (participantAnyCourse != null) {
        return participantAnyCourse.booleanValue();
    }
    CourseGroupManager cgm = courseEnvironment.getCourseGroupManager();
    boolean participantLazy = cgm.isIdentityAnyCourseParticipant(identityEnvironment.getIdentity());
    participantAnyCourse = new Boolean(participantLazy);
    return participantLazy;
}
Also used : CourseGroupManager(org.olat.course.groupsandrights.CourseGroupManager)

Example 4 with CourseGroupManager

use of org.olat.course.groupsandrights.CourseGroupManager in project OpenOLAT by OpenOLAT.

the class UserCourseEnvironmentImpl method isCoach.

@Override
public boolean isCoach() {
    if (coach != null) {
        return coach.booleanValue();
    }
    // lazy loading
    CourseGroupManager cgm = courseEnvironment.getCourseGroupManager();
    boolean coachLazy = cgm.isIdentityCourseCoach(identityEnvironment.getIdentity());
    coach = new Boolean(coachLazy);
    return coachLazy;
}
Also used : CourseGroupManager(org.olat.course.groupsandrights.CourseGroupManager)

Example 5 with CourseGroupManager

use of org.olat.course.groupsandrights.CourseGroupManager in project OpenOLAT by OpenOLAT.

the class UserCourseEnvironmentImpl method isAdminOfAnyCourse.

@Override
public boolean isAdminOfAnyCourse() {
    if (adminAnyCourse != null) {
        return adminAnyCourse.booleanValue();
    }
    CourseGroupManager cgm = courseEnvironment.getCourseGroupManager();
    boolean adminLazy = identityEnvironment.getRoles().isOLATAdmin() || identityEnvironment.getRoles().isInstitutionalResourceManager() || cgm.isIdentityAnyCourseAdministrator(identityEnvironment.getIdentity());
    adminAnyCourse = new Boolean(adminLazy);
    return adminLazy;
}
Also used : CourseGroupManager(org.olat.course.groupsandrights.CourseGroupManager)

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