Update role-based access control for user management in CMS
Some checks failed
Code Analysis (JS/Vue) / analyze (push) Failing after 44s

This commit modifies the navigation and CMS user management components to allow access for both 'admin' and 'vorstand' roles. The changes include updating the conditional rendering logic in the Navigation and index.vue files, as well as adjusting the API endpoint to reflect the new role permissions, enhancing the flexibility of user access within the CMS.
This commit is contained in:
Torsten Schulz (local)
2026-02-06 10:35:13 +01:00
parent 8045542f8f
commit d32f6eaf1c
3 changed files with 5 additions and 3 deletions

View File

@@ -850,6 +850,7 @@
Mitgliedschaftsanträge
</NuxtLink>
<NuxtLink
v-if="getAuthStore()?.hasAnyRole('admin', 'vorstand')"
to="/cms/benutzer"
class="block px-4 py-2 text-sm text-yellow-300 hover:text-white hover:bg-primary-700/50 rounded-lg transition-colors"
@click="isMobileMenuOpen = false"

View File

@@ -225,9 +225,9 @@
</p>
</NuxtLink>
<!-- Benutzerverwaltung (nur für Admin) -->
<!-- Benutzerverwaltung (Admin ODER Vorstand) -->
<NuxtLink
v-if="authStore.hasRole('admin')"
v-if="authStore.hasAnyRole('admin', 'vorstand')"
to="/cms/benutzer"
class="bg-white p-6 rounded-xl shadow-lg border border-gray-100 hover:shadow-xl transition-all group"
>

View File

@@ -5,7 +5,8 @@ export default defineEventHandler(async (event) => {
const token = getCookie(event, 'auth_token')
const currentUser = await getUserFromToken(token)
if (!currentUser || !hasAnyRole(currentUser, 'admin')) {
// Seite darf von Admin ODER Vorstand genutzt werden
if (!currentUser || !hasAnyRole(currentUser, 'admin', 'vorstand')) {
throw createError({
statusCode: 403,
message: 'Zugriff verweigert'