Class \Prado\Security\TDbUserManager
TDbUserManager class
TDbUserManager manages user accounts that are stored in a database. TDbUserManager is mainly designed to be used together with TAuthManager which manages how users are authenticated and authorized in a Prado application.
To use TDbUserManager together with TAuthManager, configure them in the application configuration like following:
<module id="db"
class="Prado\Data\TDataSourceConfig" ..../>
<module id="users"
class="Prado\Security\TDbUserManager"
UserClass="Path\To\MyUserClass"
ConnectionID="db" />
<module id="auth"
class="Prado\Security\TAuthManager"
UserManager="users" LoginPage="Path\To\LoginPage" />
In the above, \Prado\Security\setUserClass specifies what class will be used to create user instance. The class must extend from TDbUser. \Prado\Security\setConnectionID refers to the ID of a TDataSourceConfig module which specifies how to establish database connection to retrieve user information.
Class hierarchy
- \Prado\Security\TDbUserManager implements IUserManager, IDbModule
- \Prado\TModule implements IModule
- \Prado\TApplicationComponent
- \Prado\TComponent
Since: 3.1.0
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
getUserFromCookie(THttpCookie $cookie) : TDbUser
Returns a user instance according to auth data stored in a cookie.
|
public
|
|
public
|
|
public
|
setConnectionID(string $value) : mixed
Sets the ID of a TDataSourceConfig module.
The datasource module will be used to establish the DB connection that will be used by the user manager. |
public
|
|
public
|
|
public
|
validateUser(string $username, string $password) : bool
Validates if the username and password are correct.
|
protected
|
\Prado\TApplicationComponent::FX_CACHE_FILE, \Prado\TComponent::GLOBAL_RAISE_EVENT_LISTENER |