mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-07 20:27:43 +00:00
misc: general improvements
This commit is contained in:
@@ -137,6 +137,15 @@ export const pkiSubscriberServiceFactory = ({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const ca = await certificateAuthorityDAL.findById(caId);
|
||||||
|
if (!ca) {
|
||||||
|
throw new NotFoundError({ message: `CA with ID '${caId}' not found` });
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ca.projectId !== projectId) {
|
||||||
|
throw new BadRequestError({ message: "CA does not belong to the project" });
|
||||||
|
}
|
||||||
|
|
||||||
const newSubscriber = await pkiSubscriberDAL.create({
|
const newSubscriber = await pkiSubscriberDAL.create({
|
||||||
caId,
|
caId,
|
||||||
projectId,
|
projectId,
|
||||||
@@ -245,6 +254,17 @@ export const pkiSubscriberServiceFactory = ({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (caId) {
|
||||||
|
const ca = await certificateAuthorityDAL.findById(caId);
|
||||||
|
if (!ca) {
|
||||||
|
throw new NotFoundError({ message: `CA with ID '${caId}' not found` });
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ca.projectId !== projectId) {
|
||||||
|
throw new BadRequestError({ message: "CA does not belong to the project" });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const updatedSubscriber = await pkiSubscriberDAL.updateById(subscriber.id, {
|
const updatedSubscriber = await pkiSubscriberDAL.updateById(subscriber.id, {
|
||||||
caId,
|
caId,
|
||||||
name,
|
name,
|
||||||
|
|||||||
Reference in New Issue
Block a user