Skip to content
Snippets Groups Projects
Commit b2718802 authored by uhensler's avatar uhensler
Browse files

OO-4207: Participant is not allowed to override his own obligation / end date

parent 10587b4e
No related branches found
No related tags found
No related merge requests found
...@@ -26,7 +26,9 @@ import org.olat.core.gui.components.velocity.VelocityContainer; ...@@ -26,7 +26,9 @@ import org.olat.core.gui.components.velocity.VelocityContainer;
import org.olat.core.gui.control.Event; import org.olat.core.gui.control.Event;
import org.olat.core.gui.control.WindowControl; import org.olat.core.gui.control.WindowControl;
import org.olat.core.gui.control.controller.BasicController; import org.olat.core.gui.control.controller.BasicController;
import org.olat.core.id.IdentityEnvironment;
import org.olat.course.run.userview.UserCourseEnvironment; import org.olat.course.run.userview.UserCourseEnvironment;
import org.olat.course.run.userview.UserCourseEnvironmentImpl;
/** /**
* *
...@@ -51,12 +53,19 @@ public class LearningPathIdentityCtrl extends BasicController { ...@@ -51,12 +53,19 @@ public class LearningPathIdentityCtrl extends BasicController {
listenTo(coachedIdentityLargeInfosCtrl); listenTo(coachedIdentityLargeInfosCtrl);
mainVC.put("user", coachedIdentityLargeInfosCtrl.getInitialComponent()); mainVC.put("user", coachedIdentityLargeInfosCtrl.getInitialComponent());
learningPathListCtrl = new LearningPathListController(ureq, wControl, stackPanel, coachedCourseEnv); learningPathListCtrl = new LearningPathListController(ureq, wControl, stackPanel, coachedCourseEnv, getCanEdit(coachedCourseEnv));
listenTo(learningPathListCtrl); listenTo(learningPathListCtrl);
mainVC.put("list", learningPathListCtrl.getInitialComponent()); mainVC.put("list", learningPathListCtrl.getInitialComponent());
putInitialPanel(mainVC); putInitialPanel(mainVC);
} }
private boolean getCanEdit(UserCourseEnvironment coachedCourseEnv) {
IdentityEnvironment identityEnv = new IdentityEnvironment();
identityEnv.setIdentity(getIdentity());
UserCourseEnvironment myCourseEnv = new UserCourseEnvironmentImpl(identityEnv, coachedCourseEnv.getCourseEnvironment());
return !myCourseEnv.isCourseReadOnly() && (myCourseEnv.isAdmin() || myCourseEnv.isCoach());
}
@Override @Override
protected void event(UserRequest ureq, Component source, Event event) { protected void event(UserRequest ureq, Component source, Event event) {
......
...@@ -50,7 +50,6 @@ import org.olat.core.gui.control.WindowControl; ...@@ -50,7 +50,6 @@ import org.olat.core.gui.control.WindowControl;
import org.olat.core.gui.control.generic.closablewrapper.CalloutSettings; import org.olat.core.gui.control.generic.closablewrapper.CalloutSettings;
import org.olat.core.gui.control.generic.closablewrapper.CloseableCalloutWindowController; import org.olat.core.gui.control.generic.closablewrapper.CloseableCalloutWindowController;
import org.olat.core.helpers.Settings; import org.olat.core.helpers.Settings;
import org.olat.core.id.IdentityEnvironment;
import org.olat.core.util.Formatter; import org.olat.core.util.Formatter;
import org.olat.core.util.nodes.INode; import org.olat.core.util.nodes.INode;
import org.olat.course.assessment.CourseAssessmentService; import org.olat.course.assessment.CourseAssessmentService;
...@@ -61,7 +60,6 @@ import org.olat.course.learningpath.manager.LearningPathCourseTreeModelBuilder; ...@@ -61,7 +60,6 @@ import org.olat.course.learningpath.manager.LearningPathCourseTreeModelBuilder;
import org.olat.course.learningpath.ui.LearningPathDataModel.LearningPathCols; import org.olat.course.learningpath.ui.LearningPathDataModel.LearningPathCols;
import org.olat.course.nodes.CourseNode; import org.olat.course.nodes.CourseNode;
import org.olat.course.run.userview.UserCourseEnvironment; import org.olat.course.run.userview.UserCourseEnvironment;
import org.olat.course.run.userview.UserCourseEnvironmentImpl;
import org.olat.modules.assessment.AssessmentEntry; import org.olat.modules.assessment.AssessmentEntry;
import org.olat.modules.assessment.AssessmentService; import org.olat.modules.assessment.AssessmentService;
import org.olat.modules.assessment.Overridable; import org.olat.modules.assessment.Overridable;
...@@ -101,21 +99,14 @@ public class LearningPathListController extends FormBasicController implements T ...@@ -101,21 +99,14 @@ public class LearningPathListController extends FormBasicController implements T
private CourseAssessmentService courseAssessmentService; private CourseAssessmentService courseAssessmentService;
public LearningPathListController(UserRequest ureq, WindowControl wControl, TooledStackedPanel stackPanel, public LearningPathListController(UserRequest ureq, WindowControl wControl, TooledStackedPanel stackPanel,
UserCourseEnvironment userCourseEnv) { UserCourseEnvironment userCourseEnv, boolean canEdit) {
super(ureq, wControl, LAYOUT_BAREBONE); super(ureq, wControl, LAYOUT_BAREBONE);
this.userCourseEnv = userCourseEnv; this.userCourseEnv = userCourseEnv;
this.stackPanel = stackPanel; this.stackPanel = stackPanel;
this.courseEntry = userCourseEnv.getCourseEnvironment().getCourseGroupManager().getCourseEntry(); this.courseEntry = userCourseEnv.getCourseEnvironment().getCourseGroupManager().getCourseEntry();
this.canEdit = getCanEdit(); this.canEdit = canEdit;
initForm(ureq); initForm(ureq);
} }
private boolean getCanEdit() {
IdentityEnvironment identityEnv = new IdentityEnvironment();
identityEnv.setIdentity(getIdentity());
UserCourseEnvironment myCourseEnv = new UserCourseEnvironmentImpl(identityEnv, userCourseEnv.getCourseEnvironment());
return !myCourseEnv.isCourseReadOnly() && (myCourseEnv.isAdmin() || myCourseEnv.isCoach());
}
@Override @Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) { protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
......
...@@ -46,7 +46,7 @@ public class MyLearningPathController extends BasicController { ...@@ -46,7 +46,7 @@ public class MyLearningPathController extends BasicController {
String courseTitle = userCourseEnv.getCourseEnvironment().getCourseTitle(); String courseTitle = userCourseEnv.getCourseEnvironment().getCourseTitle();
mainVC.contextPut("courseTitle", courseTitle); mainVC.contextPut("courseTitle", courseTitle);
learningPathListCtrl = new LearningPathListController(ureq, wControl, stackPanel, userCourseEnv); learningPathListCtrl = new LearningPathListController(ureq, wControl, stackPanel, userCourseEnv, false);
listenTo(learningPathListCtrl); listenTo(learningPathListCtrl);
mainVC.put("list", learningPathListCtrl.getInitialComponent()); mainVC.put("list", learningPathListCtrl.getInitialComponent());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment