Search in sources :

Example 31 with CourseGroupManager

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

Example 32 with CourseGroupManager

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

Example 33 with CourseGroupManager

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())));
}
Also used : BusinessGroupService(org.olat.group.BusinessGroupService) ColumnDescriptor(org.olat.core.gui.components.table.ColumnDescriptor) RepositoryService(org.olat.repository.RepositoryService) CourseEnvironment(org.olat.course.run.environment.CourseEnvironment) UserCourseEnvironment(org.olat.course.run.userview.UserCourseEnvironment) DefaultColumnDescriptor(org.olat.core.gui.components.table.DefaultColumnDescriptor) WindowControl(org.olat.core.gui.control.WindowControl) Set(java.util.Set) Autowired(org.springframework.beans.factory.annotation.Autowired) RepositoryEntry(org.olat.repository.RepositoryEntry) Component(org.olat.core.gui.components.Component) Collectors(java.util.stream.Collectors) ModuleConfiguration(org.olat.modules.ModuleConfiguration) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) Event(org.olat.core.gui.control.Event) BasicController(org.olat.core.gui.control.controller.BasicController) CourseGroupManager(org.olat.course.groupsandrights.CourseGroupManager) DefaultTableDataModel(org.olat.core.gui.components.table.DefaultTableDataModel) List(java.util.List) Identity(org.olat.core.id.Identity) UserRequest(org.olat.core.gui.UserRequest) TableGuiConfiguration(org.olat.core.gui.components.table.TableGuiConfiguration) TableController(org.olat.core.gui.components.table.TableController) CourseGroupManager(org.olat.course.groupsandrights.CourseGroupManager) ArrayList(java.util.ArrayList) RepositoryEntry(org.olat.repository.RepositoryEntry) Identity(org.olat.core.id.Identity) HashSet(java.util.HashSet)

Example 34 with CourseGroupManager

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

Example 35 with CourseGroupManager

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

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