Skip to content
Snippets Groups Projects
Commit 61493ce6 authored by srosse's avatar srosse
Browse files

OO-2618: check permission only if message exists

parent f0f30163
No related branches found
No related tags found
No related merge requests found
...@@ -86,17 +86,19 @@ public class FOCourseNodeIndexer extends ForumIndexer implements CourseNodeIndex ...@@ -86,17 +86,19 @@ public class FOCourseNodeIndexer extends ForumIndexer implements CourseNodeIndex
ContextEntry ce = businessControl.popLauncherContextEntry(); ContextEntry ce = businessControl.popLauncherContextEntry();
Long resourceableId = ce.getOLATResourceable().getResourceableId(); Long resourceableId = ce.getOLATResourceable().getResourceableId();
Message message = ForumManager.getInstance().loadMessage(resourceableId); Message message = ForumManager.getInstance().loadMessage(resourceableId);
Message threadtop = message.getThreadtop(); if(message != null) {
if(threadtop==null) { Message threadtop = message.getThreadtop();
threadtop = message; 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
//TODO: (LD) fix this!!! - the contextEntry is not the right context for this check
boolean isOwner = BaseSecurityManager.getInstance().isIdentityPermittedOnResourceable(identity, Constants.PERMISSION_ACCESS, contextEntry.getOLATResourceable());
if(isMessageHidden && !isOwner) {
return false;
}
} }
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
//TODO: (LD) fix this!!! - the contextEntry is not the right context for this check
boolean isOwner = BaseSecurityManager.getInstance().isIdentityPermittedOnResourceable(identity, Constants.PERMISSION_ACCESS, contextEntry.getOLATResourceable());
if(isMessageHidden && !isOwner) {
return false;
}
return super.checkAccess(contextEntry, businessControl, identity, roles); return super.checkAccess(contextEntry, businessControl, identity, roles);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment