dotnet Report Builder allows Admins or Developers to easily create and manage Reports for other Users and set rights as well. You can setup a Report to only show for certain users, and also control if they get view only access or if they can edit/update it as well. You can also setup the same for User Roles, instead of just users.
dotnet Report actually relies on and uses your Application’s existing Authentication, Users and Roles mechanism. You basically just pass some of your logged in User’s Claims information to dotnet Report in an initialization method.
When initializing dotnet Report, developers can pass all the users and roles list to the Reporting System, in addition to specifying the current user and their role. The default code tries to populate the Users and Roles using the standard MVC Web Security. If it’s not being used, then the developer can populate it manually. The code is in ReportController in GetSettings Method:
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 settings.Users = new List<string>(); // Populate all your application's user, ex { "Jane", "John" } settings.UserRoles = new List<string>(); // Populate all your application's user roles, ex { "Admin", "Normal" } settings.CanUseAdminMode = true; // Set to true only if current user can use Admin mode to setup reports and dashboard // An example of populating Roles using MVC web security if available if (Roles.Enabled && User.Identity.IsAuthenticated) { settings.UserId = User.Identity.Name; settings.CurrentUserRole = Roles.GetRolesForUser(User.Identity.Name).ToList(); settings.Users = Roles.GetAllRoles().SelectMany(x => Roles.GetUsersInRole(x)).ToList(); settings.UserRoles = Roles.GetAllRoles().ToList(); }
If the current user has Admin access, or a specific user is not assigned, dotnet Report allows you to activate “Admin Mode”:
Once “Admin Mode” is turned on, the list of all Reports for any user or role for the account will be available, and each Report will show how the current user and roles access is setup for the Report.
When you Edit or Create a Report in Admin Mode, you will be able to setup View and Manage rights for the Report:
When you turn off Admin Mode, only the reports the current user or the current user role has access to will show up.
Note: This is an optional feature that is not required, and is activated only if you specify Users and Roles at initialization. If you don’t apply access restrictions by a user or role, the report will be shown to all users by default. Also, if the current UserId is empty at initialization, all reports can be edited or deleted.