Skip to content
Snippets Groups Projects
Commit 3eb1284c authored by srosse's avatar srosse
Browse files

OO-665: add a specific security callback for reflexion to be more precise

parent f8b24379
No related branches found
No related tags found
No related merge requests found
Showing
with 54 additions and 29 deletions
<fieldset #if(!$!f.domReplacementWrapperRequired) id="$r.getCId()" #end class="o_form form #if ($off_css_class) $off_css_class #end $f.getContainerCssClass()" role="form"> <fieldset #if(!$!f.domReplacementWrapperRequired) id="$r.getCId()" #end class="o_form form #if ($off_css_class) $off_css_class #end $f.getContainerCssClass()" role="form">
#if ($off_title || $off_chelp_package) #if ($off_title && $off_chelp_package)
<legend> <legend>
#if ($off_chelp_package) #if ($off_chelp_package)
$r.contextHelpWithWrapper("$off_chelp_package","$off_chelp_page","$off_chelp_hover") $r.contextHelpWithWrapper("$off_chelp_package","$off_chelp_page","$off_chelp_hover")
#end #end
#if ($off_icon) #if ($off_icon)
<i class="$off_icon"> </i> <i class="$off_icon"> </i>
#end #end
$!off_title $!off_title
</legend> </legend>
#end #elseif ($off_title)
<legend>
#if ($off_icon)
<i class="$off_icon"> </i>
#end
$!off_title
</legend>
#elseif ($off_chelp_package)
<div class="clearfix">$r.contextHelpWithWrapper("$off_chelp_package","$off_chelp_page","$off_chelp_hover")</div>
#end
#if ($off_desc) <div class="o_desc">$off_desc</div> #end #if ($off_desc) <div class="o_desc">$off_desc</div> #end
#if ($off_warn) <div class="o_warning">$off_warn</div> #end #if ($off_warn) <div class="o_warning">$off_warn</div> #end
......
...@@ -37,6 +37,8 @@ public interface EPSecurityCallback { ...@@ -37,6 +37,8 @@ public interface EPSecurityCallback {
public boolean canEditStructure(); public boolean canEditStructure();
public boolean canEditReflexion();
public boolean canShareMap(); public boolean canShareMap();
public boolean canAddArtefact(); public boolean canAddArtefact();
......
...@@ -57,11 +57,12 @@ public class EPSecurityCallbackFactory { ...@@ -57,11 +57,12 @@ public class EPSecurityCallbackFactory {
public static boolean isLockNeeded(EPSecurityCallback secCallback) { public static boolean isLockNeeded(EPSecurityCallback secCallback) {
return secCallback.canAddArtefact() || secCallback.canAddPage() || secCallback.canAddStructure() return secCallback.canAddArtefact() || secCallback.canAddPage() || secCallback.canAddStructure()
|| secCallback.canEditStructure(); || secCallback.canEditStructure() || secCallback.canEditReflexion();
} }
public static EPSecurityCallback updateAfterFailedLock(EPSecurityCallback secCallback) { public static EPSecurityCallback updateAfterFailedLock(EPSecurityCallback secCallback) {
boolean canEditStructure = false; boolean canEditStructure = false;
boolean canEditReflexion = false;
boolean canShare = secCallback.canShareMap(); boolean canShare = secCallback.canShareMap();
boolean canAddArtefact = false; boolean canAddArtefact = false;
boolean canRemoveArtefactFromStruct = false; boolean canRemoveArtefactFromStruct = false;
...@@ -73,7 +74,7 @@ public class EPSecurityCallbackFactory { ...@@ -73,7 +74,7 @@ public class EPSecurityCallbackFactory {
boolean restrictionsEnabled = secCallback.isRestrictionsEnabled(); boolean restrictionsEnabled = secCallback.isRestrictionsEnabled();
boolean isOwner = secCallback.isOwner(); boolean isOwner = secCallback.isOwner();
return new EPSecurityCallbackImpl(canEditStructure, canShare, canAddArtefact, canRemoveArtefactFromStruct, canAddStructure, canAddPage, return new EPSecurityCallbackImpl(canEditStructure, canEditReflexion, canShare, canAddArtefact, canRemoveArtefactFromStruct, canAddStructure, canAddPage,
canView, canCommentAndRate, canSubmitAssess, restrictionsEnabled, isOwner); canView, canCommentAndRate, canSubmitAssess, restrictionsEnabled, isOwner);
} }
...@@ -89,6 +90,7 @@ public class EPSecurityCallbackFactory { ...@@ -89,6 +90,7 @@ public class EPSecurityCallbackFactory {
boolean isVisible = ePFMgr.isMapVisible(ureq.getIdentity(), map.getOlatResource()); boolean isVisible = ePFMgr.isMapVisible(ureq.getIdentity(), map.getOlatResource());
boolean canEditStructure = isOwner; boolean canEditStructure = isOwner;
boolean canEditReflexion = isOwner;
boolean canShare = isOwner; boolean canShare = isOwner;
boolean canAddArtefact = isOwner; boolean canAddArtefact = isOwner;
boolean canRemoveArtefactFromStruct = isOwner; boolean canRemoveArtefactFromStruct = isOwner;
...@@ -99,7 +101,7 @@ public class EPSecurityCallbackFactory { ...@@ -99,7 +101,7 @@ public class EPSecurityCallbackFactory {
boolean canSubmitAssess = false; boolean canSubmitAssess = false;
boolean restrictionsEnabled = false; boolean restrictionsEnabled = false;
return new EPSecurityCallbackImpl(canEditStructure, canShare, canAddArtefact, canRemoveArtefactFromStruct, canAddStructure, canAddPage, return new EPSecurityCallbackImpl(canEditStructure, canEditReflexion, canShare, canAddArtefact, canRemoveArtefactFromStruct, canAddStructure, canAddPage,
canView, canCommentAndRate, canSubmitAssess, restrictionsEnabled, isOwner); canView, canCommentAndRate, canSubmitAssess, restrictionsEnabled, isOwner);
} }
...@@ -117,6 +119,7 @@ public class EPSecurityCallbackFactory { ...@@ -117,6 +119,7 @@ public class EPSecurityCallbackFactory {
boolean open = !StructureStatusEnum.CLOSED.equals(map.getStatus()); boolean open = !StructureStatusEnum.CLOSED.equals(map.getStatus());
boolean canEditStructure = false; boolean canEditStructure = false;
boolean canEditReflexion = isOwner && open;
boolean canShare = (isOwner || isCoach); boolean canShare = (isOwner || isCoach);
boolean canAddArtefact = isOwner && open; boolean canAddArtefact = isOwner && open;
boolean canRemoveArtefactFromStruct = isOwner && open; boolean canRemoveArtefactFromStruct = isOwner && open;
...@@ -127,7 +130,7 @@ public class EPSecurityCallbackFactory { ...@@ -127,7 +130,7 @@ public class EPSecurityCallbackFactory {
boolean canSubmitAssess = isOwner; boolean canSubmitAssess = isOwner;
boolean restrictionsEnabled = true; boolean restrictionsEnabled = true;
return new EPSecurityCallbackImpl(canEditStructure, canShare, canAddArtefact, canRemoveArtefactFromStruct, canAddStructure, canAddPage, return new EPSecurityCallbackImpl(canEditStructure, canEditReflexion, canShare, canAddArtefact, canRemoveArtefactFromStruct, canAddStructure, canAddPage,
canView, canCommentAndRate, canSubmitAssess, restrictionsEnabled, isOwner); canView, canCommentAndRate, canSubmitAssess, restrictionsEnabled, isOwner);
} }
...@@ -151,6 +154,7 @@ public class EPSecurityCallbackFactory { ...@@ -151,6 +154,7 @@ public class EPSecurityCallbackFactory {
boolean open = !StructureStatusEnum.CLOSED.equals(map.getStatus()); boolean open = !StructureStatusEnum.CLOSED.equals(map.getStatus());
boolean canEditStructure = (isOwner || isAdmin) && open; boolean canEditStructure = (isOwner || isAdmin) && open;
boolean canEditReflexion = (isOwner) && open;
boolean canShare = false; boolean canShare = false;
boolean canAddArtefact = false; // (isOwner || isAdmin) && open; boolean canAddArtefact = false; // (isOwner || isAdmin) && open;
boolean canRemoveArtefactFromStruct = (isOwner || isAdmin) && open; boolean canRemoveArtefactFromStruct = (isOwner || isAdmin) && open;
...@@ -161,7 +165,7 @@ public class EPSecurityCallbackFactory { ...@@ -161,7 +165,7 @@ public class EPSecurityCallbackFactory {
boolean canSubmitAssess = false; boolean canSubmitAssess = false;
boolean restrictionsEnabled = true;//for author boolean restrictionsEnabled = true;//for author
return new EPSecurityCallbackImpl(canEditStructure, canShare, canAddArtefact, canRemoveArtefactFromStruct, canAddStructure, canAddPage, return new EPSecurityCallbackImpl(canEditStructure, canEditReflexion, canShare, canAddArtefact, canRemoveArtefactFromStruct, canAddStructure, canAddPage,
canView, canCommentAndRate, canSubmitAssess, restrictionsEnabled, isOwner); canView, canCommentAndRate, canSubmitAssess, restrictionsEnabled, isOwner);
} }
} }
...@@ -32,6 +32,7 @@ package org.olat.portfolio; ...@@ -32,6 +32,7 @@ package org.olat.portfolio;
public class EPSecurityCallbackImpl implements EPSecurityCallback { public class EPSecurityCallbackImpl implements EPSecurityCallback {
private final boolean canEditStructure; private final boolean canEditStructure;
private final boolean canEditReflexion;
private final boolean canShare; private final boolean canShare;
private final boolean canAddArtefact; private final boolean canAddArtefact;
private final boolean canRemoveArtefactFromStruct; private final boolean canRemoveArtefactFromStruct;
...@@ -45,6 +46,7 @@ public class EPSecurityCallbackImpl implements EPSecurityCallback { ...@@ -45,6 +46,7 @@ public class EPSecurityCallbackImpl implements EPSecurityCallback {
public EPSecurityCallbackImpl(boolean canEdit, boolean canView) { public EPSecurityCallbackImpl(boolean canEdit, boolean canView) {
this.canEditStructure = canEdit; this.canEditStructure = canEdit;
this.canEditReflexion = canEdit;
this.canShare = canEdit; this.canShare = canEdit;
this.canAddArtefact = canEdit; this.canAddArtefact = canEdit;
this.canRemoveArtefactFromStruct = canEdit; this.canRemoveArtefactFromStruct = canEdit;
...@@ -57,9 +59,10 @@ public class EPSecurityCallbackImpl implements EPSecurityCallback { ...@@ -57,9 +59,10 @@ public class EPSecurityCallbackImpl implements EPSecurityCallback {
this.isOwner = false;//TODO this.isOwner = false;//TODO
} }
protected EPSecurityCallbackImpl(boolean canEditStructure, boolean canShare, boolean canAddArtefact, boolean canRemoveArtefactFromStruct, boolean canAddStructure, boolean canAddPage, protected EPSecurityCallbackImpl(boolean canEditStructure, boolean canEditReflexion, boolean canShare, boolean canAddArtefact, boolean canRemoveArtefactFromStruct, boolean canAddStructure, boolean canAddPage,
boolean canView, boolean canCommentAndRate, boolean canSubmitAssess, boolean restrictionsEnabled, boolean isOwner) { boolean canView, boolean canCommentAndRate, boolean canSubmitAssess, boolean restrictionsEnabled, boolean isOwner) {
this.canEditStructure = canEditStructure; this.canEditStructure = canEditStructure;
this.canEditReflexion = canEditReflexion;
this.canShare = canShare; this.canShare = canShare;
this.canAddArtefact = canAddArtefact; this.canAddArtefact = canAddArtefact;
this.canRemoveArtefactFromStruct = canRemoveArtefactFromStruct; this.canRemoveArtefactFromStruct = canRemoveArtefactFromStruct;
...@@ -88,7 +91,12 @@ public class EPSecurityCallbackImpl implements EPSecurityCallback { ...@@ -88,7 +91,12 @@ public class EPSecurityCallbackImpl implements EPSecurityCallback {
public boolean canEditStructure() { public boolean canEditStructure() {
return canEditStructure; return canEditStructure;
} }
@Override
public boolean canEditReflexion() {
return canEditReflexion;
}
@Override @Override
public boolean canShareMap() { public boolean canShareMap() {
return canShare; return canShare;
......
...@@ -60,6 +60,11 @@ public class EPSecurityCallbackOwner implements EPSecurityCallback { ...@@ -60,6 +60,11 @@ public class EPSecurityCallbackOwner implements EPSecurityCallback {
return canEdit(); return canEdit();
} }
@Override
public boolean canEditReflexion() {
return canEdit();
}
@Override @Override
public boolean canShareMap() { public boolean canShareMap() {
return canEdit(); return canEdit();
......
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
*/ */
package org.olat.portfolio.ui.artefacts.edit; package org.olat.portfolio.ui.artefacts.edit;
import org.olat.core.CoreSpringFactory;
import org.olat.core.gui.UserRequest; import org.olat.core.gui.UserRequest;
import org.olat.core.gui.components.Component; import org.olat.core.gui.components.Component;
import org.olat.core.gui.control.Controller; import org.olat.core.gui.control.Controller;
...@@ -28,7 +27,6 @@ import org.olat.core.gui.control.WindowControl; ...@@ -28,7 +27,6 @@ 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.gui.control.generic.closablewrapper.CloseableCalloutWindowController; import org.olat.core.gui.control.generic.closablewrapper.CloseableCalloutWindowController;
import org.olat.core.gui.control.generic.closablewrapper.CloseableModalController; import org.olat.core.gui.control.generic.closablewrapper.CloseableModalController;
import org.olat.core.gui.translator.Translator;
import org.olat.core.util.StringHelper; import org.olat.core.util.StringHelper;
import org.olat.core.util.Util; import org.olat.core.util.Util;
import org.olat.portfolio.EPSecurityCallback; import org.olat.portfolio.EPSecurityCallback;
...@@ -42,6 +40,7 @@ import org.olat.portfolio.ui.artefacts.collect.EPReflexionChangeEvent; ...@@ -42,6 +40,7 @@ import org.olat.portfolio.ui.artefacts.collect.EPReflexionChangeEvent;
import org.olat.portfolio.ui.artefacts.view.EPArtefactViewController; import org.olat.portfolio.ui.artefacts.view.EPArtefactViewController;
import org.olat.portfolio.ui.artefacts.view.EPReflexionViewController; import org.olat.portfolio.ui.artefacts.view.EPReflexionViewController;
import org.olat.portfolio.ui.structel.EPStructureChangeEvent; import org.olat.portfolio.ui.structel.EPStructureChangeEvent;
import org.springframework.beans.factory.annotation.Autowired;
/** /**
* Description:<br> * Description:<br>
...@@ -53,7 +52,7 @@ import org.olat.portfolio.ui.structel.EPStructureChangeEvent; ...@@ -53,7 +52,7 @@ import org.olat.portfolio.ui.structel.EPStructureChangeEvent;
* @author Roman Haag, roman.haag@frentix.com, http://www.frentix.com * @author Roman Haag, roman.haag@frentix.com, http://www.frentix.com
*/ */
public class EPReflexionWrapperController extends BasicController { public class EPReflexionWrapperController extends BasicController {
@Autowired
private EPFrontendManager ePFMgr; private EPFrontendManager ePFMgr;
private Controller reflexionCtrl; private Controller reflexionCtrl;
private boolean mapClosed; private boolean mapClosed;
...@@ -65,7 +64,6 @@ public class EPReflexionWrapperController extends BasicController { ...@@ -65,7 +64,6 @@ public class EPReflexionWrapperController extends BasicController {
public EPReflexionWrapperController(UserRequest ureq, WindowControl wControl, EPSecurityCallback secCallback, AbstractArtefact artefact, public EPReflexionWrapperController(UserRequest ureq, WindowControl wControl, EPSecurityCallback secCallback, AbstractArtefact artefact,
PortfolioStructure struct) { PortfolioStructure struct) {
super(ureq, wControl); super(ureq, wControl);
ePFMgr = (EPFrontendManager) CoreSpringFactory.getBean("epFrontendManager");
if (struct != null && struct.getRoot() instanceof PortfolioStructureMap) { if (struct != null && struct.getRoot() instanceof PortfolioStructureMap) {
mapClosed = StructureStatusEnum.CLOSED.equals(((PortfolioStructureMap) struct.getRoot()).getStatus()); mapClosed = StructureStatusEnum.CLOSED.equals(((PortfolioStructureMap) struct.getRoot()).getStatus());
} else { } else {
...@@ -74,8 +72,7 @@ public class EPReflexionWrapperController extends BasicController { ...@@ -74,8 +72,7 @@ public class EPReflexionWrapperController extends BasicController {
this.secCallback = secCallback; this.secCallback = secCallback;
this.artefact = artefact; this.artefact = artefact;
this.struct = struct; this.struct = struct;
Translator pt = Util.createPackageTranslator(EPArtefactViewController.class, ureq.getLocale(), getTranslator()); setTranslator(Util.createPackageTranslator(EPArtefactViewController.class, ureq.getLocale(), getTranslator()));
setTranslator(pt);
init(ureq); init(ureq);
} }
...@@ -84,7 +81,7 @@ public class EPReflexionWrapperController extends BasicController { ...@@ -84,7 +81,7 @@ public class EPReflexionWrapperController extends BasicController {
removeAsListenerAndDispose(reflexionCtrl); removeAsListenerAndDispose(reflexionCtrl);
String title = ""; String title = "";
boolean artClosed = ePFMgr.isArtefactClosed(artefact); boolean artClosed = ePFMgr.isArtefactClosed(artefact);
if (mapClosed || !secCallback.canEditStructure() || (artClosed && struct == null)) { if (mapClosed || !secCallback.canEditReflexion() || (artClosed && struct == null)) {
// reflexion cannot be edited, view only! // reflexion cannot be edited, view only!
reflexionCtrl = new EPReflexionViewController(ureq, getWindowControl(), artefact, struct); reflexionCtrl = new EPReflexionViewController(ureq, getWindowControl(), artefact, struct);
} else { } else {
......
...@@ -31,11 +31,11 @@ import org.olat.core.gui.control.controller.BasicController; ...@@ -31,11 +31,11 @@ import org.olat.core.gui.control.controller.BasicController;
import org.olat.core.gui.control.generic.closablewrapper.CloseableCalloutWindowController; import org.olat.core.gui.control.generic.closablewrapper.CloseableCalloutWindowController;
import org.olat.core.gui.control.generic.closablewrapper.CloseableModalController; import org.olat.core.gui.control.generic.closablewrapper.CloseableModalController;
import org.olat.portfolio.EPSecurityCallback; import org.olat.portfolio.EPSecurityCallback;
import org.olat.portfolio.EPUIFactory;
import org.olat.portfolio.manager.EPFrontendManager; import org.olat.portfolio.manager.EPFrontendManager;
import org.olat.portfolio.model.artefacts.AbstractArtefact; import org.olat.portfolio.model.artefacts.AbstractArtefact;
import org.olat.portfolio.model.structel.PortfolioStructure; import org.olat.portfolio.model.structel.PortfolioStructure;
import org.olat.portfolio.ui.artefacts.collect.EPCollectStepForm04; import org.olat.portfolio.ui.artefacts.collect.EPCollectStepForm04;
import org.olat.portfolio.ui.artefacts.edit.EPReflexionWrapperController;
import org.olat.portfolio.ui.structel.EPStructureChangeEvent; import org.olat.portfolio.ui.structel.EPStructureChangeEvent;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -104,7 +104,7 @@ public class EPArtefactViewOptionsLinkController extends BasicController { ...@@ -104,7 +104,7 @@ public class EPArtefactViewOptionsLinkController extends BasicController {
showMoveTree(ureq); showMoveTree(ureq);
} else if (source == reflexionLink) { } else if (source == reflexionLink) {
closeArtefactOptionsCallout(); closeArtefactOptionsCallout();
reflexionCtrl = EPUIFactory.getReflexionPopup(ureq, getWindowControl(), secCallback, artefact, struct); reflexionCtrl = new EPReflexionWrapperController(ureq, getWindowControl(), secCallback, artefact, struct);
listenTo(reflexionCtrl); listenTo(reflexionCtrl);
} }
} }
......
...@@ -159,7 +159,7 @@ public class EPMultipleArtefactsAsTableController extends BasicController implem ...@@ -159,7 +159,7 @@ public class EPMultipleArtefactsAsTableController extends BasicController implem
StaticColumnDescriptor staticDescr; StaticColumnDescriptor staticDescr;
if(!artefactChooseMode) { if(!artefactChooseMode) {
if(mapClosed || !secCallback.canEditStructure()) { // change link-description in row, when map is closed or viewed by another person if(mapClosed || !secCallback.canEditReflexion()) { // change link-description in row, when map is closed or viewed by another person
staticDescr = new StaticColumnDescriptor(CMD_REFLEXION, "table.header.reflexion", translate("table.header.view")); staticDescr = new StaticColumnDescriptor(CMD_REFLEXION, "table.header.reflexion", translate("table.header.view"));
} else { } else {
staticDescr = new StaticColumnDescriptor(CMD_REFLEXION, "table.header.reflexion", translate("table.row.reflexion")); staticDescr = new StaticColumnDescriptor(CMD_REFLEXION, "table.header.reflexion", translate("table.row.reflexion"));
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
<div class="o_struct_submit_assess_btn">$r.render("map.submit.assess")</div> <div class="o_struct_submit_assess_btn">$r.render("map.submit.assess")</div>
#end #end
#if($closed) #if($closed)
<div class="o_artefact_closed"><span title=" $r.translate("map.is.closed.hint") ">&nbsp;&nbsp;&nbsp;&nbsp;</span></div> <div><i class="o_icon o_artefact_closed" title=" $r.translate("map.is.closed.hint") "> </i></div>
#end #end
</div> </div>
<h1>$r.escapeHtml($map.title)</h1> <h1>$r.escapeHtml($map.title)</h1>
......
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