Update dependencies to include TinyMCE and Quill, enhance Navigation component with a new Newsletter submenu, and implement role-based access control for CMS features. Refactor user role handling to support multiple roles and improve user management functionality across various API endpoints.
This commit is contained in:
@@ -17,9 +17,20 @@ export default defineNuxtRouteMiddleware(async (to, from) => {
|
||||
|
||||
// Check role for CMS
|
||||
if (to.path.startsWith('/cms')) {
|
||||
const isAdmin = auth.value.role === 'admin' || auth.value.role === 'vorstand'
|
||||
if (!isAdmin) {
|
||||
return navigateTo('/mitgliederbereich')
|
||||
const roles = auth.value.roles || (auth.value.role ? [auth.value.role] : [])
|
||||
const hasAccess = roles.includes('admin') || roles.includes('vorstand') || roles.includes('newsletter')
|
||||
|
||||
// Newsletter-Seite nur für Newsletter-Rolle, Admin oder Vorstand
|
||||
if (to.path.startsWith('/cms/newsletter')) {
|
||||
if (!hasAccess) {
|
||||
return navigateTo('/mitgliederbereich')
|
||||
}
|
||||
} else {
|
||||
// Andere CMS-Seiten nur für Admin oder Vorstand
|
||||
const isAdmin = roles.includes('admin') || roles.includes('vorstand')
|
||||
if (!isAdmin) {
|
||||
return navigateTo('/mitgliederbereich')
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user