new package dbHandler accesscontrol memeberdb and login with rights
All checks were successful
Build Quasar SPA and Go Backend for memberApp / build-spa (push) Successful in 2m20s
Build Quasar SPA and Go Backend for memberApp / build-backend (amd64, .exe, windows) (push) Successful in 5m27s
Build Quasar SPA and Go Backend for memberApp / build-backend (amd64, , linux) (push) Successful in 5m32s
Build Quasar SPA and Go Backend for memberApp / build-backend (arm, 6, , linux) (push) Successful in 5m28s
Build Quasar SPA and Go Backend for memberApp / build-backend (arm64, , linux) (push) Successful in 5m29s

This commit is contained in:
Adrian Zürcher
2025-10-31 14:54:05 +01:00
parent b0d6bb5512
commit cc3a547961
60 changed files with 1062 additions and 1162 deletions

View File

@@ -0,0 +1,67 @@
<template>
<q-card>
<q-card bordered v-for="(permission, index) in localPermission" v-bind:key="index">
<q-card-section class="text-center">
<div class="text-h7 text-bold text-primary">{{ $t(permission.name) }}</div>
</q-card-section>
<q-separator></q-separator>
<div class="flex justify-center">
<q-checkbox
class="q-mx-md"
:model-value="isFlagSet(permission.permission, 1 << 0)"
@update:model-value="(val) => toggleBit(index, 0, val)"
>{{ i18n.global.t('read') }}</q-checkbox
>
<q-checkbox
class="q-mx-md"
:model-value="isFlagSet(permission.permission, 1 << 1)"
@update:model-value="(val) => toggleBit(index, 1, val)"
>{{ i18n.global.t('write') }}</q-checkbox
>
<q-checkbox
class="q-mx-md"
:model-value="isFlagSet(permission.permission, 1 << 2)"
@update:model-value="(val) => toggleBit(index, 2, val)"
>{{ i18n.global.t('delete') }}</q-checkbox
>
</div>
</q-card>
</q-card>
</template>
<script setup lang="ts">
import { ref, type PropType } from 'vue';
import type { Permissions } from './permissions';
import { i18n } from 'src/boot/lang';
const props = defineProps({
permissions: {
type: Object as PropType<Permissions>,
required: true,
},
});
const emit = defineEmits(['update']);
const localPermission = ref(
props.permissions.map((e) => ({
name: e.name,
permission: e.permission ?? 0,
})),
);
function isFlagSet(mask: number, flag: number) {
return (mask & flag) !== 0;
}
function toggleBit(index: number, bit: number, value: boolean) {
const item = localPermission.value[index];
if (!item) return; // guard against undefined index
const mask = 1 << bit;
const current = item.permission ?? 0;
item.permission = value ? current | mask : current & ~mask;
emit('update', localPermission.value);
}
</script>