mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Check for the NodeLockedException when deleting a file and convert to
an access denied error. When marking a file for delete check if the file node has a lock, return an access denied error if locked. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2087 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -1171,6 +1171,17 @@ public class ContentDiskDriver implements DiskInterface, IOCtlInterface
|
|||||||
" file: " + name);
|
" file: " + name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (NodeLockedException ex)
|
||||||
|
{
|
||||||
|
// Debug
|
||||||
|
|
||||||
|
if ( logger.isDebugEnabled())
|
||||||
|
logger.debug("Delete file - access denied (locked)");
|
||||||
|
|
||||||
|
// Convert to a filesystem access denied status
|
||||||
|
|
||||||
|
throw new AccessDeniedException("Delete " + name);
|
||||||
|
}
|
||||||
catch (org.alfresco.repo.security.permissions.AccessDeniedException ex)
|
catch (org.alfresco.repo.security.permissions.AccessDeniedException ex)
|
||||||
{
|
{
|
||||||
// Debug
|
// Debug
|
||||||
@@ -1378,6 +1389,23 @@ public class ContentDiskDriver implements DiskInterface, IOCtlInterface
|
|||||||
|
|
||||||
if ( permissionService.hasPermission(nodeRef, PermissionService.WRITE) == AccessStatus.DENIED)
|
if ( permissionService.hasPermission(nodeRef, PermissionService.WRITE) == AccessStatus.DENIED)
|
||||||
throw new AccessDeniedException("No write access to " + name);
|
throw new AccessDeniedException("No write access to " + name);
|
||||||
|
|
||||||
|
// Check if the file is being marked for deletion, if so then check if the file is locked
|
||||||
|
|
||||||
|
if ( info.hasSetFlag(FileInfo.SetDeleteOnClose) && info.hasDeleteOnClose())
|
||||||
|
{
|
||||||
|
// Check if the node is locked
|
||||||
|
|
||||||
|
if ( nodeService.hasAspect( nodeRef, ContentModel.ASPECT_LOCKABLE))
|
||||||
|
{
|
||||||
|
// Get the lock type, if any
|
||||||
|
|
||||||
|
String lockTypeStr = (String) nodeService.getProperty( nodeRef, ContentModel.PROP_LOCK_TYPE);
|
||||||
|
|
||||||
|
if ( lockTypeStr != null)
|
||||||
|
throw new AccessDeniedException("Node locked, cannot mark for delete");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (org.alfresco.repo.security.permissions.AccessDeniedException ex)
|
catch (org.alfresco.repo.security.permissions.AccessDeniedException ex)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user