feat: remove some roles from manage some endpoints
This commit is contained in:
parent
806968e3dd
commit
dec2722670
5 changed files with 10 additions and 90 deletions
|
|
@ -25,25 +25,9 @@ if (!process.env.MINIO_BUCKET) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const MINIO_BUCKET = process.env.MINIO_BUCKET;
|
const MINIO_BUCKET = process.env.MINIO_BUCKET;
|
||||||
const MANAGE_ROLES = [
|
const MANAGE_ROLES = ["system", "head_of_admin", "admin", "head_of_account", "account"];
|
||||||
"system",
|
|
||||||
"head_of_admin",
|
|
||||||
"admin",
|
|
||||||
"branch_manager",
|
|
||||||
"head_of_sale",
|
|
||||||
"sale",
|
|
||||||
"head_of_account",
|
|
||||||
"account",
|
|
||||||
];
|
|
||||||
function globalAllow(user: RequestWithUser["user"]) {
|
function globalAllow(user: RequestWithUser["user"]) {
|
||||||
const allowList = [
|
const allowList = ["system", "head_of_admin", "admin", "head_of_account"];
|
||||||
"system",
|
|
||||||
"head_of_admin",
|
|
||||||
"admin",
|
|
||||||
"branch_manager",
|
|
||||||
"head_of_sale",
|
|
||||||
"head_of_account",
|
|
||||||
];
|
|
||||||
return allowList.some((v) => user.roles?.includes(v));
|
return allowList.some((v) => user.roles?.includes(v));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,26 +25,10 @@ if (!process.env.MINIO_BUCKET) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const MINIO_BUCKET = process.env.MINIO_BUCKET;
|
const MINIO_BUCKET = process.env.MINIO_BUCKET;
|
||||||
const MANAGE_ROLES = [
|
const MANAGE_ROLES = ["system", "head_of_admin", "admin", "head_of_account", "account"];
|
||||||
"system",
|
|
||||||
"head_of_admin",
|
|
||||||
"admin",
|
|
||||||
"branch_manager",
|
|
||||||
"head_of_sale",
|
|
||||||
"sale",
|
|
||||||
"head_of_account",
|
|
||||||
"account",
|
|
||||||
];
|
|
||||||
|
|
||||||
function globalAllow(user: RequestWithUser["user"]) {
|
function globalAllow(user: RequestWithUser["user"]) {
|
||||||
const allowList = [
|
const allowList = ["system", "head_of_admin", "admin", "head_of_account"];
|
||||||
"system",
|
|
||||||
"head_of_admin",
|
|
||||||
"admin",
|
|
||||||
"branch_manager",
|
|
||||||
"head_of_sale",
|
|
||||||
"head_of_account",
|
|
||||||
];
|
|
||||||
return allowList.some((v) => user.roles?.includes(v));
|
return allowList.some((v) => user.roles?.includes(v));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,25 +25,9 @@ if (!process.env.MINIO_BUCKET) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const MINIO_BUCKET = process.env.MINIO_BUCKET;
|
const MINIO_BUCKET = process.env.MINIO_BUCKET;
|
||||||
const MANAGE_ROLES = [
|
const MANAGE_ROLES = ["system", "head_of_admin", "admin", "head_of_account", "account"];
|
||||||
"system",
|
|
||||||
"head_of_admin",
|
|
||||||
"admin",
|
|
||||||
"branch_manager",
|
|
||||||
"head_of_sale",
|
|
||||||
"sale",
|
|
||||||
"head_of_account",
|
|
||||||
"account",
|
|
||||||
];
|
|
||||||
function globalAllow(user: RequestWithUser["user"]) {
|
function globalAllow(user: RequestWithUser["user"]) {
|
||||||
const allowList = [
|
const allowList = ["system", "head_of_admin", "admin", "branch_manager", "head_of_account"];
|
||||||
"system",
|
|
||||||
"head_of_admin",
|
|
||||||
"admin",
|
|
||||||
"branch_manager",
|
|
||||||
"head_of_sale",
|
|
||||||
"head_of_account",
|
|
||||||
];
|
|
||||||
return allowList.some((v) => user.roles?.includes(v));
|
return allowList.some((v) => user.roles?.includes(v));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,25 +19,9 @@ import HttpStatus from "../interfaces/http-status";
|
||||||
import { RequestWithUser } from "../interfaces/user";
|
import { RequestWithUser } from "../interfaces/user";
|
||||||
import { permissionCheck } from "../middlewares/employee";
|
import { permissionCheck } from "../middlewares/employee";
|
||||||
|
|
||||||
const MANAGE_ROLES = [
|
const MANAGE_ROLES = ["system", "head_of_admin", "admin", "head_of_account", "account"];
|
||||||
"system",
|
|
||||||
"head_of_admin",
|
|
||||||
"admin",
|
|
||||||
"branch_manager",
|
|
||||||
"head_of_sale",
|
|
||||||
"sale",
|
|
||||||
"head_of_account",
|
|
||||||
"account",
|
|
||||||
];
|
|
||||||
function globalAllow(user: RequestWithUser["user"]) {
|
function globalAllow(user: RequestWithUser["user"]) {
|
||||||
const allowList = [
|
const allowList = ["system", "head_of_admin", "admin", "branch_manager", "head_of_account"];
|
||||||
"system",
|
|
||||||
"head_of_admin",
|
|
||||||
"admin",
|
|
||||||
"branch_manager",
|
|
||||||
"head_of_sale",
|
|
||||||
"head_of_account",
|
|
||||||
];
|
|
||||||
return allowList.some((v) => user.roles?.includes(v));
|
return allowList.some((v) => user.roles?.includes(v));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,25 +18,9 @@ import HttpStatus from "../interfaces/http-status";
|
||||||
import HttpError from "../interfaces/http-error";
|
import HttpError from "../interfaces/http-error";
|
||||||
import { permissionCheck } from "../middlewares/employee";
|
import { permissionCheck } from "../middlewares/employee";
|
||||||
|
|
||||||
const MANAGE_ROLES = [
|
const MANAGE_ROLES = ["system", "head_of_admin", "admin", "head_of_account", "account"];
|
||||||
"system",
|
|
||||||
"head_of_admin",
|
|
||||||
"admin",
|
|
||||||
"branch_manager",
|
|
||||||
"head_of_sale",
|
|
||||||
"sale",
|
|
||||||
"head_of_account",
|
|
||||||
"account",
|
|
||||||
];
|
|
||||||
function globalAllow(user: RequestWithUser["user"]) {
|
function globalAllow(user: RequestWithUser["user"]) {
|
||||||
const allowList = [
|
const allowList = ["system", "head_of_admin", "admin", "branch_manager", "head_of_account"];
|
||||||
"system",
|
|
||||||
"head_of_admin",
|
|
||||||
"admin",
|
|
||||||
"branch_manager",
|
|
||||||
"head_of_sale",
|
|
||||||
"head_of_account",
|
|
||||||
];
|
|
||||||
return allowList.some((v) => user.roles?.includes(v));
|
return allowList.some((v) => user.roles?.includes(v));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue