feat: update frontend for four-tier role system
Add Student Admin and Teacher Admin roles to constants, types, store, permissions, routes, and admin UI. Teacher Admin sees contests and problemsets in sidebar; Student Admin sees only problems. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
11
src/main.ts
11
src/main.ts
@@ -40,7 +40,9 @@ router.beforeEach(async (to, from, next) => {
|
||||
if (
|
||||
to.matched.some(
|
||||
(record) =>
|
||||
record.meta.requiresSuperAdmin || record.meta.requiresProblemPermission,
|
||||
record.meta.requiresSuperAdmin ||
|
||||
record.meta.requiresTeacherAdmin ||
|
||||
record.meta.requiresProblemPermission,
|
||||
)
|
||||
) {
|
||||
if (!storage.get(STORAGE_KEY.AUTHED)) {
|
||||
@@ -63,6 +65,13 @@ router.beforeEach(async (to, from, next) => {
|
||||
next("/")
|
||||
return
|
||||
}
|
||||
} else if (
|
||||
to.matched.some((record) => record.meta.requiresTeacherAdmin)
|
||||
) {
|
||||
if (!userStore.isTeacherOrAbove) {
|
||||
next("/")
|
||||
return
|
||||
}
|
||||
} else if (
|
||||
to.matched.some((record) => record.meta.requiresProblemPermission)
|
||||
) {
|
||||
|
||||
Reference in New Issue
Block a user