How to impose user privilleages to use certian dataSources, access reports

1 Answer 36 Views
DataSource WebService General Discussions Programming Report Designer - Web Report Viewer - Angular
MariApps Marine Solutions
Top achievements
Rank 1
MariApps Marine Solutions asked on 02 Apr 2024, 12:27 AM

I'm trying to build a custom report generator using the web report designer. all the data sources will be web service data sources.

now I need to impose restrictions for using the already created data sources/reports based on the logged-in user privileges.

1. How can I restrict some users from using certain Shared Data sources or accessing specific reports that are created based on their user rights? 

2. how can I get a list of all the web service data sources created programmatically?

 

 

 

1 Answer, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 04 Apr 2024, 02:27 PM

Hello,

Thank you for the provided information!

Requirement 1

The Web Report Designer provides the ability to disable certain functionalities globally or per-user - Web Report Designer Customization - Telerik Reporting, however, those cannot be disabled for specific report files/data source components.

For example, it is possible to disable the usage of SharedDataSource components for specific users through the  Commands_DataSources_SharedDataSource permission but it would disable all shared data source components, not only specific ones.

My understanding of the first requirement is that you need each user group to have access to a specific subset of shared data source components/report definitions. For this to be possible, you would need to implement the IDefinitionStorage interface for the reports, and the ISharedDataSourceStorage interface for the shared data sources. In the implements, you would able to filter the available reports/shared data sources that the storages expose for a given user.

While it does not cover the scenario of dynamically serving the available reports for a given user, the MSSQL Server database as Reports Storage for Web Report Designer - Telerik Reporting KB article contains an example of how to implement the report definition storage which may help with your implementation.

Requirement 2

The Telerik.Reporting.Report class exposes a method named GetDataSources() which will return all data sources in a report. With LINQ's OfType extension method, you can get all data sources that are of the type WebServiceDataSource. However, please note that this won't include SharedDataSource components that might have a WebServiceDataSource component inside but I am not sure if you need to include that.

For more details on this approach, you may refer to the Modify the Report Data Sources through code - Telerik Reporting article.

If you need to also check the SharedDataSource components, it would be necessary to deserialize them to get a reference to the internal component, for example:

            using (var fs = new FileStream(absolutePathToSharedDataSourceDefinition, FileMode.Open, FileAccess.Read, FileShare.Read))
            {
                var ds = (Telerik.Reporting.DataSource)new Telerik.Reporting.XmlSerialization.ReportXmlSerializer()
                    .Deserialize(fs); 
            }

If these approaches do not work for your requirements, could you please share more information about them? We are interested in hearing what is the use case where the list of the WebServiceDataSource components would be needed.

I hope that the provided information will help.

Regards,
Dimitar
Progress Telerik

Stay tuned by visiting our roadmap and feedback portal pages, enjoy a smooth take-off with our Getting Started resources, or visit the free self-paced technical training at https://learn.telerik.com/.
Tags
DataSource WebService General Discussions Programming Report Designer - Web Report Viewer - Angular
Asked by
MariApps Marine Solutions
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Share this question
or