mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-05 05:26:25 +00:00
feat: update PAM account types and endpoint handling for optional rotation settings
- Made the rotationEnabled field optional in the account schema to enhance flexibility. - Updated endpoint logic to default rotationEnabled to false if not provided in the request. - Adjusted account DTOs to reflect the optional nature of rotationEnabled, improving type safety.
This commit is contained in:
@@ -22,7 +22,7 @@ export const registerPamResourceEndpoints = <C extends TPamAccount>({
|
|||||||
folderId?: C["folderId"];
|
folderId?: C["folderId"];
|
||||||
name: C["name"];
|
name: C["name"];
|
||||||
description?: C["description"];
|
description?: C["description"];
|
||||||
rotationEnabled: C["rotationEnabled"];
|
rotationEnabled?: C["rotationEnabled"];
|
||||||
rotationIntervalSeconds?: C["rotationIntervalSeconds"];
|
rotationIntervalSeconds?: C["rotationIntervalSeconds"];
|
||||||
}>;
|
}>;
|
||||||
updateAccountSchema: z.ZodType<{
|
updateAccountSchema: z.ZodType<{
|
||||||
@@ -65,7 +65,7 @@ export const registerPamResourceEndpoints = <C extends TPamAccount>({
|
|||||||
folderId: req.body.folderId,
|
folderId: req.body.folderId,
|
||||||
name: req.body.name,
|
name: req.body.name,
|
||||||
description: req.body.description,
|
description: req.body.description,
|
||||||
rotationEnabled: req.body.rotationEnabled,
|
rotationEnabled: req.body.rotationEnabled ?? false,
|
||||||
rotationIntervalSeconds: req.body.rotationIntervalSeconds
|
rotationIntervalSeconds: req.body.rotationIntervalSeconds
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -293,15 +293,15 @@ export const pamAccountServiceFactory = ({
|
|||||||
try {
|
try {
|
||||||
const updatedAccount = await pamAccountDAL.updateById(accountId, updateDoc);
|
const updatedAccount = await pamAccountDAL.updateById(accountId, updateDoc);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...(await decryptAccount(updatedAccount, account.projectId, kmsService)),
|
...(await decryptAccount(updatedAccount, account.projectId, kmsService)),
|
||||||
resource: {
|
resource: {
|
||||||
id: resource.id,
|
id: resource.id,
|
||||||
name: resource.name,
|
name: resource.name,
|
||||||
resourceType: resource.resourceType,
|
resourceType: resource.resourceType,
|
||||||
rotationCredentialsConfigured: !!resource.encryptedRotationAccountCredentials
|
rotationCredentialsConfigured: !!resource.encryptedRotationAccountCredentials
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (err instanceof DatabaseError && (err.error as { code: string })?.code === DatabaseErrorCode.UniqueViolation) {
|
if (err instanceof DatabaseError && (err.error as { code: string })?.code === DatabaseErrorCode.UniqueViolation) {
|
||||||
throw new BadRequestError({
|
throw new BadRequestError({
|
||||||
|
|||||||
@@ -6,8 +6,10 @@ import { PamAccountOrderBy, PamAccountView } from "./pam-account-enums";
|
|||||||
// DTOs
|
// DTOs
|
||||||
export type TCreateAccountDTO = Pick<
|
export type TCreateAccountDTO = Pick<
|
||||||
TPamAccount,
|
TPamAccount,
|
||||||
"name" | "description" | "credentials" | "folderId" | "resourceId" | "rotationEnabled" | "rotationIntervalSeconds"
|
"name" | "description" | "credentials" | "folderId" | "resourceId" | "rotationIntervalSeconds"
|
||||||
>;
|
> & {
|
||||||
|
rotationEnabled?: boolean;
|
||||||
|
};
|
||||||
|
|
||||||
export type TUpdateAccountDTO = Partial<Omit<TCreateAccountDTO, "folderId" | "resourceId">> & {
|
export type TUpdateAccountDTO = Partial<Omit<TCreateAccountDTO, "folderId" | "resourceId">> & {
|
||||||
accountId: string;
|
accountId: string;
|
||||||
|
|||||||
Reference in New Issue
Block a user