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

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

View File

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