mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Fixed critical issues reported by sonar (Dodgy - Dead store to local variable)
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@63493 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -32,7 +32,6 @@ import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.OnRM
|
|||||||
import org.alfresco.module.org_alfresco_module_rm.util.PoliciesUtil;
|
import org.alfresco.module.org_alfresco_module_rm.util.PoliciesUtil;
|
||||||
import org.alfresco.repo.policy.ClassPolicyDelegate;
|
import org.alfresco.repo.policy.ClassPolicyDelegate;
|
||||||
import org.alfresco.repo.policy.PolicyComponent;
|
import org.alfresco.repo.policy.PolicyComponent;
|
||||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
import org.alfresco.service.cmr.repository.NodeService;
|
import org.alfresco.service.cmr.repository.NodeService;
|
||||||
import org.alfresco.service.namespace.QName;
|
import org.alfresco.service.namespace.QName;
|
||||||
@@ -42,7 +41,7 @@ import org.springframework.extensions.surf.util.I18NUtil;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Records Management Action Service Implementation
|
* Records Management Action Service Implementation
|
||||||
*
|
*
|
||||||
* @author Roy Wetherall
|
* @author Roy Wetherall
|
||||||
*/
|
*/
|
||||||
public class RecordsManagementActionServiceImpl implements RecordsManagementActionService
|
public class RecordsManagementActionServiceImpl implements RecordsManagementActionService
|
||||||
@@ -50,7 +49,7 @@ public class RecordsManagementActionServiceImpl implements RecordsManagementActi
|
|||||||
/** I18N */
|
/** I18N */
|
||||||
private static final String MSG_NOT_DEFINED = "rm.action.not-defined";
|
private static final String MSG_NOT_DEFINED = "rm.action.not-defined";
|
||||||
private static final String MSG_NO_IMPLICIT_NODEREF = "rm.action.no-implicit-noderef";
|
private static final String MSG_NO_IMPLICIT_NODEREF = "rm.action.no-implicit-noderef";
|
||||||
|
|
||||||
/** Logger */
|
/** Logger */
|
||||||
private static Log logger = LogFactory.getLog(RecordsManagementActionServiceImpl.class);
|
private static Log logger = LogFactory.getLog(RecordsManagementActionServiceImpl.class);
|
||||||
|
|
||||||
@@ -59,37 +58,37 @@ public class RecordsManagementActionServiceImpl implements RecordsManagementActi
|
|||||||
private Map<String, RecordsManagementActionCondition> rmConditions = new HashMap<String, RecordsManagementActionCondition>(13);
|
private Map<String, RecordsManagementActionCondition> rmConditions = new HashMap<String, RecordsManagementActionCondition>(13);
|
||||||
|
|
||||||
private Map<String, RecordsManagementAction> dispositionActions = new HashMap<String, RecordsManagementAction>(5);
|
private Map<String, RecordsManagementAction> dispositionActions = new HashMap<String, RecordsManagementAction>(5);
|
||||||
|
|
||||||
/** Policy component */
|
/** Policy component */
|
||||||
PolicyComponent policyComponent;
|
PolicyComponent policyComponent;
|
||||||
|
|
||||||
/** Node service */
|
/** Node service */
|
||||||
NodeService nodeService;
|
NodeService nodeService;
|
||||||
|
|
||||||
/** Policy delegates */
|
/** Policy delegates */
|
||||||
private ClassPolicyDelegate<BeforeRMActionExecution> beforeRMActionExecutionDelegate;
|
private ClassPolicyDelegate<BeforeRMActionExecution> beforeRMActionExecutionDelegate;
|
||||||
private ClassPolicyDelegate<OnRMActionExecution> onRMActionExecutionDelegate;
|
private ClassPolicyDelegate<OnRMActionExecution> onRMActionExecutionDelegate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the policy component
|
* Set the policy component
|
||||||
*
|
*
|
||||||
* @param policyComponent policy component
|
* @param policyComponent policy component
|
||||||
*/
|
*/
|
||||||
public void setPolicyComponent(PolicyComponent policyComponent)
|
public void setPolicyComponent(PolicyComponent policyComponent)
|
||||||
{
|
{
|
||||||
this.policyComponent = policyComponent;
|
this.policyComponent = policyComponent;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the node service
|
* Set the node service
|
||||||
*
|
*
|
||||||
* @param nodeService node service
|
* @param nodeService node service
|
||||||
*/
|
*/
|
||||||
public void setNodeService(NodeService nodeService)
|
public void setNodeService(NodeService nodeService)
|
||||||
{
|
{
|
||||||
this.nodeService = nodeService;
|
this.nodeService = nodeService;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialise RM action service
|
* Initialise RM action service
|
||||||
*/
|
*/
|
||||||
@@ -99,7 +98,7 @@ public class RecordsManagementActionServiceImpl implements RecordsManagementActi
|
|||||||
beforeRMActionExecutionDelegate = policyComponent.registerClassPolicy(BeforeRMActionExecution.class);
|
beforeRMActionExecutionDelegate = policyComponent.registerClassPolicy(BeforeRMActionExecution.class);
|
||||||
onRMActionExecutionDelegate = policyComponent.registerClassPolicy(OnRMActionExecution.class);
|
onRMActionExecutionDelegate = policyComponent.registerClassPolicy(OnRMActionExecution.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementActionService#register(org.alfresco.module.org_alfresco_module_rm.RecordsManagementAction)
|
* @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementActionService#register(org.alfresco.module.org_alfresco_module_rm.RecordsManagementAction)
|
||||||
*/
|
*/
|
||||||
@@ -108,14 +107,14 @@ public class RecordsManagementActionServiceImpl implements RecordsManagementActi
|
|||||||
if (rmActions.containsKey(rmAction.getName()) == false)
|
if (rmActions.containsKey(rmAction.getName()) == false)
|
||||||
{
|
{
|
||||||
rmActions.put(rmAction.getName(), rmAction);
|
rmActions.put(rmAction.getName(), rmAction);
|
||||||
|
|
||||||
if (rmAction.isDispositionAction() == true)
|
if (rmAction.isDispositionAction() == true)
|
||||||
{
|
{
|
||||||
dispositionActions.put(rmAction.getName(), rmAction);
|
dispositionActions.put(rmAction.getName(), rmAction);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void register(RecordsManagementActionCondition rmCondition)
|
public void register(RecordsManagementActionCondition rmCondition)
|
||||||
{
|
{
|
||||||
if (rmConditions.containsKey(rmCondition.getName()) == false)
|
if (rmConditions.containsKey(rmCondition.getName()) == false)
|
||||||
@@ -123,10 +122,10 @@ public class RecordsManagementActionServiceImpl implements RecordsManagementActi
|
|||||||
rmConditions.put(rmCondition.getName(), rmCondition);
|
rmConditions.put(rmCondition.getName(), rmCondition);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Invoke beforeRMActionExecution policy
|
* Invoke beforeRMActionExecution policy
|
||||||
*
|
*
|
||||||
* @param nodeRef node reference
|
* @param nodeRef node reference
|
||||||
* @param name action name
|
* @param name action name
|
||||||
* @param parameters action parameters
|
* @param parameters action parameters
|
||||||
@@ -139,10 +138,10 @@ public class RecordsManagementActionServiceImpl implements RecordsManagementActi
|
|||||||
BeforeRMActionExecution policy = beforeRMActionExecutionDelegate.get(qnames);
|
BeforeRMActionExecution policy = beforeRMActionExecutionDelegate.get(qnames);
|
||||||
policy.beforeRMActionExecution(nodeRef, name, parameters);
|
policy.beforeRMActionExecution(nodeRef, name, parameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Invoke onRMActionExecution policy
|
* Invoke onRMActionExecution policy
|
||||||
*
|
*
|
||||||
* @param nodeRef node reference
|
* @param nodeRef node reference
|
||||||
* @param name action name
|
* @param name action name
|
||||||
* @param parameters action parameters
|
* @param parameters action parameters
|
||||||
@@ -182,18 +181,18 @@ public class RecordsManagementActionServiceImpl implements RecordsManagementActi
|
|||||||
*/
|
*/
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public List<RecordsManagementAction> getDispositionActions(NodeRef nodeRef)
|
public List<RecordsManagementAction> getDispositionActions(NodeRef nodeRef)
|
||||||
{
|
{
|
||||||
String userName = AuthenticationUtil.getFullyAuthenticatedUser();
|
//String userName = AuthenticationUtil.getFullyAuthenticatedUser();
|
||||||
List<RecordsManagementAction> result = new ArrayList<RecordsManagementAction>(this.rmActions.size());
|
List<RecordsManagementAction> result = new ArrayList<RecordsManagementAction>(this.rmActions.size());
|
||||||
|
|
||||||
for (RecordsManagementAction action : this.rmActions.values())
|
for (RecordsManagementAction action : this.rmActions.values())
|
||||||
{
|
{
|
||||||
// TODO check the permissions on the action ...
|
// TODO check the permissions on the action ...
|
||||||
}
|
}
|
||||||
|
|
||||||
return Collections.unmodifiableList(result);
|
return Collections.unmodifiableList(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementActionService#getDispositionActionDefinitions()
|
* @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementActionService#getDispositionActionDefinitions()
|
||||||
*/
|
*/
|
||||||
@@ -203,7 +202,7 @@ public class RecordsManagementActionServiceImpl implements RecordsManagementActi
|
|||||||
result.addAll(dispositionActions.values());
|
result.addAll(dispositionActions.values());
|
||||||
return Collections.unmodifiableList(result);
|
return Collections.unmodifiableList(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService#getDispositionAction(java.lang.String)
|
* @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService#getDispositionAction(java.lang.String)
|
||||||
*/
|
*/
|
||||||
@@ -235,7 +234,7 @@ public class RecordsManagementActionServiceImpl implements RecordsManagementActi
|
|||||||
{
|
{
|
||||||
return executeRecordsManagementAction(nodeRefs, name, null);
|
return executeRecordsManagementAction(nodeRefs, name, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementActionService#executeRecordsManagementAction(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, java.util.Map)
|
* @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementActionService#executeRecordsManagementAction(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, java.util.Map)
|
||||||
*/
|
*/
|
||||||
@@ -247,7 +246,7 @@ public class RecordsManagementActionServiceImpl implements RecordsManagementActi
|
|||||||
logger.debug(" actionName = " + name);
|
logger.debug(" actionName = " + name);
|
||||||
logger.debug(" parameters = " + parameters);
|
logger.debug(" parameters = " + parameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
RecordsManagementAction rmAction = this.rmActions.get(name);
|
RecordsManagementAction rmAction = this.rmActions.get(name);
|
||||||
if (rmAction == null)
|
if (rmAction == null)
|
||||||
{
|
{
|
||||||
@@ -258,15 +257,15 @@ public class RecordsManagementActionServiceImpl implements RecordsManagementActi
|
|||||||
}
|
}
|
||||||
throw new AlfrescoRuntimeException(msg);
|
throw new AlfrescoRuntimeException(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Execute action
|
// Execute action
|
||||||
invokeBeforeRMActionExecution(nodeRef, name, parameters);
|
invokeBeforeRMActionExecution(nodeRef, name, parameters);
|
||||||
RecordsManagementActionResult result = rmAction.execute(nodeRef, parameters);
|
RecordsManagementActionResult result = rmAction.execute(nodeRef, parameters);
|
||||||
if (nodeService.exists(nodeRef) == true)
|
if (nodeService.exists(nodeRef) == true)
|
||||||
{
|
{
|
||||||
invokeOnRMActionExecution(nodeRef, name, parameters);
|
invokeOnRMActionExecution(nodeRef, name, parameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -276,7 +275,7 @@ public class RecordsManagementActionServiceImpl implements RecordsManagementActi
|
|||||||
public RecordsManagementActionResult executeRecordsManagementAction(String name, Map<String, Serializable> parameters)
|
public RecordsManagementActionResult executeRecordsManagementAction(String name, Map<String, Serializable> parameters)
|
||||||
{
|
{
|
||||||
RecordsManagementAction rmAction = rmActions.get(name);
|
RecordsManagementAction rmAction = rmActions.get(name);
|
||||||
|
|
||||||
NodeRef implicitTargetNode = rmAction.getImplicitTargetNodeRef();
|
NodeRef implicitTargetNode = rmAction.getImplicitTargetNodeRef();
|
||||||
if (implicitTargetNode == null)
|
if (implicitTargetNode == null)
|
||||||
{
|
{
|
||||||
@@ -305,7 +304,7 @@ public class RecordsManagementActionServiceImpl implements RecordsManagementActi
|
|||||||
RecordsManagementActionResult result = executeRecordsManagementAction(nodeRef, name, parameters);
|
RecordsManagementActionResult result = executeRecordsManagementAction(nodeRef, name, parameters);
|
||||||
results.put(nodeRef, result);
|
results.put(nodeRef, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -110,7 +110,7 @@ public class RMAfterInvocationProvider extends RMSecurityCommon
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the max number of permission checks
|
* Set the max number of permission checks
|
||||||
*
|
*
|
||||||
* @param maxPermissionChecks
|
* @param maxPermissionChecks
|
||||||
*/
|
*/
|
||||||
public void setMaxPermissionChecks(int maxPermissionChecks)
|
public void setMaxPermissionChecks(int maxPermissionChecks)
|
||||||
@@ -120,7 +120,7 @@ public class RMAfterInvocationProvider extends RMSecurityCommon
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the max time for permission checks
|
* Set the max time for permission checks
|
||||||
*
|
*
|
||||||
* @param maxPermissionCheckTimeMillis
|
* @param maxPermissionCheckTimeMillis
|
||||||
*/
|
*/
|
||||||
public void setMaxPermissionCheckTimeMillis(long maxPermissionCheckTimeMillis)
|
public void setMaxPermissionCheckTimeMillis(long maxPermissionCheckTimeMillis)
|
||||||
@@ -139,7 +139,7 @@ public class RMAfterInvocationProvider extends RMSecurityCommon
|
|||||||
logger.debug("Method is null.");
|
logger.debug("Method is null.");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
logger.debug("Method: " + mi.getMethod().toString());
|
logger.debug("Method: " + mi.getMethod().toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -245,7 +245,7 @@ public class RMAfterInvocationProvider extends RMSecurityCommon
|
|||||||
// TODO: Get the filter that was applied and double-check
|
// TODO: Get the filter that was applied and double-check
|
||||||
return returnedObject;
|
return returnedObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
private PermissionCheckValue decide(Authentication authentication, Object object, ConfigAttributeDefinition config, PermissionCheckValue returnedObject) throws AccessDeniedException
|
private PermissionCheckValue decide(Authentication authentication, Object object, ConfigAttributeDefinition config, PermissionCheckValue returnedObject) throws AccessDeniedException
|
||||||
{
|
{
|
||||||
// Get the wrapped value
|
// Get the wrapped value
|
||||||
@@ -254,7 +254,7 @@ public class RMAfterInvocationProvider extends RMSecurityCommon
|
|||||||
// This passes
|
// This passes
|
||||||
return returnedObject;
|
return returnedObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
private NodeRef decide(Authentication authentication, Object object, ConfigAttributeDefinition config, NodeRef returnedObject) throws AccessDeniedException
|
private NodeRef decide(Authentication authentication, Object object, ConfigAttributeDefinition config, NodeRef returnedObject) throws AccessDeniedException
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -273,14 +273,14 @@ public class RMAfterInvocationProvider extends RMSecurityCommon
|
|||||||
{
|
{
|
||||||
return returnedObject;
|
return returnedObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
int parentResult = checkRead(nodeService.getPrimaryParent(returnedObject).getParentRef());
|
int parentResult = checkRead(nodeService.getPrimaryParent(returnedObject).getParentRef());
|
||||||
int childResult = checkRead(returnedObject);
|
int childResult = checkRead(returnedObject);
|
||||||
checkSupportedDefinitions(supportedDefinitions, parentResult, childResult);
|
checkSupportedDefinitions(supportedDefinitions, parentResult, childResult);
|
||||||
|
|
||||||
return returnedObject;
|
return returnedObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkSupportedDefinitions(List<ConfigAttributeDefintion> supportedDefinitions, int parentResult, int childResult)
|
private void checkSupportedDefinitions(List<ConfigAttributeDefintion> supportedDefinitions, int parentResult, int childResult)
|
||||||
{
|
{
|
||||||
for (ConfigAttributeDefintion cad : supportedDefinitions)
|
for (ConfigAttributeDefintion cad : supportedDefinitions)
|
||||||
@@ -336,7 +336,7 @@ public class RMAfterInvocationProvider extends RMSecurityCommon
|
|||||||
{
|
{
|
||||||
return returnedObject;
|
return returnedObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
int parentReadCheck = checkRead(returnedObject.getParentRef());
|
int parentReadCheck = checkRead(returnedObject.getParentRef());
|
||||||
int childReadCheck = checkRead(returnedObject.getChildRef());
|
int childReadCheck = checkRead(returnedObject.getChildRef());
|
||||||
|
|
||||||
@@ -359,7 +359,7 @@ public class RMAfterInvocationProvider extends RMSecurityCommon
|
|||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cad.typeString.equals(cad.parent) == true && parentReadCheck != AccessDecisionVoter.ACCESS_GRANTED)
|
if (cad.typeString.equals(cad.parent) == true && parentReadCheck != AccessDecisionVoter.ACCESS_GRANTED)
|
||||||
{
|
{
|
||||||
throw new AccessDeniedException("Access Denied");
|
throw new AccessDeniedException("Access Denied");
|
||||||
@@ -453,17 +453,17 @@ public class RMAfterInvocationProvider extends RMSecurityCommon
|
|||||||
maxSize = new Integer(maxSize + returnedObject.getResultSetMetaData().getSearchParameters().getSkipCount());
|
maxSize = new Integer(maxSize + returnedObject.getResultSetMetaData().getSearchParameters().getSkipCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
int maxChecks = maxPermissionChecks;
|
// int maxChecks = maxPermissionChecks;
|
||||||
if (returnedObject.getResultSetMetaData().getSearchParameters().getMaxPermissionChecks() >= 0)
|
// if (returnedObject.getResultSetMetaData().getSearchParameters().getMaxPermissionChecks() >= 0)
|
||||||
{
|
// {
|
||||||
maxChecks = returnedObject.getResultSetMetaData().getSearchParameters().getMaxPermissionChecks();
|
// maxChecks = returnedObject.getResultSetMetaData().getSearchParameters().getMaxPermissionChecks();
|
||||||
}
|
// }
|
||||||
|
|
||||||
long maxCheckTime = maxPermissionCheckTimeMillis;
|
// long maxCheckTime = maxPermissionCheckTimeMillis;
|
||||||
if (returnedObject.getResultSetMetaData().getSearchParameters().getMaxPermissionCheckTimeMillis() >= 0)
|
// if (returnedObject.getResultSetMetaData().getSearchParameters().getMaxPermissionCheckTimeMillis() >= 0)
|
||||||
{
|
// {
|
||||||
maxCheckTime = returnedObject.getResultSetMetaData().getSearchParameters().getMaxPermissionCheckTimeMillis();
|
// maxCheckTime = returnedObject.getResultSetMetaData().getSearchParameters().getMaxPermissionCheckTimeMillis();
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (supportedDefinitions.size() == 0)
|
if (supportedDefinitions.size() == 0)
|
||||||
{
|
{
|
||||||
@@ -479,8 +479,8 @@ public class RMAfterInvocationProvider extends RMSecurityCommon
|
|||||||
}
|
}
|
||||||
filteringResultSet.setResultSetMetaData(
|
filteringResultSet.setResultSetMetaData(
|
||||||
new SimpleResultSetMetaData(
|
new SimpleResultSetMetaData(
|
||||||
returnedObject.getResultSetMetaData().getLimitedBy(),
|
returnedObject.getResultSetMetaData().getLimitedBy(),
|
||||||
PermissionEvaluationMode.EAGER,
|
PermissionEvaluationMode.EAGER,
|
||||||
returnedObject.getResultSetMetaData().getSearchParameters()));
|
returnedObject.getResultSetMetaData().getSearchParameters()));
|
||||||
return filteringResultSet;
|
return filteringResultSet;
|
||||||
}
|
}
|
||||||
@@ -492,8 +492,8 @@ public class RMAfterInvocationProvider extends RMSecurityCommon
|
|||||||
}
|
}
|
||||||
filteringResultSet.setResultSetMetaData(
|
filteringResultSet.setResultSetMetaData(
|
||||||
new SimpleResultSetMetaData(
|
new SimpleResultSetMetaData(
|
||||||
returnedObject.getResultSetMetaData().getLimitedBy(),
|
returnedObject.getResultSetMetaData().getLimitedBy(),
|
||||||
PermissionEvaluationMode.EAGER,
|
PermissionEvaluationMode.EAGER,
|
||||||
returnedObject.getResultSetMetaData().getSearchParameters()));
|
returnedObject.getResultSetMetaData().getSearchParameters()));
|
||||||
return filteringResultSet;
|
return filteringResultSet;
|
||||||
}
|
}
|
||||||
@@ -501,12 +501,12 @@ public class RMAfterInvocationProvider extends RMSecurityCommon
|
|||||||
|
|
||||||
// record the start time
|
// record the start time
|
||||||
long startTimeMillis = System.currentTimeMillis();
|
long startTimeMillis = System.currentTimeMillis();
|
||||||
|
|
||||||
// set the default, unlimited resultset type
|
// set the default, unlimited resultset type
|
||||||
filteringResultSet.setResultSetMetaData(
|
filteringResultSet.setResultSetMetaData(
|
||||||
new SimpleResultSetMetaData(
|
new SimpleResultSetMetaData(
|
||||||
returnedObject.getResultSetMetaData().getLimitedBy(),
|
returnedObject.getResultSetMetaData().getLimitedBy(),
|
||||||
PermissionEvaluationMode.EAGER,
|
PermissionEvaluationMode.EAGER,
|
||||||
returnedObject.getResultSetMetaData().getSearchParameters()));
|
returnedObject.getResultSetMetaData().getSearchParameters()));
|
||||||
|
|
||||||
for (int i = 0; i < returnedObject.length(); i++)
|
for (int i = 0; i < returnedObject.length(); i++)
|
||||||
@@ -516,15 +516,15 @@ public class RMAfterInvocationProvider extends RMSecurityCommon
|
|||||||
// {
|
// {
|
||||||
// filteringResultSet.setResultSetMetaData(
|
// filteringResultSet.setResultSetMetaData(
|
||||||
// new SimpleResultSetMetaData(
|
// new SimpleResultSetMetaData(
|
||||||
// LimitBy.NUMBER_OF_PERMISSION_EVALUATIONS,
|
// LimitBy.NUMBER_OF_PERMISSION_EVALUATIONS,
|
||||||
// PermissionEvaluationMode.EAGER,
|
// PermissionEvaluationMode.EAGER,
|
||||||
// returnedObject.getResultSetMetaData().getSearchParameters()));
|
// returnedObject.getResultSetMetaData().getSearchParameters()));
|
||||||
// break;
|
// break;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// All permission checks must pass
|
// All permission checks must pass
|
||||||
inclusionMask.set(i, true);
|
inclusionMask.set(i, true);
|
||||||
|
|
||||||
if (nodeService.exists(returnedObject.getNodeRef(i)) == false)
|
if (nodeService.exists(returnedObject.getNodeRef(i)) == false)
|
||||||
{
|
{
|
||||||
inclusionMask.set(i, false);
|
inclusionMask.set(i, false);
|
||||||
@@ -533,22 +533,22 @@ public class RMAfterInvocationProvider extends RMSecurityCommon
|
|||||||
{
|
{
|
||||||
int parentCheckRead = checkRead(returnedObject.getChildAssocRef(i).getParentRef());
|
int parentCheckRead = checkRead(returnedObject.getChildAssocRef(i).getParentRef());
|
||||||
int childCheckRead = checkRead(returnedObject.getNodeRef(i));
|
int childCheckRead = checkRead(returnedObject.getNodeRef(i));
|
||||||
|
|
||||||
for (ConfigAttributeDefintion cad : supportedDefinitions)
|
for (ConfigAttributeDefintion cad : supportedDefinitions)
|
||||||
{
|
{
|
||||||
NodeRef testNodeRef = returnedObject.getNodeRef(i);
|
NodeRef testNodeRef = returnedObject.getNodeRef(i);
|
||||||
int checkRead = childCheckRead;
|
int checkRead = childCheckRead;
|
||||||
if (cad.parent)
|
if (cad.parent)
|
||||||
{
|
{
|
||||||
testNodeRef = returnedObject.getChildAssocRef(i).getParentRef();
|
testNodeRef = returnedObject.getChildAssocRef(i).getParentRef();
|
||||||
checkRead = parentCheckRead;
|
checkRead = parentCheckRead;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isUnfiltered(testNodeRef))
|
if (isUnfiltered(testNodeRef))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inclusionMask.get(i) && (testNodeRef != null) && (checkRead != AccessDecisionVoter.ACCESS_GRANTED))
|
if (inclusionMask.get(i) && (testNodeRef != null) && (checkRead != AccessDecisionVoter.ACCESS_GRANTED))
|
||||||
{
|
{
|
||||||
inclusionMask.set(i, false);
|
inclusionMask.set(i, false);
|
||||||
@@ -613,9 +613,9 @@ public class RMAfterInvocationProvider extends RMSecurityCommon
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Default to the system-wide values and we'll see if they need to be reduced
|
// Default to the system-wide values and we'll see if they need to be reduced
|
||||||
long targetResultCount = returnedObject.size();
|
long targetResultCount = returnedObject.size();
|
||||||
int maxPermissionChecks = Integer.MAX_VALUE;
|
int maxPermissionChecks = Integer.MAX_VALUE;
|
||||||
long maxPermissionCheckTimeMillis = this.maxPermissionCheckTimeMillis;
|
long maxPermissionCheckTimeMillis = this.maxPermissionCheckTimeMillis;
|
||||||
if (returnedObject instanceof PermissionCheckCollection<?>)
|
if (returnedObject instanceof PermissionCheckCollection<?>)
|
||||||
{
|
{
|
||||||
PermissionCheckCollection permissionCheckCollection = (PermissionCheckCollection) returnedObject;
|
PermissionCheckCollection permissionCheckCollection = (PermissionCheckCollection) returnedObject;
|
||||||
@@ -630,20 +630,20 @@ public class RMAfterInvocationProvider extends RMSecurityCommon
|
|||||||
maxPermissionCheckTimeMillis = permissionCheckCollection.getCutOffAfterTimeMs();
|
maxPermissionCheckTimeMillis = permissionCheckCollection.getCutOffAfterTimeMs();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start timer and counter for cut-off
|
// Start timer and counter for cut-off
|
||||||
boolean cutoff = false;
|
boolean cutoff = false;
|
||||||
long startTimeMillis = System.currentTimeMillis();
|
long startTimeMillis = System.currentTimeMillis();
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
// Keep values explicitly
|
// Keep values explicitly
|
||||||
List<Object> keepValues = new ArrayList<Object>(returnedObject.size());
|
List<Object> keepValues = new ArrayList<Object>(returnedObject.size());
|
||||||
|
|
||||||
for (Object nextObject : returnedObject)
|
for (Object nextObject : returnedObject)
|
||||||
{
|
{
|
||||||
// if the maximum result size or time has been exceeded, then we have to remove only
|
// if the maximum result size or time has been exceeded, then we have to remove only
|
||||||
long currentTimeMillis = System.currentTimeMillis();
|
long currentTimeMillis = System.currentTimeMillis();
|
||||||
|
|
||||||
// NOTE: for reference - the "maxPermissionChecks" has never been honoured by this loop (since previously the count was not being incremented)
|
// NOTE: for reference - the "maxPermissionChecks" has never been honoured by this loop (since previously the count was not being incremented)
|
||||||
if (count >= targetResultCount)
|
if (count >= targetResultCount)
|
||||||
{
|
{
|
||||||
@@ -670,7 +670,7 @@ public class RMAfterInvocationProvider extends RMSecurityCommon
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean allowed = true;
|
boolean allowed = true;
|
||||||
for (ConfigAttributeDefintion cad : supportedDefinitions)
|
for (ConfigAttributeDefintion cad : supportedDefinitions)
|
||||||
{
|
{
|
||||||
@@ -744,8 +744,8 @@ public class RMAfterInvocationProvider extends RMSecurityCommon
|
|||||||
continue; // Continue to next ConfigAttributeDefintion
|
continue; // Continue to next ConfigAttributeDefintion
|
||||||
}
|
}
|
||||||
|
|
||||||
if (allowed &&
|
if (allowed &&
|
||||||
testNodeRef != null &&
|
testNodeRef != null &&
|
||||||
checkRead(testNodeRef) != AccessDecisionVoter.ACCESS_GRANTED)
|
checkRead(testNodeRef) != AccessDecisionVoter.ACCESS_GRANTED)
|
||||||
{
|
{
|
||||||
allowed = false;
|
allowed = false;
|
||||||
@@ -753,10 +753,10 @@ public class RMAfterInvocationProvider extends RMSecurityCommon
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Failure or success, increase the count
|
// Failure or success, increase the count
|
||||||
count++;
|
count++;
|
||||||
|
|
||||||
if (allowed)
|
if (allowed)
|
||||||
{
|
{
|
||||||
keepValues.add(nextObject);
|
keepValues.add(nextObject);
|
||||||
@@ -800,10 +800,10 @@ public class RMAfterInvocationProvider extends RMSecurityCommon
|
|||||||
for (int i = 0, l = returnedObject.length; i < l; i++)
|
for (int i = 0, l = returnedObject.length; i < l; i++)
|
||||||
{
|
{
|
||||||
Object current = returnedObject[i];
|
Object current = returnedObject[i];
|
||||||
|
|
||||||
int parentReadCheck = checkRead(getParentReadCheckNode(current));
|
int parentReadCheck = checkRead(getParentReadCheckNode(current));
|
||||||
int childReadChek = checkRead(getChildReadCheckNode(current));
|
int childReadChek = checkRead(getChildReadCheckNode(current));
|
||||||
|
|
||||||
for (ConfigAttributeDefintion cad : supportedDefinitions)
|
for (ConfigAttributeDefintion cad : supportedDefinitions)
|
||||||
{
|
{
|
||||||
incudedSet.set(i, true);
|
incudedSet.set(i, true);
|
||||||
@@ -865,7 +865,7 @@ public class RMAfterInvocationProvider extends RMSecurityCommon
|
|||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
int readCheck = childReadChek;
|
int readCheck = childReadChek;
|
||||||
if (cad.parent == true)
|
if (cad.parent == true)
|
||||||
{
|
{
|
||||||
@@ -894,7 +894,7 @@ public class RMAfterInvocationProvider extends RMSecurityCommon
|
|||||||
return answer;
|
return answer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private NodeRef getParentReadCheckNode(Object current)
|
private NodeRef getParentReadCheckNode(Object current)
|
||||||
{
|
{
|
||||||
NodeRef testNodeRef = null;
|
NodeRef testNodeRef = null;
|
||||||
@@ -921,7 +921,7 @@ public class RMAfterInvocationProvider extends RMSecurityCommon
|
|||||||
}
|
}
|
||||||
return testNodeRef;
|
return testNodeRef;
|
||||||
}
|
}
|
||||||
|
|
||||||
private NodeRef getChildReadCheckNode(Object current)
|
private NodeRef getChildReadCheckNode(Object current)
|
||||||
{
|
{
|
||||||
NodeRef testNodeRef = null;
|
NodeRef testNodeRef = null;
|
||||||
@@ -962,7 +962,7 @@ public class RMAfterInvocationProvider extends RMSecurityCommon
|
|||||||
String uuid = DefaultTypeConverter.INSTANCE.convert(String.class, filtered.get(ContentModel.PROP_NODE_UUID));
|
String uuid = DefaultTypeConverter.INSTANCE.convert(String.class, filtered.get(ContentModel.PROP_NODE_UUID));
|
||||||
StoreRef storeRef = new StoreRef(protocol, identifier);
|
StoreRef storeRef = new StoreRef(protocol, identifier);
|
||||||
NodeRef nodeRef = new NodeRef(storeRef, uuid);
|
NodeRef nodeRef = new NodeRef(storeRef, uuid);
|
||||||
if ((nodeRef == null) ||
|
if ((nodeRef == null) ||
|
||||||
(permissionService.hasPermission(getFilePlanService().getFilePlan(nodeRef), RMPermissionModel.VIEW_UPDATE_REASONS_FOR_FREEZE) != AccessStatus.ALLOWED))
|
(permissionService.hasPermission(getFilePlanService().getFilePlan(nodeRef), RMPermissionModel.VIEW_UPDATE_REASONS_FOR_FREEZE) != AccessStatus.ALLOWED))
|
||||||
{
|
{
|
||||||
filtered.remove(RecordsManagementModel.PROP_HOLD_REASON);
|
filtered.remove(RecordsManagementModel.PROP_HOLD_REASON);
|
||||||
|
Reference in New Issue
Block a user