Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix/acl-control-on-blueprint-use-button #1819

Merged
merged 1 commit into from
Jul 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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