feat(perm): update api task permission
This commit is contained in:
parent
afb725fceb
commit
d08327afb6
1 changed files with 13 additions and 3 deletions
|
|
@ -44,11 +44,21 @@ import {
|
|||
} from "../utils/minio";
|
||||
import { queryOrNot, whereDateQuery } from "../utils/relation";
|
||||
|
||||
const MANAGE_ROLES = ["system", "head_of_admin", "admin", "document_checker"];
|
||||
const MANAGE_ROLES = [
|
||||
"system",
|
||||
"head_of_admin",
|
||||
"admin",
|
||||
"executive",
|
||||
"accountant",
|
||||
"branch_admin",
|
||||
"branch_manager",
|
||||
"branch_accountant",
|
||||
"data_entry",
|
||||
];
|
||||
|
||||
function globalAllow(user: RequestWithUser["user"]) {
|
||||
const allowList = ["system", "head_of_admin"];
|
||||
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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue