. Fix to Permissions Cache to handle deleted nodes in correct order (i.e. before accessing the cache)

- fixes issue highlighted by ACLEntryVoterTest

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2076 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2006-01-05 08:28:39 +00:00
parent e86d44aacb
commit 0b80b960b8

View File

@@ -328,19 +328,23 @@ public class PermissionServiceImpl implements PermissionServiceSPI, Initializing
// If the node ref is null there is no sensible test to do - and there // If the node ref is null there is no sensible test to do - and there
// must be no permissions // must be no permissions
// - so we allow it // - so we allow it
if (nodeRef == null) if (nodeRef == null)
{ {
return AccessStatus.ALLOWED; return AccessStatus.ALLOWED;
} }
// If the permission is null we deny // If the permission is null we deny
if (perm == null) if (perm == null)
{ {
return AccessStatus.DENIED; return AccessStatus.DENIED;
} }
// Allow permissions for nodes that do not exist
if (!nodeService.exists(nodeRef))
{
return AccessStatus.ALLOWED;
}
// Get the current authentications // Get the current authentications
// Use the smart authentication cache to improve permissions performance // Use the smart authentication cache to improve permissions performance
Authentication auth = authenticationComponent.getCurrentAuthentication(); Authentication auth = authenticationComponent.getCurrentAuthentication();
@@ -355,13 +359,6 @@ public class PermissionServiceImpl implements PermissionServiceSPI, Initializing
return status; return status;
} }
// Allow permissions for nodes that do not exist
if (!nodeService.exists(nodeRef))
{
accessCache.put(key, AccessStatus.ALLOWED);
return AccessStatus.ALLOWED;
}
// If the node does not support the given permission there is no point // If the node does not support the given permission there is no point
// doing the test // doing the test
Set<PermissionReference> available = modelDAO.getAllPermissions(nodeRef); Set<PermissionReference> available = modelDAO.getAllPermissions(nodeRef);