mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
ALF-12866: WebDAV in-memory locking. Exclusive lock should be unlocked only by owner.
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@34174 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -151,21 +151,32 @@ public class UnlockMethod extends WebDAVMethod
|
|||||||
m_response.setStatus(HttpServletResponse.SC_NO_CONTENT);
|
m_response.setStatus(HttpServletResponse.SC_NO_CONTENT);
|
||||||
removeNoContentAspect(nodeRef);
|
removeNoContentAspect(nodeRef);
|
||||||
}
|
}
|
||||||
else if (lockInfo.isExclusive() /* && user is lock-owner */)
|
else if (lockInfo.isExclusive())
|
||||||
|
{
|
||||||
|
String currentUser = getAuthenticationService().getCurrentUserName();
|
||||||
|
if (currentUser.equals(lockInfo.getOwner()))
|
||||||
{
|
{
|
||||||
getLockStore().remove(nodeRef);
|
getLockStore().remove(nodeRef);
|
||||||
|
|
||||||
// Indicate that the unlock was successful
|
// Indicate that the unlock was successful
|
||||||
m_response.setStatus(HttpServletResponse.SC_NO_CONTENT);
|
m_response.setStatus(HttpServletResponse.SC_NO_CONTENT);
|
||||||
|
|
||||||
removeNoContentAspect(nodeRef);
|
removeNoContentAspect(nodeRef);
|
||||||
|
|
||||||
// DEBUG
|
|
||||||
if (logger.isDebugEnabled())
|
if (logger.isDebugEnabled())
|
||||||
{
|
{
|
||||||
logger.debug("Unlock token=" + getLockToken() + " Successful");
|
logger.debug("Unlock token=" + getLockToken() + " Successful");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (logger.isDebugEnabled())
|
||||||
|
{
|
||||||
|
logger.debug("Unlock token=" + getLockToken() + " Not lock owner");
|
||||||
|
}
|
||||||
|
// Node is not locked
|
||||||
|
throw new WebDAVServerException(HttpServletResponse.SC_PRECONDITION_FAILED);
|
||||||
|
}
|
||||||
|
}
|
||||||
else if (lockInfo.isShared())
|
else if (lockInfo.isShared())
|
||||||
{
|
{
|
||||||
Set<String> sharedLocks = lockInfo.getSharedLockTokens();
|
Set<String> sharedLocks = lockInfo.getSharedLockTokens();
|
||||||
|
Reference in New Issue
Block a user