refactor: adjust function

This commit is contained in:
Methapon Metanipat 2024-09-04 15:19:15 +07:00
parent 6baf79d76d
commit 597c107420

View file

@ -166,10 +166,9 @@ const MANAGE_ROLES = [
"account", "account",
]; ];
function globalAllow(roles?: string[]) { function globalAllow(user: RequestWithUser["user"]) {
return ["system", "head_of_admin", "admin", "branch_manager", "head_of_account"].some((v) => const allowList = ["system", "head_of_admin", "admin", "branch_manager", "head_of_account"];
roles?.includes(v), return allowList.some((v) => user.roles?.includes(v));
);
} }
@Route("/api/v1/quotation") @Route("/api/v1/quotation")