mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +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: {
|
||||
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 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
|
||||
// permission to check does user has access
|
||||
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 {
|
||||
|
||||
Reference in New Issue
Block a user