Example #1
0
 public function salir()
 {
     try {
         if (!empty(Session::get('usuario.username'))) {
             $request = new stdClass();
             $request->nombreUsuario = Session::get('usuario.username');
             $request->idSesion = Session::get('usuario.idSesion');
             $request->perfil = Session::get('usuario.perfil');
             $request->codigoSistema = $this->constants->MCASI_CODIGO_SISTEMA;
             $user_sin = new User();
             $exit = $this->mcasi->callMethod($this->constants->MCASI_METHODO_CS, $request);
             if (isset($exit->call->return->idRespuesta)) {
                 if ($exit->call->return->idRespuesta === '1') {
                     $user_sin->sincronizarEstadoSession($request, $this->constants->C_SESSION_FINALIZADA);
                     LogA::guardar(null, $this->constants->C_CIERRA_SESSION, User::getDataPk(Session::get('usuario.username')), null);
                     Session::flush();
                     return Redirect::to("/");
                 }
             }
             Session::flush();
             return Redirect::to("/");
         } else {
             Session::flush();
             Session::flash('autentificacion.exit', $this->constants->C_SESSION_EXPIRADO);
             return Redirect::to("/");
         }
     } catch (Exception $exc) {
         Session::flush();
         Session::flash('autentificacion.novalida', $this->constants->C_SESSION_FALLO);
         return Redirect::to('/');
     }
 }