Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

remove dead code

Thiago Araujo da Silva98f70585b6e6
diff --git a/backend/src/ee/services/group/group-folder-grant-fns.ts b/backend/src/ee/services/group/group-folder-grant-fns.ts
index 7cb7642b30..c0028eba20 100644
--- a/backend/src/ee/services/group/group-folder-grant-fns.ts
+++ b/backend/src/ee/services/group/group-folder-grant-fns.ts
@@ -22,39 +22,6 @@ type TReapOrphanedFolderGrantsArg = {
projectIdsByIdentityId: Map<string, string[]>;
};
-type TProjectMembershipActor = {
- actorUserId?: string | null;
- actorIdentityId?: string | null;
- scopeProjectId?: string | null;
-};
-
-const $appendProjectId = (byActorId: Map<string, string[]>, actorId: string, projectId: string) => {
- byActorId.set(actorId, [...(byActorId.get(actorId) ?? []), projectId]);
-};
-
-export const collectProjectIdsByActor = (
- memberships: TProjectMembershipActor[],
- maps: {
- projectIdsByUserId?: Map<string, string[]>;
- projectIdsByIdentityId?: Map<string, string[]>;
- } = {}
-) => {
- const projectIdsByUserId = maps.projectIdsByUserId ?? new Map<string, string[]>();
- const projectIdsByIdentityId = maps.projectIdsByIdentityId ?? new Map<string, string[]>();
-
- for (const membership of memberships) {
- if (membership.scopeProjectId) {
- if (membership.actorUserId) {
- $appendProjectId(projectIdsByUserId, membership.actorUserId, membership.scopeProjectId);
- } else if (membership.actorIdentityId) {
- $appendProjectId(projectIdsByIdentityId, membership.actorIdentityId, membership.scopeProjectId);
- }
- }
- }
-
- return { projectIdsByUserId, projectIdsByIdentityId };
-};
-
const $collectOrphanedActorsByProject = (
candidatesByActorId: Map<string, string[]>,
stillReachable: Map<string, Set<string>>
diff --git a/backend/src/services/membership-group/membership-group-dal.ts b/backend/src/services/membership-group/membership-group-dal.ts
index 8c266c0a27..925cc44a82 100644
--- a/backend/src/services/membership-group/membership-group-dal.ts
+++ b/backend/src/services/membership-group/membership-group-dal.ts
@@ -304,62 +304,5 @@ export const membershipGroupDALFactory = (db: TDbClient) => {
}
};
- type TFindEffectiveInOrgArg = {
- scopeOrgId: string;
- excludeMembershipIds: string[];
- userIds: string[];
- identityIds: string[];
- groupIds: string[];
- tx?: Knex;
- };
-
- /**
- * Find all memberships in an org that grant access to the given actors (users, identities, or groups).
- * Used to determine which actors still have at least one membership after excluding some (e.g. when unlinking a group).
- */
- const findEffectiveInOrg = async ({
- scopeOrgId,
- excludeMembershipIds,
- userIds,
- identityIds,
- groupIds,
- tx
- }: TFindEffectiveInOrgArg) => {
- try {
- if (userIds.length === 0 && identityIds.length === 0 && groupIds.length === 0) {
- return [];
- }
-
- const qb = (tx || db.replicaNode())(TableName.Membership)
- .where(`${TableName.Membership}.scopeOrgId`, scopeOrgId)
- .where(`${TableName.Membership}.scope`, AccessScope.Organization)
- .where((inner) => {
- if (userIds.length > 0) void inner.orWhereIn(`${TableName.Membership}.actorUserId`, userIds);
- if (identityIds.length > 0) void inner.orWhereIn(`${TableName.Membership}.actorIdentityId`, identityIds);
- if (groupIds.length > 0) void inner.orWhereIn(`${TableName.Membership}.actorGroupId`, groupIds);
- })
- .select(
- `${TableName.Membership}.id`,
- `${TableName.Membership}.actorUserId`,
- `${TableName.Membership}.actorIdentityId`,
- `${TableName.Membership}.actorGroupId`
- );
-
- if (excludeMembershipIds.length > 0) {
- void qb.whereNotIn(`${TableName.Membership}.id`, excludeMembershipIds);
- }
-
- const rows = await qb;
- return rows as Array<{
- id: string;
- actorUserId: string | null;
- actorIdentityId: string | null;
- actorGroupId: string | null;
- }>;
- } catch (error) {
- throw new DatabaseError({ error, name: "MembershipFindEffectiveInOrg" });
- }
- };
-
- return { ...orm, findGroups, getGroupById, findEffectiveInOrg };
+ return { ...orm, findGroups, getGroupById };
};