This example shows how to configure the Dashboard control so that it loads data in the multi-user environment.
You can identify a user in the current session and handle the following events to select the underlying data source:
- DashboardConfigurator.ConfigureDataConnection
- DashboardConfigurator.DataLoading
- DashboardConfigurator.CustomFilterExpression
- DashboardConfigurator.DataSourceCacheKeyCreated
You can limit access to data based on the current user's ID. This ID is stored in the IHttpContextAccessor.HttpContext.Session.GetString("CurrentUser")
value from session state. We use the standard IHttpContextAccessor with dependency injection to access the HTTP context in custom dashboard configurator.
When the application starts, you see the Index view with a ComboBox in which you can select a user. When you click the Sign in button, the ID of the selected user is passed to the CurrentUser
session variable and you are redirected to the Dashboard view. In this view, the Web Dashboard control displays the lists of dashboards and every dashboard loads data available to the selected user. Below is a table that illustrates the user IDs and their associated datasources in this example:
Role | Sql | Json | Excel | Object | Extract | Entity Framework |
---|---|---|---|---|---|---|
Admin | Categories | Customers | Bikes | Sales | Sales | Categories |
User | Categories from different source with optional filter | Customers from different source with optional filter | Bikes from different source | Sales from different source | - | Categories from different source |
Guest | - | - | - | - | - | - |
- Dashboard for ASP.NET Core - How to implement multi-tenant Dashboard architecture
- Dashboard for ASP.NET Core - How to implement authentication
- Dashboard for MVC - How to implement multi-tenant Dashboard architecture
- Dashboard for MVC - How to load and save dashboards from/to a database
- Dashboard for MVC - How to load different data based on the current user
(you will be redirected to DevExpress.com to submit your response)