Config
You can find all role configuration files in shared/security
directory.
1. role.ts
Mention your roles in role.ts
file. role=All means all users can access
that
page, role=Admin means only Admin can access, same as others.
export enum Role {
All = 'All',
Admin = 'Admin',
Teacher = 'Teacher',
Student = 'Student',
}
2. user.ts
Used for configure user related information.
import { Role } from './role';
export class User {
id: number;
img: string;
username: string;
password: string;
firstName: string;
lastName: string;
role: Role;
}
3. auth.service.ts
Service file used for authentication and get login information.
4. auth.guard.ts
AuthGuard configuration file for restrict page access by user role.