MNT-22138: Document Filed to RM File Plan under categories with cut off retention schedule no longer accessible to non admin users in collab site

- Limited to certain code blocks to run as system.
This commit is contained in:
Raluca Munteanu
2021-04-02 17:23:23 +03:00
parent 14ab9ee541
commit a6aa711657
2 changed files with 66 additions and 73 deletions

View File

@@ -894,79 +894,70 @@ public class DispositionServiceImpl extends ServiceBaseImpl
@Override
public boolean isNextDispositionActionEligible(NodeRef nodeRef)
{
boolean result = false;
// Get the disposition instructions
DispositionSchedule di = getDispositionSchedule(nodeRef);
DispositionAction nextDa = getNextDispositionAction(nodeRef);
if (di != null &&
this.nodeService.hasAspect(nodeRef, ASPECT_DISPOSITION_LIFECYCLE) &&
nextDa != null)
return authenticationUtil.runAsSystem(new RunAsWork<Boolean>()
{
// for accession step we can have also AND between step conditions
Boolean combineSteps = false;
if (nextDa.getName().equals("accession"))
public Boolean doWork() throws Exception
{
NodeRef accessionNodeRef = di.getDispositionActionDefinitionByName("accession").getNodeRef();
if (accessionNodeRef != null) {
Boolean combineStepsProp = (Boolean)this.nodeService.getProperty(accessionNodeRef, PROP_COMBINE_DISPOSITION_STEP_CONDITIONS);
if (combineStepsProp != null)
{
combineSteps = combineStepsProp;
}
}
}
Date asOf = (Date)this.nodeService.getProperty(nextDa.getNodeRef(), PROP_DISPOSITION_AS_OF);
Boolean asOfDateInPast = false;
if (asOf != null)
{
asOfDateInPast = asOf.before(new Date());
}
if (asOfDateInPast && !combineSteps)
{
return true;
}
else if(!asOfDateInPast && combineSteps)
{
return false;
}
DispositionAction da = new DispositionActionImpl(serviceRegistry, nextDa.getNodeRef());
DispositionActionDefinition dad = da.getDispositionActionDefinition();
if (dad != null)
{
boolean firstComplete = dad.eligibleOnFirstCompleteEvent();
List<ChildAssociationRef> assocs = this.nodeService.getChildAssocs(nextDa.getNodeRef(), ASSOC_EVENT_EXECUTIONS, RegexQNamePattern.MATCH_ALL);
for (ChildAssociationRef assoc : assocs)
{
NodeRef eventExecution = assoc.getChildRef();
Boolean isCompleteValue = (Boolean)this.nodeService.getProperty(eventExecution, PROP_EVENT_EXECUTION_COMPLETE);
boolean isComplete = false;
if (isCompleteValue != null)
{
isComplete = isCompleteValue.booleanValue();
// implement AND and OR combination of event completions
if (isComplete)
{
result = true;
if (firstComplete)
{
break;
boolean result = false;
// Get the disposition instructions
DispositionSchedule di = getDispositionSchedule(nodeRef);
DispositionAction nextDa = getNextDispositionAction(nodeRef);
if (di != null &&
nodeService.hasAspect(nodeRef, ASPECT_DISPOSITION_LIFECYCLE) &&
nextDa != null) {
// for accession step we can have also AND between step conditions
Boolean combineSteps = false;
if (nextDa.getName().equals("accession")) {
NodeRef accessionNodeRef = di.getDispositionActionDefinitionByName("accession").getNodeRef();
if (accessionNodeRef != null) {
Boolean combineStepsProp = (Boolean) nodeService.getProperty(accessionNodeRef, PROP_COMBINE_DISPOSITION_STEP_CONDITIONS);
if (combineStepsProp != null) {
combineSteps = combineStepsProp;
}
}
else
{
result = false;
if (!firstComplete)
{
break;
}
Date asOf = (Date) nodeService.getProperty(nextDa.getNodeRef(), PROP_DISPOSITION_AS_OF);
Boolean asOfDateInPast = false;
if (asOf != null) {
asOfDateInPast = asOf.before(new Date());
}
if (asOfDateInPast && !combineSteps) {
return true;
} else if (!asOfDateInPast && combineSteps) {
return false;
}
DispositionAction da = new DispositionActionImpl(serviceRegistry, nextDa.getNodeRef());
DispositionActionDefinition dad = da.getDispositionActionDefinition();
if (dad != null) {
boolean firstComplete = dad.eligibleOnFirstCompleteEvent();
List<ChildAssociationRef> assocs = nodeService.getChildAssocs(nextDa.getNodeRef(), ASSOC_EVENT_EXECUTIONS, RegexQNamePattern.MATCH_ALL);
for (ChildAssociationRef assoc : assocs) {
NodeRef eventExecution = assoc.getChildRef();
Boolean isCompleteValue = (Boolean) nodeService.getProperty(eventExecution, PROP_EVENT_EXECUTION_COMPLETE);
boolean isComplete = false;
if (isCompleteValue != null) {
isComplete = isCompleteValue.booleanValue();
// implement AND and OR combination of event completions
if (isComplete) {
result = true;
if (firstComplete) {
break;
}
} else {
result = false;
if (!firstComplete) {
break;
}
}
}
}
}
}
return result;
}
}
return result;
});
}
/**

View File

@@ -510,13 +510,14 @@ public class JSONConversionComponent extends org.alfresco.repo.jscript.app.JS
// Set the indicators array
setIndicators(rmNodeValues, nodeRef);
AuthenticationUtil.runAsSystem(new RunAsWork<Void>() {
@Override
public Void doWork() {
// Set the actions array
setActions(rmNodeValues, nodeRef);
AuthenticationUtil.runAsSystem(new RunAsWork<Void>()
{
public Void doWork() throws Exception
{
// Set the actions array
setActions(rmNodeValues, nodeRef);
//Add details of the next incomplete event in the disposition schedule
if (dispositionService.getNextDispositionAction(nodeRef) != null)
{
@@ -525,9 +526,10 @@ public class JSONConversionComponent extends org.alfresco.repo.jscript.app.JS
if (!details.isEventComplete())
{
HashMap properties = ((HashMap) rmNodeValues.get("properties"));
properties.put("combineDispositionStepConditions", nodeService.getProperty(dispositionService.getNextDispositionAction(nodeRef).getDispositionActionDefinition().getNodeRef(), PROP_COMBINE_DISPOSITION_STEP_CONDITIONS));
properties.put("incompleteDispositionEvent", details.getEventName());
properties.put("dispositionEventCombination", nodeService.getProperty(dispositionService.getNextDispositionAction(nodeRef).getDispositionActionDefinition().getNodeRef(), PROP_DISPOSITION_EVENT_COMBINATION));
properties.put("combineDispositionStepConditions", nodeService.getProperty(dispositionService.getNextDispositionAction(nodeRef).getDispositionActionDefinition().getNodeRef(), PROP_COMBINE_DISPOSITION_STEP_CONDITIONS));
properties.put("incompleteDispositionEvent", details.getEventName());
properties.put("dispositionEventCombination", nodeService.getProperty(dispositionService.getNextDispositionAction(nodeRef).getDispositionActionDefinition().getNodeRef(), PROP_DISPOSITION_EVENT_COMBINATION));
break;
}
}