Search in sources :

Example 6 with RepositoryEntrySecurity

use of org.olat.repository.model.RepositoryEntrySecurity in project OpenOLAT by OpenOLAT.

the class BlogHandler method createLaunchController.

/**
 * @see org.olat.repository.handlers.RepositoryHandler#getLaunchController(org.olat.core.id.OLATResourceable,
 *      java.lang.String, org.olat.core.gui.UserRequest,
 *      org.olat.core.gui.control.WindowControl)
 */
@Override
public MainLayoutController createLaunchController(final RepositoryEntry re, RepositoryEntrySecurity reSecurity, UserRequest ureq, WindowControl wControl) {
    boolean isAdmin = ureq.getUserSession().getRoles().isOLATAdmin();
    boolean isOwner = RepositoryManager.getInstance().isOwnerOfRepositoryEntry(ureq.getIdentity(), re);
    final FeedSecurityCallback callback = new FeedResourceSecurityCallback(isAdmin, isOwner);
    SubscriptionContext subsContext = new SubscriptionContext(re.getOlatResource(), re.getSoftkey());
    callback.setSubscriptionContext(subsContext);
    return new FeedRuntimeController(ureq, wControl, re, reSecurity, new RuntimeControllerCreator() {

        @Override
        public Controller create(UserRequest uureq, WindowControl wwControl, TooledStackedPanel toolbarPanel, RepositoryEntry entry, RepositoryEntrySecurity security, AssessmentMode assessmentMode) {
            CoreSpringFactory.getImpl(UserCourseInformationsManager.class).updateUserCourseInformations(entry.getOlatResource(), uureq.getIdentity());
            return new FeedMainController(entry.getOlatResource(), uureq, wwControl, null, null, BlogUIFactory.getInstance(uureq.getLocale()), callback, null);
        }
    });
}
Also used : TooledStackedPanel(org.olat.core.gui.components.stack.TooledStackedPanel) AssessmentMode(org.olat.course.assessment.AssessmentMode) FeedMainController(org.olat.modules.webFeed.ui.FeedMainController) FeedSecurityCallback(org.olat.modules.webFeed.FeedSecurityCallback) RepositoryEntry(org.olat.repository.RepositoryEntry) FeedResourceSecurityCallback(org.olat.modules.webFeed.FeedResourceSecurityCallback) WindowControl(org.olat.core.gui.control.WindowControl) FeedMainController(org.olat.modules.webFeed.ui.FeedMainController) StepsMainRunController(org.olat.core.gui.control.generic.wizard.StepsMainRunController) MainLayoutController(org.olat.core.gui.control.generic.layout.MainLayoutController) Controller(org.olat.core.gui.control.Controller) FeedRuntimeController(org.olat.modules.webFeed.ui.FeedRuntimeController) FeedRuntimeController(org.olat.modules.webFeed.ui.FeedRuntimeController) RuntimeControllerCreator(org.olat.repository.ui.RepositoryEntryRuntimeController.RuntimeControllerCreator) RepositoryEntrySecurity(org.olat.repository.model.RepositoryEntrySecurity) SubscriptionContext(org.olat.core.commons.services.notifications.SubscriptionContext) UserRequest(org.olat.core.gui.UserRequest)

Example 7 with RepositoryEntrySecurity

use of org.olat.repository.model.RepositoryEntrySecurity in project OpenOLAT by OpenOLAT.

the class WikiHandler method createLaunchController.

@Override
public MainLayoutController createLaunchController(RepositoryEntry re, RepositoryEntrySecurity reSecurity, UserRequest ureq, WindowControl wControl) {
    // first handle special case: disabled wiki for security (XSS Attacks) reasons
    BaseSecurityModule securityModule = CoreSpringFactory.getImpl(BaseSecurityModule.class);
    if (!securityModule.isWikiEnabled()) {
        return RepositoyUIFactory.createRepoEntryDisabledDueToSecurityMessageController(ureq, wControl);
    }
    // check role
    boolean isOLatAdmin = ureq.getUserSession().getRoles().isOLATAdmin();
    boolean isGuestOnly = ureq.getUserSession().getRoles().isGuestOnly();
    boolean isResourceOwner = false;
    if (isOLatAdmin) {
        isResourceOwner = true;
    } else {
        isResourceOwner = reSecurity.isOwner();
    }
    OLATResource res = re.getOlatResource();
    BusinessControl bc = wControl.getBusinessControl();
    final ContextEntry ce = bc.popLauncherContextEntry();
    SubscriptionContext subsContext = new SubscriptionContext(res, WikiManager.WIKI_RESOURCE_FOLDER_NAME);
    final WikiSecurityCallback callback = new WikiSecurityCallbackImpl(null, isOLatAdmin, isGuestOnly, false, isResourceOwner, subsContext);
    RepositoryEntryRuntimeController runtime = new RepositoryEntryRuntimeController(ureq, wControl, re, reSecurity, new RuntimeControllerCreator() {

        @Override
        public Controller create(UserRequest uureq, WindowControl wwControl, TooledStackedPanel toolbarPanel, RepositoryEntry entry, RepositoryEntrySecurity security, AssessmentMode assessmentMode) {
            CoreSpringFactory.getImpl(UserCourseInformationsManager.class).updateUserCourseInformations(entry.getOlatResource(), uureq.getIdentity());
            Controller controller;
            if (ce != null) {
                // jump to a certain context
                OLATResourceable ores = ce.getOLATResourceable();
                String typeName = ores.getResourceableTypeName();
                String page = typeName.substring("page=".length());
                controller = new WikiMainController(uureq, wwControl, entry.getOlatResource(), callback, page);
            } else {
                controller = new WikiMainController(uureq, wwControl, entry.getOlatResource(), callback, null);
            }
            return new OLATResourceableListeningWrapperController(uureq, wwControl, entry.getOlatResource(), controller, null, uureq.getIdentity());
        }
    });
    return runtime;
}
Also used : TooledStackedPanel(org.olat.core.gui.components.stack.TooledStackedPanel) AssessmentMode(org.olat.course.assessment.AssessmentMode) OLATResourceable(org.olat.core.id.OLATResourceable) WikiMainController(org.olat.modules.wiki.WikiMainController) BusinessControl(org.olat.core.id.context.BusinessControl) BaseSecurityModule(org.olat.basesecurity.BaseSecurityModule) OLATResource(org.olat.resource.OLATResource) RepositoryEntry(org.olat.repository.RepositoryEntry) WindowControl(org.olat.core.gui.control.WindowControl) OLATResourceableListeningWrapperController(org.olat.core.util.controller.OLATResourceableListeningWrapperController) StepsMainRunController(org.olat.core.gui.control.generic.wizard.StepsMainRunController) MainLayoutController(org.olat.core.gui.control.generic.layout.MainLayoutController) RepositoryEntryRuntimeController(org.olat.repository.ui.RepositoryEntryRuntimeController) Controller(org.olat.core.gui.control.Controller) WikiMainController(org.olat.modules.wiki.WikiMainController) ContextEntry(org.olat.core.id.context.ContextEntry) RepositoryEntryRuntimeController(org.olat.repository.ui.RepositoryEntryRuntimeController) RuntimeControllerCreator(org.olat.repository.ui.RepositoryEntryRuntimeController.RuntimeControllerCreator) WikiSecurityCallbackImpl(org.olat.modules.wiki.WikiSecurityCallbackImpl) RepositoryEntrySecurity(org.olat.repository.model.RepositoryEntrySecurity) OLATResourceableListeningWrapperController(org.olat.core.util.controller.OLATResourceableListeningWrapperController) SubscriptionContext(org.olat.core.commons.services.notifications.SubscriptionContext) WikiSecurityCallback(org.olat.modules.wiki.WikiSecurityCallback) UserRequest(org.olat.core.gui.UserRequest)

Example 8 with RepositoryEntrySecurity

use of org.olat.repository.model.RepositoryEntrySecurity in project OpenOLAT by OpenOLAT.

the class PodcastHandler method createLaunchController.

@Override
public MainLayoutController createLaunchController(RepositoryEntry re, RepositoryEntrySecurity reSecurity, UserRequest ureq, WindowControl wControl) {
    boolean isAdmin = ureq.getUserSession().getRoles().isOLATAdmin();
    boolean isOwner = reSecurity.isOwner();
    final FeedSecurityCallback callback = new FeedResourceSecurityCallback(isAdmin, isOwner);
    SubscriptionContext subsContext = new SubscriptionContext(re.getOlatResource(), re.getSoftkey());
    callback.setSubscriptionContext(subsContext);
    return new FeedRuntimeController(ureq, wControl, re, reSecurity, new RuntimeControllerCreator() {

        @Override
        public Controller create(UserRequest uureq, WindowControl wwControl, TooledStackedPanel toolbarPanel, RepositoryEntry entry, RepositoryEntrySecurity security, AssessmentMode assessmentMode) {
            CoreSpringFactory.getImpl(UserCourseInformationsManager.class).updateUserCourseInformations(entry.getOlatResource(), uureq.getIdentity());
            return new FeedMainController(entry.getOlatResource(), uureq, wwControl, null, null, PodcastUIFactory.getInstance(uureq.getLocale()), callback, null);
        }
    });
}
Also used : TooledStackedPanel(org.olat.core.gui.components.stack.TooledStackedPanel) AssessmentMode(org.olat.course.assessment.AssessmentMode) FeedMainController(org.olat.modules.webFeed.ui.FeedMainController) FeedSecurityCallback(org.olat.modules.webFeed.FeedSecurityCallback) RepositoryEntry(org.olat.repository.RepositoryEntry) FeedResourceSecurityCallback(org.olat.modules.webFeed.FeedResourceSecurityCallback) WindowControl(org.olat.core.gui.control.WindowControl) FeedMainController(org.olat.modules.webFeed.ui.FeedMainController) StepsMainRunController(org.olat.core.gui.control.generic.wizard.StepsMainRunController) MainLayoutController(org.olat.core.gui.control.generic.layout.MainLayoutController) Controller(org.olat.core.gui.control.Controller) FeedRuntimeController(org.olat.modules.webFeed.ui.FeedRuntimeController) FeedRuntimeController(org.olat.modules.webFeed.ui.FeedRuntimeController) RuntimeControllerCreator(org.olat.repository.ui.RepositoryEntryRuntimeController.RuntimeControllerCreator) RepositoryEntrySecurity(org.olat.repository.model.RepositoryEntrySecurity) SubscriptionContext(org.olat.core.commons.services.notifications.SubscriptionContext) UserRequest(org.olat.core.gui.UserRequest)

Example 9 with RepositoryEntrySecurity

use of org.olat.repository.model.RepositoryEntrySecurity in project openolat by klemens.

the class CourseOptionsController method doSelectSharedFolder.

private void doSelectSharedFolder(UserRequest ureq, RepositoryEntry repoEntry) {
    folderNameEl.setValue(StringHelper.escapeHtml(repoEntry.getDisplayname()));
    folderNameEl.setUserObject(repoEntry);
    removeFolderCommand.setVisible(true);
    RepositoryEntrySecurity reSecurity = repositoryService.isAllowed(ureq, repoEntry);
    folderReadOnlyEl.setVisible(true);
    folderReadOnlyEl.setEnabled(reSecurity.isEntryAdmin());
    folderReadOnlyEl.select(onKeys[0], true);
    sharedFolderCont.setDirty(true);
}
Also used : RepositoryEntrySecurity(org.olat.repository.model.RepositoryEntrySecurity)

Example 10 with RepositoryEntrySecurity

use of org.olat.repository.model.RepositoryEntrySecurity in project openolat by klemens.

the class BlogHandler method createLaunchController.

/**
 * @see org.olat.repository.handlers.RepositoryHandler#getLaunchController(org.olat.core.id.OLATResourceable,
 *      java.lang.String, org.olat.core.gui.UserRequest,
 *      org.olat.core.gui.control.WindowControl)
 */
@Override
public MainLayoutController createLaunchController(final RepositoryEntry re, RepositoryEntrySecurity reSecurity, UserRequest ureq, WindowControl wControl) {
    boolean isAdmin = ureq.getUserSession().getRoles().isOLATAdmin();
    boolean isOwner = RepositoryManager.getInstance().isOwnerOfRepositoryEntry(ureq.getIdentity(), re);
    final FeedSecurityCallback callback = new FeedResourceSecurityCallback(isAdmin, isOwner);
    SubscriptionContext subsContext = new SubscriptionContext(re.getOlatResource(), re.getSoftkey());
    callback.setSubscriptionContext(subsContext);
    return new FeedRuntimeController(ureq, wControl, re, reSecurity, new RuntimeControllerCreator() {

        @Override
        public Controller create(UserRequest uureq, WindowControl wwControl, TooledStackedPanel toolbarPanel, RepositoryEntry entry, RepositoryEntrySecurity security, AssessmentMode assessmentMode) {
            CoreSpringFactory.getImpl(UserCourseInformationsManager.class).updateUserCourseInformations(entry.getOlatResource(), uureq.getIdentity());
            return new FeedMainController(entry.getOlatResource(), uureq, wwControl, null, null, BlogUIFactory.getInstance(uureq.getLocale()), callback, null);
        }
    });
}
Also used : TooledStackedPanel(org.olat.core.gui.components.stack.TooledStackedPanel) AssessmentMode(org.olat.course.assessment.AssessmentMode) FeedMainController(org.olat.modules.webFeed.ui.FeedMainController) FeedSecurityCallback(org.olat.modules.webFeed.FeedSecurityCallback) RepositoryEntry(org.olat.repository.RepositoryEntry) FeedResourceSecurityCallback(org.olat.modules.webFeed.FeedResourceSecurityCallback) WindowControl(org.olat.core.gui.control.WindowControl) FeedMainController(org.olat.modules.webFeed.ui.FeedMainController) StepsMainRunController(org.olat.core.gui.control.generic.wizard.StepsMainRunController) MainLayoutController(org.olat.core.gui.control.generic.layout.MainLayoutController) Controller(org.olat.core.gui.control.Controller) FeedRuntimeController(org.olat.modules.webFeed.ui.FeedRuntimeController) FeedRuntimeController(org.olat.modules.webFeed.ui.FeedRuntimeController) RuntimeControllerCreator(org.olat.repository.ui.RepositoryEntryRuntimeController.RuntimeControllerCreator) RepositoryEntrySecurity(org.olat.repository.model.RepositoryEntrySecurity) SubscriptionContext(org.olat.core.commons.services.notifications.SubscriptionContext) UserRequest(org.olat.core.gui.UserRequest)

Aggregations

RepositoryEntrySecurity (org.olat.repository.model.RepositoryEntrySecurity)22 RepositoryEntry (org.olat.repository.RepositoryEntry)16 WindowControl (org.olat.core.gui.control.WindowControl)14 MainLayoutController (org.olat.core.gui.control.generic.layout.MainLayoutController)12 UserRequest (org.olat.core.gui.UserRequest)10 TooledStackedPanel (org.olat.core.gui.components.stack.TooledStackedPanel)10 Controller (org.olat.core.gui.control.Controller)10 AssessmentMode (org.olat.course.assessment.AssessmentMode)10 RuntimeControllerCreator (org.olat.repository.ui.RepositoryEntryRuntimeController.RuntimeControllerCreator)10 StepsMainRunController (org.olat.core.gui.control.generic.wizard.StepsMainRunController)8 SubscriptionContext (org.olat.core.commons.services.notifications.SubscriptionContext)6 Roles (org.olat.core.id.Roles)6 ContextEntry (org.olat.core.id.context.ContextEntry)6 RepositoryManager (org.olat.repository.RepositoryManager)6 RepositoryService (org.olat.repository.RepositoryService)6 LayoutMain3ColsController (org.olat.core.commons.fullWebApp.LayoutMain3ColsController)4 OLATResourceable (org.olat.core.id.OLATResourceable)4 UserSession (org.olat.core.util.UserSession)4 VFSContainer (org.olat.core.util.vfs.VFSContainer)4 ReadOnlyCallback (org.olat.core.util.vfs.callbacks.ReadOnlyCallback)4