Add more roles
This commit is contained in:
parent
1a0d06edcd
commit
e42eda52ac
3 changed files with 46 additions and 11 deletions
|
@ -1,14 +1,32 @@
|
|||
users:
|
||||
besitzer:
|
||||
displayname: 'Besitzer'
|
||||
password: '$argon2id$v=19$m=65536,t=3,p=4$Qno2VXJTVVNNNERjVkVXbQ$rEUoGFLekVIVXm76ahP8hcqLHjstRpM1pMLf0tUTBJM'
|
||||
password: '$argon2id$v=19$m=65536,t=3,p=4$P5hG9nb2S7vGF2NPVQ7s6Q$RB7+gjbNtzlWMaMqrJ2T5Vt9xrBYOV9trnNBufrnNFs'
|
||||
email: mail@example.com
|
||||
groups:
|
||||
- make
|
||||
- edit
|
||||
- account
|
||||
- serve
|
||||
koch:
|
||||
displayname: 'Koch'
|
||||
password: '$argon2id$v=19$m=65536,t=3,p=4$P5hG9nb2S7vGF2NPVQ7s6Q$RB7+gjbNtzlWMaMqrJ2T5Vt9xrBYOV9trnNBufrnNFs'
|
||||
email: mail@example.com
|
||||
groups:
|
||||
- make
|
||||
bearbeiter:
|
||||
displayname: 'Bearbeiter'
|
||||
password: '$argon2id$v=19$m=65536,t=3,p=4$P5hG9nb2S7vGF2NPVQ7s6Q$RB7+gjbNtzlWMaMqrJ2T5Vt9xrBYOV9trnNBufrnNFs'
|
||||
email: mail@example.com
|
||||
groups:
|
||||
- edit
|
||||
manager:
|
||||
displayname: 'Manager'
|
||||
password: '$argon2id$v=19$m=65536,t=3,p=4$P5hG9nb2S7vGF2NPVQ7s6Q$RB7+gjbNtzlWMaMqrJ2T5Vt9xrBYOV9trnNBufrnNFs'
|
||||
email: mail@example.com
|
||||
groups:
|
||||
- make
|
||||
- edit
|
||||
bedienung:
|
||||
displayname: 'Bedienung'
|
||||
password: '$argon2id$v=19$m=65536,t=3,p=4$WjlhejJVSXc5TVNLQVprUw$i6DzQukeTsXh3VL36KtCyt+rAdbJSG5AMe3c8Xiw34Q'
|
||||
password: '$argon2id$v=19$m=65536,t=3,p=4$P5hG9nb2S7vGF2NPVQ7s6Q$RB7+gjbNtzlWMaMqrJ2T5Vt9xrBYOV9trnNBufrnNFs'
|
||||
email: mail@example.com
|
||||
groups:
|
||||
- serve
|
||||
|
|
|
@ -6,9 +6,11 @@
|
|||
</template>
|
||||
<template #end>
|
||||
<div v-if="tablePath">
|
||||
<div v-if="editor">
|
||||
<Button v-if="tablesCount !== 0" :disabled="isLoading" icon="pi pi-minus" class="p-button-danger p-button-rounded mr-2" @click="removeTable" />
|
||||
<Button :disabled="isLoading" icon="pi pi-plus" class="p-button-success p-button-rounded" @click="addTable" />
|
||||
</div>
|
||||
</div>
|
||||
<router-link v-else :to="{ name: 'Tables' }" class="no-underline">
|
||||
<Button label="Tische" class="p-button-secondary" icon="pi pi-table" />
|
||||
</router-link>
|
||||
|
@ -42,6 +44,9 @@ export default defineComponent({
|
|||
const tablesCount = computed(() => store.getters.getTablesCount);
|
||||
const tablePath = computed(() => route.path === "/tables");
|
||||
const user = computed<string>(() => store.getters.getUsername);
|
||||
const maker = computed(() => store.getters.getGroups.includes("make"));
|
||||
const editor = computed(() => store.getters.getGroups.includes("edit"));
|
||||
const accountant = computed(() => store.getters.getGroups.includes("account"));
|
||||
|
||||
const settingsVisible = ref(false);
|
||||
provide(visible, settingsVisible);
|
||||
|
@ -74,7 +79,7 @@ export default defineComponent({
|
|||
}
|
||||
|
||||
const items = ref<MenuItem[]>([
|
||||
{ label: "Bestellungen", icon: "pi pi-fw pi-history", to: "/orders" },
|
||||
{ label: "Bestellungen", icon: "pi pi-fw pi-history", to: "/orders", visible: () => maker.value },
|
||||
{
|
||||
label: "Artikel",
|
||||
icon: "pi pi-fw pi-shopping-cart",
|
||||
|
@ -83,20 +88,26 @@ export default defineComponent({
|
|||
{ label: detailedItemTypeString(types_ItemType.ColdDrink), icon: "pi pi-fw pi-shopping-cart", to: "/items/" + types_ItemType.ColdDrink },
|
||||
{ label: detailedItemTypeString(types_ItemType.HotDrink), icon: "pi pi-fw pi-shopping-cart", to: "/items/" + types_ItemType.HotDrink },
|
||||
],
|
||||
visible: () => editor.value,
|
||||
},
|
||||
{ label: "Rechnungen", icon: "pi pi-fw pi-euro", to: "/bills", visible: () => store.getters.getGroups.includes("account") },
|
||||
{ label: "Rechnungen", icon: "pi pi-fw pi-euro", to: "/bills", visible: () => accountant.value },
|
||||
{ separator: true },
|
||||
{
|
||||
label: user.value,
|
||||
icon: "pi pi-fw pi-user",
|
||||
items: [
|
||||
{ label: "Einstellungen", icon: "pi pi-fw pi-cog", command: () => (settingsVisible.value = true) },
|
||||
{
|
||||
label: "Einstellungen",
|
||||
icon: "pi pi-fw pi-cog",
|
||||
command: () => (settingsVisible.value = true),
|
||||
visible: () => maker.value,
|
||||
},
|
||||
{ label: "Abmelden", icon: "pi pi-fw pi-power-off", command: () => emit("logout") },
|
||||
],
|
||||
},
|
||||
]);
|
||||
|
||||
return { items, tablePath, removeTable, addTable, isLoading, tablesCount };
|
||||
return { items, tablePath, removeTable, addTable, isLoading, tablesCount, editor };
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -27,6 +27,12 @@ router.beforeEach(async (to) => {
|
|||
if (to.name === "Bills") {
|
||||
if (!store.getters.getGroups.includes("account")) return "/tables";
|
||||
}
|
||||
if (to.name === "Orders") {
|
||||
if (!store.getters.getGroups.includes("make")) return "/tables";
|
||||
}
|
||||
if (to.name === "Items") {
|
||||
if (!store.getters.getGroups.includes("edit")) return "/tables";
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue