add action permissions
This commit is contained in:
@@ -120,7 +120,7 @@ const columns = [
|
||||
{ name: 'firstName', label: '苗字', field: 'firstName', align: 'left', sortable: true },
|
||||
{ name: 'email', label: '電子メール', field: 'email', align: 'left', sortable: true },
|
||||
{ name: 'status', label: '状況', field: 'status', align: 'left' },
|
||||
{ name: 'actions', label: '操作', field: 'actions', align: 'right' }
|
||||
{ name: 'actions', label: '', field: 'actions', align: 'right' }
|
||||
];
|
||||
|
||||
const statusFilterOptions = [
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
:pagination="pagination" >
|
||||
|
||||
<template v-slot:top>
|
||||
<q-btn color="primary" :disable="loading" label="新規" @click="addRow" />
|
||||
<q-btn v-permissions="Actions.user.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>
|
||||
@@ -161,6 +161,7 @@ import { ref, onMounted, computed } from 'vue';
|
||||
import TableActionMenu from 'components/TableActionMenu.vue';
|
||||
import { useUserStore } from 'stores/useUserStore';
|
||||
import { IUserDisplay, IUserRolesDisplay } from 'src/types/UserTypes';
|
||||
import { Actions } from 'boot/permissions';
|
||||
|
||||
const userStore = useUserStore();
|
||||
|
||||
@@ -171,7 +172,7 @@ const columns = [
|
||||
{ name: 'email', label: '電子メール', field: 'email', align: 'left', sortable: true },
|
||||
{ name: 'status', label: '状況', field: 'status', align: 'left' },
|
||||
{ name: 'roles', label: 'ロール', field: '', align: 'left' },
|
||||
{ name: 'actions', label: '操作', field: 'actions' }
|
||||
{ name: 'actions', label: '', field: 'actions' }
|
||||
];
|
||||
|
||||
const statusFilterOptions = [
|
||||
@@ -205,9 +206,9 @@ const editId = ref(0);
|
||||
const isCreate = computed(() => editId.value <= 0);
|
||||
|
||||
const actionList = [
|
||||
{ label: '編集', icon: 'edit_note', action: editRow },
|
||||
{ label: '編集', icon: 'edit_note', permission: Actions.user.edit, action: editRow },
|
||||
{ separator: true },
|
||||
{ label: '削除', icon: 'delete_outline', class: 'text-red', action: showDeleteUserConfirm },
|
||||
{ label: '削除', icon: 'delete_outline', permission: Actions.user.delete, class: 'text-red', action: showDeleteUserConfirm },
|
||||
];
|
||||
|
||||
const getUsers = async () => {
|
||||
|
||||
Reference in New Issue
Block a user