diff options
author | emkael <emkael@tlen.pl> | 2016-06-07 15:17:49 +0200 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2016-06-10 11:46:41 +0200 |
commit | 823d71ced9b4947b1a5a5ade7245d521ed490061 (patch) | |
tree | a9a6c7cb0de74ff705e8320c284de423a698f5b5 /app/php/user | |
parent | df401552aac363655ab8f056a6c910a7611954d6 (diff) |
* renaming php directory
Diffstat (limited to 'app/php/user')
-rw-r--r-- | app/php/user/DbUser.php | 60 | ||||
-rw-r--r-- | app/php/user/config.xml | 9 |
2 files changed, 0 insertions, 69 deletions
diff --git a/app/php/user/DbUser.php b/app/php/user/DbUser.php deleted file mode 100644 index d636e8b..0000000 --- a/app/php/user/DbUser.php +++ /dev/null @@ -1,60 +0,0 @@ -<?php - -Prado::using('System.Security.TDbUserManager'); -Prado::using('Application.model.User'); -Prado::using('Application.facades.UserFacade'); - -class DbUser extends TDbUser { - - private $_record; - - public function setDbRecord(User $record) { - $this->_record = $record; - } - - public function getDbRecord() { - if (!$this->_record) { - $this->_record = UserFacade::getInstance()->findByLogin($this->Name); - } - return $this->_record; - } - - public function createUser($username) { - $dbUser = UserFacade::getInstance()->findByLogin($username); - if (!$dbUser) { - return NULL; - } - $user = new DbUser($this->Manager); - $user->setDbRecord($dbUser); - $user->Name = $dbUser->Login; - if ($dbUser->IsAdmin) { - $user->Roles = 'Admin'; - } - $user->IsGuest = FALSE; - return $user; - } - - public function validateUser($login, $password) { - $user = UserFacade::getInstance()->findByLogin($login); - $dbPassword = $user ? $user->Password : ''; - if (UserFacade::getInstance()->verifyPassword($password, $dbPassword) - && $user) { - $user->LastLogin = date('Y-m-d H:i:s'); - $user->save(); - return TRUE; - } else { - return FALSE; - } - } - - public function __call($name, $args) { - $match = []; - if (preg_match('/^getIs(.+)$/', $name, $match)) { - return $this->isInRole($match[1]); - } - throw new Exception('Unimplemented CustomDbUser method'); - } - -} - -?> diff --git a/app/php/user/config.xml b/app/php/user/config.xml deleted file mode 100644 index 80027e5..0000000 --- a/app/php/user/config.xml +++ /dev/null @@ -1,9 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<configuration> - <modules> - <module id="auth" class="System.Security.TAuthManager" - UserManager="users" LoginPage="Login" /> - <module id="users" class="System.Security.TDbUserManager" - UserClass="Application.user.DbUser" /> - </modules> -</configuration> |