use of org.olat.modules.portfolio.model.AccessRights in project OpenOLAT by OpenOLAT.
the class EvaluationFormHandler method getController.
private Controller getController(UserRequest ureq, WindowControl wControl, PageBody body, EvaluationFormPart eva) {
PortfolioService portfolioService = CoreSpringFactory.getImpl(PortfolioService.class);
Controller ctrl = null;
Page page = portfolioService.getPageByBody(body);
List<AccessRights> accessRights = portfolioService.getAccessRights(page);
if (hasRole(PortfolioRoles.owner, ureq.getIdentity(), accessRights)) {
ctrl = new EvaluationFormController(ureq, wControl, ureq.getIdentity(), body, eva.getContent(), false);
} else if (hasRole(PortfolioRoles.coach, ureq.getIdentity(), accessRights)) {
Identity owner = getOwner(accessRights);
ctrl = new EvaluationFormController(ureq, wControl, owner, body, eva.getContent(), true);
} else if (hasRole(PortfolioRoles.reviewer, ureq.getIdentity(), accessRights) || hasRole(PortfolioRoles.invitee, ureq.getIdentity(), accessRights)) {
Identity owner = getOwner(accessRights);
ctrl = new EvaluationFormController(ureq, wControl, owner, body, eva.getContent(), true);
}
return ctrl;
}
use of org.olat.modules.portfolio.model.AccessRights in project OpenOLAT by OpenOLAT.
the class EvaluationFormHandler method getControllerForAssignment.
private Controller getControllerForAssignment(UserRequest ureq, WindowControl wControl, PageBody body, Assignment assignment, boolean onePage) {
PortfolioService portfolioService = CoreSpringFactory.getImpl(PortfolioService.class);
// find the evaluation form
RepositoryEntry re = assignment.getFormEntry();
Page page = assignment.getPage();
PageStatus pageStatus = page.getPageStatus();
Controller ctrl = null;
List<AccessRights> accessRights = portfolioService.getAccessRights(page);
boolean anonym = assignment.isAnonymousExternalEvaluation();
if (pageStatus == null || pageStatus == PageStatus.draft) {
if (hasRole(PortfolioRoles.owner, ureq.getIdentity(), accessRights)) {
ctrl = new EvaluationFormController(ureq, wControl, ureq.getIdentity(), body, re, false, false);
}
} else if (assignment.isOnlyAutoEvaluation()) {
// only the auto evaluation is shown
if (hasRole(PortfolioRoles.owner, ureq.getIdentity(), accessRights)) {
boolean readOnly = (pageStatus == PageStatus.published) || (pageStatus == PageStatus.closed) || (pageStatus == PageStatus.deleted);
ctrl = new EvaluationFormController(ureq, wControl, ureq.getIdentity(), body, re, readOnly, false);
} else if (hasRole(PortfolioRoles.coach, ureq.getIdentity(), accessRights)) {
Identity owner = getOwner(accessRights);
ctrl = new EvaluationFormController(ureq, wControl, owner, body, re, true, false);
} else if (hasRole(PortfolioRoles.reviewer, ureq.getIdentity(), accessRights) || hasRole(PortfolioRoles.invitee, ureq.getIdentity(), accessRights)) {
if (assignment.isReviewerSeeAutoEvaluation()) {
Identity owner = getOwner(accessRights);
ctrl = new EvaluationFormController(ureq, wControl, owner, body, re, true, false);
}
}
} else {
if (hasRole(PortfolioRoles.owner, ureq.getIdentity(), accessRights)) {
boolean readOnly = (pageStatus == PageStatus.published) || (pageStatus == PageStatus.closed) || (pageStatus == PageStatus.deleted) || onePage;
Identity owner = getOwner(accessRights);
List<Identity> coachesAndReviewers = getCoachesAndReviewers(accessRights);
if (coachesAndReviewers.size() > 0) {
ctrl = new MultiEvaluationFormController(ureq, wControl, owner, coachesAndReviewers, body, re, false, readOnly, onePage, anonym);
} else {
ctrl = new EvaluationFormController(ureq, wControl, ureq.getIdentity(), body, re, readOnly, false);
}
} else if (hasRole(PortfolioRoles.coach, ureq.getIdentity(), accessRights)) {
Identity owner = getOwner(accessRights);
List<Identity> coachesAndReviewers = getCoachesAndReviewers(accessRights);
boolean readOnly = (pageStatus == PageStatus.draft) || (pageStatus == PageStatus.closed) || (pageStatus == PageStatus.deleted) || onePage;
ctrl = new MultiEvaluationFormController(ureq, wControl, owner, coachesAndReviewers, body, re, false, readOnly, onePage, anonym);
} else if (hasRole(PortfolioRoles.reviewer, ureq.getIdentity(), accessRights) || hasRole(PortfolioRoles.invitee, ureq.getIdentity(), accessRights)) {
boolean readOnly = (pageStatus == PageStatus.draft) || (pageStatus == PageStatus.closed) || (pageStatus == PageStatus.deleted) || onePage;
if (assignment.isReviewerSeeAutoEvaluation()) {
Identity owner = getOwner(accessRights);
List<Identity> reviewers = Collections.singletonList(ureq.getIdentity());
ctrl = new MultiEvaluationFormController(ureq, wControl, owner, reviewers, body, re, true, readOnly, onePage, anonym);
} else {
ctrl = new EvaluationFormController(ureq, wControl, ureq.getIdentity(), body, re, readOnly, !readOnly);
}
}
}
return ctrl;
}
use of org.olat.modules.portfolio.model.AccessRights in project OpenOLAT by OpenOLAT.
the class BinderInvitationContextEntryControllerCreator method createController.
@Override
public Controller createController(List<ContextEntry> ces, UserRequest ureq, WindowControl wControl) {
if (!ureq.getUserSession().getRoles().isInvitee()) {
return null;
}
Binder binder = getBinderFromContext(ces.get(0));
BinderConfiguration config = BinderConfiguration.createInvitationConfig();
List<AccessRights> rights = CoreSpringFactory.getImpl(PortfolioService.class).getAccessRights(binder, ureq.getIdentity());
BinderSecurityCallback secCallback = BinderSecurityCallbackFactory.getCallbackForInvitation(rights);
Controller binderCtrl = new PortfolioInvitationController(ureq, wControl, secCallback, binder, config);
LayoutMain3ColsController layoutCtr = new LayoutMain3ColsController(ureq, wControl, binderCtrl);
layoutCtr.addDisposableChildController(binderCtrl);
return layoutCtr;
}
use of org.olat.modules.portfolio.model.AccessRights in project OpenOLAT by OpenOLAT.
the class SharedPagesController method doSelectedPage.
private Activateable2 doSelectedPage(UserRequest ureq, SharedPageRow row) {
removeAsListenerAndDispose(pageCtrl);
Page reloadedPage = portfolioService.getPageByKey(row.getPageKey());
Binder binder = reloadedPage.getSection().getBinder();
OLATResourceable pageOres = OresHelper.createOLATResourceableInstance("Entry", reloadedPage.getKey());
WindowControl swControl = addToHistory(ureq, pageOres, null);
List<AccessRights> rights = portfolioService.getAccessRights(binder, getIdentity());
BinderSecurityCallback secCallback = BinderSecurityCallbackFactory.getCallbackForCoach(binder, rights);
pageCtrl = new PageRunController(ureq, swControl, stackPanel, secCallback, reloadedPage, false);
listenTo(pageCtrl);
stackPanel.pushController(reloadedPage.getTitle(), pageCtrl);
return pageCtrl;
}
use of org.olat.modules.portfolio.model.AccessRights in project openolat by klemens.
the class PortfolioServiceTest method binderAccessRights.
@Test
public void binderAccessRights() {
Identity owner = JunitTestHelper.createAndPersistIdentityAsRndUser("port-u-2");
String title = "My private binder";
String summary = "My live";
Binder binder = portfolioService.createNewBinder(title, summary, null, owner);
dbInstance.commitAndCloseSession();
// load right
List<AccessRights> rights = portfolioService.getAccessRights(binder);
Assert.assertNotNull(rights);
Assert.assertEquals(1, rights.size());
AccessRights ownerRight = rights.get(0);
Assert.assertEquals(binder.getKey(), ownerRight.getBinderKey());
Assert.assertEquals(owner, ownerRight.getIdentity());
Assert.assertEquals(PortfolioRoles.owner, ownerRight.getRole());
}
Aggregations