mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-15 06:35:21 +00:00
feat: integrated to est routes
This commit is contained in:
@@ -1535,30 +1535,28 @@ export const certificateAuthorityServiceFactory = ({
|
||||
return estConfig;
|
||||
};
|
||||
|
||||
const getCaEstConfiguration = async ({
|
||||
caId,
|
||||
actorId,
|
||||
actorAuthMethod,
|
||||
actor,
|
||||
actorOrgId
|
||||
}: TGetCaEstConfigurationDTO) => {
|
||||
const ca = await certificateAuthorityDAL.findById(caId);
|
||||
const getCaEstConfiguration = async (dto: TGetCaEstConfigurationDTO) => {
|
||||
const ca = await certificateAuthorityDAL.findById(dto.caId);
|
||||
if (!ca) {
|
||||
throw new NotFoundError({ message: "CA not found" });
|
||||
}
|
||||
|
||||
const { permission } = await permissionService.getProjectPermission(
|
||||
actor,
|
||||
actorId,
|
||||
ca.projectId,
|
||||
actorAuthMethod,
|
||||
actorOrgId
|
||||
);
|
||||
if (!dto.isInternal) {
|
||||
const { permission } = await permissionService.getProjectPermission(
|
||||
dto.actor,
|
||||
dto.actorId,
|
||||
ca.projectId,
|
||||
dto.actorAuthMethod,
|
||||
dto.actorOrgId
|
||||
);
|
||||
|
||||
ForbiddenError.from(permission).throwUnlessCan(
|
||||
ProjectPermissionActions.Edit,
|
||||
ProjectPermissionSub.CertificateAuthorities
|
||||
);
|
||||
ForbiddenError.from(permission).throwUnlessCan(
|
||||
ProjectPermissionActions.Edit,
|
||||
ProjectPermissionSub.CertificateAuthorities
|
||||
);
|
||||
}
|
||||
|
||||
const { caId } = dto;
|
||||
|
||||
const caEstConfig = await certificateAuthorityEstConfigDAL.findOne({
|
||||
caId
|
||||
@@ -1587,7 +1585,8 @@ export const certificateAuthorityServiceFactory = ({
|
||||
return {
|
||||
caId,
|
||||
isEnabled: caEstConfig.isEnabled,
|
||||
caChain: decryptedCaChain.toString()
|
||||
caChain: decryptedCaChain.toString(),
|
||||
hashedPassphrase: caEstConfig.hashedPassphrase
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -181,6 +181,12 @@ export type TUpdateCaEstConfigurationDTO = {
|
||||
isEnabled?: boolean;
|
||||
} & Omit<TProjectPermission, "projectId">;
|
||||
|
||||
export type TGetCaEstConfigurationDTO = {
|
||||
caId: string;
|
||||
} & Omit<TProjectPermission, "projectId">;
|
||||
export type TGetCaEstConfigurationDTO =
|
||||
| {
|
||||
isInternal: true;
|
||||
caId: string;
|
||||
}
|
||||
| ({
|
||||
isInternal: false;
|
||||
caId: string;
|
||||
} & Omit<TProjectPermission, "projectId">);
|
||||
|
||||
Reference in New Issue
Block a user