예제 #1
0
 /**
  * Obtener los datos para la ficha de perfil
  */
 public function getProfile()
 {
     $this->view->addTemplate('profiles');
     $profile = $this->view->itemId ? Profile::getProfile($this->view->itemId) : new Profile();
     $this->view->assign('profile', $profile);
     $this->view->assign('isDisabled', $this->view->actionId === self::ACTION_USR_PROFILES_VIEW ? 'disabled' : '');
     if ($this->view->isView === true) {
         $this->view->assign('usedBy', Profile::getProfileInUsersName($this->view->itemId));
     }
 }
예제 #2
0
 /**
  * Inicialiar la sesión de usuario
  */
 private static function initSession()
 {
     $sessionLifeTime = self::getSessionLifeTime();
     // Timeout de sesión
     if (Session::getLastActivity() && time() - Session::getLastActivity() > $sessionLifeTime) {
         if (isset($_COOKIE[session_name()])) {
             setcookie(session_name(), '', time() - 42000, '/');
         }
         self::wrLogoutInfo();
         session_unset();
         session_destroy();
         session_start();
         return;
     }
     // Regenerar el Id de sesión periódicamente para evitar fijación
     if (Session::getSidStartTime() === 0) {
         Session::setSidStartTime(time());
         Session::setStartActivity(time());
     } else {
         if (Session::getUserId() && time() - Session::getSidStartTime() > $sessionLifeTime / 2) {
             $sessionMPass = SessionUtil::getSessionMPass();
             session_regenerate_id(true);
             Session::setSidStartTime(time());
             // Recargar los permisos del perfil de usuario
             Session::setUserProfile(Profile::getProfile(Session::getUserProfileId()));
             // Regenerar la clave maestra
             SessionUtil::saveSessionMPass($sessionMPass);
         }
     }
     Session::setLastActivity(time());
 }