use of org.olat.course.groupsandrights.CourseGroupManager in project openolat by klemens.
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 klemens.
the class UserCourseEnvironmentImpl method isParticipant.
@Override
public boolean isParticipant() {
if (participant != null) {
return participant.booleanValue();
}
// lazy loading
CourseGroupManager cgm = courseEnvironment.getCourseGroupManager();
boolean partLazy = cgm.isIdentityCourseParticipant(identityEnvironment.getIdentity());
participant = new Boolean(partLazy);
return partLazy;
}
use of org.olat.course.groupsandrights.CourseGroupManager in project openolat by klemens.
the class MembersPeekViewController method readFormData.
protected void readFormData(ModuleConfiguration config) {
CourseGroupManager cgm = courseEnv.getCourseGroupManager();
RepositoryEntry courseRepositoryEntry = courseEnv.getCourseGroupManager().getCourseEntry();
List<Identity> owners = MembersHelpers.getOwners(repositoryService, courseRepositoryEntry);
List<Identity> coaches = new ArrayList<>();
MembersHelpers.addCoaches(config, cgm, businessGroupService, coaches);
List<Identity> participants = new ArrayList<>();
MembersHelpers.addParticipants(config, cgm, businessGroupService, participants);
Set<Long> duplicateCatcher = new HashSet<Long>();
List<Identity> filteredOwners = owners.stream().filter(ident -> {
if (duplicateCatcher.contains(ident.getKey())) {
return false;
}
duplicateCatcher.add(ident.getKey());
return true;
}).collect(Collectors.toList());
List<Identity> filteredCoaches = coaches.stream().filter(ident -> {
if (duplicateCatcher.contains(ident.getKey())) {
return false;
}
duplicateCatcher.add(ident.getKey());
return true;
}).collect(Collectors.toList());
List<Identity> filteredParticipants = participants.stream().filter(ident -> {
if (duplicateCatcher.contains(ident.getKey())) {
return false;
}
duplicateCatcher.add(ident.getKey());
return true;
}).collect(Collectors.toList());
entries.add(new Row(translate("members.owners"), Integer.toString(filteredOwners.size())));
entries.add(new Row(translate("members.coaches"), Integer.toString(filteredCoaches.size())));
entries.add(new Row(translate("members.participants"), Integer.toString(filteredParticipants.size())));
}
use of org.olat.course.groupsandrights.CourseGroupManager in project openolat by klemens.
the class EditorUserCourseEnvironmentImpl method getLifecycle.
@Override
public RepositoryEntryLifecycle getLifecycle() {
if (lifecycle == null) {
CourseGroupManager cgm = courseEditorEnv.getCourseGroupManager();
OLATResource courseResource = cgm.getCourseResource();
RepositoryEntry re = RepositoryManager.getInstance().lookupRepositoryEntry(courseResource, false);
if (re != null) {
lifecycle = re.getLifecycle();
}
}
return lifecycle;
}
use of org.olat.course.groupsandrights.CourseGroupManager in project openolat by klemens.
the class CourseRuntimeController method loadRights.
@Override
protected void loadRights(RepositoryEntrySecurity security) {
super.loadRights(security);
if (corrupted)
return;
ICourse course = CourseFactory.loadCourse(getRepositoryEntry());
CourseGroupManager cgm = course.getCourseEnvironment().getCourseGroupManager();
// 3) all other rights are defined in the groupmanagement using the learning
// group rights
UserCourseEnvironmentImpl uce = getUserCourseEnvironment();
if (uce != null) {
uce.setUserRoles(security.isEntryAdmin(), security.isCourseCoach() || security.isGroupCoach(), security.isCourseParticipant() || security.isGroupParticipant());
if (security.isReadOnly()) {
if (overrideReadOnly) {
uce.setCourseReadOnly(Boolean.FALSE);
} else {
uce.setCourseReadOnly(Boolean.TRUE);
}
} else {
uce.setCourseReadOnly(Boolean.FALSE);
}
}
courseRightsCache = new HashMap<>();
if (!security.isEntryAdmin() && !isGuestOnly) {
List<String> rights = cgm.getRights(getIdentity());
courseRightsCache.put(CourseRights.RIGHT_GROUPMANAGEMENT, Boolean.valueOf(rights.contains(CourseRights.RIGHT_GROUPMANAGEMENT)));
courseRightsCache.put(CourseRights.RIGHT_MEMBERMANAGEMENT, Boolean.valueOf(rights.contains(CourseRights.RIGHT_MEMBERMANAGEMENT)));
courseRightsCache.put(CourseRights.RIGHT_COURSEEDITOR, Boolean.valueOf(rights.contains(CourseRights.RIGHT_COURSEEDITOR)));
courseRightsCache.put(CourseRights.RIGHT_ARCHIVING, Boolean.valueOf(rights.contains(CourseRights.RIGHT_ARCHIVING)));
courseRightsCache.put(CourseRights.RIGHT_ASSESSMENT, Boolean.valueOf(rights.contains(CourseRights.RIGHT_ASSESSMENT)));
courseRightsCache.put(CourseRights.RIGHT_ASSESSMENT_MODE, Boolean.valueOf(rights.contains(CourseRights.RIGHT_ASSESSMENT_MODE)));
courseRightsCache.put(CourseRights.RIGHT_GLOSSARY, Boolean.valueOf(rights.contains(CourseRights.RIGHT_GLOSSARY)));
courseRightsCache.put(CourseRights.RIGHT_STATISTICS, Boolean.valueOf(rights.contains(CourseRights.RIGHT_STATISTICS)));
courseRightsCache.put(CourseRights.RIGHT_DB, Boolean.valueOf(rights.contains(CourseRights.RIGHT_DB)));
}
}
Aggregations