mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
feat: corrected validation
This commit is contained in:
@@ -39,7 +39,8 @@ export const registerAccessApprovalPolicyRouter = async (server: FastifyZodProvi
|
||||
.max(100, "Cannot have more than 100 approvers")
|
||||
.min(1, { message: "At least one approver should be provided" })
|
||||
.refine(
|
||||
(el) => el.every((i) => Object.hasOwn(i, "id") || Object.hasOwn(i, "username")),
|
||||
// @ts-expect-error this is ok
|
||||
(el) => el.every((i) => Boolean(i?.id) || Boolean(i?.username)),
|
||||
"Must provide either username or id"
|
||||
),
|
||||
bypassers: z
|
||||
@@ -193,7 +194,8 @@ export const registerAccessApprovalPolicyRouter = async (server: FastifyZodProvi
|
||||
.min(1, { message: "At least one approver should be provided" })
|
||||
.max(100, "Cannot have more than 100 approvers")
|
||||
.refine(
|
||||
(el) => el.every((i) => Object.hasOwn(i, "id") || Object.hasOwn(i, "username")),
|
||||
// @ts-expect-error this is ok
|
||||
(el) => el.every((i) => Boolean(i?.id) || Boolean(i?.username)),
|
||||
"Must provide either username or id"
|
||||
),
|
||||
bypassers: z
|
||||
|
||||
@@ -95,9 +95,6 @@ export const accessApprovalPolicyServiceFactory = ({
|
||||
(approver) => approver.type === ApproverType.User && approver.username
|
||||
) as { username: string; sequence?: number }[];
|
||||
|
||||
if (!groupApprovers && approvals > userApprovers.length + userApproverNames.length)
|
||||
throw new BadRequestError({ message: "Approvals cannot be greater than approvers" });
|
||||
|
||||
const { permission } = await permissionService.getProjectPermission({
|
||||
actor,
|
||||
actorId,
|
||||
@@ -137,7 +134,6 @@ export const accessApprovalPolicyServiceFactory = ({
|
||||
}))
|
||||
);
|
||||
}
|
||||
|
||||
let groupBypassers: string[] = [];
|
||||
let bypasserUserIds: string[] = [];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user