diff --git a/src/controllers/01-branch-controller.ts b/src/controllers/01-branch-controller.ts index b040fb6..e1b6bb8 100644 --- a/src/controllers/01-branch-controller.ts +++ b/src/controllers/01-branch-controller.ts @@ -38,6 +38,12 @@ function globalAllow(user: RequestWithUser["user"]) { 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 = { status?: Status; code: string; @@ -126,7 +132,7 @@ type BranchUpdate = { }[]; }; -const permissionCond = createPermCondition(globalAllow); +const permissionCond = createPermCondition(globalAllowView); const permissionCheck = createPermCheck(globalAllow); @Route("api/v1/branch")