Skip to content

Commit

Permalink
SAK-28074 Changing the Forum feed permission logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Gundala authored and Gundala committed Jan 13, 2015
1 parent a35bd87 commit 7824838
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ private List<?> getAllForaForSite(String siteId,String userId) {

for(DiscussionForum fatForum : fatFora) {

if( ! checkAccess(fatForum,userId)) {
if( ! checkAccess(fatForum,userId,siteId)) {
LOG.warn("Access denied for user id '" + userId + "' to forum '" + fatForum.getId()
+ "'. This forum will not be returned.");
continue;
Expand Down Expand Up @@ -205,7 +205,7 @@ private Object getForum(Long forumId, String siteId, String userId) {

DiscussionForum fatForum = forumManager.getForumByIdWithTopicsAttachmentsAndMessages(forumId);

if(checkAccess(fatForum,userId)) {
if(checkAccess(fatForum,userId,siteId)) {

SparseForum sparseForum = new SparseForum(fatForum,developerHelperService);

Expand Down Expand Up @@ -356,12 +356,12 @@ private Object getMessage(Long messageId,String siteId,String userId) {

}

private boolean checkAccess(BaseForum baseForum, String userId) {
private boolean checkAccess(BaseForum baseForum, String userId, String siteId) {

if(baseForum instanceof OpenForum) {

// If the supplied user is the super user, return true.
if(securityService.isSuperUser(userId)) {
// If the supplied user is the super user or an instructor, return true.
if(securityService.isSuperUser(userId) || forumManager.isInstructor(userId, "/site/" + siteId)) {
return true;
}

Expand Down

0 comments on commit 7824838

Please sign in to comment.