mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Reverse merged HEAD (5.0/Cloud)
<< Cause of 4 errors in https://bamboo.alfresco.com/bamboo/browse/ALF-ENT-141 >> 85880: ACE-2181 : Reverse Merge HEAD (5.0) << Implementing another approach for MNT-10946 and ACE-2181 >> Merged HEAD-BUG-FIX (5.0/Cloud) to HEAD (4.3/Cloud) 71600: Merged V4.2-BUG-FIX (4.2.3) to HEAD-BUG-FIX (4.3/Cloud) 70349: Merged DEV to V4.2-BUG-FIX (4.2.3) 70294 : MNT-10946 : Admin is no longer able to unlock files - Check if node is locked before unlock for non-admin or System users. Fix related test 85881: ACE-2181 : Merged DEV to HEAD (5.0) 76214 : MNT-10946 : Admin is no longer able to unlock files - Drop check for lockowner from AbstractLockStore.set. Fix related test git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@86049 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -34,7 +34,6 @@ import org.alfresco.repo.search.IndexerAndSearcher;
|
||||
import org.alfresco.repo.search.SearcherComponent;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationComponent;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
import org.alfresco.repo.security.permissions.AccessDeniedException;
|
||||
import org.alfresco.service.cmr.coci.CheckOutCheckInService;
|
||||
import org.alfresco.service.cmr.lock.LockService;
|
||||
import org.alfresco.service.cmr.lock.LockStatus;
|
||||
@@ -48,7 +47,6 @@ import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.cmr.repository.StoreRef;
|
||||
import org.alfresco.service.cmr.search.ResultSet;
|
||||
import org.alfresco.service.cmr.security.MutableAuthenticationService;
|
||||
import org.alfresco.service.cmr.security.PermissionService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.test_category.BaseSpringTestsCategory;
|
||||
import org.alfresco.test_category.OwnJVMTestsCategory;
|
||||
@@ -73,8 +71,6 @@ public class LockServiceImplTest extends BaseSpringTest
|
||||
private MutableAuthenticationService authenticationService;
|
||||
private CheckOutCheckInService cociService;
|
||||
|
||||
private PermissionService permissionService;
|
||||
private LockService securedLockService;
|
||||
/**
|
||||
* Data used in tests
|
||||
*/
|
||||
@@ -98,10 +94,6 @@ public class LockServiceImplTest extends BaseSpringTest
|
||||
{
|
||||
this.nodeService = (NodeService)applicationContext.getBean("dbNodeService");
|
||||
this.lockService = (LockService)applicationContext.getBean("lockService");
|
||||
|
||||
this.securedLockService = (LockService)applicationContext.getBean("LockService");
|
||||
this.permissionService = (PermissionService)applicationContext.getBean("PermissionService");
|
||||
|
||||
this.authenticationService = (MutableAuthenticationService)applicationContext.getBean("authenticationService");
|
||||
this.cociService = (CheckOutCheckInService) applicationContext.getBean("checkOutCheckInService");
|
||||
|
||||
@@ -179,11 +171,6 @@ public class LockServiceImplTest extends BaseSpringTest
|
||||
TestWithUserUtils.createUser(GOOD_USER_NAME, PWD, rootNodeRef, this.nodeService, this.authenticationService);
|
||||
TestWithUserUtils.createUser(BAD_USER_NAME, PWD, rootNodeRef, this.nodeService, this.authenticationService);
|
||||
|
||||
this.permissionService.setPermission(rootNodeRef, GOOD_USER_NAME, PermissionService.ALL_PERMISSIONS, true);
|
||||
this.permissionService.setPermission(rootNodeRef, BAD_USER_NAME, PermissionService.CHECK_OUT, true);
|
||||
this.permissionService.setPermission(rootNodeRef, BAD_USER_NAME, PermissionService.WRITE, true);
|
||||
this.permissionService.setPermission(rootNodeRef, BAD_USER_NAME, PermissionService.READ, true);
|
||||
|
||||
// Stash the user node ref's for later use
|
||||
TestWithUserUtils.authenticateUser(BAD_USER_NAME, PWD, rootNodeRef, this.authenticationService);
|
||||
TestWithUserUtils.authenticateUser(GOOD_USER_NAME, PWD, rootNodeRef, this.authenticationService);
|
||||
@@ -918,8 +905,7 @@ public class LockServiceImplTest extends BaseSpringTest
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public void testUnlockNodeWithAdminUser()
|
||||
public void testUnlockEphemeralNodeWithAdminUser()
|
||||
{
|
||||
for (Lifetime lt : new Lifetime[]{Lifetime.EPHEMERAL, Lifetime.PERSISTENT})
|
||||
{
|
||||
@@ -930,30 +916,27 @@ public class LockServiceImplTest extends BaseSpringTest
|
||||
this.nodeService.createNode(parentNode, ContentModel.ASSOC_CONTAINS, QName.createQName("{}testNode"), ContentModel.TYPE_CONTAINER).getChildRef();
|
||||
|
||||
// lock it as GOOD user
|
||||
this.securedLockService.lock(testNode, LockType.WRITE_LOCK, 2 * 86400, lt, null);
|
||||
this.lockService.lock(testNode, LockType.WRITE_LOCK, 2 * 86400, lt, null);
|
||||
|
||||
TestWithUserUtils.authenticateUser(BAD_USER_NAME, PWD, rootNodeRef, this.authenticationService);
|
||||
|
||||
try
|
||||
{
|
||||
// try to unlock as bad user
|
||||
this.securedLockService.unlock(testNode);
|
||||
this.lockService.unlock(testNode);
|
||||
fail("BAD user shouldn't be able to unlock " + lt + " lock");
|
||||
}
|
||||
catch(AccessDeniedException e)
|
||||
catch(UnableToReleaseLockException e)
|
||||
{
|
||||
// expected expetion
|
||||
// it's expected
|
||||
}
|
||||
|
||||
TestWithUserUtils.authenticateUser(AuthenticationUtil.getAdminUserName(), "admin", rootNodeRef, this.authenticationService);
|
||||
|
||||
// try to unlock as ADMIN user
|
||||
this.securedLockService.unlock(testNode);
|
||||
|
||||
// test that bad use able to lock/unlock node
|
||||
TestWithUserUtils.authenticateUser(BAD_USER_NAME, PWD, rootNodeRef, this.authenticationService);
|
||||
this.securedLockService.lock(testNode, LockType.WRITE_LOCK, 2 * 86400, lt, null);
|
||||
this.securedLockService.unlock(testNode);
|
||||
this.lockService.unlock(testNode);
|
||||
|
||||
TestWithUserUtils.authenticateUser(GOOD_USER_NAME, PWD, rootNodeRef, this.authenticationService);
|
||||
|
||||
this.nodeService.deleteNode(testNode);
|
||||
}
|
||||
|
Reference in New Issue
Block a user