feat(perm): update api task permission
All checks were successful
Spell Check / Spell Check with Typos (push) Successful in 5s
All checks were successful
Spell Check / Spell Check with Typos (push) Successful in 5s
This commit is contained in:
parent
41372b5fe9
commit
848df4df88
1 changed files with 13 additions and 3 deletions
|
|
@ -44,11 +44,21 @@ import {
|
||||||
} from "../utils/minio";
|
} from "../utils/minio";
|
||||||
import { queryOrNot, whereDateQuery } from "../utils/relation";
|
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"]) {
|
function globalAllow(user: RequestWithUser["user"]) {
|
||||||
const allowList = ["system", "head_of_admin"];
|
const listAllowed = ["system", "head_of_admin", "admin", "executive", "accountant"];
|
||||||
return allowList.some((v) => user.roles?.includes(v));
|
return user.roles?.some((v) => listAllowed.includes(v)) || false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const permissionCondCompany = createPermCondition((_) => true);
|
const permissionCondCompany = createPermCondition((_) => true);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue