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);
}
}
}
}
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());
}
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;
}
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;
}
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;
}
Aggregations