Search in sources :

Example 31 with ContextEntry

use of org.olat.core.id.context.ContextEntry in project OpenOLAT by OpenOLAT.

the class FOCourseNodeIndexer method checkAccess.

@Override
public boolean checkAccess(ContextEntry contextEntry, BusinessControl businessControl, Identity identity, Roles roles) {
    ContextEntry ce = businessControl.popLauncherContextEntry();
    if (ce == null || ce.getOLATResourceable() == null || ce.getOLATResourceable().getResourceableId() == null) {
        // it's the node itself
        return true;
    }
    Long resourceableId = ce.getOLATResourceable().getResourceableId();
    Message message = ForumManager.getInstance().loadMessage(resourceableId);
    if (message != null) {
        Message threadtop = message.getThreadtop();
        if (threadtop == null) {
            threadtop = message;
        }
        boolean isMessageHidden = Status.getStatus(threadtop.getStatusCode()).isHidden();
        // TODO: (LD) fix this!!! - the contextEntry is not the right context for this check
        if (isMessageHidden && !BaseSecurityManager.getInstance().isIdentityPermittedOnResourceable(identity, Constants.PERMISSION_ACCESS, contextEntry.getOLATResourceable())) {
            return false;
        }
    }
    return super.checkAccess(contextEntry, businessControl, identity, roles);
}
Also used : Message(org.olat.modules.fo.Message) ContextEntry(org.olat.core.id.context.ContextEntry)

Example 32 with ContextEntry

use of org.olat.core.id.context.ContextEntry in project OpenOLAT by OpenOLAT.

the class PodcastCourseNode method createNodeRunConstructionResult.

/**
 * @see org.olat.course.nodes.AbstractAccessableCourseNode#createNodeRunConstructionResult(org.olat.core.gui.UserRequest,
 *      org.olat.core.gui.control.WindowControl,
 *      org.olat.course.run.userview.UserCourseEnvironment,
 *      org.olat.course.run.userview.NodeEvaluation, java.lang.String)
 */
@Override
public NodeRunConstructionResult createNodeRunConstructionResult(UserRequest ureq, WindowControl control, UserCourseEnvironment userCourseEnv, NodeEvaluation ne, String nodecmd) {
    RepositoryEntry entry = getReferencedRepositoryEntry();
    // create business path courseID:nodeID
    // userCourseEnv.getCourseEnvironment().getCourseResourceableId();
    // getIdent();
    Long courseId = userCourseEnv.getCourseEnvironment().getCourseResourceableId();
    String nodeId = this.getIdent();
    boolean isAdmin = ureq.getUserSession().getRoles().isOLATAdmin();
    boolean isGuest = ureq.getUserSession().getRoles().isGuestOnly();
    boolean isOwner = RepositoryManager.getInstance().isOwnerOfRepositoryEntry(ureq.getIdentity(), entry);
    FeedSecurityCallback callback;
    if (userCourseEnv.isCourseReadOnly()) {
        callback = new FeedReadOnlySecurityCallback();
    } else {
        callback = new FeedNodeSecurityCallback(ne, isAdmin, isOwner, isGuest);
    }
    SubscriptionContext subsContext = CourseModule.createSubscriptionContext(userCourseEnv.getCourseEnvironment(), this);
    callback.setSubscriptionContext(subsContext);
    ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrap(this));
    FeedMainController podcastCtr = PodcastUIFactory.getInstance(ureq.getLocale()).createMainController(entry.getOlatResource(), ureq, control, callback, courseId, nodeId);
    List<ContextEntry> entries = BusinessControlFactory.getInstance().createCEListFromResourceType(nodecmd);
    podcastCtr.activate(ureq, entries, null);
    Controller wrapperCtrl = TitledWrapperHelper.getWrapper(ureq, control, podcastCtr, this, "o_podcast_icon");
    NodeRunConstructionResult result = new NodeRunConstructionResult(wrapperCtrl);
    return result;
}
Also used : FeedMainController(org.olat.modules.webFeed.ui.FeedMainController) FeedSecurityCallback(org.olat.modules.webFeed.FeedSecurityCallback) RepositoryEntry(org.olat.repository.RepositoryEntry) TabbableController(org.olat.core.gui.control.generic.tabbable.TabbableController) FeedMainController(org.olat.modules.webFeed.ui.FeedMainController) PodcastNodeEditController(org.olat.course.nodes.feed.podcast.PodcastNodeEditController) FeedNodeEditController(org.olat.course.nodes.feed.FeedNodeEditController) Controller(org.olat.core.gui.control.Controller) NodeEditController(org.olat.course.editor.NodeEditController) FeedPeekviewController(org.olat.course.nodes.feed.FeedPeekviewController) NodeRunConstructionResult(org.olat.course.run.navigation.NodeRunConstructionResult) ContextEntry(org.olat.core.id.context.ContextEntry) FeedNodeSecurityCallback(org.olat.course.nodes.feed.FeedNodeSecurityCallback) SubscriptionContext(org.olat.core.commons.services.notifications.SubscriptionContext) FeedReadOnlySecurityCallback(org.olat.modules.webFeed.FeedReadOnlySecurityCallback)

Example 33 with ContextEntry

use of org.olat.core.id.context.ContextEntry in project OpenOLAT by OpenOLAT.

the class PaypalTransactionsController method addSearchToHistory.

protected void addSearchToHistory(UserRequest ureq) {
    String transactionId = tableEl.getQuickSearchString();
    StateMapped state = new StateMapped();
    if (StringHelper.containsNonWhitespace(transactionId)) {
        state.getDelegate().put("transactionId", transactionId);
    }
    ContextEntry currentEntry = getWindowControl().getBusinessControl().getCurrentContextEntry();
    if (currentEntry != null) {
        currentEntry.setTransientState(state);
    }
    addToHistory(ureq, getWindowControl());
}
Also used : StateMapped(org.olat.core.id.context.StateMapped) ContextEntry(org.olat.core.id.context.ContextEntry)

Example 34 with ContextEntry

use of org.olat.core.id.context.ContextEntry in project OpenOLAT by OpenOLAT.

the class OrdersAdminController method addSearchToHistory.

protected void addSearchToHistory(UserRequest ureq) {
    StateEntry state = searchForm == null ? null : searchForm.getStateEntry();
    ContextEntry currentEntry = getWindowControl().getBusinessControl().getCurrentContextEntry();
    if (currentEntry != null) {
        currentEntry.setTransientState(state);
    }
    addToHistory(ureq, getWindowControl());
}
Also used : StateEntry(org.olat.core.id.context.StateEntry) ContextEntry(org.olat.core.id.context.ContextEntry)

Example 35 with ContextEntry

use of org.olat.core.id.context.ContextEntry in project OpenOLAT by OpenOLAT.

the class PaypalMapper method handle.

@Override
public MediaResource handle(String relPath, HttpServletRequest request) {
    List<ContextEntry> entries = null;
    UserSession usess = CoreSpringFactory.getImpl(UserSessionManager.class).getUserSession(request);
    try {
        entries = BusinessControlFactory.getInstance().createCEListFromString(businessPath);
        if (relPath.indexOf(';') > 0) {
            relPath = relPath.substring(0, relPath.indexOf(';'));
        }
        if (relPath.indexOf('?') > 0) {
            relPath = relPath.substring(0, relPath.indexOf('?'));
        }
        String uuid = relPath.substring(1, relPath.length() - 5);
        paypalManager.updateTransaction(uuid);
        usess.putEntryInNonClearedStore("paypal-uuid", uuid);
    } catch (Exception e) {
        log.error("", e);
        usess.putEntryInNonClearedStore("paypal-mapper-error", Boolean.TRUE);
    }
    String resourceUrl = BusinessControlFactory.getInstance().getBusinessPathAsURIFromCEList(entries);
    MediaResource redirect = new RedirectMediaResource(Settings.getServerContextPathURI() + "/auth/" + resourceUrl);
    return redirect;
}
Also used : UserSessionManager(org.olat.core.util.session.UserSessionManager) UserSession(org.olat.core.util.UserSession) RedirectMediaResource(org.olat.core.gui.media.RedirectMediaResource) MediaResource(org.olat.core.gui.media.MediaResource) RedirectMediaResource(org.olat.core.gui.media.RedirectMediaResource) ContextEntry(org.olat.core.id.context.ContextEntry)

Aggregations

ContextEntry (org.olat.core.id.context.ContextEntry)270 OLATResourceable (org.olat.core.id.OLATResourceable)78 WindowControl (org.olat.core.gui.control.WindowControl)58 Activateable2 (org.olat.core.gui.control.generic.dtabs.Activateable2)44 ArrayList (java.util.ArrayList)42 TreeNode (org.olat.core.gui.components.tree.TreeNode)30 Controller (org.olat.core.gui.control.Controller)26 RepositoryEntry (org.olat.repository.RepositoryEntry)24 List (java.util.List)22 Identity (org.olat.core.id.Identity)22 BusinessControl (org.olat.core.id.context.BusinessControl)22 LayoutMain3ColsController (org.olat.core.commons.fullWebApp.LayoutMain3ColsController)20 BusinessControlFactory (org.olat.core.id.context.BusinessControlFactory)18 HistoryPoint (org.olat.core.id.context.HistoryPoint)18 CollaborationTools (org.olat.collaboration.CollaborationTools)16 GenericTreeNode (org.olat.core.gui.components.tree.GenericTreeNode)14 UserSession (org.olat.core.util.UserSession)14 CourseNode (org.olat.course.nodes.CourseNode)14 SubscriptionContext (org.olat.core.commons.services.notifications.SubscriptionContext)12 Translator (org.olat.core.gui.translator.Translator)12