mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
Fix: Make verifyApprovers independent on memberships
This commit is contained in:
@@ -7,7 +7,7 @@ import { ProjectPermissionActions, ProjectPermissionSub } from "../permission/pr
|
|||||||
import { TVerifyApprovers } from "./access-approval-policy-types";
|
import { TVerifyApprovers } from "./access-approval-policy-types";
|
||||||
|
|
||||||
export const verifyApprovers = async ({
|
export const verifyApprovers = async ({
|
||||||
approverProjectMemberships,
|
userIds,
|
||||||
projectId,
|
projectId,
|
||||||
orgId,
|
orgId,
|
||||||
envSlug,
|
envSlug,
|
||||||
@@ -15,12 +15,11 @@ export const verifyApprovers = async ({
|
|||||||
secretPath,
|
secretPath,
|
||||||
permissionService
|
permissionService
|
||||||
}: TVerifyApprovers) => {
|
}: TVerifyApprovers) => {
|
||||||
for (const approver of approverProjectMemberships) {
|
for await (const userId of userIds) {
|
||||||
try {
|
try {
|
||||||
// eslint-disable-next-line no-await-in-loop
|
|
||||||
const { permission: approverPermission } = await permissionService.getProjectPermission(
|
const { permission: approverPermission } = await permissionService.getProjectPermission(
|
||||||
ActorType.USER,
|
ActorType.USER,
|
||||||
approver.userId,
|
userId,
|
||||||
projectId,
|
projectId,
|
||||||
actorAuthMethod,
|
actorAuthMethod,
|
||||||
orgId
|
orgId
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
import { TProjectMemberships } from "@app/db/schemas";
|
|
||||||
import { TProjectPermission } from "@app/lib/types";
|
import { TProjectPermission } from "@app/lib/types";
|
||||||
import { ActorAuthMethod } from "@app/services/auth/auth-type";
|
import { ActorAuthMethod } from "@app/services/auth/auth-type";
|
||||||
|
|
||||||
import { TPermissionServiceFactory } from "../permission/permission-service";
|
import { TPermissionServiceFactory } from "../permission/permission-service";
|
||||||
|
|
||||||
export type TVerifyApprovers = {
|
export type TVerifyApprovers = {
|
||||||
approverProjectMemberships: TProjectMemberships[];
|
userIds: string[];
|
||||||
permissionService: Pick<TPermissionServiceFactory, "getProjectPermission">;
|
permissionService: Pick<TPermissionServiceFactory, "getProjectPermission">;
|
||||||
envSlug: string;
|
envSlug: string;
|
||||||
actorAuthMethod: ActorAuthMethod;
|
actorAuthMethod: ActorAuthMethod;
|
||||||
@@ -16,7 +15,7 @@ export type TVerifyApprovers = {
|
|||||||
|
|
||||||
export type TCreateAccessApprovalPolicy = {
|
export type TCreateAccessApprovalPolicy = {
|
||||||
approvals: number;
|
approvals: number;
|
||||||
secretPath?: string | null;
|
secretPath: string;
|
||||||
environment: string;
|
environment: string;
|
||||||
approvers: string[];
|
approvers: string[];
|
||||||
projectSlug: string;
|
projectSlug: string;
|
||||||
@@ -26,7 +25,7 @@ export type TCreateAccessApprovalPolicy = {
|
|||||||
export type TUpdateAccessApprovalPolicy = {
|
export type TUpdateAccessApprovalPolicy = {
|
||||||
policyId: string;
|
policyId: string;
|
||||||
approvals?: number;
|
approvals?: number;
|
||||||
approvers: string[];
|
approvers?: string[];
|
||||||
secretPath?: string;
|
secretPath?: string;
|
||||||
name?: string;
|
name?: string;
|
||||||
} & Omit<TProjectPermission, "projectId">;
|
} & Omit<TProjectPermission, "projectId">;
|
||||||
@@ -43,8 +42,3 @@ export type TGetAccessPolicyCountByEnvironmentDTO = {
|
|||||||
export type TListAccessApprovalPoliciesDTO = {
|
export type TListAccessApprovalPoliciesDTO = {
|
||||||
projectSlug: string;
|
projectSlug: string;
|
||||||
} & Omit<TProjectPermission, "projectId">;
|
} & Omit<TProjectPermission, "projectId">;
|
||||||
|
|
||||||
export type TGetBoardAccessApprovalPolicy = {
|
|
||||||
projectId: string;
|
|
||||||
environment: string;
|
|
||||||
} & Omit<TProjectPermission, "projectId">;
|
|
||||||
|
|||||||
Reference in New Issue
Block a user