Commit 188a3084d54ea58b718a1b648266273a7b36f95b

Authored by André Souza
1 parent 9a10ae9e
Exists in master and in 1 other branch desenv

incluindo campo sigla no retorno da autenticação

Showing 2 changed files with 24 additions and 1 deletions   Show diff stats
controlador_ws.php
... ... @@ -32,6 +32,7 @@ class TokenValidationMiddleware{
32 32 }
33 33 }
34 34  
  35 +
35 36 $config = array(
36 37 'settings' => array(
37 38 'determineRouteBeforeAppMiddleware' => true,
... ... @@ -41,6 +42,24 @@ $config = array(
41 42  
42 43 $app = new \Slim\App($config);
43 44  
  45 +//Enable CORS
  46 +// $app->options('/{routes:.+}', function ($request, $response, $args) {
  47 +// return $response;
  48 +// });
  49 +
  50 +// $app->add(function ($req, $res, $next) {
  51 +// $response = $next($req, $res);
  52 +
  53 +// //cabeçalhos encontrados na implementação do Mobile
  54 +// $strAllowHeaders = 'X-Requested-With, Content-Type, Accept, Origin, Authorization, Access-Control-Max-Age, If-Modified-Since' .
  55 +// 'token, User-Agent, Cookie, Content-Disposition, Content-Length, Transfer-Encoding, Accept-Encoding';
  56 +
  57 +// return $response->withHeader('Access-Control-Allow-Origin', 'http://localhost:8100') //Especifico para o IONIC
  58 +// ->withHeader('Access-Control-Allow-Headers', $strAllowHeaders)
  59 +// ->withHeader('Access-Control-Allow-Credentials', 'true')
  60 +// ->withHeader('Access-Control-Allow-Methods', 'GET, PUT, POST, DELETE, OPTIONS, HEAD');
  61 +// });
  62 +
44 63 /**
45 64 * Grupo para a versao v1 de servicos REST
46 65 */
... ...
rn/MdWsSeiUsuarioRN.php
... ... @@ -180,13 +180,17 @@ class MdWsSeiUsuarioRN extends InfraRN {
180 180 $this->encriptaSenha($usuarioDTO->getStrSenha()),
181 181 ConfiguracaoSEI::getInstance()->getValor('SessaoSEI', 'SiglaSistema'),
182 182 $siglaOrgao
183   - );
  183 + );
184 184  
185 185 if(!$ret){
186 186 throw new InfraException('Usuário ou senha inválido!');
187 187 }
188 188 $this->setaVariaveisAutenticacao(get_object_vars($ret));
  189 +
  190 + //dados usuário
189 191 $ret->id_unidade_atual = SessaoSEI::getInstance()->getNumIdUnidadeAtual();
  192 + $ret->sigla = $usuarioDTO->getStrSigla();
  193 +
190 194 $token = $this->tokenEncode($usuarioDTO->getStrSigla(), $usuarioDTO->getStrSenha());
191 195  
192 196 $arrUnidades = array();
... ...