From 17b9a6daf51e223b24616b8a1edb1e6441e0c3b2 Mon Sep 17 00:00:00 2001 From: Alan Davis Date: Thu, 18 Sep 2014 17:17:42 +0000 Subject: [PATCH] Merged HEAD-BUG-FIX (5.0/Cloud) to HEAD (5.0/Cloud) 83943: Merged V4.2-BUG-FIX (4.2.4) to HEAD-BUG-FIX (5.0/Cloud) 82504: Merged V4.1-BUG-FIX (4.1.10) to V4.2-BUG-FIX (4.2.4) 81668: Merged DEV to V4.1-BUG-FIX (4.1.10) 80985 : MNT-12082 : Consumers can add comments using URL parameters, although they are not allowed to do so - Fixed the issue. Implemented a test to simulate the issue. 82513: Fix build failure after: Merged DEV to V4.1-BUG-FIX (4.1.10) 80985 : MNT-12082 : Consumers can add comments using URL parameters, although they are not allowed to do so - Fixed the issue. Implemented a test to simulate the issue. 83418: Add further hacks to the CommentsApiTest, which needs to be refactored to use RetryingTransactionHelper. 83679: MNT-12082 : Consumers can add comments using URL parameters, although they are not allowed to do so - Fixed build failure git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@84601 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../org/alfresco/repo/blog/BlogServiceImpl.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/source/java/org/alfresco/repo/blog/BlogServiceImpl.java b/source/java/org/alfresco/repo/blog/BlogServiceImpl.java index f59da5540f..85ac8a76e1 100644 --- a/source/java/org/alfresco/repo/blog/BlogServiceImpl.java +++ b/source/java/org/alfresco/repo/blog/BlogServiceImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005-2011 Alfresco Software Limited. + * Copyright (C) 2005-2014 Alfresco Software Limited. * * This file is part of Alfresco * @@ -254,7 +254,13 @@ public class BlogServiceImpl implements BlogService { // Comment from the old JavaScript: // disable permission inheritance. The result is that only the creator will have access to the draft - permissionService.setInheritParentPermissions(postNode.getChildRef(), false); + NodeRef draft = postNode.getChildRef(); + permissionService.setInheritParentPermissions(draft, false); + + // MNT-12082: give permissions to the post creator. He should be able to comment in his post's + // forumFolder and commentsFolder, where owner is System user + String creator = (String) nodeService.getProperty(draft, ContentModel.PROP_CREATOR); + permissionService.setPermission(draft, creator, permissionService.getAllPermission(), true); } else { @@ -474,6 +480,10 @@ public class BlogServiceImpl implements BlogService // this if (!permissionService.getInheritParentPermissions(blogPostNode)) { + // MNT-12082 + String creator = (String) nodeService.getProperty(blogPostNode, ContentModel.PROP_CREATOR); + permissionService.deletePermission(blogPostNode, creator, permissionService.getAllPermission()); + permissionService.setInheritParentPermissions(blogPostNode, true); }