public static function getCurrentUser() { if (!UsersLogin::isLogined()) { return; } return array('currentUser' => UsersLogin::getCurrentSession()->getParseData()); }
public function testLogin() { $api = new Login(); $api->exec(); $this->assertTrue(\UsersLogin::isLogined()); $this->assertEquals(\UsersLogin::getCurrentSession()->login->getValue(), self::Login); }
public function check() { if (!UsersLogin::isLogined()) { $this->user = null; } $needAuth = empty($this->user); if ($needAuth) { $authDataPresent = !empty($this->login) || !empty($this->password); try { if ($authDataPresent || UsersLogin::isLogined()) { if ($authDataPresent) { UsersLogin::login($this->login, $this->password); } } $this->user = UsersLogin::getCurrentUser(); $this->processUser(); } catch (ForbiddenException $e) { $this->authProc(); return false; } catch (\NotFoundException $e) { $this->authProc(); return false; } } return true; }
public static function getCurrentUserGrants() { $result = self::loadGuestUserRights(); // if (UsersLogin::isLogined()) { $result = array_merge($result, self::extractUserGrants(UsersLogin::getCurrentSession())); } return $result; }
public function testLogout() { \UsersLogin::login(self::Login, self::Password); $this->AssertTrue(\UsersLogin::isLogined()); $api = new Logout(); $api->exec(); $this->AssertFalse(\UsersLogin::isLogined()); // }
public function testForInjections() { if (\UsersLogin::isLogined()) { if (\CMSAuth::getInstance()->isAdmin(\UsersLogin::getCurrentSession())) { return; } } foreach ($this->data as $key => $value) { self::validateParameter($key, $value); } $this->validateParameter('Current page url', $this->uri()); }
public function __construct($urlInfo = array()) { parent::__construct($urlInfo); if (!UsersLogin::isLogined()) { /** * @todo Избавиться от этой зависимости */ $this->addAlert(\plugins\MessageDictionary\Plugin::getMessage('need_auth')); $this->jump('/'); throw new Exception('User not logined'); } $this->aProfile = UsersLogin::getCurrentSession(); }
protected function action() { if (\UsersLogin::isLogined()) { \UsersLogin::logout(); } }
/** * (non-PHPdoc) * @see Page::main() */ public function main($aData = array(), $error = '') { if (UsersLogin::isLogined()) { $this->jump('/profile/'); } $this->loadMeta(); $this->aParse['postData'] = $aData; $this->aParse['aProfile'] = $aData; $this->aParse['signupFailed'] = htmlspecialchars($error); if (!empty($this->recaptchaPublicKey)) { $this->aParse['captcha'] = recaptcha_get_html($this->recaptchaPublicKey, $error); } $this->output('users/registration/form'); }
public function tearDown() { if (\UsersLogin::isLogined()) { \UsersLogin::logout(); } }