feature_24570 #11
|
@ -143,7 +143,7 @@ public class SimpleLifeCycleManager extends AbstractLifeCycleManager implements
|
||||||
return new GuardedStepExecution(Steps.UNPUBLISH) {
|
return new GuardedStepExecution(Steps.UNPUBLISH) {
|
||||||
@Override
|
@Override
|
||||||
protected StepExecutionReport run() throws Exception {
|
protected StepExecutionReport run() throws Exception {
|
||||||
|
log.info(Steps.UNPUBLISH+ " running...");
|
||||||
//DeMaterialize
|
//DeMaterialize
|
||||||
JSONPathWrapper wrapper = new JSONPathWrapper(theReport.getTheRequest().getDocument().getTheDocument().toJson());
|
JSONPathWrapper wrapper = new JSONPathWrapper(theReport.getTheRequest().getDocument().getTheDocument().toJson());
|
||||||
for (String s : wrapper.getMatchingPaths("$..[?(@." + RegisteredFileSet.PAYLOADS + ")]")){
|
for (String s : wrapper.getMatchingPaths("$..[?(@." + RegisteredFileSet.PAYLOADS + ")]")){
|
||||||
|
|
|
@ -29,14 +29,14 @@ public abstract class GuardedExecution<R extends BaseExecutionRequest,T extends
|
||||||
|
|
||||||
protected T theReport;
|
protected T theReport;
|
||||||
|
|
||||||
protected void checks() throws ConfigurationException, InsufficientPrivileges {
|
protected void checks() throws ConfigurationException, InsufficientPrivileges, StepException {
|
||||||
if(theReport.getTheRequest()==null) throw new RuntimeException("Unexpected state : request cannot be null");
|
if(theReport.getTheRequest()==null) throw new RuntimeException("Unexpected state : request cannot be null");
|
||||||
|
|
||||||
// Check document phase
|
// Check document phase
|
||||||
if(op.getAppliableToPhases()!=null&&!op.getAppliableToPhases().isEmpty()) {
|
if(op.getAppliableToPhases()!=null&&!op.getAppliableToPhases().isEmpty()) {
|
||||||
String currentPhase = theReport.getTheRequest().getDocument().getLifecycleInformation().getPhase();
|
String currentPhase = theReport.getTheRequest().getDocument().getLifecycleInformation().getPhase();
|
||||||
if(!op.getAppliableToPhases().contains(currentPhase))
|
if(!op.getAppliableToPhases().contains(currentPhase))
|
||||||
new StepException("Document must be in one of the following phases : "+ op.getAppliableToPhases());
|
throw new StepException("Document must be in one of the following phases : "+ op.getAppliableToPhases());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package org.gcube.application.cms.plugins.implementations.executions;
|
package org.gcube.application.cms.plugins.implementations.executions;
|
||||||
|
|
||||||
import org.gcube.application.cms.plugins.faults.InsufficientPrivileges;
|
import org.gcube.application.cms.plugins.faults.InsufficientPrivileges;
|
||||||
|
import org.gcube.application.cms.plugins.faults.StepException;
|
||||||
import org.gcube.application.cms.plugins.implementations.RoleManager;
|
import org.gcube.application.cms.plugins.implementations.RoleManager;
|
||||||
import org.gcube.application.cms.plugins.reports.StepExecutionReport;
|
import org.gcube.application.cms.plugins.reports.StepExecutionReport;
|
||||||
import org.gcube.application.cms.plugins.requests.StepExecutionRequest;
|
import org.gcube.application.cms.plugins.requests.StepExecutionRequest;
|
||||||
|
@ -17,7 +18,7 @@ public abstract class GuardedStepExecution extends GuardedExecution<StepExecutio
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void checks() throws ConfigurationException, InsufficientPrivileges {
|
protected void checks() throws ConfigurationException, InsufficientPrivileges, StepException {
|
||||||
super.checks();
|
super.checks();
|
||||||
RoleManager r = new RoleManager(config);
|
RoleManager r = new RoleManager(config);
|
||||||
if(!r.canInvokeStep(theReport.getTheRequest().getStep(),theReport.getTheRequest().getCaller()))
|
if(!r.canInvokeStep(theReport.getTheRequest().getStep(),theReport.getTheRequest().getCaller()))
|
||||||
|
|
Loading…
Reference in New Issue