/** * Similar to AuthComponent::user() except if the session user cannot be found, connected authentication * objects will have their getUser() methods called. This lets stateless authentication methods function correctly. * * @return bool true if a user can be found, false if one cannot. */ protected function _getUser() { if ($user = $this->user()) { static::$_user = $user; $this->Session->delete('Auth.redirect'); return $user['active'] && !$user['locked_out']; } return false; }
/** * Initialize connection params * * @param string $host * @param string $user * @param string $password * @param int $port * @param int $timeout (seconds) */ public static function forge($host = null, $user = null, $password = null, $port = 21, $timeout = 90) { static::$_host = $host; static::$_user = $user; static::$_pwd = $password; static::$_port = (int) $port; static::$_timeout = (int) $timeout; if (!static::$instance) { static::$instance = new self(); } return static::$instance; }
/** * @param null $user * * @return bool */ public function login($user = NULL) { $this->_setDefaults(); if (empty($user)) { $user = $this->identify($this->request, $this->response); } if ($user) { $event = new CakeEvent('Auth.afterIdentify', $this, array('user' => $user)); $this->_Collection->getController()->getEventManager()->dispatch($event); } static::$_user = $user; return (bool) $user; }
public function __construct() { if (!\R::getDatabaseAdapter()) { $dbConfig = (require_once __DIR__ . '/cnf.php'); static::$_host = $dbConfig['host']; static::$_dbname = $dbConfig['dbname']; static::$_user = $dbConfig['user']; static::$_password = $dbConfig['password']; \R::setup('mysql:host=' . static::$_host . ';dbname=' . static::$_dbname, static::$_user, static::$_password, true); //for both mysql or mariaDB } $this->_redbeans = \R::getToolBox()->getRedBean(); $this->_rbToolbox = \R::getToolBox(); }
/** * Similar to AuthComponent::user() except if the session user cannot be found, connected authentication * objects will have their getUser() methods called. This lets stateless authentication methods function correctly. * * @return bool true if a user can be found, false if one cannot. */ protected function _getUser() { $user = $this->user(); if ($user) { $this->Session->delete('Auth.redirect'); return true; } if (empty($this->_authenticateObjects)) { $this->constructAuthenticate(); } foreach ($this->_authenticateObjects as $auth) { $result = $auth->getUser($this->request); if (!empty($result) && is_array($result)) { static::$_user = $result; return true; } } return false; }
public static function clearUser() { static::$_user = array(); }