add filter so user can not change to admin if the have the right to change user rights

This commit is contained in:
Adrian Zürcher
2026-02-14 13:43:21 +01:00
parent 8963cba016
commit b726eb42dc
2 changed files with 26 additions and 5 deletions

View File

@@ -148,7 +148,7 @@
query-id
v-on:update="(val) => updateUser(val)"
></EditOneDialog>
<EditAllDialog ref="editAllDialog" :roles="localRoles" v-on:update="updateUsers"></EditAllDialog>
<EditAllDialog ref="editAllDialog" :roles="roles" v-on:update="updateUsers"></EditAllDialog>
<OkDialog
ref="okDialog"
:dialog-label="$t('delete')"
@@ -184,7 +184,10 @@ const editAllDialog = ref();
const okDialog = ref();
const deleteText = ref('');
const localRoles = computed(() => {
return roles.value.map((role) => role.role);
return roles.value.filter((role) => {
if (user.user?.role.role.includes('admin') || !user.user?.role.role.includes('admin'))
return role;
});
});
const selectOption = ref(false);
const selected = ref<Users>([]);
@@ -272,6 +275,9 @@ function removeUser(...removeUsers: Users) {
// update role select
function updateUser(user: User) {
if (user.role?.id) {
user.roleId = user.role?.id;
}
appApi
.post('/users/update', user)
.then(() => NotifyResponse(i18n.global.t('userUpdated')))