How to restrict user from creating new datasources (dictionary) in Designer and only use available connection

Stimulsoft Reports.BLAZOR discussion
Post Reply
muhammadhunainnasir
Posts: 25
Joined: Wed Mar 12, 2025 9:44 pm

How to restrict user from creating new datasources (dictionary) in Designer and only use available connection

Post by muhammadhunainnasir »

Hi.

I want to have a predefined MSSQL datasource (from app.settings) connection string to be used for Reports (Viewing and Designing).

How can I add a MSSQL connection string from code behind in .Net 8 Blazor Server application and hide add data source option from designer for users ?
Max Shamanov
Posts: 990
Joined: Tue Sep 07, 2021 10:11 am

Re: How to restrict user from creating new datasources (dictionary) in Designer and only use available connection

Post by Max Shamanov »

Hello,

You can try to use the following code to create a datasource from the code and add it to the report:

Code: Select all

var sqlDatabase = new StiSqlDatabase("MS SQL Connection", "connectionString");
 report.Dictionary.Databases.Add(sqlDatabase);
And you can use the following code to hide add datasource option:

Code: Select all

private StiBlazorDesignerOptions Options = new StiBlazorDesignerOptions()
    {
          Dictionary = {
            PermissionDataSources = Stimulsoft.Report.Web.StiDesignerPermissions.View
        }

    };

Thank you.
muhammadhunainnasir
Posts: 25
Joined: Wed Mar 12, 2025 9:44 pm

Re: How to restrict user from creating new datasources (dictionary) in Designer and only use available connection

Post by muhammadhunainnasir »

it is still letting me create new dictionary please see attached. I want to eliminate new dictionary and save as dictionary option to prevent user from creating new dictionaries.
Attachments
New Dictionary.png
New Dictionary.png (40.33 KiB) Viewed 1004 times
Max Shamanov
Posts: 990
Joined: Tue Sep 07, 2021 10:11 am

Re: How to restrict user from creating new datasources (dictionary) in Designer and only use available connection

Post by Max Shamanov »

Hello,

We would need more time to get an answer for you.
We will let you know when we get any results.

Thank you.
#17466
Max Shamanov
Posts: 990
Joined: Tue Sep 07, 2021 10:11 am

Re: How to restrict user from creating new datasources (dictionary) in Designer and only use available connection

Post by Max Shamanov »

Hello,

Please check the attached sample project.

Thank you.
Attachments
NET 8.0.zip
(457.06 KiB) Downloaded 97 times
Post Reply