fix: permission employee
All checks were successful
Spell Check / Spell Check with Typos (push) Successful in 3s

This commit is contained in:
Methapon2001 2025-08-22 09:41:43 +07:00
parent df38eebbcc
commit 2c9fae400c

View file

@ -65,7 +65,9 @@ function globalAllow(user: RequestWithUser["user"]) {
return user.roles?.some((v) => listAllowed.includes(v)) || false; return user.roles?.some((v) => listAllowed.includes(v)) || false;
} }
const permissionCondCompany = createPermCondition((_) => true);
const permissionCond = createPermCondition(globalAllow); const permissionCond = createPermCondition(globalAllow);
const permissionCheckCompany = createPermCheck((_) => true);
const permissionCheck = createPermCheck(globalAllow); const permissionCheck = createPermCheck(globalAllow);
type EmployeeCreate = { type EmployeeCreate = {
@ -669,7 +671,7 @@ export class EmployeeFileController extends Controller {
}, },
}); });
if (!data) throw notFoundError("Employee"); if (!data) throw notFoundError("Employee");
await permissionCheck(user, data.customerBranch.customer.registeredBranch); await permissionCheckCompany(user, data.customerBranch.customer.registeredBranch);
} }
@Get("image") @Get("image")