ASP. NET zero--back-end applications

Source: Internet
Author: User
Tags change settings ldap subdomain

back-end applications

This is the actual application of user name and password input. You will add your business requirements primarily on this application.

App folder

The back-end application is built into the private zone by default , called " App ," but can be determined when the solution is created . Therefore, all controllers, views, and models are located under the Areas/app folder. In addition, the relevant script and style files are located under the Wwwroot/view-resources/areas/app folder, as follows:

Main Menu

the main menu of the application defined in the Appnavigationprovider class . See the ABP navigation documentation for more information on creating menus. when you add a new menu item, it is automatically rendered in the layout.

Layout

The layout of the application is located under the areas/app/views/layout folder. It uses the component's header , footer, and sidebar :

the main menu is rendered in the sidebar component . layouts are also highly used by bundling and compressing (see below) system scripts and styles included.

Version Management

If you are not developing a multi-tenant application, you can skip this section.

most SaaS(Multi-tenant) applications have versions (packages) that have different features .  As a result, they can offer different price and feature options for their tenants (customers) . version pages , which can be used in host logins , are used to manage the version of the application:

The version is used to group feature values and assign to tenants. When we click on the version of the action/edit, we can see the function it has assigned:

the Startup project contains only each version/tenant can enable/disable the chat feature (and it is 2 sub-features). all features are defined in the appfeatureprovider class . The eigenvalues are stored in the abpfeatures table. features are not limited to Boolean (enable/disable) values, and can contain different types of values, as follows:

For more information, see Feature Management and version Management documentation.

Tenant Management

If you are not developing a multi-tenant application, you can skip this section.

If this is a multi-tenant application and is logged in as the host user, the tenant page is displayed:

tenants are represented by the tenant class. You can extend the tenant class by adding new attribute classes . only one tenant defaults to default . the tenant name (codename name) is the unique name of the tenant . the tenant can be active or locked . If it is locked, then the user of this tenant cannot log in to the application.

when we click on the " Create new tenant " button, a dialog box will appear:

The lease name should be unique and cannot contain spaces or other special characters because it can be used as a subdomain (such as tenancyname.mydomain.com. See the section below). The name can be anything. Administrator Email is used as the e-mail address for the new customer's admin user. The user will automatically create an administrator user. We can set a random password for the administrator and send an activation message. when a user logs on for the first time, he or she should change the password. We can uncheck this to enter a known password.

When we create a new tenant, we should select/create a database to store the data for the new tenant. We can select " use host database " to store tenant data in the host database (which can be used for a single database method), or we can specify a connection string for the new tenant Create/Use a dedicated database . the AspNet Zero supports hybrid mode. This means that you can use the host database for some tenants and create a dedicated database for other tenants. Even if you can Group Some tenants in a separate database.

all tenant operations are handled by the Tenantappservice class processing . Example (delete tenant):

Public  Asyncdeletetenant(entityrequestinput input){    var  Tenant = wait   tenantmanager.getbyidasync (input.id); checkerrors (Wait  Tenantmanager.deleteasync (tenant)); }

Tenantappservice mainly used Tenantmanager the domain name service for tenant operations.

Tenant Edition and features

a version can be assigned to a tenant (create or edit). The tenant inherits all the features assigned to the version. But we can also cover the functionality and value of the tenant. Click the action/change function of the tenant to customize its functionality:

Tenant User Impersonation

as the host user, we may want to perform actions on behalf of the tenant. In this case, we can click the " log on to this tenant " button in the action. When we click on it, we see a pattern to select The user of the tenant . We can select any user and perform actions that allow that user. For more information, see the "User Impersonation" section in this document .

use a lease name as a subdomain

Multi-tenant applications typically use subdomains to identify the current tenant. tenant1 . mydomain.com,tenant2 . mydomain.com and so on. ASP. NET zero automatically recognizes and obtains tenant names from subdomains (see Host Settings section).

organizational Unit

organizational units (OUs) are used to group users and entities hierarchically. then you can get the user or entity based on their OU. When we click on the admin/organizational unit, we go to the relevant page:

Here, we can manage OUs (create, edit, Cancel, move) and members (Add/Remove).

Organizationunitmanager is used to manage OUs, and Usermanager is used to manage OU members in code. Organizationunitappservice executes the application logic.

in the Left OU tree, we can right-click an OU (or left - Click on the arrow to the right) to open The ou operation's context Menu . When we try to add a member , a modal is displayed to select the User:

This is actually a generic lookup mode that can be used to select any type of entity (see Region/application/view/public/modal/_lookupmodal.cshtml and its associated script file). to select the user, we create The Findusers method Commonlookupappservice then configure the mode to use this method of work (see View resources/Area/application/Browse /organizationunits/index.js for lookupmodal.open files).

For more information, see Organizational unit management files .

Role Management

When we click on the admin/role menu, we go to the Role Management page:

roles are used for grouping permissions . When a user has a role, he or she will have all the permissions for that role.

role by The Role class represents. The role class can be extended by adding new properties.

RoleManager executes the domain logic,roleappservice The application logic that executes the role.

The role can be dynamic or static:

    • Static role : The static role has a known name (such as "admin") and cannot change the name (we can change the display name ). It exists at system startup and cannot be deleted. Therefore, we can write code based on the static role name.
    • Dynamic Roles : You can create dynamic roles after deployment. Then we can grant the role permissions, we can assign the role to some users, we can delete it. We cannot know the name of a dynamic role during development time.

one or more roles can be set to default . default roles are assigned to newly added/registered users by default. This is not a development-time property and can be set or changed after deployment.

in the Startup project, we for host (for multi-tenant applications) has a static Administrator role. In addition, we provide static administrator and user roles for tenants . administrative Roles are granted all permissions by default. the user role is the default role for new users and does not have permissions by default. These can be easily changed. for all static roles, see the Staticrolenames class and change the static role's approleconfig.

Role Permissions

Because roles are used for group permissions, we can set permissions when creating or editing a role, as follows:

(Not all permissions are shown)

each tenant has its own role, and any changes to the tenant role will not affect other tenants. Also, host has its own role.

User Management

When we click on the admin/user menu, we go to the User Management page:

a user is a person who can log in to an application and perform certain actions based on its permissions .

the user class represents the user, and you can extend the user class by adding new attributes .

Usermanager is used to perform domain logic, andUserappservice is used to execute application logic for the user.

a user can have 0 or more roles . If the user has more than one role, he inherits the permissions of all those roles. In addition, we can set user-specific permissions . User-specific permission settings override the role settings for this permission. The User Rights dialog box:

(Not all permissions are shown)

dialog box for creating/editing users:

We can change the user password , make it active/locked, etc... The user has a profile picture . Users can change (see the User menu section). An administrator user cannot be deleted as a business rule. If you don't want to use an administrator, you can lock it.

User Simulation

as an administrator (or any allowed user), we may want to log on as a user and perform actions on behalf of that user without knowing his password. When we click the " log in as this user " icon in the user's action , we will automatically redirect and log in as this user. This is referred to as " user impersonation ". When we impersonate a user, the " back to my account " option is added to the User Profile menu:

in a demo account, we can only perform actions allowed by that user. This means that everything happens to be able to log in to yourself as this same user. The only difference is that it is shown in the audit log, which indicates that the operation was performed by someone else. attention; also , near the user name also displays a The red "Back" icon indicates that you are in a demo account.

Simulate in the accountcontroller of a Web project .

Language Management

The Language Management page is used to manage (Add/edit/delete) the application language and change the localized text :

We can create a new language, edit/delete an existing language, and set the language as the default language . attention; the tenant cannot edit/delete the default language, but the host user can do it.

When we click change text in any language , we are redirected to a new view to edit the language text:

we can select any language as the basis (reference) and change The text of the target language. the base language is just to help with the translation progress. Since there may be different sources of localization , we select the source to translate. When we click on the edit icon, we can see the editing mode of the selected text:

the host user (if allowed) can edit the language and localized text.  for all tenants of a multi-tenant application, these languages will be the default. tenants inherit languages and localized text, and can overwrite localized text or add new languages.

two pages are used The Languageappservice class acts as an application service. It has methods for managing languages and localizing text.  Iapplicationlanguagemanager and Iapplicationlanguagetextmanager The interface is used to perform domain logic (used by Languageappservice).

For more information, see Language management and localization documentation.

Audit Log

In the Audit log page, we can see all the user interactions with the application:

all application service methods and MVC controller operations are automatically recorded and can be viewed here. See the audit log documentation to learn how to configure it. When we click on the magnifying glass icon, we can see that all the details are an audit log:

audit log reports are reported by The Auditlogappservice class provides .

Host Settings

The Host Settings page is used to configure some system settings:

The time zone is an important setting in this page. The AspNet Zero can work in multiple regions. Each user can see the date and time in his or her time zone. the time zone setting on this page allows you to set the default time zone for your application, including all tenants and users. Tenants and users can change the time zone in their own settings.  the time zone setting is only available when using the UTC clock. See the documentation to switch to UTC.

The Save All button saves all settings in one click. Hostsettingappservice is used to retrieve and save settings (see the Setting Provider section for more information).

The Security tab in the Host Settings page contains password complexity and other security settings. the host can define system-wide security settings in this tab. Each tenant can override this setting in the Tenant Settings page. The Passwordcomplexitychecker class is responsible for checking that passwords meet password complexity settings.

Tenant Settings

In a multi-tenant application, the tenant settings are as follows:

If we disable multi-tenancy, then this page will also show some host settings (because there is no host Settings page). tenants can also define user password complexity settings, or they can use host user-defined password complexity settings.

Tenantsettingappservice is used to get/set tenant settings.

Enable LDAP (ACTIVE DIRECTORY) authentication

LDAP (Active Directory) disables authentication by default. in order for it to work, we should disable multi-tenancy because LDAP auth does not work properly in a multitenant system. in the Coremodule class of the. Core project, we should enable the following line:

Configuration.Modules.ZeroLdap (). Enable ( typeof(Appldapauthenticationsource)); 

We can then see in the Settings page LDAP Settings section:

we can check " Enable LDAP authentication " to enable it. If the server is running domain users or local systems in domains and applications, it is not usually necessary to set up domain names, users, and passwords. You can log off and then sign in with your domain user name and password . If not, you should set these credentials.

. Net Core Compatibility

LDAP authentication has not been supported by. NET Core. Therefore, it is designed to be conditional. If you are using the. Net Framework (4.6+), it will be available, otherwise it will be disabled.

Maintenance

The Maintenance page can be used on the host side of a multitenant application (a single-tenant application is displayed on the tenant side) as follows:

in the Caching tab, we can clear some or all of the cache. If you manually change the database and want to flush the application cache, you may need to clear the cache. The cachingappservice is used to clear the server-side cache.

The Site Log tab is used to view and download logs:

Weblogappservice is used to get logs from the server.

Tenant Dashboard

The ASP. NET Zero Startup Project also includes a sample dashboard. This is just for demonstration purposes, and you can use it as a starting point for your actual dashboard:

here, only the member activity diagram data is retrieved from the server (from tenantdashboardappservice) . You can click the Refresh button to generate a random graph.

Notice

The notification icon is located next to the language selection button. The number in the red circle shows the unread notification count.

Users can see the 3 most recent notifications by clicking on this icon.

Users can mark all notifications as read by clicking the set all to all link, or mark individual notifications by clicking the Set as Read link next to each notification.

notifications are sent in real time using SIGNALR. In addition, Desktop push notifications are displayed when notifications are received .

Notification Settings

The settings link opens the Notification Settings dialog box.

in this dialog box, there is a global setting to enable/disable receiving notifications. If you enable this setting, users can enable/disable each notification individually.

you can also A custom notification is defined in the Appnotificationprovider class . For example, a new user's registration notice is defined in the appnotificationprovider below.

context. Manager.add (      new notificationdefinition (        appnotificationnames.newuserregistered,          displayname:l ("Newuserregisterednotificationdefinition"),         Permissiondependency:new simplepermissiondependency (apppermissions.pages_administration_users)      ));   

for more information, see the Notification Definitions section.

The Appnotifier class is used to publish notifications. The Notificationappservice class is used to manage notification application logic. for more information, see the notification documentation.

Notification Form

All notifications for the user are listed on this page.

. Net Core Compatibility

Because SIGNALR is not yet ready for. NET core, real-time notifications will not work if you choose. NET core as the foundation framework.

Talk

the chat icon is located next to the user profile image in the upper-right corner of the page. The number in the red circle shows the count of unread chat messages.

when the user taps this icon, the chat panel appears on the right side of the page. This panel contains a list of users ' friends and blocked users.

The user can add a new friend by writing the user name to the User Name text box in the Friends list. If you enable the chat with other tenants feature for your tenant, you can add users of other tenants as friends by writing [tenant name] \ [user name] (for example: Default \ Admin). if the "Chat with host user" feature is enabled, the host user can write by using the same text box. \ [user name] added as a friend.

While online friends/users have a green circle on their profile picture, offline friends/users have a gray circle.

users can locate or cancel the chat panel by tapping the pin icon in the upper right corner of the chat panel. the application tries to remember the last state of the chat panel and resumes when the user logs on to the application.

When a friend/user is selected, the session panel is opened.

users can block or unblock friends/users in this area. A wrench icon appears to the right of the selected user's user name. This icon opens an Action menu that contains block users or unblock user actions based on the user's block status.

Chat messages through Use Chatmessagemanager of the domain class Chathub SIGNALR Hub class propagation .

The Chatuserstatewatcher class is responsible for viewing online/offline status changes for chat users. When the user is online or offline, the class crawls the status changes and notifies the relevant user's friend.

the Friendshipappservice and Friendshipmanager Classes are responsible for managing friendship requests. Chat messages from blocked users are not delivered to the target user.

since chat is a real-time operation, the application caches the number of unread messages for online users ' friends and each friend. The Userfriendscache class manages these cache operations.

The Userfriendcachesyncronizer class is responsible for keeping the user's friend cache up-to-date. To do this, it will watch some of the events of the friendship and chatmessage entities.

. Net Core Compatibility

Because SIGNALR is not ready for. NET core, the chat feature will not work properly if you choose. NET cores as the underlying framework.

Chat Features

There are three chat functions in the system. These are "chat", "Chat with host", "Chat with other tenants". each Version/tenant can enable/disable these features. by using these features, the host can enable/disable chat with users or host users of other tenants.

User Menu

Users can click on the name in the upper right corner to open the user menu:

Linked Accounts

linked accounts are used to link multiple accounts to each other. in this way, users can easily browse his/her account using this feature.

Users can link to a new account or delete a linked account by clicking on the "Manage Account" link.

In order to link the new account, the user must enter the login credentials for the relevant account.

The Userlinkappservice class is used to manage the application logic for account linking, and the Userlinkmanager class is used to manage domain logic for account linking.

configuration File Settings

My settings are used to change user profile settings:

the Administrator user name cannot be changed, as shown below. It is considered a special user name because it is used for database migration seeds. Other users can change their user name. Profileappservice is used to get/change settings.

Login Attempts

All logon attempts (successful failures) are recorded in the application. The user can see the last logon attempt for his/her account. Userloginappservice is used to obtain login attempts from the server.

Change Picture

users can change their profile picture. Profilecontroller is used to upload and retrieve user profile images. Currently, jpg/jpeg,gif and PNG files are supported and you can extend it.

Change Password

Profileappservice used to change the password.

Log Out

AccountController is used to log off the user and redirect to the login page.

ASP. NET zero--back-end applications

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.