mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-22 15:12:38 +00:00
Fix the api-explorer version, there is no 5.2.2-SNAPSHOT version yet.
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@137776 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -759,7 +759,7 @@ public class CommentServiceImpl extends AbstractLifecycleBean implements Comment
|
||||
if (behaviourFilter.isEnabled(ContentModel.ASPECT_LOCKABLE) // eg. delete site (MNT-14671)
|
||||
&& isWorkingCopyOrLocked(discussableNodeRef)
|
||||
&& !isLockOwner(discussableNodeRef)
|
||||
&& !canDelete)
|
||||
&& canDelete)
|
||||
{
|
||||
throw new NodeLockedException(discussableNodeRef);
|
||||
}
|
||||
|
||||
@@ -409,6 +409,10 @@ public class CommentsTest
|
||||
* REPO-2557, ALF-21907
|
||||
*/
|
||||
@Test public void testAddingCommentOnLockedNode()
|
||||
{
|
||||
String user = authenticationComponent.getCurrentUserName();
|
||||
final NodeRef testDoc = testDocs.get(0);
|
||||
try
|
||||
{
|
||||
// create user 2 and 3
|
||||
transactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback<Void>()
|
||||
@@ -429,7 +433,6 @@ public class CommentsTest
|
||||
authenticationComponent.setCurrentUser(USER_ONE_NAME);
|
||||
|
||||
// create some comments
|
||||
final NodeRef testDoc = testDocs.get(0);
|
||||
transactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback<Void>()
|
||||
{
|
||||
@Override
|
||||
@@ -474,6 +477,26 @@ public class CommentsTest
|
||||
// Fails because is not the lock owner
|
||||
}
|
||||
|
||||
authenticationComponent.setCurrentUser(USER_ONE_NAME);
|
||||
|
||||
try
|
||||
{
|
||||
transactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback<Void>()
|
||||
{
|
||||
@Override
|
||||
public Void execute() throws Throwable
|
||||
{
|
||||
applyComment(testDoc, "Hello 3");
|
||||
return null;
|
||||
}
|
||||
});
|
||||
fail("NodeLockedException not thrown");
|
||||
}
|
||||
catch (NodeLockedException e)
|
||||
{
|
||||
// Fails because is not the lock owner
|
||||
}
|
||||
|
||||
// change to lock owner
|
||||
authenticationComponent.setCurrentUser(USER_TWO_NAME);
|
||||
|
||||
@@ -488,8 +511,24 @@ public class CommentsTest
|
||||
});
|
||||
|
||||
assertCommentCountIs(testDoc, 3);
|
||||
}
|
||||
finally
|
||||
{
|
||||
authenticationComponent.setCurrentUser(USER_ONE_NAME);
|
||||
|
||||
authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
|
||||
// unlock node
|
||||
transactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback<Void>()
|
||||
{
|
||||
@Override
|
||||
public Void execute() throws Throwable
|
||||
{
|
||||
lockService.unlock(testDoc);
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
||||
authenticationComponent.setCurrentUser(user);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user