Add permissions

This commit is contained in:
2024-11-07 14:26:57 +01:00
parent a392841012
commit 41951d7603
20 changed files with 523 additions and 16 deletions

View File

@@ -1,6 +1,10 @@
<script setup lang="ts">
definePageMeta({
rights: ['admin'],
})
const job = ref<string>('');
const toaster = useToast();
const data = ref(), status = ref<'idle' | 'pending' | 'success' | 'error'>('idle'), success = ref(false), err = ref(false), error = ref();
async function fetch()
{
@@ -19,6 +23,8 @@ async function fetch()
error.value = null;
err.value = false;
success.value = true;
toaster.add({ duration: 10000, content: data.value ?? 'Job executé avec succès', type: 'success', timer: true, });
}
catch(e)
{
@@ -26,6 +32,8 @@ async function fetch()
error.value = e;
err.value = true;
success.value = false;
toaster.add({ duration: 10000, content: error.value, type: 'error', timer: true, });
}
}
</script>

View File

@@ -9,8 +9,8 @@ let { user, clear } = useUserSession();
<Head>
<Title>Mon profil</Title>
</Head>
<div class="flex w-full items-start py-8 gap-6" v-if="user">
<div class="flex gap-4 min-w-1/3 max-w-2/3 border border-light-35 dark:border-dark-35 p-4">
<div class="grid grid-cols-4 w-full items-start py-8 gap-6 content-start" v-if="user">
<div class="flex gap-4 col-span-3 border border-light-35 dark:border-dark-35 p-4">
<Avatar icon="radix-icons:person" :src="`/users/${user?.id}.medium.jpg`" class="w-32 h-32" />
<div class="flex flex-col items-start">
<ProseH5>{{ user.username }}</ProseH5>
@@ -24,5 +24,19 @@ let { user, clear } = useUserSession();
<div class="flex-1">
<Button @click="async () => await clear()">Se deconnecter</Button>
</div>
<div class="flex">
<ProseTable class="!m-0">
<ProseThead>
<ProseTr>
<ProseTh>Permission</ProseTh>
</ProseTr>
</ProseThead>
<ProseTbody>
<ProseTr v-for="permission in user.permissions">
<ProseTd>{{ permission }}</ProseTd>
</ProseTr>
</ProseTbody>
</ProseTable>
</div>
</div>
</template>