Add subuser role with hierarchy adjustments and redirection logic

- Introduced "subuser" role with level 2 hierarchy and access control.
- Added reactive subuser redirection logic based on status changes.
- Adjusted hierarchy levels for "superuser" (4) and "admin" (3).
This commit is contained in:
Jeppe Bundgaard
2026-02-12 17:27:14 +01:00
parent b41d839258
commit 393a46ae34
+17 -2
View File
@@ -17,16 +17,22 @@ import PosDepartmentStepMobile1Location
const hiarchyAccessLevels = {
superuser: {
name: 'superuser',
level: 3,
level: 4,
access: computed(() => SessionUser.canAccessSuperUser()),
route: 'superuser'
},
admin: {
name: 'admin',
level: 2,
level: 3,
access: computed(() => SessionUser.canAccessAdmin()),
route: 'admin'
},
subuser: {
name: 'subuser',
level: 2,
access: computed(() => SessionUser.isSubuser.value && SessionUser.initiated.value),
route: 'dashboard'
},
user: {
name: 'user',
level: 1,
@@ -112,6 +118,15 @@ watch(() => SessionUser.permissions.value, (newValue) => {
}
});
// Watch for changes in the subuser status
watch(() => SessionUser.isSubuser.value, (newValue) => {
if (newValue !== undefined) {
console.log('Subuser status changed, attempting redirect');
// If the subuser status changes, attempt to redirect
attemptRedirect();
}
});
// Watch for changes in the attemptAutoSelectDepartment flag (to start the timeout for location fetching)
watch(attemptAutoSelectDepartment, (newValue) => {
if (newValue) {