mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
Verify if node exists
This commit is contained in:
@@ -70,7 +70,7 @@ public class ExtendedPermissionServiceImpl extends PermissionServiceImpl
|
|||||||
|
|
||||||
/** File plan service */
|
/** File plan service */
|
||||||
private FilePlanService filePlanService;
|
private FilePlanService filePlanService;
|
||||||
|
|
||||||
/** Permission processor registry */
|
/** Permission processor registry */
|
||||||
private PermissionProcessorRegistry permissionProcessorRegistry;
|
private PermissionProcessorRegistry permissionProcessorRegistry;
|
||||||
|
|
||||||
@@ -93,13 +93,13 @@ public class ExtendedPermissionServiceImpl extends PermissionServiceImpl
|
|||||||
{
|
{
|
||||||
this.filePlanService = filePlanService;
|
this.filePlanService = filePlanService;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the permission processor registry
|
* Sets the permission processor registry
|
||||||
*
|
*
|
||||||
* @param permissionProcessorRegistry the permissions processor registry
|
* @param permissionProcessorRegistry the permissions processor registry
|
||||||
*/
|
*/
|
||||||
public void setPermissionProcessorRegistry(PermissionProcessorRegistry permissionProcessorRegistry)
|
public void setPermissionProcessorRegistry(PermissionProcessorRegistry permissionProcessorRegistry)
|
||||||
{
|
{
|
||||||
this.permissionProcessorRegistry = permissionProcessorRegistry;
|
this.permissionProcessorRegistry = permissionProcessorRegistry;
|
||||||
}
|
}
|
||||||
@@ -146,40 +146,42 @@ public class ExtendedPermissionServiceImpl extends PermissionServiceImpl
|
|||||||
public AccessStatus hasPermission(NodeRef nodeRef, String perm)
|
public AccessStatus hasPermission(NodeRef nodeRef, String perm)
|
||||||
{
|
{
|
||||||
AccessStatus result = AccessStatus.UNDETERMINED;
|
AccessStatus result = AccessStatus.UNDETERMINED;
|
||||||
|
if (nodeService.exists(nodeRef))
|
||||||
// permission pre-processors
|
{
|
||||||
List<PermissionPreProcessor> preProcessors = permissionProcessorRegistry.getPermissionPreProcessors();
|
|
||||||
for (PermissionPreProcessor preProcessor : preProcessors)
|
// permission pre-processors
|
||||||
{
|
List<PermissionPreProcessor> preProcessors = permissionProcessorRegistry.getPermissionPreProcessors();
|
||||||
// pre process permission
|
for (PermissionPreProcessor preProcessor : preProcessors)
|
||||||
result = preProcessor.process(nodeRef, perm);
|
{
|
||||||
|
// pre process permission
|
||||||
// veto if denied
|
result = preProcessor.process(nodeRef, perm);
|
||||||
if (AccessStatus.DENIED.equals(result))
|
|
||||||
{
|
// veto if denied
|
||||||
return result;
|
if (AccessStatus.DENIED.equals(result))
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
// evaluate permission
|
||||||
// evaluate permission
|
result = hasPermissionImpl(nodeRef, perm);
|
||||||
result = hasPermissionImpl(nodeRef, perm);
|
|
||||||
|
// permission post-processors
|
||||||
// permission post-processors
|
List<PermissionPostProcessor> postProcessors = permissionProcessorRegistry.getPermissionPostProcessors();
|
||||||
List<PermissionPostProcessor> postProcessors = permissionProcessorRegistry.getPermissionPostProcessors();
|
for (PermissionPostProcessor postProcessor : postProcessors)
|
||||||
for (PermissionPostProcessor postProcessor : postProcessors)
|
{
|
||||||
{
|
// post process permission
|
||||||
// post process permission
|
result = postProcessor.process(result, nodeRef, perm);
|
||||||
result = postProcessor.process(result, nodeRef, perm);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of hasPermission method call.
|
* Implementation of hasPermission method call.
|
||||||
* <p>
|
* <p>
|
||||||
* Separation also convenient for unit testing.
|
* Separation also convenient for unit testing.
|
||||||
*
|
*
|
||||||
* @param nodeRef node reference
|
* @param nodeRef node reference
|
||||||
* @param perm permission
|
* @param perm permission
|
||||||
* @return {@link AccessStatus} access status result
|
* @return {@link AccessStatus} access status result
|
||||||
|
Reference in New Issue
Block a user