From 6f02c42583879c51c2c06e9b2efe0714514dfab6 Mon Sep 17 00:00:00 2001 From: srosse <stephane.rosse@frentix.com> Date: Mon, 10 Feb 2020 17:18:51 +0100 Subject: [PATCH] OO-4168: be nice and deliver blog images --- .../dispatching/FeedMediaDispatcher.java | 31 ++++++++++--------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/src/main/java/org/olat/modules/webFeed/dispatching/FeedMediaDispatcher.java b/src/main/java/org/olat/modules/webFeed/dispatching/FeedMediaDispatcher.java index 058b141282f..f8feef89b61 100644 --- a/src/main/java/org/olat/modules/webFeed/dispatching/FeedMediaDispatcher.java +++ b/src/main/java/org/olat/modules/webFeed/dispatching/FeedMediaDispatcher.java @@ -403,21 +403,22 @@ public class FeedMediaDispatcher implements Dispatcher, GenericEventListener { boolean hasAccess = false; if(identity != null && roles != null && reSecurity != null) { - String courseNodeId = BlogToolController.SUBSCRIPTION_SUBIDENTIFIER.equals(pathNodeId) - ? course.getRunStructure().getRootNode().getIdent() - : pathNodeId; - IdentityEnvironment ienv = new IdentityEnvironment(identity, roles); - UserCourseEnvironment userCourseEnv = new UserCourseEnvironmentImpl(ienv, course.getCourseEnvironment(), null, null, null, null, - reSecurity.isCourseCoach() || reSecurity.isGroupCoach(), reSecurity.isEntryAdmin(), reSecurity.isCourseParticipant() || reSecurity.isGroupParticipant(), - false); - // Build an evaluation tree - NodeAccessService nodeAccessService = CoreSpringFactory.getImpl(NodeAccessService.class); - TreeNode treeNode = nodeAccessService.getCourseTreeModelBuilder(userCourseEnv) - .withFilter(AccessibleFilter.create()) - .build() - .getNodeById(courseNodeId); - if (treeNode != null && treeNode.isAccessible()) { - hasAccess = true; + if(BlogToolController.SUBSCRIPTION_SUBIDENTIFIER.equals(pathNodeId)) { + hasAccess = reSecurity.canLaunch(); + } else { + IdentityEnvironment ienv = new IdentityEnvironment(identity, roles); + UserCourseEnvironment userCourseEnv = new UserCourseEnvironmentImpl(ienv, course.getCourseEnvironment(), null, null, null, null, + reSecurity.isCourseCoach() || reSecurity.isGroupCoach(), reSecurity.isEntryAdmin(), reSecurity.isCourseParticipant() || reSecurity.isGroupParticipant(), + false); + // Build an evaluation tree + NodeAccessService nodeAccessService = CoreSpringFactory.getImpl(NodeAccessService.class); + TreeNode treeNode = nodeAccessService.getCourseTreeModelBuilder(userCourseEnv) + .withFilter(AccessibleFilter.create()) + .build() + .getNodeById(pathNodeId); + if (treeNode != null && treeNode.isAccessible()) { + hasAccess = true; + } } } -- GitLab