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