mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-08 08:27:53 +00:00
feat: include path and environment on secret folder
This commit is contained in:
@@ -365,7 +365,15 @@ export const registerSecretFolderRouter = async (server: FastifyZodProvider) =>
|
|||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
200: z.object({
|
200: z.object({
|
||||||
folder: SecretFoldersSchema
|
folder: SecretFoldersSchema.extend({
|
||||||
|
environment: z.object({
|
||||||
|
envId: z.string(),
|
||||||
|
envName: z.string(),
|
||||||
|
envSlug: z.string()
|
||||||
|
}),
|
||||||
|
path: z.string(),
|
||||||
|
projectId: z.string()
|
||||||
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -502,12 +502,21 @@ export const secretFolderServiceFactory = ({
|
|||||||
|
|
||||||
const getFolderById = async ({ actor, actorId, actorOrgId, actorAuthMethod, id }: TGetFolderByIdDTO) => {
|
const getFolderById = async ({ actor, actorId, actorOrgId, actorAuthMethod, id }: TGetFolderByIdDTO) => {
|
||||||
const folder = await folderDAL.findById(id);
|
const folder = await folderDAL.findById(id);
|
||||||
if (!folder) throw new NotFoundError({ message: "folder not found" });
|
if (!folder) throw new NotFoundError({ message: "Folder not found" });
|
||||||
// folder list is allowed to be read by anyone
|
// folder list is allowed to be read by anyone
|
||||||
// permission to check does user has access
|
// permission to check does user has access
|
||||||
await permissionService.getProjectPermission(actor, actorId, folder.projectId, actorAuthMethod, actorOrgId);
|
await permissionService.getProjectPermission(actor, actorId, folder.projectId, actorAuthMethod, actorOrgId);
|
||||||
|
|
||||||
return folder;
|
const [folderWithPath] = await folderDAL.findSecretPathByFolderIds(folder.projectId, [folder.id]);
|
||||||
|
|
||||||
|
if (!folderWithPath) {
|
||||||
|
throw new NotFoundError({ message: "Folder path not found" });
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
...folder,
|
||||||
|
path: folderWithPath.path
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
Reference in New Issue
Block a user