Changes in Rights and Roles

This commit is contained in:
2024-12-21 18:53:53 +01:00
parent c8521ad1f6
commit 813944fc23
10 changed files with 447 additions and 324 deletions

View File

@@ -71,12 +71,26 @@ const filteredRows = computed(() => {
if(selectedFilters.value.length > 0) {
selectedFilters.value.forEach(filterName => {
let filter = dataType.filters.find(i => i.name === filterName)
tempItems = tempItems.filter(filter.filterFunction)
})
}
if(!useRole().generalAvailableRights.value[type].showToAllUsers) {
if(useRole().checkRight(`${type}-viewAll`)){
console.log("Right to Show All")
} else if(useRole().checkRight(type)){
console.log("Only Righty to show Own")
console.log(tempItems)
tempItems = tempItems.filter(item => item.profiles.includes(dataStore.activeProfile.id))
} else {
console.log("No Right to Show")
tempItems = []
}
}
return useSearch(searchString.value, tempItems)
})
@@ -139,7 +153,7 @@ const filteredRows = computed(() => {
:columns="columns"
class="w-full"
:ui="{ divide: 'divide-gray-200 dark:divide-gray-800' }"
@select="(i) => router.push(`/projects/show/${i.id}`) "
@select="(i) => router.push(`/${type}/show/${i.id}`) "
:empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: `Keine ${dataType.label} anzuzeigen` }"
>
<template #name-data="{row}">
@@ -175,29 +189,6 @@ const filteredRows = computed(() => {
<component v-if="column.component" :is="column.component" :row="row"></component>
<span v-else>{{row[column.key]}}</span>
</template>
<!-- <template #name-data="{row}">
<span class="text-primary-500 font-bold" v-if="row === filteredRows[selectedItem]">{{row.name}}</span>
<span v-else>{{row.name}}</span>
</template>
<template #projecttype-data="{row}">
{{row.projecttype ? row.projecttype.name : ""}}
</template>
<template #phase-data="{row}">
{{getActivePhaseLabel(row)}}
</template>
<template #customer-data="{row}">
{{row.customer ? row.customer.name : ""}}
</template>
<template #plant-data="{row}">
{{row.plant ? row.plant.name : ""}}
</template>
<template #users-data="{row}">
{{row.users.map(i => dataStore.getProfileById(i).fullName).join(", ")}}
</template>-->
</UTable>
</template>

View File

@@ -73,21 +73,21 @@ const links = computed(() => {
defaultOpen: false,
icon: "i-heroicons-user-group",
children: [
{
... role.checkRight("customers") ? [{
label: "Kunden",
to: "/customers",
icon: "i-heroicons-user-group"
},
{
}] : [],
... role.checkRight("vendors") ? [{
label: "Lieferanten",
to: "/vendors",
icon: "i-heroicons-truck"
},
{
}] : [],
... role.checkRight("contacts") ? [{
label: "Ansprechpartner",
to: "/contacts",
icon: "i-heroicons-user-group"
},
}] : [],
]
},] : [],
{
@@ -95,7 +95,7 @@ const links = computed(() => {
defaultOpen:false,
icon: "i-heroicons-user-group",
children: [
... dataStore.ownTenant.features.timeTracking ? [{
... dataStore.ownTenant.features.timeTracking ? [{
label: "Zeiterfassung",
to: "/employees/timetracking",
icon: "i-heroicons-clock"
@@ -137,7 +137,7 @@ const links = computed(() => {
},
]
},] : [],
... dataStore.ownTenant.features.inventory ? [{
... role.checkRight("inventory") ? [{
label: "Lager",
icon: "i-heroicons-puzzle-piece",
defaultOpen: false,
@@ -151,28 +151,28 @@ const links = computed(() => {
to: "/inventory/stocks",
icon: "i-heroicons-square-3-stack-3d"
},
{
... role.checkRight("spaces") ? [{
label: "Lagerplätze",
to: "/spaces",
icon: "i-heroicons-square-3-stack-3d"
},
{
}] : [],
... role.checkRight("inventoryitems") ? [{
label: "Inventar",
to: "/inventoryitems",
icon: "i-heroicons-puzzle-piece"
},
}] : [],
]
},] : [],
... dataStore.ownTenant.features.vehicles ? [{
... role.checkRight("vehicles") ? [{
label: "Fuhrpark",
defaultOpen: false,
icon: "i-heroicons-truck",
children: [
{
... role.checkRight("vehicles") ? [{
label: "Fahrzeuge",
to: "/vehicles",
icon: "i-heroicons-truck"
},{
}] : [],{
label: "Fahrten",
to: "/trackingTrips",
icon: "i-heroicons-map"
@@ -184,23 +184,26 @@ const links = computed(() => {
defaultOpen: false,
icon: "i-heroicons-clipboard-document",
children: [
{
... role.checkRight("products") ? [{
label: "Artikel",
to: "/products",
icon: "i-heroicons-puzzle-piece"
},{
}] : [],
... role.checkRight("productcategories") ? [{
label: "Artikelkategorien",
to: "/productcategories",
icon: "i-heroicons-puzzle-piece"
},{
}] : [],
... role.checkRight("services") ? [{
label: "Leistungen",
to: "/services",
icon: "i-heroicons-puzzle-piece"
},{
}] : [],
... role.checkRight("servicecategories") ? [{
label: "Leistungskategorien",
to: "/servicecategories",
icon: "i-heroicons-puzzle-piece"
},
}] : [],
]
},
... role.checkRight("checks") ? [{
@@ -208,17 +211,17 @@ const links = computed(() => {
to: "/checks",
icon: "i-heroicons-magnifying-glass"
},] : [],
... (role.checkRight("projects") && dataStore.ownTenant.features.projects) ? [{
... role.checkRight("projects") ? [{
label: "Projekte",
to: "/projects",
icon: "i-heroicons-clipboard-document-check"
},] : [],
... (role.checkRight("contracts") && dataStore.ownTenant.features.contracts) ? [{
... role.checkRight("contracts") ? [{
label: "Verträge",
to: "/contracts",
icon: "i-heroicons-clipboard-document"
}] : [],
... (role.checkRight("plants") && dataStore.ownTenant.features.objects) ? [{
... role.checkRight("plants") ? [{
label: "Objekte",
to: "/plants",
icon: "i-heroicons-clipboard-document"
@@ -237,6 +240,10 @@ const links = computed(() => {
label: "Mitarbeiter",
to: "/profiles",
icon: "i-heroicons-clipboard-document-list"
},{
label: "Rollen",
to: "/roles",
icon: "i-heroicons-clipboard-document-list"
},{
label: "E-Mail Konten",
to: "/settings/emailAccounts",