From a2390c962c3427435b65b1db585c9c824fded5c7 Mon Sep 17 00:00:00 2001 From: Thomas Draier Date: Mon, 16 Dec 2024 11:28:28 +0100 Subject: [PATCH 1/3] Revert "[front] restore access for webcrawler (#9399)" This reverts commit 69805161862f267b1effb64c0d0ccd6a1355f602. --- .../data_sources/[dsId]/documents/[documentId]/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/front/pages/api/v1/w/[wId]/spaces/[spaceId]/data_sources/[dsId]/documents/[documentId]/index.ts b/front/pages/api/v1/w/[wId]/spaces/[spaceId]/data_sources/[dsId]/documents/[documentId]/index.ts index 36f3f5ba9b30..f749f9d0655d 100644 --- a/front/pages/api/v1/w/[wId]/spaces/[spaceId]/data_sources/[dsId]/documents/[documentId]/index.ts +++ b/front/pages/api/v1/w/[wId]/spaces/[spaceId]/data_sources/[dsId]/documents/[documentId]/index.ts @@ -297,7 +297,7 @@ async function handler( if ( !dataSource || dataSource.space.sId !== spaceId || - (!dataSource.canRead(auth) && !auth.isSystemKey()) + !dataSource.canRead(auth) ) { return apiError(req, res, { status_code: 404, From 797cb0557972d78365a9da30e0cb63c65f95498c Mon Sep 17 00:00:00 2001 From: Thomas Draier Date: Mon, 16 Dec 2024 11:32:29 +0100 Subject: [PATCH 2/3] Give access to all groups for system key --- front/lib/resources/group_resource.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/front/lib/resources/group_resource.ts b/front/lib/resources/group_resource.ts index f3824043827d..2289b0822de7 100644 --- a/front/lib/resources/group_resource.ts +++ b/front/lib/resources/group_resource.ts @@ -129,10 +129,6 @@ export class GroupResource extends BaseResource { if (key.isSystem) { whereCondition = { ...whereCondition, - [Op.or]: [ - { kind: { [Op.in]: ["system", "global"] } }, - { id: key.groupId }, - ], }; } else { // If it's not a system key, we only fetch the associated group. From e3656da0b8787a9ff4d2a47400d111068ea1b0c8 Mon Sep 17 00:00:00 2001 From: Thomas Draier Date: Mon, 16 Dec 2024 13:57:56 +0100 Subject: [PATCH 3/3] simplify and update comments --- front/lib/resources/group_resource.ts | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/front/lib/resources/group_resource.ts b/front/lib/resources/group_resource.ts index 2289b0822de7..00b5b2f9b2b6 100644 --- a/front/lib/resources/group_resource.ts +++ b/front/lib/resources/group_resource.ts @@ -121,22 +121,16 @@ export class GroupResource extends BaseResource { static async listWorkspaceGroupsFromKey( key: KeyResource ): Promise { - let whereCondition: WhereOptions = { - workspaceId: key.workspaceId, - }; - - // If the key is a system key, we also include the global group. - if (key.isSystem) { - whereCondition = { - ...whereCondition, - }; - } else { - // If it's not a system key, we only fetch the associated group. - whereCondition = { - ...whereCondition, - id: key.groupId, - }; - } + const whereCondition: WhereOptions = key.isSystem + ? // If the key is a system key, we include all groups in the workspace. + { + workspaceId: key.workspaceId, + } + : // If it's not a system key, we only fetch the associated group. + { + workspaceId: key.workspaceId, + id: key.groupId, + }; const groups = await this.model.findAll({ where: whereCondition,