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
This commit is contained in:
Alan Davis
2014-09-18 17:17:42 +00:00
parent 7d5bf5ce5a
commit 7fe1374edb
4 changed files with 196 additions and 46 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2005-2013 Alfresco Software Limited.
* Copyright (C) 2005-2014 Alfresco Software Limited.
*
* This file is part of Alfresco
*
@@ -318,13 +318,17 @@ public class CommentsPost extends DeclarativeWebScript {
public NodeRef doWork() throws Exception
{
NodeRef commentsFolder = null;
AuthenticationUtil.pushAuthentication();
// ALF-5240: turn off auditing round the discussion node creation to prevent
// the source document from being modified by the first user leaving a comment
behaviourFilter.disableBehaviour(nodeRef, ContentModel.ASPECT_AUDITABLE);
try
{
{
// MNT-12082: set System user for creating forumFolder and commentsFolder nodes
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName());
nodeService.addAspect(nodeRef, QName.createQName(NamespaceService.FORUMS_MODEL_1_0_URI, "discussable"), null);
nodeService.addAspect(nodeRef, QName.createQName(NamespaceService.FORUMS_MODEL_1_0_URI, "commentsRollup"), null);
List<ChildAssociationRef> assocs = nodeService.getChildAssocs(nodeRef, QName.createQName(NamespaceService.FORUMS_MODEL_1_0_URI, "discussion"), RegexQNamePattern.MATCH_ALL);
@@ -344,6 +348,7 @@ public class CommentsPost extends DeclarativeWebScript {
}
finally
{
AuthenticationUtil.popAuthentication();
behaviourFilter.enableBehaviour(nodeRef, ContentModel.ASPECT_AUDITABLE);
}