fix: change role name
This commit is contained in:
parent
856bdef0f6
commit
c5600add96
4 changed files with 12 additions and 12 deletions
|
|
@ -111,7 +111,7 @@ export class ProductGroup extends Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Post()
|
@Post()
|
||||||
@Security("keycloak", ["system", "head_of_admin", "admin", "branch_accountant", "accountant"])
|
@Security("keycloak", ["system", "head_of_admin", "admin", "account", "head_of_account"])
|
||||||
async createProductGroup(@Request() req: RequestWithUser, @Body() body: ProductGroupCreate) {
|
async createProductGroup(@Request() req: RequestWithUser, @Body() body: ProductGroupCreate) {
|
||||||
const record = await prisma.$transaction(
|
const record = await prisma.$transaction(
|
||||||
async (tx) => {
|
async (tx) => {
|
||||||
|
|
@ -149,7 +149,7 @@ export class ProductGroup extends Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Put("{groupId}")
|
@Put("{groupId}")
|
||||||
@Security("keycloak", ["system", "head_of_admin", "admin", "branch_accountant", "accountant"])
|
@Security("keycloak", ["system", "head_of_admin", "admin", "account", "head_of_account"])
|
||||||
async editProductGroup(
|
async editProductGroup(
|
||||||
@Request() req: RequestWithUser,
|
@Request() req: RequestWithUser,
|
||||||
@Body() body: ProductGroupUpdate,
|
@Body() body: ProductGroupUpdate,
|
||||||
|
|
@ -176,7 +176,7 @@ export class ProductGroup extends Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Delete("{groupId}")
|
@Delete("{groupId}")
|
||||||
@Security("keycloak", ["system", "head_of_admin", "admin", "branch_accountant", "accountant"])
|
@Security("keycloak", ["system", "head_of_admin", "admin", "account", "head_of_account"])
|
||||||
async deleteProductGroup(@Path() groupId: string) {
|
async deleteProductGroup(@Path() groupId: string) {
|
||||||
const record = await prisma.productGroup.findFirst({ where: { id: groupId } });
|
const record = await prisma.productGroup.findFirst({ where: { id: groupId } });
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,8 +31,8 @@ const MANAGE_ROLES = [
|
||||||
"admin",
|
"admin",
|
||||||
"branch_admin",
|
"branch_admin",
|
||||||
"branch_manager",
|
"branch_manager",
|
||||||
"accountant",
|
"head_of_account",
|
||||||
"branch_accountant",
|
"account",
|
||||||
];
|
];
|
||||||
|
|
||||||
type ProductCreate = {
|
type ProductCreate = {
|
||||||
|
|
@ -87,7 +87,7 @@ function imageLocation(id: string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function globalAllow(roles?: string[]) {
|
function globalAllow(roles?: string[]) {
|
||||||
return ["system", "head_of_admin", "admin", "branch_admin", "branch_manager", "accountant"].some(
|
return ["system", "head_of_admin", "admin", "branch_admin", "branch_manager", "head_of_account"].some(
|
||||||
(v) => roles?.includes(v),
|
(v) => roles?.includes(v),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -163,12 +163,12 @@ const MANAGE_ROLES = [
|
||||||
"admin",
|
"admin",
|
||||||
"branch_admin",
|
"branch_admin",
|
||||||
"branch_manager",
|
"branch_manager",
|
||||||
"accountant",
|
"head_of_account",
|
||||||
"branch_accountant",
|
"account",
|
||||||
];
|
];
|
||||||
|
|
||||||
function globalAllow(roles?: string[]) {
|
function globalAllow(roles?: string[]) {
|
||||||
return ["system", "head_of_admin", "admin", "branch_admin", "branch_manager", "accountant"].some(
|
return ["system", "head_of_admin", "admin", "branch_admin", "branch_manager", "head_of_account"].some(
|
||||||
(v) => roles?.includes(v),
|
(v) => roles?.includes(v),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,8 +31,8 @@ const MANAGE_ROLES = [
|
||||||
"admin",
|
"admin",
|
||||||
"branch_admin",
|
"branch_admin",
|
||||||
"branch_manager",
|
"branch_manager",
|
||||||
"accountant",
|
"head_of_account",
|
||||||
"branch_accountant",
|
"account",
|
||||||
];
|
];
|
||||||
|
|
||||||
type ServiceCreate = {
|
type ServiceCreate = {
|
||||||
|
|
@ -73,7 +73,7 @@ function imageLocation(id: string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function globalAllow(roles?: string[]) {
|
function globalAllow(roles?: string[]) {
|
||||||
return ["system", "head_of_admin", "admin", "accountant"].some((v) => roles?.includes(v));
|
return ["system", "head_of_admin", "admin", "head_of_account"].some((v) => roles?.includes(v));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Route("api/v1/service")
|
@Route("api/v1/service")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue