PHP Класс Prado\Security\TDbUserManager
TDbUserManager manages user accounts that are stored in a database.
TDbUserManager is mainly designed to be used together with {@link 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:
In the above, {@link setUserClass UserClass} specifies what class will be used
to create user instance. The class must extend from {@link TDbUser}.
{@link setConnectionID ConnectionID} refers to the ID of a {@link TDataSourceConfig} module
which specifies how to establish database connection to retrieve user information.
Показать файл
Открыть проект
Открытые методы
Защищенные методы
Метод |
Описание |
|
createDbConnection ( $connectionID ) : TDbConnection |
Creates the DB connection. |
|
Описание методов
createDbConnection()
защищенный метод
Creates the DB connection.
protected createDbConnection ( $connectionID ) : TDbConnection |
Результат |
TDbConnection |
the created DB connection |
getConnectionID()
публичный метод
getDbConnection()
публичный метод
public getDbConnection ( ) : TDbConnection |
Результат |
TDbConnection |
the database connection that may be used to retrieve user data. |
getGuestName()
публичный метод
getUser()
публичный метод
Returns a user instance given the user name.
public getUser ( $username = null ) : TUser |
Результат |
TUser |
the user instance, null if the specified username is not in the user database. |
getUserClass()
публичный метод
public getUserClass ( ) : string |
Результат |
string |
the user class name in namespace format. Defaults to empty string, meaning not set. |
getUserFromCookie()
публичный метод
Returns a user instance according to auth data stored in a cookie.
public getUserFromCookie ( $cookie ) : TDbUser |
Результат |
TDbUser |
the user instance generated based on the cookie auth data, null if the cookie does not have valid auth data. |
This method is required by IModule and is invoked by application.
saveUserToCookie()
публичный метод
Saves user auth data into a cookie.
setConnectionID()
публичный метод
The datasource module will be used to establish the DB connection
that will be used by the user manager.
setGuestName()
публичный метод
setUserClass()
публичный метод
validateUser()
публичный метод
Validates if the username and password are correct.