90 lines
1.7 KiB
TypeScript
90 lines
1.7 KiB
TypeScript
export interface PermissionTopic {
|
|
topic: string;
|
|
list: string[];
|
|
}
|
|
|
|
export const permissions = [
|
|
{
|
|
topic: "Manage Corporate",
|
|
list: [
|
|
"viewCorporate",
|
|
"editCorporate",
|
|
"deleteCorporate",
|
|
"createCodeCorporate",
|
|
],
|
|
},
|
|
{
|
|
topic: "Manage Admin",
|
|
list: ["viewAdmin", "editAdmin", "deleteAdmin", "createCodeAdmin"],
|
|
},
|
|
{
|
|
topic: "Manage Student",
|
|
list: ["viewStudent", "editStudent", "deleteStudent", "createCodeStudent"],
|
|
},
|
|
{
|
|
topic: "Manage Teacher",
|
|
list: ["viewTeacher", "editTeacher", "deleteTeacher", "createCodeTeacher"],
|
|
},
|
|
{
|
|
topic: "Manage Country Manager",
|
|
list: [
|
|
"viewCountryManager",
|
|
"editCountryManager",
|
|
"deleteCountryManager",
|
|
"createCodeCountryManager",
|
|
],
|
|
},
|
|
{
|
|
topic: "Manage Exams",
|
|
list: [
|
|
"createReadingExam",
|
|
"createListeningExam",
|
|
"createWritingExam",
|
|
"createSpeakingExam",
|
|
"createLevelExam",
|
|
],
|
|
},
|
|
{
|
|
topic: "View Pages",
|
|
list: [
|
|
"viewExams",
|
|
"viewExercises",
|
|
"viewRecords",
|
|
"viewStats",
|
|
"viewTickets",
|
|
"viewPaymentRecords",
|
|
],
|
|
},
|
|
{
|
|
topic: "Manage Group",
|
|
list: ["viewGroup", "editGroup", "deleteGroup", "createGroup"],
|
|
},
|
|
{
|
|
topic: "Manage Codes",
|
|
list: ["viewCodes", "deleteCodes", "createCodes"],
|
|
},
|
|
{
|
|
topic: "Others",
|
|
list: ["all"],
|
|
},
|
|
] as const;
|
|
|
|
const permissionsList = [
|
|
...new Set(
|
|
permissions.reduce(
|
|
(accm: string[], permission) => [...accm, ...permission.list],
|
|
[]
|
|
)
|
|
),
|
|
];
|
|
|
|
export type PermissionType =
|
|
(typeof permissionsList)[keyof typeof permissionsList];
|
|
|
|
export interface Permission {
|
|
id: string;
|
|
type: PermissionType;
|
|
topic: string;
|
|
users: string[];
|
|
}
|