feat: add role that can view another branch
This commit is contained in:
parent
ea72b1a1bb
commit
10aca80abe
1 changed files with 7 additions and 1 deletions
|
|
@ -38,6 +38,12 @@ function globalAllow(user: RequestWithUser["user"]) {
|
||||||
return MANAGE_ROLES.some((v) => user.roles?.includes(v));
|
return MANAGE_ROLES.some((v) => user.roles?.includes(v));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function globalAllowView(user: RequestWithUser["user"]) {
|
||||||
|
return MANAGE_ROLES.concat("head_of_account", "head_of_sale").some((v) =>
|
||||||
|
user.roles?.includes(v),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
type BranchCreate = {
|
type BranchCreate = {
|
||||||
status?: Status;
|
status?: Status;
|
||||||
code: string;
|
code: string;
|
||||||
|
|
@ -126,7 +132,7 @@ type BranchUpdate = {
|
||||||
}[];
|
}[];
|
||||||
};
|
};
|
||||||
|
|
||||||
const permissionCond = createPermCondition(globalAllow);
|
const permissionCond = createPermCondition(globalAllowView);
|
||||||
const permissionCheck = createPermCheck(globalAllow);
|
const permissionCheck = createPermCheck(globalAllow);
|
||||||
|
|
||||||
@Route("api/v1/branch")
|
@Route("api/v1/branch")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue