Skip to content

Role-Based Guard

Alpha Fusion allows you to protect routes not only by authentication but also by user roles. This ensures that only authorized users with specific roles can access certain pages or features.

🧩 Core Implementation

  • AuthService
    Provides the current user's role via currentUser.role.

  • RoleGuard
    A route guard that checks the user's role before allowing access to a route.

  • Usage Example

ts
{
  path: 'admin',
  component: AdminComponent,
  canActivate: [RoleGuard],
  data: { roles: ['Administrator', 'Manager'] }
}