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