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
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:
@@ -36,13 +36,13 @@ export default defineRouter(function (/* { store, ssrContext } */) {
|
||||
|
||||
Router.beforeEach((to, from, next) => {
|
||||
const userStore = useUserStore();
|
||||
|
||||
const isLoggedIn = userStore.isAuthenticated;
|
||||
const isAdmin = userStore.user?.role === 'admin';
|
||||
|
||||
if (to.meta.requiresAuth && !isLoggedIn) {
|
||||
next('/login');
|
||||
} else if (to.meta.requiresAdmin && !isAdmin) {
|
||||
} else if (
|
||||
to.meta.requiresAdmin &&
|
||||
!userStore.isPermittedTo(to.path.replace('/', ''), 'read')
|
||||
) {
|
||||
next('/');
|
||||
} else {
|
||||
next();
|
||||
|
||||
@@ -10,21 +10,21 @@ const routes: RouteRecordRaw[] = [
|
||||
component: () => import('pages/LoginPage.vue'),
|
||||
},
|
||||
{
|
||||
path: '/login',
|
||||
path: 'login',
|
||||
component: () => import('pages/LoginPage.vue'),
|
||||
},
|
||||
{
|
||||
path: '/members',
|
||||
path: 'members',
|
||||
component: () => import('pages/MembersTable.vue'),
|
||||
meta: { requiresAuth: true, requiresAdmin: true },
|
||||
},
|
||||
{
|
||||
path: '/settings',
|
||||
path: 'settings',
|
||||
component: () => import('pages/SettingsPage.vue'),
|
||||
meta: { requiresAuth: true, requiresAdmin: true },
|
||||
},
|
||||
{
|
||||
path: '/usersSettings',
|
||||
path: 'userSettings',
|
||||
component: () => import('pages/UserSettings.vue'),
|
||||
meta: { requiresAuth: true, requiresAdmin: true },
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user