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);
}
}
}
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);
}
}
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);
}
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);
}
}
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());
}
}
Aggregations