Changeset 1752

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

added TDbUserManager and TDbUser.

Location:
trunk
Files:
1 added
6 modified

Legend:

Unmodified
Added
Removed
  • trunk/COPYRIGHT

    r1398 r1752  
    22They are released under the terms of the following BSD License. 
    33 
    4 Copyright 2004-2006, The PRADO Group (http://www.pradosoft.com) 
     4Copyright 2004-2007, The PRADO Group (http://www.pradosoft.com) 
    55All rights reserved. 
    66 
  • trunk/HISTORY

    r1740 r1752  
    2323NEW: TShellApplication (Qiang) 
    2424NEW: TDbCache (Qiang) 
     25NEW: TDbUserManager and TDbUser (Qiang) 
    2526NEW: Active Record driver for IBM DB2 (Cesar Ramos) 
    2627 
  • 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> 
  • trunk/demos/quickstart/protected/pages/GettingStarted/Introduction.page

    r1729 r1752  
    55This Quickstart tutorial is provided to help you quickly start building your own Web applications based on PRADO version 3.x. 
    66</p> 
     7<p> 
     8If you are an existing PRADO 3.x user and would like to learn what enhancements are available for each new version, please check out the <a href="?page=GettingStarted.NewFeatures">new features</a> page. Otherwise, the following sections are helpful for newbies. 
     9</p> 
    710<div class="start-page"> 
    811        <div class="concepts start-block"> 
    9         <h2>How Prado Works</h2> 
     12        <h2>How PRADO Works</h2> 
    1013        <p>Concepts and fundamentals</p> 
    1114        <ol> 
    12                 <li><a href="#">Building web applications with Prado</a></li> 
     15                <li><a href="#">Building web applications with PRADO</a></li> 
    1316                <li><a href="#">Web controls and events</a></li> 
    1417                <li><a href="#">Validating user input</a></li> 
  • trunk/demos/quickstart/protected/pages/GettingStarted/NewFeatures.page

    r1695 r1752  
    2020<li>Added support to allow <a href="?page=Configurations.AppConfig">including external application configurations</a>. Enhanced template syntax to facilitate <a href="?page=Configurations.Templates1">subproperty configuration</a>.</li> 
    2121 
     22<li>Added TDbUserManager and TDbUser to simplify <a href="?page=Advanced.Auth">authentication and authorization</a> with user accounts stored in a database.</li> 
     23 
    2224</ul> 
    2325 
  • trunk/framework/Data/TDataSourceConfig.php

    r1596 r1752  
    1010 * @package System.Data 
    1111 */ 
     12 
     13Prado::using('System.Data.TDbConnection'); 
    1214 
    1315/** 
     
    4749class TDataSourceConfig extends TModule 
    4850{ 
    49         private $_connID; 
     51        private $_connID=''; 
    5052        private $_conn; 
    5153        private $_connClass='System.Data.TDbConnection'; 
     
    9294        public function getDbConnection() 
    9395        { 
    94                 if(is_null($this->_conn)) 
     96                if($this->_conn===null) 
    9597                { 
    96                         if(!is_null($this->_connID)) 
     98                        if($this->_connID!=='') 
    9799                                $this->_conn = $this->findConnectionByID($this->getConnectionID()); 
    98100                        else