RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TEndUserAdapter Class

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

Pascal
TEndUserAdapter = class(TCustomEndUserAdapter);
C++
class TEndUserAdapter : public TCustomEndUserAdapter;

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 by generating events where you can retrieve user information and execute user actions 

TEndUserAdapter supports two default Adapter fields: DisplayName and LoggedIn. These fields provide access to the user's name and login state. Implement the OnGetDisplayName and OnIsLoggedIn events to provide values for these fields. 

TEndUserAdapter contains 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. Implement the OnLogin and OnLogout events to change the login state of an end user. 

The EndUser script variable is used to 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>
<%   } %>

TEndUserAdapter 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. 

 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!