Exemple #1
0
 public function testLogin()
 {
     $api = new Login();
     $api->exec();
     $this->assertTrue(\UsersLogin::isLogined());
     $this->assertEquals(\UsersLogin::getCurrentSession()->login->getValue(), self::Login);
 }
Exemple #2
0
 public static function getCurrentUser()
 {
     if (!UsersLogin::isLogined()) {
         return;
     }
     return array('currentUser' => UsersLogin::getCurrentSession()->getParseData());
 }
Exemple #3
0
 public static function getCurrentUserGrants()
 {
     $result = self::loadGuestUserRights();
     //
     if (UsersLogin::isLogined()) {
         $result = array_merge($result, self::extractUserGrants(UsersLogin::getCurrentSession()));
     }
     return $result;
 }
Exemple #4
0
 protected function autoLogin()
 {
     if (UsersLogin::isLogined()) {
         $user = UsersLogin::getCurrentSession();
         if ($this->isAdmin($user)) {
             $this->user = $user;
         }
         EventController::callEvent(self::EventName, $this);
     }
 }
Exemple #5
0
 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());
 }
Exemple #6
0
 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();
 }
Exemple #7
0
 public function __construct()
 {
     //
     $auth = CMSAuth::getInstance();
     if (!$auth->isSuperAdmin(UsersLogin::getCurrentSession())) {
         $this->addError('Access denied');
         $this->jump(\Extasy\CMS::getDashboardWWWRoot());
     }
     parent::__construct();
     // Вызов формы редактирования
     $this->addGet('id', 'showEdit');
     // Вызов формы добавления
     $this->addGet('add', 'showAdd');
     // Вызов функции редактирования
     $this->addPost('id,login,password,rights', 'postEdit');
     $this->addPost('id,login,password', 'postEdit');
     // Вызов функции добавления
     $this->addPost('login,password,rights', 'postAdd');
     $this->addPost('login,password', 'postAdd');
     // Удаление
     $this->addPost('id', 'delete');
 }
Exemple #8
0
 protected function initUserParseData()
 {
     $user = \UsersLogin::getCurrentSession();
     if (is_object($user)) {
         $userData = $user->getData();
         $this->view->set('currentUser', $userData);
     }
 }