Search in sources :

Example 21 with ContextEntry

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

the class BinderController method activateEntries.

private void activateEntries(UserRequest ureq) {
    int numOfPages = doOpenEntries(ureq).getNumOfPages();
    if (numOfPages == 1 && !secCallback.canEditBinder()) {
        PortfolioElementRow firstPage = entriesCtrl.getFirstPage();
        if (firstPage != null) {
            OLATResourceable ores = OresHelper.createOLATResourceableInstance("Page", firstPage.getPage().getKey());
            List<ContextEntry> entries = BusinessControlFactory.getInstance().createCEListFromString(ores);
            entriesCtrl.activate(ureq, entries, null);
        }
    }
}
Also used : PortfolioElementRow(org.olat.modules.portfolio.ui.model.PortfolioElementRow) OLATResourceable(org.olat.core.id.OLATResourceable) ContextEntry(org.olat.core.id.context.ContextEntry)

Example 22 with ContextEntry

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

the class AbstractHierarchicalIndexer method checkAccess.

/**
 * @param businessControl
 * @param identity
 * @param roles
 * @return
 */
public boolean checkAccess(BusinessControl businessControl, Identity identity, Roles roles) {
    boolean debug = isLogDebugEnabled();
    if (debug)
        logDebug("checkAccess for businessControl=" + businessControl + "  identity=" + identity + "  roles=" + roles);
    ContextEntry contextEntry = businessControl.popLauncherContextEntry();
    if (contextEntry != null) {
        // there is an other context-entry => go further
        OLATResourceable ores = contextEntry.getOLATResourceable();
        String type = ores.getResourceableTypeName();
        List<Indexer> indexers = getIndexerByType(type);
        if (indexers.isEmpty()) {
            // loop in child-indexers to check access for businesspath not stacked as on index-run
            for (Indexer childIndexer : childIndexers) {
                List<Indexer> foundSubChildIndexers = childIndexer instanceof AbstractHierarchicalIndexer ? ((AbstractHierarchicalIndexer) childIndexer).getIndexerByType(type) : null;
                if (foundSubChildIndexers != null) {
                    if (debug)
                        logDebug("took a childindexer for ores= " + ores + " not directly linked (means businesspath is not the same stack as indexer -> childindexer). type= " + type + " . indexer parent-type not on businesspath=" + childIndexer.getSupportedTypeName());
                    for (Indexer foundSubChildIndexer : foundSubChildIndexers) {
                        boolean allow = foundSubChildIndexer.checkAccess(contextEntry, businessControl, identity, roles) && super.checkAccess(contextEntry, businessControl, identity, roles);
                        if (allow) {
                            return true;
                        }
                    }
                }
            }
            if (debug)
                logDebug("could not find an indexer for type=" + type + " businessControl=" + businessControl + " identity=" + identity, null);
        } else {
            for (Indexer indexer : indexers) {
                boolean allow = indexer.checkAccess(contextEntry, businessControl, identity, roles) && super.checkAccess(contextEntry, businessControl, identity, roles);
                if (allow) {
                    return true;
                }
            }
        }
        return false;
    } else {
        // rearch the end context entry list
        return super.checkAccess(contextEntry, businessControl, identity, roles);
    }
}
Also used : OLATResourceable(org.olat.core.id.OLATResourceable) ContextEntry(org.olat.core.id.context.ContextEntry)

Example 23 with ContextEntry

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

the class GroupForumIndexer method checkAccess.

/**
 * @see org.olat.search.service.indexer.Indexer#checkAccess(org.olat.core.id.context.ContextEntry, org.olat.core.id.context.BusinessControl, org.olat.core.id.Identity, org.olat.core.id.Roles)
 */
@Override
public boolean checkAccess(ContextEntry contextEntry, BusinessControl businessControl, Identity identity, Roles roles) {
    ContextEntry ce = businessControl.popLauncherContextEntry();
    Long resourceableId = ce.getOLATResourceable().getResourceableId();
    Message message = ForumManager.getInstance().loadMessage(resourceableId);
    if (message == null)
        return false;
    Message threadtop = message.getThreadtop();
    if (threadtop == null) {
        threadtop = message;
    }
    boolean isMessageHidden = Status.getStatus(threadtop.getStatusCode()).isHidden();
    // assumes that if is owner then is moderator so it is allowed to see the hidden forum threads
    // here it is checked if the identity is owner of the forum tool but it has no way to find out whether is owner of the group that owns the forum tool
    boolean isOwner = BaseSecurityManager.getInstance().isIdentityPermittedOnResourceable(identity, Constants.PERMISSION_ACCESS, contextEntry.getOLATResourceable());
    if (isMessageHidden && !isOwner) {
        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 24 with ContextEntry

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

the class EditorMainController method jumpToNodeEditor.

/**
 * Initializes the node edit tabbed pane and its controller for this
 * particular node
 *
 * @param ureq
 * @param chosenNode
 * @param groupMgr
 */
private void jumpToNodeEditor(String activatorIdent, UserRequest ureq, CourseNode chosenNode) {
    initNodeEditor(ureq, chosenNode);
    if (nodeEditCntrllr instanceof ActivateableTabbableDefaultController) {
        OLATResourceable activeOres = OresHelper.createOLATResourceableInstanceWithoutCheck(activatorIdent, 0l);
        List<ContextEntry> entries = BusinessControlFactory.getInstance().createCEListFromString(activeOres);
        ((ActivateableTabbableDefaultController) nodeEditCntrllr).activate(ureq, entries, null);
    }
}
Also used : ActivateableTabbableDefaultController(org.olat.core.gui.control.generic.tabbable.ActivateableTabbableDefaultController) OLATResourceable(org.olat.core.id.OLATResourceable) ContextEntry(org.olat.core.id.context.ContextEntry)

Example 25 with ContextEntry

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

the class MembersManagementMainController method activate.

@Override
public void activate(UserRequest ureq, List<ContextEntry> entries, StateEntry state) {
    if (entries == null || entries.isEmpty())
        return;
    ContextEntry currentEntry = entries.get(0);
    String cmd = currentEntry.getOLATResourceable().getResourceableTypeName();
    Controller selectedCtrl = selectMenuItem(ureq, cmd);
    if (selectedCtrl instanceof Activateable2) {
        List<ContextEntry> subEntries = entries.subList(1, entries.size());
        ((Activateable2) selectedCtrl).activate(ureq, subEntries, currentEntry.getTransientState());
    }
}
Also used : Activateable2(org.olat.core.gui.control.generic.dtabs.Activateable2) GroupsAndRightsController(org.olat.course.groupsandrights.GroupsAndRightsController) LayoutMain3ColsController(org.olat.core.commons.fullWebApp.LayoutMain3ColsController) Controller(org.olat.core.gui.control.Controller) MainLayoutBasicController(org.olat.core.gui.control.controller.MainLayoutBasicController) OrdersAdminController(org.olat.resource.accesscontrol.ui.OrdersAdminController) 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