How to Disable "Build new data connections" in the SqlDataSource Wizard of the Web Report Designer
Environment
Product | Reporting |
Version | 19.2.25.1001 |
Description
I need to prevent users from creating new database connections in the Web Report Designer's SqlDataSource component while still allowing them to select from pre-configured existing connections.
Solution
To stop users from creating new SQL database connections, use a middleware to intercept the /api/reportdesigner/connectionspermissions
request and modify the response. By returning an empty JSON or an object with all values set to false
, you can disable the "Build new data connections" option.
app.Use(async (context, next) =>
{
if (context.Request.Path.Equals("/api/reportdesigner/connectionspermissions"))
{
context.Response.ContentType = "application/json";
await context.Response.WriteAsync("{}"); // Return empty JSON to disable "Build new connections".
return;
}
await next();
});