feat(perm): update api customer/employee perm

This commit is contained in:
Methapon2001 2025-07-02 10:27:24 +07:00
parent 41f5de7fd0
commit fa95fe46a5
9 changed files with 54 additions and 39 deletions

View file

@ -47,15 +47,16 @@ const MANAGE_ROLES = [
"system",
"head_of_admin",
"admin",
"head_of_accountant",
"executive",
"accountant",
"head_of_sale",
"sale",
"branch_admin",
"branch_manager",
"branch_accountant",
];
function globalAllow(user: RequestWithUser["user"]) {
const allowList = ["system", "head_of_admin", "head_of_accountant", "head_of_sale"];
return allowList.some((v) => user.roles?.includes(v));
const listAllowed = ["system", "head_of_admin", "admin", "executive", "accountant"];
return user.roles?.some((v) => listAllowed.includes(v)) || false;
}
const permissionCondCompany = createPermCondition((_) => true);