use of org.olat.core.commons.modules.glossary.GlossarySecurityCallbackImpl in project OpenOLAT by OpenOLAT.
the class CourseGlossaryFactory method createCourseGlossaryMainRunController.
/**
* The glossarymaincontroller allows browsing in the glossary. A flag enables
* the edit mode.
*
* @param windowControl
* @param ureq
* @param courseConfig use the glossary configuration from the given course
* configuration
* @param hasGlossaryEditRights
* @return
*/
public static GlossaryMainController createCourseGlossaryMainRunController(WindowControl lwControl, UserRequest lureq, CourseConfig cc, boolean hasGlossaryRights) {
if (cc.hasGlossary()) {
RepositoryEntry repoEntry = RepositoryManager.getInstance().lookupRepositoryEntryBySoftkey(cc.getGlossarySoftKey(), false);
if (repoEntry == null) {
// seems to be removed
return null;
}
RepositoryService repositoryService = CoreSpringFactory.getImpl(RepositoryService.class);
boolean owner = repositoryService.hasRole(lureq.getIdentity(), repoEntry, GroupRoles.owner.name());
VFSContainer glossaryFolder = GlossaryManager.getInstance().getGlossaryRootFolder(repoEntry.getOlatResource());
Properties glossProps = GlossaryItemManager.getInstance().getGlossaryConfig(glossaryFolder);
boolean editUsersEnabled = "true".equals(glossProps.getProperty(GlossaryItemManager.EDIT_USERS));
GlossarySecurityCallback secCallback;
if (lureq.getUserSession().getRoles().isGuestOnly()) {
secCallback = new GlossarySecurityCallbackImpl();
} else {
secCallback = new GlossarySecurityCallbackImpl(hasGlossaryRights, owner, editUsersEnabled, lureq.getIdentity().getKey());
}
return new GlossaryMainController(lwControl, lureq, glossaryFolder, repoEntry.getOlatResource(), secCallback, true);
}
return null;
}
use of org.olat.core.commons.modules.glossary.GlossarySecurityCallbackImpl in project openolat by klemens.
the class CourseGlossaryFactory method createCourseGlossaryMainRunController.
/**
* The glossarymaincontroller allows browsing in the glossary. A flag enables
* the edit mode.
*
* @param windowControl
* @param ureq
* @param courseConfig use the glossary configuration from the given course
* configuration
* @param hasGlossaryEditRights
* @return
*/
public static GlossaryMainController createCourseGlossaryMainRunController(WindowControl lwControl, UserRequest lureq, CourseConfig cc, boolean hasGlossaryRights) {
if (cc.hasGlossary()) {
RepositoryEntry repoEntry = RepositoryManager.getInstance().lookupRepositoryEntryBySoftkey(cc.getGlossarySoftKey(), false);
if (repoEntry == null) {
// seems to be removed
return null;
}
RepositoryService repositoryService = CoreSpringFactory.getImpl(RepositoryService.class);
boolean owner = repositoryService.hasRole(lureq.getIdentity(), repoEntry, GroupRoles.owner.name());
VFSContainer glossaryFolder = GlossaryManager.getInstance().getGlossaryRootFolder(repoEntry.getOlatResource());
Properties glossProps = GlossaryItemManager.getInstance().getGlossaryConfig(glossaryFolder);
boolean editUsersEnabled = "true".equals(glossProps.getProperty(GlossaryItemManager.EDIT_USERS));
GlossarySecurityCallback secCallback;
if (lureq.getUserSession().getRoles().isGuestOnly()) {
secCallback = new GlossarySecurityCallbackImpl();
} else {
secCallback = new GlossarySecurityCallbackImpl(hasGlossaryRights, owner, editUsersEnabled, lureq.getIdentity().getKey());
}
return new GlossaryMainController(lwControl, lureq, glossaryFolder, repoEntry.getOlatResource(), secCallback, true);
}
return null;
}
use of org.olat.core.commons.modules.glossary.GlossarySecurityCallbackImpl in project OpenOLAT by OpenOLAT.
the class GlossaryHandler method createEditorController.
@Override
public Controller createEditorController(RepositoryEntry re, UserRequest ureq, WindowControl wControl, TooledStackedPanel toolbar) {
VFSContainer glossaryFolder = GlossaryManager.getInstance().getGlossaryRootFolder(re.getOlatResource());
Properties glossProps = GlossaryItemManager.getInstance().getGlossaryConfig(glossaryFolder);
boolean editableByUser = "true".equals(glossProps.getProperty(GlossaryItemManager.EDIT_USERS));
GlossarySecurityCallback secCallback;
if (ureq.getUserSession().getRoles().isGuestOnly()) {
secCallback = new GlossarySecurityCallbackImpl();
} else {
secCallback = new GlossarySecurityCallbackImpl(true, true, editableByUser, ureq.getIdentity().getKey());
}
GlossaryMainController gctr = new GlossaryMainController(wControl, ureq, glossaryFolder, re.getOlatResource(), secCallback, false);
// use on column layout
LayoutMain3ColsController layoutCtr = new LayoutMain3ColsController(ureq, wControl, gctr);
// dispose content on layout dispose
layoutCtr.addDisposableChildController(gctr);
return layoutCtr;
}
use of org.olat.core.commons.modules.glossary.GlossarySecurityCallbackImpl in project openolat by klemens.
the class GlossaryHandler method createEditorController.
@Override
public Controller createEditorController(RepositoryEntry re, UserRequest ureq, WindowControl wControl, TooledStackedPanel toolbar) {
VFSContainer glossaryFolder = GlossaryManager.getInstance().getGlossaryRootFolder(re.getOlatResource());
Properties glossProps = GlossaryItemManager.getInstance().getGlossaryConfig(glossaryFolder);
boolean editableByUser = "true".equals(glossProps.getProperty(GlossaryItemManager.EDIT_USERS));
GlossarySecurityCallback secCallback;
if (ureq.getUserSession().getRoles().isGuestOnly()) {
secCallback = new GlossarySecurityCallbackImpl();
} else {
secCallback = new GlossarySecurityCallbackImpl(true, true, editableByUser, ureq.getIdentity().getKey());
}
GlossaryMainController gctr = new GlossaryMainController(wControl, ureq, glossaryFolder, re.getOlatResource(), secCallback, false);
// use on column layout
LayoutMain3ColsController layoutCtr = new LayoutMain3ColsController(ureq, wControl, gctr);
// dispose content on layout dispose
layoutCtr.addDisposableChildController(gctr);
return layoutCtr;
}
Aggregations