Skip to content

Commit

Permalink
fix(core): acl control added on 'Use' buttons in BlueprintsBrowser & …
Browse files Browse the repository at this point in the history
…BlueprintDetail

closes #1816
  • Loading branch information
brian-mulier-p committed Jul 27, 2023
1 parent f8c55c5 commit a23bb94
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
9 changes: 8 additions & 1 deletion ui/src/components/flows/blueprints/BlueprintDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<h2 class="blueprint-title align-self-center">
{{ blueprint.title }}
</h2>
<div class="ms-auto align-self-center">
<div v-if="userCanCreateFlow" class="ms-auto align-self-center">
<router-link :to="{name: 'flows/create'}" @click="asAutoRestoreDraft">
<el-button size="large" type="primary" v-if="!embed">
{{ $t('use') }}
Expand Down Expand Up @@ -93,6 +93,9 @@
import {shallowRef} from "vue";
import ContentCopy from "vue-material-design-icons/ContentCopy.vue";
import Markdown from "../../layout/Markdown.vue";
import {mapState} from "vuex";
import permission from "../../../models/permission";
import action from "../../../models/action";
export default {
Expand Down Expand Up @@ -158,6 +161,10 @@
}
},
computed: {
...mapState("auth", ["user"]),
userCanCreateFlow() {
return this.user.hasAnyAction(permission.FLOW, action.CREATE);
},
parsedFlow() {
return {
...YamlUtils.parse(this.blueprint.flow),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
{{ $t('copy') }}
</el-button>
</el-tooltip>
<el-button v-else size="large" text bg @click="blueprintToEditor(blueprint.id)">
<el-button v-else-if="userCanCreateFlow" size="large" text bg @click="blueprintToEditor(blueprint.id)">
{{ $t('use') }}
</el-button>
</div>
Expand All @@ -76,6 +76,9 @@
import {shallowRef} from "vue";
import ContentCopy from "vue-material-design-icons/ContentCopy.vue";
import RestoreUrl from "../../../../mixins/restoreUrl";
import permission from "../../../../models/permission";
import action from "../../../../models/action";
import {mapState} from "vuex";
export default {
mixins: [RestoreUrl, DataTableActions],
Expand Down Expand Up @@ -198,6 +201,12 @@
this.load(this.onDataLoaded);
}
},
computed: {
...mapState("auth", ["user"]),
userCanCreateFlow() {
return this.user.hasAnyAction(permission.FLOW, action.CREATE);
}
},
watch: {
$route(newValue, oldValue) {
if (oldValue.name === newValue.name) {
Expand Down

0 comments on commit a23bb94

Please sign in to comment.