feat: add conditional company scope query
This commit is contained in:
parent
e0c00d4aad
commit
fdc72a7caf
1 changed files with 3 additions and 1 deletions
|
|
@ -42,6 +42,7 @@ function globalAllow(user: RequestWithUser["user"]) {
|
|||
return allowList.some((v) => user.roles?.includes(v));
|
||||
}
|
||||
|
||||
const permissionCondCompany = createPermCondition((_) => true);
|
||||
const permissionCond = createPermCondition(globalAllow);
|
||||
const permissionCheck = createPermCheck(globalAllow);
|
||||
|
||||
|
|
@ -169,6 +170,7 @@ export class CustomerBranchController extends Controller {
|
|||
async list(
|
||||
@Request() req: RequestWithUser,
|
||||
@Query() zipCode?: string,
|
||||
@Query() company?: boolean,
|
||||
@Query() customerId?: string,
|
||||
@Query() registeredBranchId?: string,
|
||||
@Query() status?: Status,
|
||||
|
|
@ -197,7 +199,7 @@ export class CustomerBranchController extends Controller {
|
|||
: {
|
||||
registeredBranch: {
|
||||
AND: { id: registeredBranchId },
|
||||
OR: permissionCond(req.user),
|
||||
OR: company ? permissionCondCompany(req.user) : permissionCond(req.user),
|
||||
},
|
||||
},
|
||||
customerId,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue