Update some user permissions
This commit is contained in:
@@ -62,8 +62,6 @@
|
||||
margin: 5px;
|
||||
}
|
||||
|
||||
.active-foundry-stats {}
|
||||
|
||||
.inactive-foundry-stats {
|
||||
display: none;
|
||||
}
|
||||
@@ -79,9 +77,6 @@ import Button from 'primevue/button'
|
||||
import Card from 'primevue/card'
|
||||
import Chip from 'primevue/chip'
|
||||
import Dropdown from 'primevue/dropdown'
|
||||
import Toolbar from 'primevue/toolbar'
|
||||
|
||||
import type { FormInstance } from '@primevue/forms'
|
||||
|
||||
import {
|
||||
useSelectedTable,
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
<Column header="Actions" v-if="showClose">
|
||||
<template #body="slotProps">
|
||||
<Button label="Close" @click="stopTable(slotProps.data)" />
|
||||
<Button label="Close" @click="stopTable(slotProps.data)" :disabled="!isTableOwner(slotProps.data)" />
|
||||
</template>
|
||||
</Column>
|
||||
|
||||
@@ -27,7 +27,8 @@
|
||||
<template #body="slotProps">
|
||||
<div class="flex flex-row">
|
||||
<span class="flex"></span>
|
||||
<SplitButton label="Start" @click="startTable(slotProps.data)" :model="buildButtonModel(slotProps.data)" />
|
||||
<SplitButton label="Start" @click="startTable(slotProps.data)" :model="buildButtonModel(slotProps.data)"
|
||||
:disabled="!isTableOwner(slotProps.data)" />
|
||||
</div>
|
||||
</template>
|
||||
</Column>
|
||||
@@ -47,6 +48,7 @@ import SplitButton from 'primevue/splitbutton'
|
||||
import ConfirmDialog from 'primevue/confirmdialog'
|
||||
import { useConfirm } from 'primevue/useconfirm'
|
||||
|
||||
import { useUserData } from './user'
|
||||
import {
|
||||
startTable,
|
||||
hardStartTable,
|
||||
@@ -54,6 +56,8 @@ import {
|
||||
deleteTable,
|
||||
} from './game_tables'
|
||||
|
||||
import type { GameTable } from './game_tables'
|
||||
|
||||
const props = defineProps<{
|
||||
gameTables: any
|
||||
showClose?: boolean
|
||||
@@ -63,6 +67,7 @@ const props = defineProps<{
|
||||
const hostname = ref()
|
||||
const router = useRouter()
|
||||
const confirm = useConfirm()
|
||||
const user = useUserData()
|
||||
|
||||
onMounted(() => {
|
||||
hostname.value = location.host
|
||||
@@ -98,4 +103,8 @@ function buildButtonModel(table: any) {
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
function isTableOwner(gameTable: GameTable): boolean {
|
||||
return user.value.is_admin || gameTable.user_id == user.value.id
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -3,6 +3,7 @@ import { ref, readonly, onMounted } from 'vue'
|
||||
import type { Ref } from 'vue'
|
||||
|
||||
export interface User {
|
||||
id: number
|
||||
username: string
|
||||
is_admin: boolean
|
||||
authenticated: boolean
|
||||
|
||||
Reference in New Issue
Block a user