1. Home
  2. Advanced Topics
  3. Saving Reports by Users or Roles

Saving Reports by Users or Roles

dotnet Report Builder supports saving Reports by different users or roles, so that they can create their own set of Reports or Dashboards.

Saving separate reports for separate client or user is very simple. You need to provide the Client Id or User Id (or both) in the ReportController in the initialization code:

private DotNetReportSettings GetSettings()

            settings.ClientId = "";  // You can pass your multi-tenant client id here to track their reports and folders
            settings.UserId = ""; // You can pass your current authenticated user id here to track their reports and folders            
            settings.UserName = ""; 
            settings.CurrentUserRole = new List<string>(); // Populate your current authenticated user's roles

            return settings;

Specifying clientId 

If you have multiple clients (or companies) using the Report Builder, you can add the current user’s Client ID from the current session in the above code. The system assumes that you already have an authentication process, and your current Client ID is already determined and is available to use in the current session. Actual authentication or login code is currently not part of dotnet Report Builder.

Once you set clientId, the system will automatically save and load reports for the given clientId and will only allow editing/deleting the reports saved for the given clientId. Reports saved with other Client IDs will not be shown.

Specifying userId

If you want to further control reports just saved for a specific user in addition to the client, or just want to separate reports for a User instead of a Client, populate the userId field with your currently logged in User ID from the current session in the above code. Again, we are assuming that your system already has an authentication process and your currently logged in User’s ID is available.

Once you set the userId, similar to the clientId, the system will save/load reports only for the given userId, and will only allow editing/deleting reports saved for the given userId. Reports saved with other User IDs will not be shown.

Just to clarify, you can provide just the clientId, just the userId, or both clientId and userId. If you specify both, the reports will be saved/shown for both Client and User. You can also restrict by current User’s role in the same way.

Global Run Only Reports

If you leave the clientId and userId fields blank, and run the system and create and save Reports, those reports will be treated as global reports and will be available to all clients or users of your system. However, once you specify a clientId or userId, those users will only be able to see and run the Reports. They will not be able to edit or delete these global reports. In order to edit/delete them, or to create new global reports, you must run without specifying clientId or userId.

Was this article helpful to you? Yes No

How can we help?