mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-07 15:27:46 +00:00
Addressed pr comments
This commit is contained in:
@@ -25,9 +25,9 @@ export async function up(knex: Knex): Promise<void> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function down(knex: Knex): Promise<void> {
|
export async function down(knex: Knex): Promise<void> {
|
||||||
if (await knex.schema.hasColumn(TableName.IdentityLdapAuth, "template")) {
|
if (await knex.schema.hasColumn(TableName.IdentityLdapAuth, "templateId")) {
|
||||||
await knex.schema.alterTable(TableName.IdentityLdapAuth, (t) => {
|
await knex.schema.alterTable(TableName.IdentityLdapAuth, (t) => {
|
||||||
t.dropForeign("templateId");
|
t.dropForeign(["templateId"]);
|
||||||
t.dropColumn("templateId");
|
t.dropColumn("templateId");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -419,15 +419,6 @@ const buildMemberPermission = () => {
|
|||||||
can(OrgPermissionGatewayActions.AttachGateways, OrgPermissionSubjects.Gateway);
|
can(OrgPermissionGatewayActions.AttachGateways, OrgPermissionSubjects.Gateway);
|
||||||
|
|
||||||
can(OrgPermissionMachineIdentityAuthTemplateActions.ListTemplates, OrgPermissionSubjects.MachineIdentityAuthTemplate);
|
can(OrgPermissionMachineIdentityAuthTemplateActions.ListTemplates, OrgPermissionSubjects.MachineIdentityAuthTemplate);
|
||||||
can(OrgPermissionMachineIdentityAuthTemplateActions.EditTemplates, OrgPermissionSubjects.MachineIdentityAuthTemplate);
|
|
||||||
can(
|
|
||||||
OrgPermissionMachineIdentityAuthTemplateActions.CreateTemplates,
|
|
||||||
OrgPermissionSubjects.MachineIdentityAuthTemplate
|
|
||||||
);
|
|
||||||
can(
|
|
||||||
OrgPermissionMachineIdentityAuthTemplateActions.DeleteTemplates,
|
|
||||||
OrgPermissionSubjects.MachineIdentityAuthTemplate
|
|
||||||
);
|
|
||||||
can(
|
can(
|
||||||
OrgPermissionMachineIdentityAuthTemplateActions.UnlinkTemplates,
|
OrgPermissionMachineIdentityAuthTemplateActions.UnlinkTemplates,
|
||||||
OrgPermissionSubjects.MachineIdentityAuthTemplate
|
OrgPermissionSubjects.MachineIdentityAuthTemplate
|
||||||
|
|||||||
@@ -35,7 +35,11 @@ export const registerIdentityTemplateRouter = async (server: FastifyZodProvider)
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
body: z.object({
|
body: z.object({
|
||||||
name: z.string().trim().min(1, TEMPLATE_VALIDATION_MESSAGES.TEMPLATE_NAME_REQUIRED),
|
name: z
|
||||||
|
.string()
|
||||||
|
.trim()
|
||||||
|
.min(1, TEMPLATE_VALIDATION_MESSAGES.TEMPLATE_NAME_REQUIRED)
|
||||||
|
.max(64, TEMPLATE_VALIDATION_MESSAGES.TEMPLATE_NAME_MAX_LENGTH),
|
||||||
authMethod: z.nativeEnum(IdentityAuthTemplateMethod),
|
authMethod: z.nativeEnum(IdentityAuthTemplateMethod),
|
||||||
templateFields: ldapTemplateFieldsSchema
|
templateFields: ldapTemplateFieldsSchema
|
||||||
}),
|
}),
|
||||||
@@ -91,7 +95,12 @@ export const registerIdentityTemplateRouter = async (server: FastifyZodProvider)
|
|||||||
templateId: z.string().min(1, TEMPLATE_VALIDATION_MESSAGES.TEMPLATE_ID_REQUIRED)
|
templateId: z.string().min(1, TEMPLATE_VALIDATION_MESSAGES.TEMPLATE_ID_REQUIRED)
|
||||||
}),
|
}),
|
||||||
body: z.object({
|
body: z.object({
|
||||||
name: z.string().trim().optional(),
|
name: z
|
||||||
|
.string()
|
||||||
|
.trim()
|
||||||
|
.min(1, TEMPLATE_VALIDATION_MESSAGES.TEMPLATE_NAME_REQUIRED)
|
||||||
|
.max(64, TEMPLATE_VALIDATION_MESSAGES.TEMPLATE_NAME_MAX_LENGTH)
|
||||||
|
.optional(),
|
||||||
templateFields: ldapTemplateFieldsSchema.partial().optional()
|
templateFields: ldapTemplateFieldsSchema.partial().optional()
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
@@ -232,7 +241,8 @@ export const registerIdentityTemplateRouter = async (server: FastifyZodProvider)
|
|||||||
],
|
],
|
||||||
querystring: z.object({
|
querystring: z.object({
|
||||||
limit: z.coerce.number().positive().max(100).default(5).optional(),
|
limit: z.coerce.number().positive().max(100).default(5).optional(),
|
||||||
offset: z.coerce.number().min(0).default(0).optional()
|
offset: z.coerce.number().min(0).default(0).optional(),
|
||||||
|
search: z.string().optional()
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
200: z.object({
|
200: z.object({
|
||||||
@@ -247,6 +257,7 @@ export const registerIdentityTemplateRouter = async (server: FastifyZodProvider)
|
|||||||
const { templates, totalCount } = await server.services.identityAuthTemplate.listTemplates({
|
const { templates, totalCount } = await server.services.identityAuthTemplate.listTemplates({
|
||||||
limit: req.query.limit,
|
limit: req.query.limit,
|
||||||
offset: req.query.offset,
|
offset: req.query.offset,
|
||||||
|
search: req.query.search,
|
||||||
actor: req.permission.type,
|
actor: req.permission.type,
|
||||||
actorId: req.permission.id,
|
actorId: req.permission.id,
|
||||||
actorAuthMethod: req.permission.authMethod,
|
actorAuthMethod: req.permission.authMethod,
|
||||||
@@ -303,7 +314,7 @@ export const registerIdentityTemplateRouter = async (server: FastifyZodProvider)
|
|||||||
onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]),
|
onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]),
|
||||||
schema: {
|
schema: {
|
||||||
hide: false,
|
hide: false,
|
||||||
description: "Get identity auth templates by authentication method",
|
description: "Get template usage by template ID",
|
||||||
security: [
|
security: [
|
||||||
{
|
{
|
||||||
bearerAuth: []
|
bearerAuth: []
|
||||||
@@ -338,7 +349,7 @@ export const registerIdentityTemplateRouter = async (server: FastifyZodProvider)
|
|||||||
method: "POST",
|
method: "POST",
|
||||||
url: "/:templateId/usage",
|
url: "/:templateId/usage",
|
||||||
config: {
|
config: {
|
||||||
rateLimit: readLimit
|
rateLimit: writeLimit
|
||||||
},
|
},
|
||||||
onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]),
|
onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]),
|
||||||
schema: {
|
schema: {
|
||||||
|
|||||||
@@ -14,9 +14,18 @@ export const identityAuthTemplateDALFactory = (db: TDbClient) => {
|
|||||||
|
|
||||||
const findByOrgId = async (
|
const findByOrgId = async (
|
||||||
orgId: string,
|
orgId: string,
|
||||||
{ limit, offset, tx }: { limit?: number; offset?: number; tx?: Knex } = {}
|
{ limit, offset, search, tx }: { limit?: number; offset?: number; search?: string; tx?: Knex } = {}
|
||||||
) => {
|
) => {
|
||||||
let query = (tx || db.replicaNode())(TableName.IdentityAuthTemplate).where({ orgId }).orderBy("createdAt", "desc");
|
let query = (tx || db.replicaNode())(TableName.IdentityAuthTemplate).where({ orgId });
|
||||||
|
let countQuery = (tx || db.replicaNode())(TableName.IdentityAuthTemplate).where({ orgId });
|
||||||
|
|
||||||
|
if (search) {
|
||||||
|
const searchFilter = `%${search.toLowerCase()}%`;
|
||||||
|
query = query.whereRaw("LOWER(name) LIKE ?", [searchFilter]);
|
||||||
|
countQuery = countQuery.whereRaw("LOWER(name) LIKE ?", [searchFilter]);
|
||||||
|
}
|
||||||
|
|
||||||
|
query = query.orderBy("createdAt", "desc");
|
||||||
|
|
||||||
if (limit !== undefined) {
|
if (limit !== undefined) {
|
||||||
query = query.limit(limit);
|
query = query.limit(limit);
|
||||||
@@ -27,9 +36,7 @@ export const identityAuthTemplateDALFactory = (db: TDbClient) => {
|
|||||||
|
|
||||||
const docs = await query;
|
const docs = await query;
|
||||||
|
|
||||||
const [{ count }] = (await (tx || db.replicaNode())(TableName.IdentityAuthTemplate)
|
const [{ count }] = (await countQuery.count("* as count")) as [{ count: string | number }];
|
||||||
.where({ orgId })
|
|
||||||
.count("* as count")) as [{ count: string | number }];
|
|
||||||
|
|
||||||
return { docs, totalCount: Number(count) };
|
return { docs, totalCount: Number(count) };
|
||||||
};
|
};
|
||||||
@@ -60,10 +67,17 @@ export const identityAuthTemplateDALFactory = (db: TDbClient) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const findByIdAndOrgId = async (id: string, orgId: string, tx?: Knex) => {
|
||||||
|
const query = (tx || db.replicaNode())(TableName.IdentityAuthTemplate).where({ id, orgId });
|
||||||
|
const doc = await query;
|
||||||
|
return doc?.[0];
|
||||||
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...identityAuthTemplateOrm,
|
...identityAuthTemplateOrm,
|
||||||
findByOrgId,
|
findByOrgId,
|
||||||
findByAuthMethod,
|
findByAuthMethod,
|
||||||
findTemplateUsages
|
findTemplateUsages,
|
||||||
|
findByIdAndOrgId
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ export enum IdentityAuthTemplateMethod {
|
|||||||
|
|
||||||
export const TEMPLATE_VALIDATION_MESSAGES = {
|
export const TEMPLATE_VALIDATION_MESSAGES = {
|
||||||
TEMPLATE_NAME_REQUIRED: "Template name is required",
|
TEMPLATE_NAME_REQUIRED: "Template name is required",
|
||||||
|
TEMPLATE_NAME_MAX_LENGTH: "Template name must be at most 64 characters long",
|
||||||
AUTH_METHOD_REQUIRED: "Auth method is required",
|
AUTH_METHOD_REQUIRED: "Auth method is required",
|
||||||
TEMPLATE_ID_REQUIRED: "Template ID is required",
|
TEMPLATE_ID_REQUIRED: "Template ID is required",
|
||||||
LDAP_URL_REQUIRED: "LDAP URL is required",
|
LDAP_URL_REQUIRED: "LDAP URL is required",
|
||||||
|
|||||||
@@ -249,19 +249,20 @@ export const identityAuthTemplateServiceFactory = ({
|
|||||||
|
|
||||||
const { decryptor } = await kmsService.createCipherPairWithDataKey({
|
const { decryptor } = await kmsService.createCipherPairWithDataKey({
|
||||||
type: KmsDataKey.Organization,
|
type: KmsDataKey.Organization,
|
||||||
orgId: actorOrgId
|
orgId: template.orgId
|
||||||
});
|
});
|
||||||
const decryptedTemplateFields = decryptor({ cipherTextBlob: template.templateFields }).toString();
|
const decryptedTemplateFields = decryptor({ cipherTextBlob: template.templateFields }).toString();
|
||||||
return {
|
return {
|
||||||
...template,
|
...template,
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||||
templateFields: JSON.parse(decryptedTemplateFields.toString())
|
templateFields: JSON.parse(decryptedTemplateFields)
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
const listTemplates = async ({
|
const listTemplates = async ({
|
||||||
limit,
|
limit,
|
||||||
offset,
|
offset,
|
||||||
|
search,
|
||||||
actorId,
|
actorId,
|
||||||
actorAuthMethod,
|
actorAuthMethod,
|
||||||
actor,
|
actor,
|
||||||
@@ -280,7 +281,7 @@ export const identityAuthTemplateServiceFactory = ({
|
|||||||
OrgPermissionSubjects.MachineIdentityAuthTemplate
|
OrgPermissionSubjects.MachineIdentityAuthTemplate
|
||||||
);
|
);
|
||||||
|
|
||||||
const { docs, totalCount } = await identityAuthTemplateDAL.findByOrgId(actorOrgId, { limit, offset });
|
const { docs, totalCount } = await identityAuthTemplateDAL.findByOrgId(actorOrgId, { limit, offset, search });
|
||||||
|
|
||||||
const { decryptor } = await kmsService.createCipherPairWithDataKey({
|
const { decryptor } = await kmsService.createCipherPairWithDataKey({
|
||||||
type: KmsDataKey.Organization,
|
type: KmsDataKey.Organization,
|
||||||
|
|||||||
@@ -16,16 +16,16 @@ export type TTemplateFieldsByMethod = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Generic base types that use conditional types for type safety
|
// Generic base types that use conditional types for type safety
|
||||||
export type TCreateIdentityAuthTemplateDTO<T extends IdentityAuthTemplateMethod = IdentityAuthTemplateMethod> = {
|
export type TCreateIdentityAuthTemplateDTO = {
|
||||||
name: string;
|
name: string;
|
||||||
authMethod: T;
|
authMethod: IdentityAuthTemplateMethod;
|
||||||
templateFields: TTemplateFieldsByMethod[T];
|
templateFields: TTemplateFieldsByMethod[IdentityAuthTemplateMethod];
|
||||||
} & Omit<TProjectPermission, "projectId">;
|
} & Omit<TProjectPermission, "projectId">;
|
||||||
|
|
||||||
export type TUpdateIdentityAuthTemplateDTO<T extends IdentityAuthTemplateMethod = IdentityAuthTemplateMethod> = {
|
export type TUpdateIdentityAuthTemplateDTO = {
|
||||||
templateId: string;
|
templateId: string;
|
||||||
name?: string;
|
name?: string;
|
||||||
templateFields?: Partial<TTemplateFieldsByMethod[T]>;
|
templateFields?: Partial<TTemplateFieldsByMethod[IdentityAuthTemplateMethod]>;
|
||||||
} & Omit<TProjectPermission, "projectId">;
|
} & Omit<TProjectPermission, "projectId">;
|
||||||
|
|
||||||
export type TDeleteIdentityAuthTemplateDTO = {
|
export type TDeleteIdentityAuthTemplateDTO = {
|
||||||
@@ -39,6 +39,7 @@ export type TGetIdentityAuthTemplateDTO = {
|
|||||||
export type TListIdentityAuthTemplatesDTO = {
|
export type TListIdentityAuthTemplatesDTO = {
|
||||||
limit?: number;
|
limit?: number;
|
||||||
offset?: number;
|
offset?: number;
|
||||||
|
search?: string;
|
||||||
} & Omit<TProjectPermission, "projectId">;
|
} & Omit<TProjectPermission, "projectId">;
|
||||||
|
|
||||||
export type TGetTemplatesByAuthMethodDTO = {
|
export type TGetTemplatesByAuthMethodDTO = {
|
||||||
@@ -55,5 +56,5 @@ export type TUnlinkTemplateUsageDTO = {
|
|||||||
} & Omit<TProjectPermission, "projectId">;
|
} & Omit<TProjectPermission, "projectId">;
|
||||||
|
|
||||||
// Specific LDAP types for convenience
|
// Specific LDAP types for convenience
|
||||||
export type TCreateLdapTemplateDTO = TCreateIdentityAuthTemplateDTO<IdentityAuthTemplateMethod.LDAP>;
|
export type TCreateLdapTemplateDTO = TCreateIdentityAuthTemplateDTO;
|
||||||
export type TUpdateLdapTemplateDTO = TUpdateIdentityAuthTemplateDTO<IdentityAuthTemplateMethod.LDAP>;
|
export type TUpdateLdapTemplateDTO = TUpdateIdentityAuthTemplateDTO;
|
||||||
|
|||||||
@@ -250,7 +250,9 @@ export const identityLdapAuthServiceFactory = ({
|
|||||||
orgId: identityMembershipOrg.orgId
|
orgId: identityMembershipOrg.orgId
|
||||||
});
|
});
|
||||||
|
|
||||||
const template = templateId ? await identityAuthTemplateDAL.findById(templateId) : undefined;
|
const template = templateId
|
||||||
|
? await identityAuthTemplateDAL.findByIdAndOrgId(templateId, identityMembershipOrg.orgId)
|
||||||
|
: undefined;
|
||||||
|
|
||||||
let ldapConfig: { bindDN: string; bindPass: string; searchBase: string; url: string };
|
let ldapConfig: { bindDN: string; bindPass: string; searchBase: string; url: string };
|
||||||
if (template) {
|
if (template) {
|
||||||
@@ -401,7 +403,9 @@ export const identityLdapAuthServiceFactory = ({
|
|||||||
orgId: identityMembershipOrg.orgId
|
orgId: identityMembershipOrg.orgId
|
||||||
});
|
});
|
||||||
|
|
||||||
const template = templateId ? await identityAuthTemplateDAL.findById(templateId) : undefined;
|
const template = templateId
|
||||||
|
? await identityAuthTemplateDAL.findByIdAndOrgId(templateId, identityMembershipOrg.orgId)
|
||||||
|
: undefined;
|
||||||
let config: {
|
let config: {
|
||||||
bindDN?: string;
|
bindDN?: string;
|
||||||
bindPass?: string;
|
bindPass?: string;
|
||||||
|
|||||||
@@ -6,7 +6,8 @@ import {
|
|||||||
GetIdentityAuthTemplatesDTO,
|
GetIdentityAuthTemplatesDTO,
|
||||||
GetTemplateUsagesDTO,
|
GetTemplateUsagesDTO,
|
||||||
IdentityAuthTemplate,
|
IdentityAuthTemplate,
|
||||||
MachineAuthTemplateUsage
|
MachineAuthTemplateUsage,
|
||||||
|
MachineIdentityAuthMethod
|
||||||
} from "./types";
|
} from "./types";
|
||||||
|
|
||||||
export const identityAuthTemplatesKeys = {
|
export const identityAuthTemplatesKeys = {
|
||||||
@@ -15,8 +16,8 @@ export const identityAuthTemplatesKeys = {
|
|||||||
[...identityAuthTemplatesKeys.all, "list", dto] as const,
|
[...identityAuthTemplatesKeys.all, "list", dto] as const,
|
||||||
getTemplate: (templateId: string) =>
|
getTemplate: (templateId: string) =>
|
||||||
[...identityAuthTemplatesKeys.all, "single", templateId] as const,
|
[...identityAuthTemplatesKeys.all, "single", templateId] as const,
|
||||||
getTemplatesByOrgId: (authMethod: string) =>
|
getAvailableTemplates: (authMethod: MachineIdentityAuthMethod) =>
|
||||||
[...identityAuthTemplatesKeys.all, "list", authMethod] as const,
|
[...identityAuthTemplatesKeys.all, "available", authMethod] as const,
|
||||||
getTemplateUsages: (templateId: string) =>
|
getTemplateUsages: (templateId: string) =>
|
||||||
[...identityAuthTemplatesKeys.all, "usages", templateId] as const
|
[...identityAuthTemplatesKeys.all, "usages", templateId] as const
|
||||||
};
|
};
|
||||||
@@ -32,7 +33,8 @@ export const useGetIdentityAuthTemplates = (dto: GetIdentityAuthTemplatesDTO) =>
|
|||||||
params: {
|
params: {
|
||||||
organizationId: dto.organizationId,
|
organizationId: dto.organizationId,
|
||||||
limit: dto.limit || 50,
|
limit: dto.limit || 50,
|
||||||
offset: dto.offset || 0
|
offset: dto.offset || 0,
|
||||||
|
...(dto.search && { search: dto.search })
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return data;
|
return data;
|
||||||
@@ -57,9 +59,9 @@ export const useGetIdentityAuthTemplate = (templateId: string, organizationId: s
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const useGetIdentityAuthTemplatesByOrgId = (authMethod: string) => {
|
export const useGetAvailableTemplates = (authMethod: MachineIdentityAuthMethod) => {
|
||||||
return useQuery({
|
return useQuery({
|
||||||
queryKey: identityAuthTemplatesKeys.getTemplatesByOrgId(authMethod),
|
queryKey: identityAuthTemplatesKeys.getAvailableTemplates(authMethod),
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const { data } = await apiRequest.get<IdentityAuthTemplate[]>(
|
const { data } = await apiRequest.get<IdentityAuthTemplate[]>(
|
||||||
"/api/v1/identities/templates",
|
"/api/v1/identities/templates",
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ export interface GetIdentityAuthTemplatesDTO {
|
|||||||
organizationId: string;
|
organizationId: string;
|
||||||
limit?: number;
|
limit?: number;
|
||||||
offset?: number;
|
offset?: number;
|
||||||
|
search?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface MachineAuthTemplateUsage {
|
export interface MachineAuthTemplateUsage {
|
||||||
|
|||||||
+4
-7
@@ -90,7 +90,8 @@ export const IdentityAuthTemplatesTable = ({ handlePopUpOpen }: Props) => {
|
|||||||
const { data, isPending, isFetching } = useGetIdentityAuthTemplates({
|
const { data, isPending, isFetching } = useGetIdentityAuthTemplates({
|
||||||
organizationId,
|
organizationId,
|
||||||
limit,
|
limit,
|
||||||
offset
|
offset,
|
||||||
|
search: debouncedSearch
|
||||||
});
|
});
|
||||||
|
|
||||||
const { templates = [], totalCount = 0 } = data ?? {};
|
const { templates = [], totalCount = 0 } = data ?? {};
|
||||||
@@ -100,10 +101,6 @@ export const IdentityAuthTemplatesTable = ({ handlePopUpOpen }: Props) => {
|
|||||||
setPage
|
setPage
|
||||||
});
|
});
|
||||||
|
|
||||||
const filteredTemplates = templates.filter((template) =>
|
|
||||||
template.name.toLowerCase().includes(debouncedSearch.toLowerCase())
|
|
||||||
);
|
|
||||||
|
|
||||||
const handleSort = (column: TemplatesOrderBy) => {
|
const handleSort = (column: TemplatesOrderBy) => {
|
||||||
if (column === orderBy) {
|
if (column === orderBy) {
|
||||||
setOrderDirection((prev) =>
|
setOrderDirection((prev) =>
|
||||||
@@ -177,7 +174,7 @@ export const IdentityAuthTemplatesTable = ({ handlePopUpOpen }: Props) => {
|
|||||||
<TBody>
|
<TBody>
|
||||||
{isPending && <TableSkeleton columns={4} innerKey="identity-auth-templates" />}
|
{isPending && <TableSkeleton columns={4} innerKey="identity-auth-templates" />}
|
||||||
{!isPending &&
|
{!isPending &&
|
||||||
filteredTemplates?.map((template) => (
|
templates?.map((template) => (
|
||||||
<Tr
|
<Tr
|
||||||
className="h-10 cursor-pointer transition-colors duration-100 hover:bg-mineshaft-700"
|
className="h-10 cursor-pointer transition-colors duration-100 hover:bg-mineshaft-700"
|
||||||
key={`template-${template.id}`}
|
key={`template-${template.id}`}
|
||||||
@@ -268,7 +265,7 @@ export const IdentityAuthTemplatesTable = ({ handlePopUpOpen }: Props) => {
|
|||||||
onChangePerPage={handlePerPageChange}
|
onChangePerPage={handlePerPageChange}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{!isPending && data && filteredTemplates.length === 0 && (
|
{!isPending && data && templates.length === 0 && (
|
||||||
<EmptyState
|
<EmptyState
|
||||||
title={
|
title={
|
||||||
debouncedSearch.trim().length > 0
|
debouncedSearch.trim().length > 0
|
||||||
|
|||||||
+3
-2
@@ -22,12 +22,13 @@ import {
|
|||||||
} from "@app/components/v2";
|
} from "@app/components/v2";
|
||||||
import { useOrganization, useSubscription } from "@app/context";
|
import { useOrganization, useSubscription } from "@app/context";
|
||||||
import {
|
import {
|
||||||
|
MachineIdentityAuthMethod,
|
||||||
useAddIdentityLdapAuth,
|
useAddIdentityLdapAuth,
|
||||||
useGetIdentityLdapAuth,
|
useGetIdentityLdapAuth,
|
||||||
useUpdateIdentityLdapAuth
|
useUpdateIdentityLdapAuth
|
||||||
} from "@app/hooks/api";
|
} from "@app/hooks/api";
|
||||||
import { IdentityTrustedIp } from "@app/hooks/api/identities/types";
|
import { IdentityTrustedIp } from "@app/hooks/api/identities/types";
|
||||||
import { useGetIdentityAuthTemplatesByOrgId } from "@app/hooks/api/identityAuthTemplates/queries";
|
import { useGetAvailableTemplates } from "@app/hooks/api/identityAuthTemplates/queries";
|
||||||
import { UsePopUpState } from "@app/hooks/usePopUp";
|
import { UsePopUpState } from "@app/hooks/usePopUp";
|
||||||
|
|
||||||
import { IdentityFormTab } from "./types";
|
import { IdentityFormTab } from "./types";
|
||||||
@@ -141,7 +142,7 @@ export const IdentityLdapAuthForm = ({
|
|||||||
const { mutateAsync: addMutateAsync } = useAddIdentityLdapAuth();
|
const { mutateAsync: addMutateAsync } = useAddIdentityLdapAuth();
|
||||||
const { mutateAsync: updateMutateAsync } = useUpdateIdentityLdapAuth();
|
const { mutateAsync: updateMutateAsync } = useUpdateIdentityLdapAuth();
|
||||||
const [tabValue, setTabValue] = useState<IdentityFormTab>(IdentityFormTab.Configuration);
|
const [tabValue, setTabValue] = useState<IdentityFormTab>(IdentityFormTab.Configuration);
|
||||||
const { data: templates } = useGetIdentityAuthTemplatesByOrgId("ldap");
|
const { data: templates } = useGetAvailableTemplates(MachineIdentityAuthMethod.LDAP);
|
||||||
|
|
||||||
const { data } = useGetIdentityLdapAuth(identityId ?? "", {
|
const { data } = useGetIdentityLdapAuth(identityId ?? "", {
|
||||||
enabled: isUpdate
|
enabled: isUpdate
|
||||||
|
|||||||
+1
-1
@@ -156,7 +156,7 @@ export const IdentitySection = withPermission(
|
|||||||
<div className="flex items-center gap-1">
|
<div className="flex items-center gap-1">
|
||||||
<p className="text-xl font-semibold text-mineshaft-100">Identity Auth Templates</p>
|
<p className="text-xl font-semibold text-mineshaft-100">Identity Auth Templates</p>
|
||||||
<a
|
<a
|
||||||
href="https://infisical.com/docs/documentation/platform/identities/overview"
|
href="https://infisical.com/docs/documentation/platform/identities/auth-templates"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noopener noreferrer"
|
rel="noopener noreferrer"
|
||||||
>
|
>
|
||||||
|
|||||||
+2
-2
@@ -171,7 +171,7 @@ export const MachineAuthTemplateUsagesModal = ({
|
|||||||
</Tr>
|
</Tr>
|
||||||
</THead>
|
</THead>
|
||||||
<TBody>
|
<TBody>
|
||||||
{isPending && <TableSkeleton columns={4} innerKey="template-usages" />}
|
{isPending && <TableSkeleton columns={3} innerKey="template-usages" />}
|
||||||
{!isPending &&
|
{!isPending &&
|
||||||
usages.map((usage) => (
|
usages.map((usage) => (
|
||||||
<Tr
|
<Tr
|
||||||
@@ -180,7 +180,7 @@ export const MachineAuthTemplateUsagesModal = ({
|
|||||||
>
|
>
|
||||||
<Td>
|
<Td>
|
||||||
<Checkbox
|
<Checkbox
|
||||||
id="select-usage"
|
id={`select-usage-${usage.identityId}`}
|
||||||
isChecked={selectedUsageIds.includes(usage.identityId)}
|
isChecked={selectedUsageIds.includes(usage.identityId)}
|
||||||
onCheckedChange={() => handleUsageToggle(usage.identityId)}
|
onCheckedChange={() => handleUsageToggle(usage.identityId)}
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in New Issue
Block a user