Show
Ignore:
Timestamp:
03/09/2007 02:21:01 PM (22 months ago)
Author:
xue
Message:

added TDbUserManager and TDbUser.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/demos/quickstart/protected/pages/Advanced/Auth.page

    r1650 r1752  
    9090where the <tt>roles</tt> attribute in <tt>user</tt> element is optional. User roles can be specified in either the <tt>user</tt> element or in a separate <tt>role</tt> element. 
    9191</p> 
     92 
     93<h2 id="5505">Using <tt>TDbUserManager</tt></h2> 
     94<p id="720563" class="block-content"> 
     95<tt>TDbUserManager</tt> is introduced in v3.1.0. Its main purpose is to simplify the task of managing user accounts that are stored in a database. It requires developers to write a user class that represents the necessary information for a user account. The user class must extend from <tt>TDbUser</tt>. 
     96</p> 
     97<p id="720564" class="block-content"> 
     98To use <tt>TDbUserManager</tt>, configure it in the application configuration like following: 
     99</p> 
     100<com:TTextHighlighter Language="xml" CssClass="source block-content" id="code4"> 
     101<module id="db" 
     102     class="System.Data.TDataSourceConfig" ..../> 
     103<module id="users" 
     104     class="System.Security.TDbUserManager" 
     105     UserClass="Path.To.MyUserClass" 
     106     ConnectionID="db" /> 
     107<module id="auth" 
     108     class="System.Security.TAuthManager" 
     109     UserManager="users" LoginPage="Path.To.LoginPage" /> 
     110</com:TTextHighlighter> 
     111 
     112</p> 
     113<p id="720565" class="block-content"> 
     114In the above, <tt>UserClass</tt> specifies what class will be used to create user instance. The class must extend from <tt>TDbUser</tt>. <tt>ConnectionID</tt> refers to the ID of a <tt>TDataSourceConfig</tt> module which specifies how to establish database connection to retrieve user information. 
     115</p> 
     116<p id="720566" class="block-content"> 
     117The user class has to implement the two abstract methods in <tt>TDbUser</tt>: <tt>validateUser()</tt> and <tt>createUser()</tt>. Since user account information is stored in a database, the user class may make use of its <tt>DbConnection</tt> property to reach the database. 
     118</p> 
     119 
    92120<div class="last-modified">$Id$</div></com:TContent>