feat: UI-only permission gate for admin routes (cosmetic pending backend)
adminAuthGuard only checked isAuthenticated() - any signed-in admin could reach any route. The live Telegram/QR auth (Mechanism A) carries no role claim, so a real gate needs a backend change (tracked in BACKEND-API-REFERENCE.md). Added AdminPermissionsService + requireAdminPermission() guard factory that derive a permission set locally by matching the Telegram username against the mock Users domain's roleId - the same local-only stand-in already used for the rest of that domain. Wired onto /backoffice/users requiring 'users.manage'. Explicitly cosmetic: backend must independently authorize every mutation regardless of what this guard decides. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { Routes } from '@angular/router';
|
||||
import { languageGuard } from './guards/language.guard';
|
||||
import { projectEditorDirtyGuard } from './features/project-editor/guards/project-editor-dirty.guard';
|
||||
import { adminAuthGuard } from './core/admin-auth/admin-auth.guard';
|
||||
import { adminAuthGuard, requireAdminPermission } from './core/admin-auth/admin-auth.guard';
|
||||
import { authRoutes } from './core/auth/auth.routes';
|
||||
import { adminCategoryDirtyGuard } from './features/admin/categories/guards/admin-category-dirty.guard';
|
||||
import { adminProductDirtyGuard } from './features/admin/products/guards/admin-product-dirty.guard';
|
||||
@@ -229,6 +229,7 @@ const coreRoutes: Routes = [
|
||||
},
|
||||
{
|
||||
path: 'users',
|
||||
canActivate: [requireAdminPermission('users.manage')],
|
||||
loadComponent: () => import('./features/admin/users/pages/admin-users-page.component').then(m => m.AdminUsersPageComponent),
|
||||
data: {
|
||||
titleKey: 'adminShell.pages.users.title',
|
||||
|
||||
Reference in New Issue
Block a user