restricted user management to a couple of users

This commit is contained in:
Luca Haid
2025-12-29 14:24:58 +01:00
parent 6a366c7740
commit 42f79ed9f8
2 changed files with 42 additions and 10 deletions

View File

@@ -3,14 +3,14 @@ Vue.component("User", {
<div>
<tt-card>
<tt-table :data="window['TT_CONFIG']['USERS']" :config="UserTableConfig">
<template v-slot:top-buttons>
<template v-slot:top-buttons v-if="canManageUsers">
<tt-button @click="window.location = window['TT_CONFIG']['ADD_URL']"
additional-class="btn-primary"
text="Benutzer hinzufügen"
icon="fas fa-plus"/>
</template>
<template v-slot:actions="{ row: user }">
<template v-slot:actions="{ row: user }" v-if="canManageUsers">
<div class="d-flex justify-content-center" style="gap: 4px">
<tt-button @click="window.location = window['TT_CONFIG']['EDIT_URL'] + '?id=' + user.id"
additional-class="btn-outline-primary"
@@ -49,11 +49,14 @@ Vue.component("User", {
showSendMailModal: false,
selectedUserForMail: null,
isSendingMail: false,
UserTableConfig: {
key: "UserTable",
tableHeader: "Benutzer",
defaultPageSize: 25,
headers: [{text: "Username", key: "username", class: "text-center", sortable: false, priority: 20},
}),
computed: {
canManageUsers() {
return window['TT_CONFIG']['CAN_MANAGE_USERS'] === true;
},
UserTableConfig() {
const headers = [
{text: "Username", key: "username", class: "text-center", sortable: false, priority: 20},
{text: "Name", key: "name", class: "text-center", sortable: false, priority: 18},
{text: "Firma", key: "address", class: "text-center", priority: 19},
{text: "E-Mail", key: "email", priority: 14},
@@ -79,9 +82,18 @@ Vue.component("User", {
filterOptions: [{value: "1", text: "Ist Aktiv", icon: "fa-regular fa-circle-check text-success"},
{value: "0", text: "Ist nicht aktiv", icon: "fa-regular fa-circle-xmark text-danger"}],
},
{text: "Aktionen", key: "actions", class: "text-center", sortable: false, priority: 21, filter: false}]
];
if (this.canManageUsers) {
headers.push({text: "Aktionen", key: "actions", class: "text-center", sortable: false, priority: 21, filter: false});
}
return {
key: "UserTable",
tableHeader: "Benutzer",
defaultPageSize: 25,
headers: headers
};
}
}),
},
methods: {
openSendMailModal(user) {
this.selectedUserForMail = user;