Show: Delphi C++
Display Preferences

WebAdapt.TEndUserSessionAdapter

From XE2 API Documentation
Jump to: navigation, search

WebAdapt.TCustomEndUserSessionAdapterWebAdapt.TBaseEndUserAdapterWebAdapt.TDefaultFieldsAdapterWebAdapt.TCustomAdapter
TEndUserSessionAdapter

Delphi

TEndUserSessionAdapter = class(TCustomEndUserSessionAdapter)

C++

class PASCALIMPLEMENTATION TEndUserSessionAdapter : public TCustomEndUserSessionAdapter

Properties

Type Visibility Source Unit Parent
class public
WebAdapt.pas
WebAdapt.hpp
WebAdapt WebAdapt

Description

TEndUserSessionAdapter provides information about the current end user such as the user name, user ID, and whether the user is logged in.

Add TEndUserSessionAdapter to a WebSnap application where users must log in before accessing Web pages. TEndUserSessionAdapter handles login and logout actions on behalf of the end user. TEndUserSessionAdapter uses the TSessionsService component to store information about the current end user. The WebSnap application must contain a TSessionsService component (or equivalent) in order for the TEndUserSessionAdapter to work properly.

TEndUserSessionAdapter supports two default Adapter fields: DisplayName and LoggedIn. These fields provide access to the user's name and login state. TEndUserSessionAdapter retrieves the values for these fields from a Web session, which is maintained by the TSessionsService component.

TEndUserSessionAdapter supports two default actions: LoginForm and LogoutOut. These actions are used to display a login form and to log the user out. Use the LoginPage property to specify the name of the login page. The default implementation of the logout action terminates the session.

The EndUser script variable is used by server-side script to display end user information and execute end user actions. The following JavaScript displays the name of the logged in end user, if any.

<% if (EndUser.LoggedIn) { %> <h1>Welcome <%= EndUser.DisplayName %> </h1> <% } %>

The following JavaScript displays a login or logout hyperlink.

<% if (EndUser.Logout.Enabled) { %> <a href="<%=EndUser.Logout.AsHREF%>">Logout</a> <% } %> <% if (EndUser.LoginForm.Enabled) { %> <a href=<%=EndUser.LoginForm.AsHREF%>>Login</a> <% } %>

TEndUserSessionAdapter also determines access rights for a user. If the WebSnap application contains a TWebUserList or equivalent, TEndUserAdapter calls the TWebUserList component to check rights for a particular user ID. Implement the OnHasRights event to check rights in an event handler.

See Also

Personal tools
Previous Versions
Translations