Skip to content

Commit

Permalink
fix(): allow create flow and allow save when namespace is allowed (#4512
Browse files Browse the repository at this point in the history
)

close kestraio/kestra-ee#1443
  • Loading branch information
Skraye committed Aug 1, 2024
1 parent 572ccc5 commit 6a48d62
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion ui/src/components/flows/Flows.vue
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@
return this.canRead || this.canDelete || this.canUpdate;
},
canCreate() {
return this.user && this.user.isAllowed(permission.FLOW, action.CREATE, this.$route.query.namespace);
return this.user && this.user.hasAnyActionOnAnyNamespace(permission.FLOW, action.CREATE);
},
canRead() {
return this.user && this.user.isAllowed(permission.FLOW, action.READ, this.$route.query.namespace);
Expand Down
12 changes: 6 additions & 6 deletions ui/src/components/inputs/EditorView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,6 @@
stopTour();
});
window.addEventListener("beforeunload", persistEditorWidth);
window.addEventListener("resize", onResize);
if (props.isCreating) {
Expand Down Expand Up @@ -399,11 +398,12 @@
store.commit("core/setGuidedProperties", {tourStarted: false});
};
const isAllowedEdit = () => {
const isAllowedEdit = computed(() => {
return (
user && user.isAllowed(permission.FLOW, action.UPDATE, props.namespace)
user && user.isAllowed(permission.FLOW, action.UPDATE, flowParsed.value?.namespace ?? props.namespace)
);
};
});
const forwardEvent = (type, event) => {
emit(type, event);
Expand Down Expand Up @@ -985,7 +985,7 @@
:is-creating="props.isCreating"
:is-read-only="props.isReadOnly"
:can-delete="canDelete()"
:is-allowed-edit="isAllowedEdit()"
:is-allowed-edit="isAllowedEdit"
:have-change="flowYaml !== flowYamlOrigin"
:flow-have-tasks="flowHaveTasks()"
:errors="flowErrors"
Expand Down Expand Up @@ -1074,7 +1074,7 @@
:execution="execution"
:is-read-only="isReadOnly"
:source="flowYaml"
:is-allowed-edit="isAllowedEdit()"
:is-allowed-edit="isAllowedEdit"
:view-type="viewType"
:expanded-subflows="props.expandedSubflows"
/>
Expand Down

0 comments on commit 6a48d62

Please sign in to comment.