diff --git a/src/main/java/org/olat/modules/qpool/ui/AbstractItemListController.java b/src/main/java/org/olat/modules/qpool/ui/AbstractItemListController.java index f95ee72b1f784178a76351012abdb1b80a332601..0c82678227db2f06953e43dea6bc86efe9d46449 100644 --- a/src/main/java/org/olat/modules/qpool/ui/AbstractItemListController.java +++ b/src/main/java/org/olat/modules/qpool/ui/AbstractItemListController.java @@ -113,14 +113,14 @@ public abstract class AbstractItemListController extends FormBasicController this(ureq, wControl, securityCallback, source, null, key, searchAllTaxonomyLevels); } - public AbstractItemListController(UserRequest ureq, WindowControl wControl, QuestionItemsSource source, - String key) { - this(ureq, wControl, null, source, null, key, false); + public AbstractItemListController(UserRequest ureq, WindowControl wControl, QPoolSecurityCallback securityCallback, + QuestionItemsSource source, String key) { + this(ureq, wControl, securityCallback, source, null, key, false); } - public AbstractItemListController(UserRequest ureq, WindowControl wControl, QuestionItemsSource source, - String restrictToFormat, String key) { - this(ureq, wControl, null, source, restrictToFormat, key, false); + public AbstractItemListController(UserRequest ureq, WindowControl wControl, QPoolSecurityCallback securityCallback, + QuestionItemsSource source, String restrictToFormat, String key) { + this(ureq, wControl, securityCallback, source, restrictToFormat, key, false); } public AbstractItemListController(UserRequest ureq, WindowControl wControl, QPoolSecurityCallback securityCallback, diff --git a/src/main/java/org/olat/modules/qpool/ui/ItemListController.java b/src/main/java/org/olat/modules/qpool/ui/ItemListController.java index b4acafb112e2687dac253eed6d8315c5481ded82..20bc220e932609abc36271e572ec4d4bc303544c 100644 --- a/src/main/java/org/olat/modules/qpool/ui/ItemListController.java +++ b/src/main/java/org/olat/modules/qpool/ui/ItemListController.java @@ -29,6 +29,7 @@ import org.olat.core.gui.components.form.flexible.elements.FormLink; import org.olat.core.gui.components.form.flexible.impl.FormEvent; import org.olat.core.gui.components.link.Link; import org.olat.core.gui.control.WindowControl; +import org.olat.modules.qpool.QPoolSecurityCallback; import org.olat.modules.qpool.QuestionItemView; import org.olat.modules.qpool.ui.events.QItemViewEvent; @@ -42,8 +43,8 @@ public class ItemListController extends AbstractItemListController { private FormLink selectLink; - public ItemListController(UserRequest ureq, WindowControl wControl, QuestionItemsSource source) { - super(ureq, wControl, source, "select"); + public ItemListController(UserRequest ureq, WindowControl wControl, QPoolSecurityCallback secCallback, QuestionItemsSource source) { + super(ureq, wControl, secCallback, source, "select"); initForm(ureq); } diff --git a/src/main/java/org/olat/modules/qpool/ui/ItemListMyCompetencesController.java b/src/main/java/org/olat/modules/qpool/ui/ItemListMyCompetencesController.java index 15322ce987fc8605be911748b0242ed2082086e5..533351eaf51e84bc9784491ef724776e055f15fe 100644 --- a/src/main/java/org/olat/modules/qpool/ui/ItemListMyCompetencesController.java +++ b/src/main/java/org/olat/modules/qpool/ui/ItemListMyCompetencesController.java @@ -31,6 +31,7 @@ import org.olat.core.gui.components.form.flexible.impl.FormEvent; import org.olat.core.gui.components.link.Link; import org.olat.core.gui.control.WindowControl; import org.olat.core.util.StringHelper; +import org.olat.modules.qpool.QPoolSecurityCallback; import org.olat.modules.qpool.QuestionItemView; import org.olat.modules.qpool.ui.datasource.EmptyItemsSource; import org.olat.modules.qpool.ui.datasource.FinalItemsSource; @@ -54,8 +55,8 @@ public class ItemListMyCompetencesController extends AbstractItemListController private QPoolTaxonomyTreeBuilder qpoolTaxonomyTreeBuilder; - public ItemListMyCompetencesController(UserRequest ureq, WindowControl wControl, String restrictToFormat) { - super(ureq, wControl, new EmptyItemsSource(), restrictToFormat, "select"); + public ItemListMyCompetencesController(UserRequest ureq, WindowControl wControl, QPoolSecurityCallback secCallback, String restrictToFormat) { + super(ureq, wControl, secCallback, new EmptyItemsSource(), restrictToFormat, "select"); } @Override diff --git a/src/main/java/org/olat/modules/qpool/ui/ItemListMyListsController.java b/src/main/java/org/olat/modules/qpool/ui/ItemListMyListsController.java index 8966fcdc150d57a03a8e5249ef391a9717d58f83..206eb3559500d8799630ec97d27e14c0797610e9 100644 --- a/src/main/java/org/olat/modules/qpool/ui/ItemListMyListsController.java +++ b/src/main/java/org/olat/modules/qpool/ui/ItemListMyListsController.java @@ -31,6 +31,7 @@ import org.olat.core.gui.components.form.flexible.impl.FormEvent; import org.olat.core.gui.components.link.Link; import org.olat.core.gui.control.WindowControl; import org.olat.core.util.StringHelper; +import org.olat.modules.qpool.QPoolSecurityCallback; import org.olat.modules.qpool.QuestionItemCollection; import org.olat.modules.qpool.QuestionItemView; import org.olat.modules.qpool.ui.datasource.CollectionOfItemsSource; @@ -50,8 +51,8 @@ public class ItemListMyListsController extends AbstractItemListController { private List<QuestionItemCollection> myCollections; - public ItemListMyListsController(UserRequest ureq, WindowControl wControl, String restrictToFormat) { - super(ureq, wControl, new EmptyItemsSource(), restrictToFormat, "select"); + public ItemListMyListsController(UserRequest ureq, WindowControl wControl, QPoolSecurityCallback secCallback, String restrictToFormat) { + super(ureq, wControl, secCallback, new EmptyItemsSource(), restrictToFormat, "select"); } @Override diff --git a/src/main/java/org/olat/modules/qpool/ui/ItemListMySharesController.java b/src/main/java/org/olat/modules/qpool/ui/ItemListMySharesController.java index d1820c25430d028b5e724ba33b4609e86f76ffd9..9706166141ecb9be33709aef680db4c4b72c88af 100644 --- a/src/main/java/org/olat/modules/qpool/ui/ItemListMySharesController.java +++ b/src/main/java/org/olat/modules/qpool/ui/ItemListMySharesController.java @@ -33,6 +33,7 @@ import org.olat.core.gui.control.WindowControl; import org.olat.core.util.StringHelper; import org.olat.group.BusinessGroup; import org.olat.modules.qpool.Pool; +import org.olat.modules.qpool.QPoolSecurityCallback; import org.olat.modules.qpool.QuestionItemView; import org.olat.modules.qpool.ui.datasource.EmptyItemsSource; import org.olat.modules.qpool.ui.datasource.PoolItemsSource; @@ -53,8 +54,8 @@ public class ItemListMySharesController extends AbstractItemListController { private List<Pool> myPools; private List<BusinessGroup> myGroups; - public ItemListMySharesController(UserRequest ureq, WindowControl wControl, String restrictToFormat) { - super(ureq, wControl, new EmptyItemsSource(), restrictToFormat, "select"); + public ItemListMySharesController(UserRequest ureq, WindowControl wControl, QPoolSecurityCallback secCallback, String restrictToFormat) { + super(ureq, wControl, secCallback, new EmptyItemsSource(), restrictToFormat, "select"); } @Override diff --git a/src/main/java/org/olat/modules/qpool/ui/SelectItemController.java b/src/main/java/org/olat/modules/qpool/ui/SelectItemController.java index 64c72045ebe563b2a28d6ddbbb83ffbb0f5748ae..cf2c147c427faf07b88a876dca3e0c298cfd8dd2 100644 --- a/src/main/java/org/olat/modules/qpool/ui/SelectItemController.java +++ b/src/main/java/org/olat/modules/qpool/ui/SelectItemController.java @@ -32,7 +32,10 @@ import org.olat.core.gui.control.Event; import org.olat.core.gui.control.WindowControl; import org.olat.core.gui.control.controller.BasicController; import org.olat.core.util.StringHelper; +import org.olat.core.util.UserSession; +import org.olat.modules.qpool.QPoolSecurityCallback; import org.olat.modules.qpool.QuestionPoolModule; +import org.olat.modules.qpool.security.QPoolSecurityCallbackFactory; import org.olat.modules.qpool.ui.datasource.DefaultItemsSource; import org.olat.modules.qpool.ui.datasource.MarkedItemsSource; import org.olat.modules.qpool.ui.datasource.MyItemsSource; @@ -58,14 +61,21 @@ public class SelectItemController extends BasicController { private ItemListMyCompetencesController myCompetencesCtrl; private String restrictToFormat; + private final QPoolSecurityCallback secCallback; + @Autowired private QuestionPoolModule qpoolModule; + @Autowired + private QPoolSecurityCallbackFactory qPoolSecurityCallbackFactory; public SelectItemController(UserRequest ureq, WindowControl wControl, String restrictToFormat) { super(ureq, wControl); this.restrictToFormat = restrictToFormat; mainVC = createVelocityContainer("item_list_overview"); + UserSession usess = ureq.getUserSession(); + secCallback = qPoolSecurityCallbackFactory.createQPoolSecurityCallback(usess.getRoles()); + int marked = updateMarkedItems(ureq); if(marked <= 0) { updateOwnedGroups(ureq); @@ -129,7 +139,7 @@ public class SelectItemController extends BasicController { DefaultItemsSource source = new MarkedItemsSource(getIdentity(), ureq.getUserSession().getRoles(), "Fav"); source.getDefaultParams().setFavoritOnly(true); source.getDefaultParams().setFormat(restrictToFormat); - markedItemsCtrl = new ItemListController(ureq, getWindowControl(), source); + markedItemsCtrl = new ItemListController(ureq, getWindowControl(), secCallback, source); listenTo(markedItemsCtrl); } int numOfMarkedItems = markedItemsCtrl.updateList(); @@ -142,7 +152,7 @@ public class SelectItemController extends BasicController { DefaultItemsSource source = new MyItemsSource(getIdentity(), ureq.getUserSession().getRoles(), "My"); source.getDefaultParams().setAuthor(getIdentity()); source.getDefaultParams().setFormat(restrictToFormat); - ownedItemsCtrl = new ItemListController(ureq, getWindowControl(), source); + ownedItemsCtrl = new ItemListController(ureq, getWindowControl(), secCallback, source); listenTo(ownedItemsCtrl); } ownedItemsCtrl.updateList(); @@ -151,7 +161,7 @@ public class SelectItemController extends BasicController { private void updateMyLists(UserRequest ureq) { if(myListsCtrl == null) { - myListsCtrl = new ItemListMyListsController(ureq, getWindowControl(), restrictToFormat); + myListsCtrl = new ItemListMyListsController(ureq, getWindowControl(), secCallback, restrictToFormat); listenTo(myListsCtrl); } mainVC.put("itemList", myListsCtrl.getInitialComponent()); @@ -159,7 +169,7 @@ public class SelectItemController extends BasicController { private void updateMyShares(UserRequest ureq) { if(mySharesCtrl == null) { - mySharesCtrl = new ItemListMySharesController(ureq, getWindowControl(), restrictToFormat); + mySharesCtrl = new ItemListMySharesController(ureq, getWindowControl(), secCallback, restrictToFormat); listenTo(mySharesCtrl); } mainVC.put("itemList", mySharesCtrl.getInitialComponent()); @@ -167,7 +177,7 @@ public class SelectItemController extends BasicController { private void updateMyCompetences(UserRequest ureq) { if(myCompetencesCtrl == null) { - myCompetencesCtrl = new ItemListMyCompetencesController(ureq, getWindowControl(), restrictToFormat); + myCompetencesCtrl = new ItemListMyCompetencesController(ureq, getWindowControl(), secCallback, restrictToFormat); listenTo(myCompetencesCtrl); } mainVC.put("itemList", myCompetencesCtrl.getInitialComponent());