Skip to content

Commit

Permalink
fix: launch user can only use same labels as pipeline if any
Browse files Browse the repository at this point in the history
  • Loading branch information
JaimeSeqLabs committed Aug 21, 2023
1 parent 8296f08 commit 8833b24
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/main/java/io/seqera/tower/cli/commands/LaunchCmd.java
Original file line number Diff line number Diff line change
Expand Up @@ -246,10 +246,6 @@ private List<Long> obtainLabelIDs(@Nullable Long workspaceId) throws ApiExceptio
return Collections.emptyList();
}

if (!labelPermission(workspaceId)) {
throw new ApiException("User does not have permission to modify pipeline labels");
}

// retrieve labels for the workspace and check if we need to create new ones
List<LabelDbDto> wspLabels = new ArrayList<>();

Expand All @@ -268,6 +264,10 @@ private List<Long> obtainLabelIDs(@Nullable Long workspaceId) throws ApiExceptio
.filter(labelName -> !nameToID.containsKey(labelName))
.collect(Collectors.toList());

if (!newLabels.isEmpty() && !labelPermission(workspaceId)) {
throw new ApiException("User does not have permission to modify pipeline labels");
}

// create the new ones via POST /labels
for (String labelName: newLabels) {
CreateLabelResponse created = api().createLabel(
Expand Down

0 comments on commit 8833b24

Please sign in to comment.