Skip to content
This repository was archived by the owner on Dec 13, 2023. It is now read-only.

Commit fd2816d

Browse files
committed
used enum instead of String
1 parent a63c37a commit fd2816d

File tree

2 files changed

+18
-9
lines changed

2 files changed

+18
-9
lines changed

core/src/main/java/com/netflix/conductor/core/execution/WorkflowExecutor.java

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,8 @@ public void resetCallbacksForWorkflow(String workflowId) {
154154
});
155155
}
156156

157-
@PreAuthorize("hasPermission(#request, 'OPERATOR')")
157+
@PreAuthorize(
158+
"hasPermission(#request, T(com.netflix.conductor.common.metadata.acl.Permission).OPERATOR)")
158159
public String rerun(RerunWorkflowRequest request) {
159160
Utils.checkNotNull(request.getReRunFromWorkflowId(), "reRunFromWorkflowId is missing");
160161
if (!rerunWF(
@@ -177,7 +178,8 @@ public String rerun(RerunWorkflowRequest request) {
177178
* @throws NotFoundException Workflow definition is not found or Workflow is deemed
178179
* non-restartable as per workflow definition.
179180
*/
180-
@PreAuthorize("hasPermission(#workflowId, 'OPERATOR')")
181+
@PreAuthorize(
182+
"hasPermission(#workflowId, T(com.netflix.conductor.common.metadata.acl.Permission).OPERATOR)")
181183
public void restart(String workflowId, boolean useLatestDefinitions) {
182184
final WorkflowModel workflow = executionDAOFacade.getWorkflowModel(workflowId, true);
183185

@@ -263,7 +265,8 @@ public void restart(String workflowId, boolean useLatestDefinitions) {
263265
*
264266
* @param workflowId the id of the workflow to be retried
265267
*/
266-
@PreAuthorize("hasPermission(#workflowId, 'OPERATOR')")
268+
@PreAuthorize(
269+
"hasPermission(#workflowId, T(com.netflix.conductor.common.metadata.acl.Permission).OPERATOR)")
267270
public void retry(String workflowId, boolean resumeSubworkflowTasks) {
268271
WorkflowModel workflow = executionDAOFacade.getWorkflowModel(workflowId, true);
269272
if (!workflow.getStatus().isTerminal()) {
@@ -565,7 +568,8 @@ WorkflowModel completeWorkflow(WorkflowModel workflow) {
565568
return workflow;
566569
}
567570

568-
@PreAuthorize("hasPermission(#workflowId, 'OPERATOR')")
571+
@PreAuthorize(
572+
"hasPermission(#workflowId, T(com.netflix.conductor.common.metadata.acl.Permission).OPERATOR)")
569573
public void terminateWorkflow(String workflowId, String reason) {
570574
WorkflowModel workflow = executionDAOFacade.getWorkflowModel(workflowId, true);
571575
if (WorkflowModel.Status.COMPLETED.equals(workflow.getStatus())) {
@@ -1187,7 +1191,8 @@ List<TaskModel> dedupAndAddTasks(WorkflowModel workflow, List<TaskModel> tasks)
11871191
/**
11881192
* @throws ConflictException if the workflow is in terminal state.
11891193
*/
1190-
@PreAuthorize("hasPermission(#workflowId, 'OPERATOR')")
1194+
@PreAuthorize(
1195+
"hasPermission(#workflowId, T(com.netflix.conductor.common.metadata.acl.Permission).OPERATOR)")
11911196
public void pauseWorkflow(String workflowId) {
11921197
try {
11931198
executionLockService.acquireLock(workflowId, 60000);
@@ -1223,7 +1228,8 @@ public void pauseWorkflow(String workflowId) {
12231228
* @param workflowId the workflow to be resumed
12241229
* @throws IllegalStateException if the workflow is not in PAUSED state
12251230
*/
1226-
@PreAuthorize("hasPermission(#workflowId, 'OPERATOR')")
1231+
@PreAuthorize(
1232+
"hasPermission(#workflowId, T(com.netflix.conductor.common.metadata.acl.Permission).OPERATOR)")
12271233
public void resumeWorkflow(String workflowId) {
12281234
WorkflowModel workflow = executionDAOFacade.getWorkflowModel(workflowId, false);
12291235
if (!workflow.getStatus().equals(WorkflowModel.Status.PAUSED)) {
@@ -1252,7 +1258,8 @@ public void resumeWorkflow(String workflowId) {
12521258
* @param skipTaskRequest the {@link SkipTaskRequest} object
12531259
* @throws IllegalStateException
12541260
*/
1255-
@PreAuthorize("hasPermission(#workflowId, 'OPERATOR')")
1261+
@PreAuthorize(
1262+
"hasPermission(#workflowId, T(com.netflix.conductor.common.metadata.acl.Permission).OPERATOR)")
12561263
public void skipTaskFromWorkflow(
12571264
String workflowId, String taskReferenceName, SkipTaskRequest skipTaskRequest) {
12581265

core/src/main/java/com/netflix/conductor/core/operation/StartWorkflowOperation.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,15 @@ public StartWorkflowOperation(
6565
}
6666

6767
@Override
68-
@PreAuthorize("hasPermission(#input, 'OWNER')")
68+
@PreAuthorize(
69+
"hasPermission(#input, T(com.netflix.conductor.common.metadata.acl.Permission).OWNER)")
6970
public String execute(StartWorkflowInput input) {
7071
return startWorkflow(input);
7172
}
7273

7374
@EventListener(WorkflowCreationEvent.class)
74-
@PreAuthorize("hasPermission(#workflowCreationEvent.startWorkflowInput, 'OWNER')")
75+
@PreAuthorize(
76+
"hasPermission(#workflowCreationEvent.startWorkflowInput, T(com.netflix.conductor.common.metadata.acl.Permission).OWNER)")
7577
public void handleWorkflowCreationEvent(WorkflowCreationEvent workflowCreationEvent) {
7678
startWorkflow(workflowCreationEvent.getStartWorkflowInput());
7779
}

0 commit comments

Comments
 (0)