Skip to content

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

fix: review comments

Piyush Gupta0a0cb81b138c
diff --git a/backend/src/ee/routes/v1/group-router.ts b/backend/src/ee/routes/v1/group-router.ts
index ed45483428..355a259d53 100644
--- a/backend/src/ee/routes/v1/group-router.ts
+++ b/backend/src/ee/routes/v1/group-router.ts
@@ -3,7 +3,7 @@ import { z } from "zod";
import { GroupsSchema, IdentitiesSchema, OrgMembershipRole, ProjectsSchema, UsersSchema } from "@app/db/schemas";
import {
FilterMemberType,
- FilterReturnedIdentities,
+ FilterReturnedMachineIdentities,
FilterReturnedProjects,
FilterReturnedUsers,
GroupMembersOrderBy,
@@ -235,7 +235,7 @@ export const registerGroupRouter = async (server: FastifyZodProvider) => {
server.route({
method: "GET",
- url: "/:id/identities",
+ url: "/:id/machine-identities",
config: {
rateLimit: readLimit
},
@@ -244,17 +244,20 @@ export const registerGroupRouter = async (server: FastifyZodProvider) => {
hide: false,
tags: [ApiDocsTags.Groups],
params: z.object({
- id: z.string().trim().describe(GROUPS.LIST_IDENTITIES.id)
+ id: z.string().trim().describe(GROUPS.LIST_MACHINE_IDENTITIES.id)
}),
querystring: z.object({
- offset: z.coerce.number().min(0).default(0).describe(GROUPS.LIST_IDENTITIES.offset),
- limit: z.coerce.number().min(1).max(100).default(10).describe(GROUPS.LIST_IDENTITIES.limit),
- search: z.string().trim().optional().describe(GROUPS.LIST_IDENTITIES.search),
- filter: z.nativeEnum(FilterReturnedIdentities).optional().describe(GROUPS.LIST_IDENTITIES.filterIdentities)
+ offset: z.coerce.number().min(0).default(0).describe(GROUPS.LIST_MACHINE_IDENTITIES.offset),
+ limit: z.coerce.number().min(1).max(100).default(10).describe(GROUPS.LIST_MACHINE_IDENTITIES.limit),
+ search: z.string().trim().optional().describe(GROUPS.LIST_MACHINE_IDENTITIES.search),
+ filter: z
+ .nativeEnum(FilterReturnedMachineIdentities)
+ .optional()
+ .describe(GROUPS.LIST_MACHINE_IDENTITIES.filterMachineIdentities)
}),
response: {
200: z.object({
- identities: GroupIdentityResponseSchema.extend({
+ machineIdentities: GroupIdentityResponseSchema.extend({
isPartOfGroup: z.boolean(),
joinedGroupAt: z.date().nullable()
}).array(),
@@ -263,7 +266,7 @@ export const registerGroupRouter = async (server: FastifyZodProvider) => {
}
},
handler: async (req) => {
- const { identities, totalCount } = await server.services.group.listGroupIdentities({
+ const { machineIdentities, totalCount } = await server.services.group.listGroupMachineIdentities({
id: req.params.id,
actor: req.permission.type,
actorId: req.permission.id,
@@ -272,7 +275,7 @@ export const registerGroupRouter = async (server: FastifyZodProvider) => {
...req.query
});
- return { identities, totalCount };
+ return { machineIdentities, totalCount };
}
});
@@ -311,20 +314,18 @@ export const registerGroupRouter = async (server: FastifyZodProvider) => {
response: {
200: z.object({
members: z
- .union([
- UsersSchema.pick({
- email: true,
- username: true,
- firstName: true,
- lastName: true,
- id: true
- }).extend({
+ .discriminatedUnion("type", [
+ z.object({
+ id: z.string(),
joinedGroupAt: z.date().nullable(),
- memberType: z.literal("user")
+ type: z.literal("user"),
+ user: UsersSchema.pick({ id: true, firstName: true, lastName: true, email: true, username: true })
}),
- GroupIdentityResponseSchema.extend({
+ z.object({
+ id: z.string(),
joinedGroupAt: z.date().nullable(),
- memberType: z.literal("identity")
+ type: z.literal("machineIdentity"),
+ machineIdentity: GroupIdentityResponseSchema
})
])
.array(),
@@ -444,7 +445,7 @@ export const registerGroupRouter = async (server: FastifyZodProvider) => {
server.route({
method: "POST",
- url: "/:id/identities/:identityId",
+ url: "/:id/machine-identities/:machineIdentityId",
config: {
rateLimit: writeLimit
},
@@ -453,24 +454,24 @@ export const registerGroupRouter = async (server: FastifyZodProvider) => {
hide: false,
tags: [ApiDocsTags.Groups],
params: z.object({
- id: z.string().trim().describe(GROUPS.ADD_IDENTITY.id),
- identityId: z.string().trim().describe(GROUPS.ADD_IDENTITY.identityId)
+ id: z.string().trim().describe(GROUPS.ADD_MACHINE_IDENTITY.id),
+ machineIdentityId: z.string().trim().describe(GROUPS.ADD_MACHINE_IDENTITY.machineIdentityId)
}),
response: {
200: GroupIdentityResponseSchema
}
},
handler: async (req) => {
- const identity = await server.services.group.addIdentityToGroup({
+ const machineIdentity = await server.services.group.addMachineIdentityToGroup({
id: req.params.id,
- identityId: req.params.identityId,
+ identityId: req.params.machineIdentityId,
actor: req.permission.type,
actorId: req.permission.id,
actorAuthMethod: req.permission.authMethod,
actorOrgId: req.permission.orgId
});
- return identity;
+ return machineIdentity;
}
});
@@ -514,7 +515,7 @@ export const registerGroupRouter = async (server: FastifyZodProvider) => {
server.route({
method: "DELETE",
- url: "/:id/identities/:identityId",
+ url: "/:id/machine-identities/:machineIdentityId",
config: {
rateLimit: writeLimit
},
@@ -523,24 +524,24 @@ export const registerGroupRouter = async (server: FastifyZodProvider) => {
hide: false,
tags: [ApiDocsTags.Groups],
params: z.object({
- id: z.string().trim().describe(GROUPS.DELETE_IDENTITY.id),
- identityId: z.string().trim().describe(GROUPS.DELETE_IDENTITY.identityId)
+ id: z.string().trim().describe(GROUPS.DELETE_MACHINE_IDENTITY.id),
+ machineIdentityId: z.string().trim().describe(GROUPS.DELETE_MACHINE_IDENTITY.machineIdentityId)
}),
response: {
200: GroupIdentityResponseSchema
}
},
handler: async (req) => {
- const identity = await server.services.group.removeIdentityFromGroup({
+ const machineIdentity = await server.services.group.removeMachineIdentityFromGroup({
id: req.params.id,
- identityId: req.params.identityId,
+ identityId: req.params.machineIdentityId,
actor: req.permission.type,
actorId: req.permission.id,
actorAuthMethod: req.permission.authMethod,
actorOrgId: req.permission.orgId
});
- return identity;
+ return machineIdentity;
}
});
};
diff --git a/backend/src/ee/services/group/group-dal.ts b/backend/src/ee/services/group/group-dal.ts
index 01d46a894b..463086c321 100644
--- a/backend/src/ee/services/group/group-dal.ts
+++ b/backend/src/ee/services/group/group-dal.ts
@@ -8,7 +8,7 @@ import { OrderByDirection } from "@app/lib/types";
import {
FilterMemberType,
- FilterReturnedIdentities,
+ FilterReturnedMachineIdentities,
FilterReturnedProjects,
FilterReturnedUsers,
GroupMembersOrderBy,
@@ -174,7 +174,7 @@ export const groupDALFactory = (db: TDbClient) => {
}
};
- const findAllGroupPossibleIdentities = async ({
+ const findAllGroupPossibleMachineIdentities = async ({
orgId,
groupId,
offset = 0,
@@ -187,7 +187,7 @@ export const groupDALFactory = (db: TDbClient) => {
offset?: number;
limit?: number;
search?: string;
- filter?: FilterReturnedIdentities;
+ filter?: FilterReturnedMachineIdentities;
}) => {
try {
const query = db
@@ -224,27 +224,27 @@ export const groupDALFactory = (db: TDbClient) => {
}
switch (filter) {
- case FilterReturnedIdentities.ASSIGNED_IDENTITIES:
+ case FilterReturnedMachineIdentities.ASSIGNED_MACHINE_IDENTITIES:
void query.andWhere(`${TableName.IdentityGroupMembership}.createdAt`, "is not", null);
break;
- case FilterReturnedIdentities.NON_ASSIGNED_IDENTITIES:
+ case FilterReturnedMachineIdentities.NON_ASSIGNED_MACHINE_IDENTITIES:
void query.andWhere(`${TableName.IdentityGroupMembership}.createdAt`, "is", null);
break;
default:
break;
}
- const identities = await query;
+ const machineIdentities = await query;
return {
- identities: identities.map(({ name, identityId, joinedGroupAt, groupId: identityGroupId }) => ({
+ machineIdentities: machineIdentities.map(({ name, identityId, joinedGroupAt, groupId: identityGroupId }) => ({
id: identityId,
name,
isPartOfGroup: Boolean(identityGroupId),
joinedGroupAt
})),
// @ts-expect-error col select is raw and not strongly typed
- totalCount: Number(identities?.[0]?.total_count ?? 0)
+ totalCount: Number(machineIdentities?.[0]?.total_count ?? 0)
};
} catch (error) {
throw new DatabaseError({ error, name: "Find all group identities" });
@@ -271,13 +271,19 @@ export const groupDALFactory = (db: TDbClient) => {
memberTypeFilter?: FilterMemberType[];
}) => {
try {
- // Query for users - subquery for UNION
- const usersSubquery = db
+ const includeUsers =
+ !memberTypeFilter || memberTypeFilter.length === 0 || memberTypeFilter.includes(FilterMemberType.USERS);
+ const includeMachineIdentities =
+ !memberTypeFilter ||
+ memberTypeFilter.length === 0 ||
+ memberTypeFilter.includes(FilterMemberType.MACHINE_IDENTITIES);
+
+ const query = db
.replicaNode()(TableName.Membership)
.where(`${TableName.Membership}.scopeOrgId`, orgId)
.where(`${TableName.Membership}.scope`, AccessScope.Organization)
- .whereNotNull(`${TableName.Membership}.actorUserId`)
- .join(TableName.Users, `${TableName.Membership}.actorUserId`, `${TableName.Users}.id`)
+ .leftJoin(TableName.Users, `${TableName.Membership}.actorUserId`, `${TableName.Users}.id`)
+ .leftJoin(TableName.Identity, `${TableName.Membership}.actorIdentityId`, `${TableName.Identity}.id`)
.leftJoin(TableName.UserGroupMembership, (bd) => {
bd.on(`${TableName.UserGroupMembership}.userId`, "=", `${TableName.Users}.id`).andOn(
`${TableName.UserGroupMembership}.groupId`,
@@ -285,38 +291,6 @@ export const groupDALFactory = (db: TDbClient) => {
db.raw("?", [groupId])
);
})
- .andWhere(`${TableName.UserGroupMembership}.createdAt`, "is not", null)
- .select(
- db.ref("createdAt").withSchema(TableName.UserGroupMembership).as("joinedGroupAt"),
- db.ref("email").withSchema(TableName.Users),
- db.ref("username").withSchema(TableName.Users),
- db.ref("firstName").withSchema(TableName.Users),
- db.ref("lastName").withSchema(TableName.Users),
- db.raw(`"${TableName.Users}"."id"::text as "userId"`),
- db.raw('NULL::text as "identityId"'),
- db.raw('NULL::text as "identityName"'),
- db.raw("'user' as member_type"),
- db.raw(
- `COALESCE(NULLIF(TRIM(CONCAT_WS(' ', "${TableName.Users}"."firstName", "${TableName.Users}"."lastName")), ''), "${TableName.Users}"."username", "${TableName.Users}"."email") as "sortName"`
- )
- )
- .where(`${TableName.Users}.isGhost`, false);
-
- if (search) {
- void usersSubquery.andWhereRaw(
- `CONCAT_WS(' ', "${TableName.Users}"."firstName", "${TableName.Users}"."lastName", lower("${TableName.Users}"."username")) ilike ?`,
- [`%${search}%`]
- );
- }
-
- // Query for identities - subquery for UNION
- const identitiesSubquery = db
- .replicaNode()(TableName.Membership)
- .where(`${TableName.Membership}.scopeOrgId`, orgId)
- .where(`${TableName.Membership}.scope`, AccessScope.Organization)
- .whereNotNull(`${TableName.Membership}.actorIdentityId`)
- .whereNull(`${TableName.Identity}.projectId`)
- .join(TableName.Identity, `${TableName.Membership}.actorIdentityId`, `${TableName.Identity}.id`)
.leftJoin(TableName.IdentityGroupMembership, (bd) => {
bd.on(`${TableName.IdentityGroupMembership}.identityId`, "=", `${TableName.Identity}.id`).andOn(
`${TableName.IdentityGroupMembership}.groupId`,
@@ -324,63 +298,83 @@ export const groupDALFactory = (db: TDbClient) => {
db.raw("?", [groupId])
);
})
- .andWhere(`${TableName.IdentityGroupMembership}.createdAt`, "is not", null)
+ .where((qb) => {
+ void qb
+ .where((innerQb) => {
+ void innerQb
+ .whereNotNull(`${TableName.Membership}.actorUserId`)
+ .whereNotNull(`${TableName.UserGroupMembership}.createdAt`)
+ .where(`${TableName.Users}.isGhost`, false);
+ })
+ .orWhere((innerQb) => {
+ void innerQb
+ .whereNotNull(`${TableName.Membership}.actorIdentityId`)
+ .whereNotNull(`${TableName.IdentityGroupMembership}.createdAt`)
+ .whereNull(`${TableName.Identity}.projectId`);
+ });
+ })
.select(
- db.ref("createdAt").withSchema(TableName.IdentityGroupMembership).as("joinedGroupAt"),
- db.raw('NULL::text as "email"'),
- db.raw('NULL::text as "username"'),
- db.raw('NULL::text as "firstName"'),
- db.raw('NULL::text as "lastName"'),
- db.raw('NULL::text as "userId"'),
+ db.raw(
+ `CASE WHEN "${TableName.Membership}"."actorUserId" IS NOT NULL THEN "${TableName.UserGroupMembership}"."createdAt" ELSE "${TableName.IdentityGroupMembership}"."createdAt" END as "joinedGroupAt"`
+ ),
+ db.ref("email").withSchema(TableName.Users),
+ db.ref("username").withSchema(TableName.Users),
+ db.ref("firstName").withSchema(TableName.Users),
+ db.ref("lastName").withSchema(TableName.Users),
+ db.raw(`"${TableName.Users}"."id"::text as "userId"`),
db.raw(`"${TableName.Identity}"."id"::text as "identityId"`),
- db.raw(`"${TableName.Identity}"."name" as "identityName"`),
- db.raw("'identity' as member_type"),
- db.raw(`"${TableName.Identity}"."name" as "sortName"`)
+ db.ref("name").withSchema(TableName.Identity).as("identityName"),
+ db.raw(
+ `CASE WHEN "${TableName.Membership}"."actorUserId" IS NOT NULL THEN 'user' ELSE 'machineIdentity' END as "member_type"`
+ ),
+ db.raw(
+ `COALESCE(NULLIF(TRIM(CONCAT_WS(' ', "${TableName.Users}"."firstName", "${TableName.Users}"."lastName")), ''), "${TableName.Users}"."username", "${TableName.Users}"."email", "${TableName.Identity}"."name") as "sortName"`
+ ),
+ db.raw(`count(*) OVER() as total_count`)
);
- if (search) {
- void identitiesSubquery.andWhereRaw(`LOWER("${TableName.Identity}"."name") ilike ?`, [`%${search}%`]);
- }
+ void query.andWhere((qb) => {
+ if (includeUsers) {
+ void qb.whereNotNull(`${TableName.Membership}.actorUserId`);
+ }
+
+ if (includeMachineIdentities) {
+ void qb[includeUsers ? "orWhere" : "where"]((innerQb) => {
+ void innerQb.whereNotNull(`${TableName.Membership}.actorIdentityId`);
+ });
+ }
- let unionQuery;
+ if (!includeUsers && !includeMachineIdentities) {
+ void qb.whereRaw("FALSE");
+ }
+ });
- const includeUsers =
- !memberTypeFilter || memberTypeFilter.length === 0 || memberTypeFilter.includes(FilterMemberType.USERS);
- const includeIdentities =
- !memberTypeFilter || memberTypeFilter.length === 0 || memberTypeFilter.includes(FilterMemberType.IDENTITIES);
-
- if (includeUsers && includeIdentities) {
- unionQuery = db.raw("(? UNION ALL ?)", [usersSubquery, identitiesSubquery]);
- } else if (includeUsers) {
- unionQuery = db.raw("(?)", [usersSubquery]);
- } else if (includeIdentities) {
- unionQuery = db.raw("(?)", [identitiesSubquery]);
- } else {
- unionQuery = db.raw("(? UNION ALL ?)", [usersSubquery, identitiesSubquery]);
+ if (search) {
+ void query.andWhere((qb) => {
+ void qb
+ .whereRaw(
+ `CONCAT_WS(' ', "${TableName.Users}"."firstName", "${TableName.Users}"."lastName", lower("${TableName.Users}"."username")) ilike ?`,
+ [`%${search}%`]
+ )
+ .orWhereRaw(`LOWER("${TableName.Identity}"."name") ilike ?`, [`%${search}%`]);
+ });
}
- const combinedQuery = db
- .replicaNode()
- .select("*")
- .select(db.raw(`count(*) OVER() as total_count`))
- .from(db.raw("(?) as combined_members", [unionQuery]));
-
- if (orderBy) {
- if (orderBy === GroupMembersOrderBy.Name) {
- const orderDirectionClause = orderDirection === OrderByDirection.ASC ? "ASC" : "DESC";
- void combinedQuery.orderByRaw(`LOWER("sortName") ${orderDirectionClause}`);
- }
+ if (orderBy === GroupMembersOrderBy.Name) {
+ const orderDirectionClause = orderDirection === OrderByDirection.ASC ? "ASC" : "DESC";
+ void query.orderByRaw(
+ `LOWER(COALESCE(NULLIF(TRIM(CONCAT_WS(' ', "${TableName.Users}"."firstName", "${TableName.Users}"."lastName")), ''), "${TableName.Users}"."username", "${TableName.Users}"."email", "${TableName.Identity}"."name")) ${orderDirectionClause}`
+ );
}
if (offset) {
- void combinedQuery.offset(offset);
+ void query.offset(offset);
}
-
if (limit) {
- void combinedQuery.limit(limit);
+ void query.limit(limit);
}
- const results = (await combinedQuery) as {
+ const results = (await query) as unknown as {
email: string;
username: string;
firstName: string;
@@ -388,7 +382,7 @@ export const groupDALFactory = (db: TDbClient) => {
userId: string;
identityId: string;
identityName: string;
- member_type: "user" | "identity";
+ member_type: "user" | "machineIdentity";
joinedGroupAt: Date;
total_count: string;
}[];
@@ -398,19 +392,25 @@ export const groupDALFactory = (db: TDbClient) => {
if (member_type === "user") {
return {
id: userId,
- email,
- username,
- firstName,
- lastName,
joinedGroupAt,
- memberType: "user" as const
+ type: "user" as const,
+ user: {
+ id: userId,
+ email,
+ username,
+ firstName,
+ lastName
+ }
};
}
return {
id: identityId,
- name: identityName,
joinedGroupAt,
- memberType: "identity" as const
+ type: "machineIdentity" as const,
+ machineIdentity: {
+ id: identityId,
+ name: identityName
+ }
};
}
);
@@ -571,7 +571,7 @@ export const groupDALFactory = (db: TDbClient) => {
findGroups,
findByOrgId,
findAllGroupPossibleUsers,
- findAllGroupPossibleIdentities,
+ findAllGroupPossibleMachineIdentities,
findAllGroupPossibleMembers,
findAllGroupProjects,
findGroupsByProjectId,
diff --git a/backend/src/ee/services/group/group-service.ts b/backend/src/ee/services/group/group-service.ts
index 060774e77f..da9756046f 100644
--- a/backend/src/ee/services/group/group-service.ts
+++ b/backend/src/ee/services/group/group-service.ts
@@ -27,16 +27,16 @@ import {
removeUsersFromGroupByUserIds
} from "./group-fns";
import {
- TAddIdentityToGroupDTO,
+ TAddMachineIdentityToGroupDTO,
TAddUserToGroupDTO,
TCreateGroupDTO,
TDeleteGroupDTO,
TGetGroupByIdDTO,
- TListGroupIdentitiesDTO,
+ TListGroupMachineIdentitiesDTO,
TListGroupMembersDTO,
TListGroupProjectsDTO,
TListGroupUsersDTO,
- TRemoveIdentityFromGroupDTO,
+ TRemoveMachineIdentityFromGroupDTO,
TRemoveUserFromGroupDTO,
TUpdateGroupDTO
} from "./group-types";
@@ -55,7 +55,7 @@ type TGroupServiceFactoryDep = {
| "update"
| "delete"
| "findAllGroupPossibleUsers"
- | "findAllGroupPossibleIdentities"
+ | "findAllGroupPossibleMachineIdentities"
| "findAllGroupPossibleMembers"
| "findById"
| "transaction"
@@ -395,7 +395,7 @@ export const groupServiceFactory = ({
return { users: members, totalCount };
};
- const listGroupIdentities = async ({
+ const listGroupMachineIdentities = async ({
id,
offset,
limit,
@@ -405,7 +405,7 @@ export const groupServiceFactory = ({
actorOrgId,
search,
filter
- }: TListGroupIdentitiesDTO) => {
+ }: TListGroupMachineIdentitiesDTO) => {
if (!actorOrgId) throw new UnauthorizedError({ message: "No organization ID provided in request" });
const { permission } = await permissionService.getOrgPermission({
@@ -428,7 +428,7 @@ export const groupServiceFactory = ({
message: `Failed to find group with ID ${id}`
});
- const { identities, totalCount } = await groupDAL.findAllGroupPossibleIdentities({
+ const { machineIdentities, totalCount } = await groupDAL.findAllGroupPossibleMachineIdentities({
orgId: group.orgId,
groupId: group.id,
offset,
@@ -437,7 +437,7 @@ export const groupServiceFactory = ({
filter
});
- return { identities, totalCount };
+ return { machineIdentities, totalCount };
};
const listGroupMembers = async ({
@@ -618,14 +618,14 @@ export const groupServiceFactory = ({
return users[0];
};
- const addIdentityToGroup = async ({
+ const addMachineIdentityToGroup = async ({
id,
identityId,
actor,
actorId,
actorAuthMethod,
actorOrgId
- }: TAddIdentityToGroupDTO) => {
+ }: TAddMachineIdentityToGroupDTO) => {
if (!actorOrgId) throw new UnauthorizedError({ message: "No organization ID provided in request" });
const { permission } = await permissionService.getOrgPermission({
@@ -772,14 +772,14 @@ export const groupServiceFactory = ({
return users[0];
};
- const removeIdentityFromGroup = async ({
+ const removeMachineIdentityFromGroup = async ({
id,
identityId,
actor,
actorId,
actorAuthMethod,
actorOrgId
- }: TRemoveIdentityFromGroupDTO) => {
+ }: TRemoveMachineIdentityFromGroupDTO) => {
if (!actorOrgId) throw new UnauthorizedError({ message: "No organization ID provided in request" });
const { permission } = await permissionService.getOrgPermission({
@@ -845,13 +845,13 @@ export const groupServiceFactory = ({
updateGroup,
deleteGroup,
listGroupUsers,
- listGroupIdentities,
+ listGroupMachineIdentities,
listGroupMembers,
listGroupProjects,
addUserToGroup,
- addIdentityToGroup,
+ addMachineIdentityToGroup,
removeUserFromGroup,
- removeIdentityFromGroup,
+ removeMachineIdentityFromGroup,
getGroupById
};
};
diff --git a/backend/src/ee/services/group/group-types.ts b/backend/src/ee/services/group/group-types.ts
index 831d4ca735..e1f2d030dc 100644
--- a/backend/src/ee/services/group/group-types.ts
+++ b/backend/src/ee/services/group/group-types.ts
@@ -46,12 +46,12 @@ export type TListGroupUsersDTO = {
filter?: FilterReturnedUsers;
} & TGenericPermission;
-export type TListGroupIdentitiesDTO = {
+export type TListGroupMachineIdentitiesDTO = {
id: string;
offset: number;
limit: number;
search?: string;
- filter?: FilterReturnedIdentities;
+ filter?: FilterReturnedMachineIdentities;
} & TGenericPermission;
export type TListGroupMembersDTO = {
@@ -83,7 +83,7 @@ export type TAddUserToGroupDTO = {
username: string;
} & TGenericPermission;
-export type TAddIdentityToGroupDTO = {
+export type TAddMachineIdentityToGroupDTO = {
id: string;
identityId: string;
} & TGenericPermission;
@@ -93,7 +93,7 @@ export type TRemoveUserFromGroupDTO = {
username: string;
} & TGenericPermission;
-export type TRemoveIdentityFromGroupDTO = {
+export type TRemoveMachineIdentityFromGroupDTO = {
id: string;
identityId: string;
} & TGenericPermission;
@@ -170,9 +170,9 @@ export enum FilterReturnedUsers {
NON_MEMBERS = "nonMembers"
}
-export enum FilterReturnedIdentities {
- ASSIGNED_IDENTITIES = "assignedIdentities",
- NON_ASSIGNED_IDENTITIES = "nonAssignedIdentities"
+export enum FilterReturnedMachineIdentities {
+ ASSIGNED_MACHINE_IDENTITIES = "assignedMachineIdentities",
+ NON_ASSIGNED_MACHINE_IDENTITIES = "nonAssignedMachineIdentities"
}
export enum FilterReturnedProjects {
@@ -190,5 +190,5 @@ export enum GroupMembersOrderBy {
export enum FilterMemberType {
USERS = "users",
- IDENTITIES = "identities"
+ MACHINE_IDENTITIES = "machineIdentities"
}
diff --git a/backend/src/lib/api-docs/constants.ts b/backend/src/lib/api-docs/constants.ts
index 177f84341e..9e647369ba 100644
--- a/backend/src/lib/api-docs/constants.ts
+++ b/backend/src/lib/api-docs/constants.ts
@@ -106,23 +106,24 @@ export const GROUPS = {
filterUsers:
"Whether to filter the list of returned users. 'existingMembers' will only return existing users in the group, 'nonMembers' will only return users not in the group, undefined will return all users in the organization."
},
- LIST_IDENTITIES: {
+ LIST_MACHINE_IDENTITIES: {
id: "The ID of the group to list identities for.",
offset: "The offset to start from. If you enter 10, it will start from the 10th identity.",
limit: "The number of identities to return.",
- search: "The text string that identity name will be filtered by.",
- filterIdentities:
- "Whether to filter the list of returned identities. 'assignedIdentities' will only return identities assigned to the group, 'nonAssignedIdentities' will only return identities not assigned to the group, undefined will return all identities in the organization."
+ search: "The text string that machine identity name will be filtered by.",
+ filterMachineIdentities:
+ "Whether to filter the list of returned identities. 'assignedMachineIdentities' will only return identities assigned to the group, 'nonAssignedMachineIdentities' will only return identities not assigned to the group, undefined will return all identities in the organization."
},
LIST_MEMBERS: {
id: "The ID of the group to list members for.",
offset: "The offset to start from. If you enter 10, it will start from the 10th member.",
limit: "The number of members to return.",
- search: "The text string that member email(in case of users) or name(in case of identities) will be filtered by.",
+ search:
+ "The text string that member email(in case of users) or name(in case of machine identities) will be filtered by.",
orderBy: "The column to order members by.",
orderDirection: "The direction to order members in.",
memberTypeFilter:
- "Filter members by type. Can be a single value ('users' or 'identities') or an array of values. If not specified, both users and identities will be returned."
+ "Filter members by type. Can be a single value ('users' or 'machineIdentities') or an array of values. If not specified, both users and machine identities will be returned."
},
LIST_PROJECTS: {
id: "The ID of the group to list projects for.",
@@ -138,9 +139,9 @@ export const GROUPS = {
id: "The ID of the group to add the user to.",
username: "The username of the user to add to the group."
},
- ADD_IDENTITY: {
- id: "The ID of the group to add the identity to.",
- identityId: "The ID of the identity to add to the group."
+ ADD_MACHINE_IDENTITY: {
+ id: "The ID of the group to add the machine identity to.",
+ machineIdentityId: "The ID of the machine identity to add to the group."
},
GET_BY_ID: {
id: "The ID of the group to fetch."
@@ -149,9 +150,9 @@ export const GROUPS = {
id: "The ID of the group to remove the user from.",
username: "The username of the user to remove from the group."
},
- DELETE_IDENTITY: {
- id: "The ID of the group to remove the identity from.",
- identityId: "The ID of the identity to remove from the group."
+ DELETE_MACHINE_IDENTITY: {
+ id: "The ID of the group to remove the machine identity from.",
+ machineIdentityId: "The ID of the machine identity to remove from the group."
}
} as const;
diff --git a/docs/api-reference/endpoints/groups/add-group-identity.mdx b/docs/api-reference/endpoints/groups/add-group-identity.mdx
deleted file mode 100644
index dcf65060b0..0000000000
--- a/docs/api-reference/endpoints/groups/add-group-identity.mdx
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: "Add Group Identity"
-openapi: "POST /api/v1/groups/{id}/identities/{identityId}"
----
-
diff --git a/docs/api-reference/endpoints/groups/add-group-machine-identity.mdx b/docs/api-reference/endpoints/groups/add-group-machine-identity.mdx
new file mode 100644
index 0000000000..a997cddc7b
--- /dev/null
+++ b/docs/api-reference/endpoints/groups/add-group-machine-identity.mdx
@@ -0,0 +1,4 @@
+---
+title: "Add Machine Identity to Group"
+openapi: "POST /api/v1/groups/{id}/machine-identities/{machineIdentityId}"
+---
diff --git a/docs/api-reference/endpoints/groups/list-group-identities.mdx b/docs/api-reference/endpoints/groups/list-group-identities.mdx
deleted file mode 100644
index bd4da18151..0000000000
--- a/docs/api-reference/endpoints/groups/list-group-identities.mdx
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: "List Group Identities"
-openapi: "GET /api/v1/groups/{id}/identities"
----
-
diff --git a/docs/api-reference/endpoints/groups/list-group-machine-identities.mdx b/docs/api-reference/endpoints/groups/list-group-machine-identities.mdx
new file mode 100644
index 0000000000..ebe0417132
--- /dev/null
+++ b/docs/api-reference/endpoints/groups/list-group-machine-identities.mdx
@@ -0,0 +1,4 @@
+---
+title: "List Group Machine Identities"
+openapi: "GET /api/v1/groups/{id}/machine-identities"
+---
diff --git a/docs/api-reference/endpoints/groups/remove-group-identity.mdx b/docs/api-reference/endpoints/groups/remove-group-identity.mdx
index 251ecb5b16..b2ec485579 100644
--- a/docs/api-reference/endpoints/groups/remove-group-identity.mdx
+++ b/docs/api-reference/endpoints/groups/remove-group-identity.mdx
@@ -1,5 +1,4 @@
---
-title: "Remove Group Identity"
-openapi: "DELETE /api/v1/groups/{id}/identities/{identityId}"
+title: "Remove Machine Identity from Group"
+openapi: "DELETE /api/v1/groups/{id}/machine-identities/{machineIdentityId}"
---
-
diff --git a/docs/docs.json b/docs/docs.json
index 6a57ed08a5..aee8477fb6 100644
--- a/docs/docs.json
+++ b/docs/docs.json
@@ -877,9 +877,9 @@
"api-reference/endpoints/groups/add-group-user",
"api-reference/endpoints/groups/remove-group-user",
"api-reference/endpoints/groups/list-group-users",
- "api-reference/endpoints/groups/add-group-identity",
- "api-reference/endpoints/groups/remove-group-identity",
- "api-reference/endpoints/groups/list-group-identities",
+ "api-reference/endpoints/groups/add-group-machine-identity",
+ "api-reference/endpoints/groups/remove-group-machine-identity",
+ "api-reference/endpoints/groups/list-group-machine-identities",
"api-reference/endpoints/groups/list-group-projects",
"api-reference/endpoints/groups/list-group-members"
]
diff --git a/frontend/src/hooks/api/groups/index.tsx b/frontend/src/hooks/api/groups/index.tsx
index 694ff2b57c..b705ec3ade 100644
--- a/frontend/src/hooks/api/groups/index.tsx
+++ b/frontend/src/hooks/api/groups/index.tsx
@@ -9,7 +9,7 @@ export {
} from "./mutations";
export {
useGetGroupById,
- useListGroupIdentities,
+ useListGroupMachineIdentities,
useListGroupProjects,
useListGroupUsers
} from "./queries";
diff --git a/frontend/src/hooks/api/groups/mutations.tsx b/frontend/src/hooks/api/groups/mutations.tsx
index 0e239081db..ea5ac22730 100644
--- a/frontend/src/hooks/api/groups/mutations.tsx
+++ b/frontend/src/hooks/api/groups/mutations.tsx
@@ -5,7 +5,7 @@ import { apiRequest } from "@app/config/request";
import { organizationKeys } from "../organization/queries";
import { userKeys } from "../users/query-keys";
import { groupKeys } from "./queries";
-import { TGroup, TGroupIdentity } from "./types";
+import { TGroup, TGroupMachineIdentity } from "./types";
export const useCreateGroup = () => {
const queryClient = useQueryClient();
@@ -136,8 +136,8 @@ export const useAddIdentityToGroup = () => {
identityId: string;
slug: string;
}) => {
- const { data } = await apiRequest.post<Pick<TGroupIdentity, "id" | "name">>(
- `/api/v1/groups/${groupId}/identities/${identityId}`
+ const { data } = await apiRequest.post<Pick<TGroupMachineIdentity, "id" | "name">>(
+ `/api/v1/groups/${groupId}/machine-identities/${identityId}`
);
return data;
@@ -160,8 +160,8 @@ export const useRemoveIdentityFromGroup = () => {
identityId: string;
slug: string;
}) => {
- const { data } = await apiRequest.delete<Pick<TGroupIdentity, "id" | "name">>(
- `/api/v1/groups/${groupId}/identities/${identityId}`
+ const { data } = await apiRequest.delete<Pick<TGroupMachineIdentity, "id" | "name">>(
+ `/api/v1/groups/${groupId}/machine-identities/${identityId}`
);
return data;
diff --git a/frontend/src/hooks/api/groups/queries.tsx b/frontend/src/hooks/api/groups/queries.tsx
index 5bbe1d7e01..fadb0e833c 100644
--- a/frontend/src/hooks/api/groups/queries.tsx
+++ b/frontend/src/hooks/api/groups/queries.tsx
@@ -5,12 +5,12 @@ import { apiRequest } from "@app/config/request";
import { OrderByDirection } from "../generic/types";
import {
FilterMemberType,
- FilterReturnedIdentities,
+ FilterReturnedMachineIdentities,
FilterReturnedProjects,
FilterReturnedUsers,
GroupMembersOrderBy,
TGroup,
- TGroupIdentity,
+ TGroupMachineIdentity,
TGroupMember,
TGroupProject,
TGroupUser
@@ -48,7 +48,7 @@ export const groupKeys = {
offset: number;
limit: number;
search: string;
- filter?: FilterReturnedIdentities;
+ filter?: FilterReturnedMachineIdentities;
}) =>
[...groupKeys.forGroupIdentitiesMemberships(slug), { offset, limit, search, filter }] as const,
allGroupMembers: () => ["group-members"] as const,
@@ -214,7 +214,7 @@ export const useListGroupMembers = ({
});
};
-export const useListGroupIdentities = ({
+export const useListGroupMachineIdentities = ({
id,
groupSlug,
offset = 0,
@@ -227,7 +227,7 @@ export const useListGroupIdentities = ({
offset: number;
limit: number;
search: string;
- filter?: FilterReturnedIdentities;
+ filter?: FilterReturnedMachineIdentities;
}) => {
return useQuery({
queryKey: groupKeys.specificGroupIdentitiesMemberships({
@@ -247,12 +247,12 @@ export const useListGroupIdentities = ({
...(filter && { filter })
});
- const { data } = await apiRequest.get<{ identities: TGroupIdentity[]; totalCount: number }>(
- `/api/v1/groups/${id}/identities`,
- {
- params
- }
- );
+ const { data } = await apiRequest.get<{
+ machineIdentities: TGroupMachineIdentity[];
+ totalCount: number;
+ }>(`/api/v1/groups/${id}/machine-identities`, {
+ params
+ });
return data;
}
diff --git a/frontend/src/hooks/api/groups/types.ts b/frontend/src/hooks/api/groups/types.ts
index 7f1b3f5733..f5549a3c1d 100644
--- a/frontend/src/hooks/api/groups/types.ts
+++ b/frontend/src/hooks/api/groups/types.ts
@@ -42,6 +42,11 @@ export type TGroupWithProjectMemberships = {
orgId: string;
};
+export enum GroupMemberType {
+ USER = "user",
+ MACHINE_IDENTITY = "machineIdentity"
+}
+
export type TGroupUser = {
id: string;
email: string;
@@ -51,36 +56,45 @@ export type TGroupUser = {
joinedGroupAt: Date;
};
-export enum GroupMemberType {
- USER = "user",
- IDENTITY = "identity"
-}
+export type TGroupMachineIdentity = {
+ id: string;
+ name: string;
+ joinedGroupAt: Date;
+};
-export type TGroupMemberUser = TGroupUser & {
- memberType: GroupMemberType.USER;
+export type TGroupMemberUser = {
+ id: string;
+ joinedGroupAt: Date;
+ type: GroupMemberType.USER;
+ user: {
+ email: string;
+ username: string;
+ firstName: string;
+ lastName: string;
+ };
};
-export type TGroupMemberIdentity = TGroupIdentity & {
- memberType: GroupMemberType.IDENTITY;
+export type TGroupMemberMachineIdentity = {
+ id: string;
+ joinedGroupAt: Date;
+ type: GroupMemberType.MACHINE_IDENTITY;
+ machineIdentity: {
+ id: string;
+ name: string;
+ };
};
+export type TGroupMember = TGroupMemberUser | TGroupMemberMachineIdentity;
+
export enum GroupMembersOrderBy {
Name = "name"
}
export enum FilterMemberType {
USERS = "users",
- IDENTITIES = "identities"
+ MACHINE_IDENTITIES = "machineIdentities"
}
-export type TGroupMember = TGroupMemberUser | TGroupMemberIdentity;
-
-export type TGroupIdentity = {
- id: string;
- name: string;
- joinedGroupAt: Date;
-};
-
export type TGroupProject = {
id: string;
name: string;
@@ -95,9 +109,9 @@ export enum FilterReturnedUsers {
NON_MEMBERS = "nonMembers"
}
-export enum FilterReturnedIdentities {
- ASSIGNED_IDENTITIES = "assignedIdentities",
- NON_ASSIGNED_IDENTITIES = "nonAssignedIdentities"
+export enum FilterReturnedMachineIdentities {
+ ASSIGNED_MACHINE_IDENTITIES = "assignedMachineIdentities",
+ NON_ASSIGNED_MACHINE_IDENTITIES = "nonAssignedMachineIdentities"
}
export enum FilterReturnedProjects {
diff --git a/frontend/src/pages/organization/GroupDetailsByIDPage/components/AddGroupMemberModalTabs/AddGroupIdentitiesTab.tsx b/frontend/src/pages/organization/GroupDetailsByIDPage/components/AddGroupMemberModalTabs/AddGroupIdentitiesTab.tsx
index 21640cde5b..0e09c0bbe9 100644
--- a/frontend/src/pages/organization/GroupDetailsByIDPage/components/AddGroupMemberModalTabs/AddGroupIdentitiesTab.tsx
+++ b/frontend/src/pages/organization/GroupDetailsByIDPage/components/AddGroupMemberModalTabs/AddGroupIdentitiesTab.tsx
@@ -18,8 +18,11 @@ import {
} from "@app/components/v2";
import { OrgPermissionGroupActions, OrgPermissionSubjects } from "@app/context";
import { useResetPageHelper } from "@app/hooks";
-import { useAddIdentityToGroup, useListGroupIdentities } from "@app/hooks/api";
-import { FilterReturnedIdentities, TGroupIdentity } from "@app/hooks/api/groups/types";
+import { useAddIdentityToGroup, useListGroupMachineIdentities } from "@app/hooks/api";
+import {
+ FilterReturnedMachineIdentities,
+ TGroupMachineIdentity
+} from "@app/hooks/api/groups/types";
type Props = {
groupId: string;
@@ -32,13 +35,13 @@ export const AddGroupIdentitiesTab = ({ groupId, groupSlug, search }: Props) =>
const [perPage, setPerPage] = useState(10);
const offset = (page - 1) * perPage;
- const { data, isPending } = useListGroupIdentities({
+ const { data, isPending } = useListGroupMachineIdentities({
id: groupId,
groupSlug,
offset,
limit: perPage,
search,
- filter: FilterReturnedIdentities.NON_ASSIGNED_IDENTITIES
+ filter: FilterReturnedMachineIdentities.NON_ASSIGNED_MACHINE_IDENTITIES
});
const { totalCount = 0 } = data ?? {};
@@ -84,7 +87,7 @@ export const AddGroupIdentitiesTab = ({ groupId, groupSlug, search }: Props) =>
<TBody>
{isPending && <TableSkeleton columns={2} innerKey="group-identities" />}
{!isPending &&
- data?.identities?.map((identity: TGroupIdentity) => {
+ data?.machineIdentities?.map((identity: TGroupMachineIdentity) => {
return (
<Tr className="items-center" key={`group-identity-${identity.id}`}>
<Td>
@@ -125,7 +128,7 @@ export const AddGroupIdentitiesTab = ({ groupId, groupSlug, search }: Props) =>
onChangePerPage={(newPerPage) => setPerPage(newPerPage)}
/>
)}
- {!isPending && !data?.identities?.length && (
+ {!isPending && !data?.machineIdentities?.length && (
<EmptyState
title={
search
diff --git a/frontend/src/pages/organization/GroupDetailsByIDPage/components/GroupMembersSection/GroupMembersSection.tsx b/frontend/src/pages/organization/GroupDetailsByIDPage/components/GroupMembersSection/GroupMembersSection.tsx
index cfac512066..ccbd64d0af 100644
--- a/frontend/src/pages/organization/GroupDetailsByIDPage/components/GroupMembersSection/GroupMembersSection.tsx
+++ b/frontend/src/pages/organization/GroupDetailsByIDPage/components/GroupMembersSection/GroupMembersSection.tsx
@@ -23,7 +23,7 @@ type Props = {
type RemoveMemberData =
| { memberType: GroupMemberType.USER; username: string }
- | { memberType: GroupMemberType.IDENTITY; identityId: string; name: string };
+ | { memberType: GroupMemberType.MACHINE_IDENTITY; identityId: string; name: string };
export const GroupMembersSection = ({ groupId, groupSlug }: Props) => {
const { popUp, handlePopUpOpen, handlePopUpToggle } = usePopUp([
@@ -76,9 +76,9 @@ export const GroupMembersSection = ({ groupId, groupSlug }: Props) => {
};
return (
- <div className="w-full rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-4">
- <div className="flex items-center justify-between border-b border-mineshaft-400 pb-4">
- <h3 className="text-lg font-medium text-mineshaft-100">Group Members</h3>
+ <div className="border-mineshaft-600 bg-mineshaft-900 w-full rounded-lg border p-4">
+ <div className="border-mineshaft-400 flex items-center justify-between border-b pb-4">
+ <h3 className="text-mineshaft-100 text-lg font-medium">Group Members</h3>
<OrgPermissionCan I={OrgPermissionGroupActions.Edit} a={OrgPermissionSubjects.Groups}>
{(isAllowed) => (
<div className="mb-4 flex items-center justify-center">
diff --git a/frontend/src/pages/organization/GroupDetailsByIDPage/components/GroupMembersSection/GroupMembersTable.tsx b/frontend/src/pages/organization/GroupDetailsByIDPage/components/GroupMembersSection/GroupMembersTable.tsx
index 724da31fb6..61d2a394bd 100644
--- a/frontend/src/pages/organization/GroupDetailsByIDPage/components/GroupMembersSection/GroupMembersTable.tsx
+++ b/frontend/src/pages/organization/GroupDetailsByIDPage/components/GroupMembersSection/GroupMembersTable.tsx
@@ -117,8 +117,8 @@ export const GroupMembersTable = ({ groupId, groupSlug, handlePopUpOpen }: Props
},
{
icon: <HardDriveIcon size={16} />,
- label: "Identities",
- value: FilterMemberType.IDENTITIES
+ label: "Machine Identities",
+ value: FilterMemberType.MACHINE_IDENTITIES
}
];
@@ -138,7 +138,7 @@ export const GroupMembersTable = ({ groupId, groupSlug, handlePopUpOpen }: Props
variant="plain"
size="sm"
className={twMerge(
- "flex h-10 w-11 items-center justify-center overflow-hidden border border-mineshaft-600 bg-mineshaft-800 p-0 transition-all hover:border-primary/60 hover:bg-primary/10",
+ "border-mineshaft-600 bg-mineshaft-800 hover:border-primary/60 hover:bg-primary/10 flex h-10 w-11 items-center justify-center overflow-hidden border p-0 transition-all",
memberTypeFilter.length > 0 && "border-primary/50 text-primary"
)}
>
@@ -147,7 +147,7 @@ export const GroupMembersTable = ({ groupId, groupSlug, handlePopUpOpen }: Props
</DropdownMenuTrigger>
<DropdownMenuContent
sideOffset={2}
- className="max-h-[70vh] thin-scrollbar overflow-y-auto"
+ className="thin-scrollbar max-h-[70vh] overflow-y-auto"
align="end"
>
<DropdownMenuLabel>Filter by Member Type</DropdownMenuLabel>
@@ -209,7 +209,7 @@ export const GroupMembersTable = ({ groupId, groupSlug, handlePopUpOpen }: Props
{isPending && <TableSkeleton columns={4} innerKey="group-user-memberships" />}
{!isPending &&
groupMemberships?.members?.map((userGroupMembership) => {
- return userGroupMembership.memberType === GroupMemberType.USER ? (
+ return userGroupMembership.type === GroupMemberType.USER ? (
<GroupMembershipUserRow
key={`user-group-membership-${userGroupMembership.id}`}
user={userGroupMembership}
diff --git a/frontend/src/pages/organization/GroupDetailsByIDPage/components/GroupMembersSection/GroupMembershipIdentityRow.tsx b/frontend/src/pages/organization/GroupDetailsByIDPage/components/GroupMembersSection/GroupMembershipIdentityRow.tsx
index eb1587207d..9af1ba09f0 100644
--- a/frontend/src/pages/organization/GroupDetailsByIDPage/components/GroupMembersSection/GroupMembershipIdentityRow.tsx
+++ b/frontend/src/pages/organization/GroupDetailsByIDPage/components/GroupMembersSection/GroupMembershipIdentityRow.tsx
@@ -14,11 +14,11 @@ import {
Tr
} from "@app/components/v2";
import { OrgPermissionGroupActions, OrgPermissionSubjects } from "@app/context";
-import { GroupMemberType, TGroupMemberIdentity } from "@app/hooks/api/groups/types";
+import { GroupMemberType, TGroupMemberMachineIdentity } from "@app/hooks/api/groups/types";
import { UsePopUpState } from "@app/hooks/usePopUp";
type Props = {
- identity: TGroupMemberIdentity;
+ identity: TGroupMemberMachineIdentity;
handlePopUpOpen: (
popUpName: keyof UsePopUpState<["removeMemberFromGroup"]>,
data?: object
@@ -26,7 +26,11 @@ type Props = {
};
export const GroupMembershipIdentityRow = ({
- identity: { name, joinedGroupAt, id },
+ identity: {
+ machineIdentity: { name },
+ joinedGroupAt,
+ id
+ },
handlePopUpOpen
}: Props) => {
return (
@@ -64,7 +68,7 @@ export const GroupMembershipIdentityRow = ({
icon={<FontAwesomeIcon icon={faUserMinus} />}
onClick={() =>
handlePopUpOpen("removeMemberFromGroup", {
- memberType: GroupMemberType.IDENTITY,
+ memberType: GroupMemberType.MACHINE_IDENTITY,
identityId: id,
name
})
diff --git a/frontend/src/pages/organization/GroupDetailsByIDPage/components/GroupMembersSection/GroupMembershipUserRow.tsx b/frontend/src/pages/organization/GroupDetailsByIDPage/components/GroupMembersSection/GroupMembershipUserRow.tsx
index 3c6a1250ff..eb5fc45e56 100644
--- a/frontend/src/pages/organization/GroupDetailsByIDPage/components/GroupMembersSection/GroupMembershipUserRow.tsx
+++ b/frontend/src/pages/organization/GroupDetailsByIDPage/components/GroupMembersSection/GroupMembershipUserRow.tsx
@@ -27,7 +27,11 @@ type Props = {
};
export const GroupMembershipUserRow = ({
- user: { firstName, lastName, username, joinedGroupAt, email, id },
+ user: {
+ user: { firstName, lastName, email, username },
+ joinedGroupAt,
+ id
+ },
handlePopUpOpen
}: Props) => {
const { currentOrg } = useOrganization();
diff --git a/frontend/src/pages/project/GroupDetailsByIDPage/components/GroupMembersSection/GroupMembersSection.tsx b/frontend/src/pages/project/GroupDetailsByIDPage/components/GroupMembersSection/GroupMembersSection.tsx
index 4534e4371e..cf6e9682b8 100644
--- a/frontend/src/pages/project/GroupDetailsByIDPage/components/GroupMembersSection/GroupMembersSection.tsx
+++ b/frontend/src/pages/project/GroupDetailsByIDPage/components/GroupMembersSection/GroupMembersSection.tsx
@@ -8,9 +8,9 @@ type Props = {
export const GroupMembersSection = ({ groupMembership }: Props) => {
return (
- <div className="w-full rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-4">
- <div className="flex items-center justify-between border-b border-mineshaft-400 pb-4">
- <h3 className="text-lg font-medium text-mineshaft-100">Group Members</h3>
+ <div className="border-mineshaft-600 bg-mineshaft-900 w-full rounded-lg border p-4">
+ <div className="border-mineshaft-400 flex items-center justify-between border-b pb-4">
+ <h3 className="text-mineshaft-100 text-lg font-medium">Group Members</h3>
</div>
<div className="py-4">
<GroupMembersTable groupMembership={groupMembership} />
diff --git a/frontend/src/pages/project/GroupDetailsByIDPage/components/GroupMembersSection/GroupMembersTable.tsx b/frontend/src/pages/project/GroupDetailsByIDPage/components/GroupMembersSection/GroupMembersTable.tsx
index 6e81db9730..34118021f2 100644
--- a/frontend/src/pages/project/GroupDetailsByIDPage/components/GroupMembersSection/GroupMembersTable.tsx
+++ b/frontend/src/pages/project/GroupDetailsByIDPage/components/GroupMembersSection/GroupMembersTable.tsx
@@ -162,8 +162,8 @@ export const GroupMembersTable = ({ groupMembership }: Props) => {
},
{
icon: <HardDriveIcon size={16} />,
- label: "Identities",
- value: FilterMemberType.IDENTITIES
+ label: "Machine Identities",
+ value: FilterMemberType.MACHINE_IDENTITIES
}
];
@@ -183,7 +183,7 @@ export const GroupMembersTable = ({ groupMembership }: Props) => {
variant="plain"
size="sm"
className={twMerge(
- "flex h-10 w-11 items-center justify-center overflow-hidden border border-mineshaft-600 bg-mineshaft-800 p-0 transition-all hover:border-primary/60 hover:bg-primary/10",
+ "border-mineshaft-600 bg-mineshaft-800 hover:border-primary/60 hover:bg-primary/10 flex h-10 w-11 items-center justify-center overflow-hidden border p-0 transition-all",
memberTypeFilter.length > 0 && "border-primary/50 text-primary"
)}
>
@@ -192,7 +192,7 @@ export const GroupMembersTable = ({ groupMembership }: Props) => {
</DropdownMenuTrigger>
<DropdownMenuContent
sideOffset={2}
- className="max-h-[70vh] thin-scrollbar overflow-y-auto"
+ className="thin-scrollbar max-h-[70vh] overflow-y-auto"
align="end"
>
<DropdownMenuLabel>Filter by Member Type</DropdownMenuLabel>
@@ -254,7 +254,7 @@ export const GroupMembersTable = ({ groupMembership }: Props) => {
{isPending && <TableSkeleton columns={4} innerKey="group-user-memberships" />}
{!isPending &&
groupMemberships?.members?.map((userGroupMembership) => {
- return userGroupMembership.memberType === GroupMemberType.USER ? (
+ return userGroupMembership.type === GroupMemberType.USER ? (
<GroupMembershipUserRow
key={`user-group-membership-${userGroupMembership.id}`}
user={userGroupMembership}
diff --git a/frontend/src/pages/project/GroupDetailsByIDPage/components/GroupMembersSection/GroupMembershipIdentityRow.tsx b/frontend/src/pages/project/GroupDetailsByIDPage/components/GroupMembersSection/GroupMembershipIdentityRow.tsx
index b76d23d4d8..2e00c43e51 100644
--- a/frontend/src/pages/project/GroupDetailsByIDPage/components/GroupMembersSection/GroupMembershipIdentityRow.tsx
+++ b/frontend/src/pages/project/GroupDetailsByIDPage/components/GroupMembersSection/GroupMembershipIdentityRow.tsx
@@ -14,15 +14,19 @@ import {
Tr
} from "@app/components/v2";
import { ProjectPermissionIdentityActions, ProjectPermissionSub } from "@app/context";
-import { TGroupMemberIdentity } from "@app/hooks/api/groups/types";
+import { TGroupMemberMachineIdentity } from "@app/hooks/api/groups/types";
type Props = {
- identity: TGroupMemberIdentity;
+ identity: TGroupMemberMachineIdentity;
onAssumePrivileges: (identityId: string) => void;
};
export const GroupMembershipIdentityRow = ({
- identity: { name, joinedGroupAt, id },
+ identity: {
+ machineIdentity: { name },
+ joinedGroupAt,
+ id
+ },
onAssumePrivileges
}: Props) => {
return (
diff --git a/frontend/src/pages/project/GroupDetailsByIDPage/components/GroupMembersSection/GroupMembershipUserRow.tsx b/frontend/src/pages/project/GroupDetailsByIDPage/components/GroupMembersSection/GroupMembershipUserRow.tsx
index 9a202b3cb1..3288bea81b 100644
--- a/frontend/src/pages/project/GroupDetailsByIDPage/components/GroupMembersSection/GroupMembershipUserRow.tsx
+++ b/frontend/src/pages/project/GroupDetailsByIDPage/components/GroupMembersSection/GroupMembershipUserRow.tsx
@@ -22,7 +22,11 @@ type Props = {
};
export const GroupMembershipUserRow = ({
- user: { firstName, lastName, joinedGroupAt, email, id },
+ user: {
+ user: { firstName, lastName, email },
+ joinedGroupAt,
+ id
+ },
onAssumePrivileges
}: Props) => {
return (