Skip to content

This example shows how to configure the ASP.NET Core Dashboard control so that it works in the multi-user environment.

License

Notifications You must be signed in to change notification settings

DevExpress-Examples/DashboardUserBasedAspNetCore

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dashboard for ASP.NET Core - Multi-tenant Dashboard Architecture

In this example, we configure the DevExpress Dashboard control for multi-user environments.

It illustrates how to identify a user in the current session and return the following user-specific content:

Dashboards

Custom dashboard storage allows you to specify which dashboards the user can access, edit, and save.

API: IEditableDashboardStorage Interface

Files to review: CustomDashboardStorage.cs

Data Sources

Custom data source storage allows you to specify which data sources are available to the user.

API: IDataSourceStorage Interface

Files to review: CustomDataSourceStorage.cs

Data Source Schema

A custom data source schema provider allows you to filter the data source for different users and display specific data source segments.

API: DBSchemaProviderEx Class

Files to review: CustomDBSchemaProvider.cs

Connection Strings

A custom connection string provider allows you to specify connection strings based a given user’s access rights.

API: IDataSourceWizardConnectionStringsProvider Interface

Files to review: CustomConnectionStringProvider.cs

Working Mode

The Web Dashboard control can be used in ViewerOnly mode for unauthorized users. To enable this capability, handle the DashboardConfigurator.VerifyClientTrustLevel event and set the e.ClientTrustLevel property to Restricted. This setting prevents inadvertent or unauthorized modifications of dashboards stored on a server. To learn more, please review the following help topic: Security Considerations - Working Mode Access Rights.

API: DashboardConfigurator.VerifyClientTrustLevel Event

Files to review: Dashboard.cshtml and Startup.cs

Example Structure

You can limit access to sensitive information based on the current user's ID. Every custom store/provider reads the IHttpContextAccessor.HttpContext.Session.GetString("CurrentUser") value from session state. We use the standard IHttpContextAccessor with dependency injection to access the HTTP context is custom storages/providers.

When the application starts, you can use the Index view (with a ComboBox) to select a user. When you click the Sign in button, the ID of the selected user is passed to the CurrentUser variable in Session and you are redirected to the Dashboard view. In this view, the Web Dashboard control displays the features available to the selected user. Below is a table that illustrates the user IDs and their associated rights in this particular example:

Role Dashboard Storage DataSource Storage ConnectionString Provider DBSchema Provider Working Mode Create/Edit
Admin dashboard1_admin, dashboard2_admin SqlDataSource, JsonDataSource Northwind, CarsXtraScheduling All (Categories, Products, Cars,...) Designer, Viewer Yes
User dashboard1_user SqlDataSource CarsXtraScheduling Cars Designer, Viewer No
Guest dashboard1_guest - - - ViewerOnly -
Unauthorized - - - - ViewerOnly -

Documentation

More Examples

Does this example address your development requirements/objectives?

(you will be redirected to DevExpress.com to submit your response)