Skip to content

Commit

Permalink
Make sure only webcrawler configuration can be updated by a user
Browse files Browse the repository at this point in the history
  • Loading branch information
lasryaric committed Apr 4, 2024
1 parent ceb18de commit 157ee15
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions front/pages/api/w/[wId]/data_sources/[name]/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,27 @@ async function handler(

switch (req.method) {
case "PATCH":
switch (dataSource.connectorProvider) {
// Check which parameters are being updated here.
// Eg: For WebCrawler, all parameters can be updated, but the
// SlackConfiguration.pdfEnabled can only be updated
// from Poke (once this settings is moved to the new configuration system).
case "webcrawler": {
// Webcrawler configuration can be updated.
break;
}
default: {
return apiError(req, res, {
status_code: 404,
api_error: {
type: "data_source_error",
message:
"The configuration of this Data Source cannot be updated.",
},
});
}
}

const parseRes = ioTsParsePayload(
req.body,
UpdateConnectorConfigurationTypeSchema
Expand Down

0 comments on commit 157ee15

Please sign in to comment.