mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged HEAD-BUG-FIX (4.3/Cloud) to HEAD (4.3/Cloud)
70223: Merged V4.2-BUG-FIX (4.2.3) to HEAD-BUG-FIX (4.3/Cloud) 70056: Merged DEV to V4.2-BUG-FIX (4.2.3) 69689 : MNT-10946 : Admin is no longer able to unlock files - Check if node is locked for non-admin users. Fix related test 69751 : MNT-10946 : Admin is no longer able to unlock files - Changed warn message git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@70488 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -33,6 +33,7 @@ import org.alfresco.repo.lock.mem.LockStore;
|
||||
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.service.cmr.coci.CheckOutCheckInService;
|
||||
import org.alfresco.service.cmr.lock.LockService;
|
||||
import org.alfresco.service.cmr.lock.LockStatus;
|
||||
@@ -903,5 +904,41 @@ public class LockServiceImplTest extends BaseSpringTest
|
||||
logger.debug("exception while trying to unlock a checked out node", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void testUnlockEphemeralNodeWithAdminUser()
|
||||
{
|
||||
for (Lifetime lt : new Lifetime[]{Lifetime.EPHEMERAL, Lifetime.PERSISTENT})
|
||||
{
|
||||
TestWithUserUtils.authenticateUser(GOOD_USER_NAME, PWD, rootNodeRef, this.authenticationService);
|
||||
|
||||
/* create node */
|
||||
final NodeRef testNode =
|
||||
this.nodeService.createNode(parentNode, ContentModel.ASSOC_CONTAINS, QName.createQName("{}testNode"), ContentModel.TYPE_CONTAINER).getChildRef();
|
||||
|
||||
// lock it as GOOD user
|
||||
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.lockService.unlock(testNode);
|
||||
fail("BAD user shouldn't be able to unlock " + lt + " lock");
|
||||
}
|
||||
catch(NodeLockedException e)
|
||||
{
|
||||
// it's expected
|
||||
}
|
||||
|
||||
TestWithUserUtils.authenticateUser(AuthenticationUtil.getAdminUserName(), "admin", rootNodeRef, this.authenticationService);
|
||||
|
||||
// try to unlock as ADMIN user
|
||||
this.lockService.unlock(testNode);
|
||||
|
||||
TestWithUserUtils.authenticateUser(GOOD_USER_NAME, PWD, rootNodeRef, this.authenticationService);
|
||||
|
||||
this.nodeService.deleteNode(testNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user