diff --git a/front/pages/api/w/[wId]/data_sources/[name]/configuration.ts b/front/pages/api/w/[wId]/data_sources/[name]/configuration.ts index 9144afb3e9f15..493bd58dfea87 100644 --- a/front/pages/api/w/[wId]/data_sources/[name]/configuration.ts +++ b/front/pages/api/w/[wId]/data_sources/[name]/configuration.ts @@ -38,12 +38,14 @@ async function handler( }, }); } - if (!auth.user()) { + + if (!auth.isBuilder()) { return apiError(req, res, { - status_code: 404, + status_code: 403, api_error: { - type: "workspace_user_not_found", - message: "Could not find the user of the current session.", + type: "data_source_auth_error", + message: + "Only the users that are `builders` for the current workspace can access Data Source configuration.", }, }); } @@ -59,16 +61,6 @@ async function handler( }); } - if (!auth.isBuilder()) { - return apiError(req, res, { - status_code: 403, - api_error: { - type: "data_source_auth_error", - message: - "Only the users that are `builders` for the current workspace can access Data Source configuration.", - }, - }); - } if (!dataSource.connectorProvider || !dataSource.connectorId) { return apiError(req, res, { status_code: 404, diff --git a/front/pages/api/w/[wId]/data_sources/managed.ts b/front/pages/api/w/[wId]/data_sources/managed.ts index bbfab032691d1..3c816db4fbf7a 100644 --- a/front/pages/api/w/[wId]/data_sources/managed.ts +++ b/front/pages/api/w/[wId]/data_sources/managed.ts @@ -334,7 +334,7 @@ async function handler( owner.sId, systemAPIKeyRes.value.secret, dataSourceName, - connectionId || "n/a", + connectionId || "none", configuration );