REPO-2451 / MNT-17612: AccessDeniedException in AOS Edit Offline - Upload New Version

- Make sure ephemeral locks which are expired are ignored.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@136946 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Ancuta Morarasu
2017-05-25 15:39:16 +00:00
parent 8c5964adfb
commit b930f7ca56
4 changed files with 157 additions and 59 deletions

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Repository
* %%
* Copyright (C) 2005 - 2016 Alfresco Software Limited
* Copyright (C) 2005 - 2017 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
@@ -540,7 +540,7 @@ public class LockServiceImpl implements LockService,
}
finally
{
behaviourFilter.enableBehaviour(nodeRef, ContentModel.ASPECT_VERSIONABLE);
behaviourFilter.enableBehaviour(nodeRef, ContentModel.ASPECT_VERSIONABLE);
lockableAspectInterceptor.enableForThread();
removeFromIgnoreSet(nodeRef);
}
@@ -919,6 +919,18 @@ public class LockServiceImpl implements LockService,
nodeRef = tenantService.getName(nodeRef);
LockState lockState = lockStore.get(nodeRef);
if (lockState != null)
{
String lockOwner = lockState.getOwner();
Date expiryDate = lockState.getExpires();
LockStatus status = LockUtils.lockStatus(lockOwner, lockOwner, expiryDate);
// in-memory ephemeral lock which is expired is irrelevant
if (status.equals(LockStatus.LOCK_EXPIRED))
{
lockState = null;
}
}
//ALF-20361: It is possible that a rollback has resulted in a "non-lock" lock state being added to
//the lock store. Because of that, we check both whether the retrieved lockState is null and, if it isn't,
//whether it represents a real lock