add action permissions
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
<q-table :rows="rows" :columns="columns" row-key="id" :filter="filter" :loading="loading" :pagination="pagination">
|
||||
|
||||
<template v-slot:top>
|
||||
<q-btn color="primary" :disable="loading" label="新規" @click="addRow" />
|
||||
<q-btn v-permissions="Actions.domain.add" color="primary" :disable="loading" label="新規" @click="addRow" />
|
||||
<q-space />
|
||||
<q-input borderless dense filled debounce="300" v-model="filter" placeholder="検索">
|
||||
<template v-slot:append>
|
||||
@@ -154,6 +154,7 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted, computed } from 'vue';
|
||||
import { api } from 'boot/axios';
|
||||
import { Actions } from 'boot/permissions';
|
||||
import { useAuthStore } from 'stores/useAuthStore';
|
||||
import ShareUsageDialog from 'components/ShareDomain/ShareUsageDialog.vue';
|
||||
import ShareManageDialog from 'components/ShareDomain/ShareManageDialog.vue';
|
||||
@@ -233,15 +234,16 @@ const SHARE_USE = 'use';
|
||||
const SHARE_MANAGE = 'manage';
|
||||
|
||||
const actionList = [
|
||||
{ label: '編集', icon: 'edit_note', action: editRow },
|
||||
{ label: '利用権限設定', icon: 'person_add_alt', action: (row: IDomainOwnerDisplay) => {openShareDg(SHARE_USE, row)} },
|
||||
{ label: '管理権限設定', icon: 'add_moderator',
|
||||
{ label: '編集', icon: 'edit_note', permission: Actions.domain.edit, action: editRow },
|
||||
{ label: '利用権限設定', icon: 'person_add_alt', permission: Actions.domain.grantUse,
|
||||
action: (row: IDomainOwnerDisplay) => {openShareDg(SHARE_USE, row)} },
|
||||
{ label: '管理権限設定', icon: 'add_moderator', permission: Actions.domain.grantManage,
|
||||
disable: (row: IDomainOwnerDisplay) => !isOwner(row),
|
||||
tooltip: (row: IDomainOwnerDisplay) => isOwner(row) ? '' : 'ドメイン所有者でないため、操作できません',
|
||||
action: (row: IDomainOwnerDisplay) => {openShareDg(SHARE_MANAGE, row)}
|
||||
},
|
||||
{ separator: true },
|
||||
{ label: '削除', icon: 'delete_outline', class: 'text-red', action: removeRow },
|
||||
{ label: '削除', icon: 'delete_outline', permission: Actions.domain.delete, class: 'text-red', action: removeRow },
|
||||
];
|
||||
|
||||
const isOwner = (row: IDomainOwnerDisplay) => row.owner.id === Number(authStore.userId);
|
||||
|
||||
Reference in New Issue
Block a user