diff --git a/.gitignore b/.gitignore index f64a998..e834759 100644 --- a/.gitignore +++ b/.gitignore @@ -42,4 +42,7 @@ src/main/resources/firebase/ skills/ *.env -*.json \ No newline at end of file +*.json + +test/ignored/ +AGENTS.md \ No newline at end of file diff --git a/src/main/java/br/com/acta/service/AlertaPrazoService.java b/src/main/java/br/com/acta/service/AlertaPrazoService.java index bf401fb..c1b0774 100644 --- a/src/main/java/br/com/acta/service/AlertaPrazoService.java +++ b/src/main/java/br/com/acta/service/AlertaPrazoService.java @@ -49,7 +49,7 @@ public void inserir() { repo.gerarAlertasAtraso(); } - @PreAuthorize("authService.isProprioUsuario(#idUsuario)") + @PreAuthorize("@authService.isProprioUsuario(#idUsuario)") @Transactional public AlertaPrazoResponseDTO marcarLido(Long idTarefa, Long idAlerta, Long idUsuario){ authService.configurarUsuarioAtual(); @@ -61,4 +61,4 @@ public AlertaPrazoResponseDTO marcarLido(Long idTarefa, Long idAlerta, Long idUs AlertaPrazo salvo = repo.save(alertaPrazo); return mapper.toResponse(salvo); } -} +} \ No newline at end of file diff --git a/src/main/java/br/com/acta/service/ColaboradorService.java b/src/main/java/br/com/acta/service/ColaboradorService.java index 13b2eba..3352198 100644 --- a/src/main/java/br/com/acta/service/ColaboradorService.java +++ b/src/main/java/br/com/acta/service/ColaboradorService.java @@ -132,7 +132,7 @@ public ColaboradorResponseDTO inserir(ColaboradorRequestDTO dto) { return mapper.toResponse(salvo); } - @PreAuthorize("hasRole('ADMIN') and authService.isColaboradorEmpresa(#id)") + @PreAuthorize("hasRole('ADMIN') and @authService.isColaboradorEmpresa(#id)") @Override @Transactional public ColaboradorResponseDTO patch(Long id, Map campos) { @@ -151,7 +151,7 @@ public ColaboradorResponseDTO patch(Long id, Map campos) { return mapper.toResponse(salvo); } - @PreAuthorize("hasRole('ADMIN') and authService.isColaboradorEmpresa(#id)") + @PreAuthorize("hasRole('ADMIN') and @authService.isColaboradorEmpresa(#id)") @Override @Transactional public void excluir(Long id) { @@ -170,4 +170,4 @@ public Colaborador getEntity(Long id) { return repo.findByIdAndEmpresaId(id, atual().idEmpresa()) .orElseThrow(() -> new ModelNotFoundException("Colaborador", id)); } -} +} \ No newline at end of file diff --git a/src/main/java/br/com/acta/service/EmailService.java b/src/main/java/br/com/acta/service/EmailService.java index 01b7e05..9a3bb2a 100644 --- a/src/main/java/br/com/acta/service/EmailService.java +++ b/src/main/java/br/com/acta/service/EmailService.java @@ -39,7 +39,7 @@ public List buscarEmailsEmpresa(Long idEmpresa) { return emailEmpresaMapper.toResponseList(emails); } - @PreAuthorize("hasRole('ADMIN') and authService.isUsuarioByIdEmpresa(#idEmpresa)") + @PreAuthorize("hasRole('ADMIN') and @authService.isUsuarioByIdEmpresa(#idEmpresa)") @Transactional public EmailResponseDTO inserirEmailEmpresa(Long idEmpresa, EmailRequestDTO dto) { authService.configurarUsuarioAtual(); @@ -54,7 +54,7 @@ public EmailResponseDTO inserirEmailEmpresa(Long idEmpresa, EmailRequestDTO dto) return emailEmpresaMapper.toResponse(salvo); } - @PreAuthorize("hasRole('ADMIN') and authService.isUsuarioByIdEmpresa(#idEmpresa)") + @PreAuthorize("hasRole('ADMIN') and @authService.isUsuarioByIdEmpresa(#idEmpresa)") @Transactional public void excluirEmailEmpresa(Long idEmpresa, Long idEmail) { authService.configurarUsuarioAtual(); @@ -105,4 +105,4 @@ private EmailColaborador getEmailColaborador(Long idColaborador, Long idEmail) { return emailColaboradorRepo.findByColaboradorIdAndId(colaborador.getId(), idEmail) .orElseThrow(() -> new ModelNotFoundException("Email", idEmail)); } -} +} \ No newline at end of file diff --git a/src/main/java/br/com/acta/service/EmpresaService.java b/src/main/java/br/com/acta/service/EmpresaService.java index 8d18701..f183834 100644 --- a/src/main/java/br/com/acta/service/EmpresaService.java +++ b/src/main/java/br/com/acta/service/EmpresaService.java @@ -56,7 +56,7 @@ public EmpresaService(EmpresaRepository repo, EmpresaMapper mapper, EmailEmpresa this.telefoneRepo = telefoneRepo; } - @PreAuthorize("hasRole('ADMIN') and authService.isUsuarioByIdEmpresa(#id)") + @PreAuthorize("hasRole('ADMIN') and @authService.isUsuarioByIdEmpresa(#id)") @Override @Transactional public EmpresaResponseDTO patch(Long id, Map campos) { @@ -86,7 +86,7 @@ public List buscar(TamanhoEmpresa tamanho){ return mapper.toResponseList(empresas); } - @PreAuthorize("isAuthenticated() and authService.isUsuarioByIdEmpresa(#id)") + @PreAuthorize("isAuthenticated() and @authService.isUsuarioByIdEmpresa(#id)") @Transactional(readOnly = true) @Override public EmpresaResponseDTO buscar(Long id) { @@ -137,4 +137,4 @@ protected void antesInserir(Empresa empresa, EmpresaRequestDTO dto) { public EmpresaResponseDTO inserir(EmpresaRequestDTO dto) { return super.inserir(dto); } -} +} \ No newline at end of file diff --git a/src/main/java/br/com/acta/service/EnderecoEmpresaService.java b/src/main/java/br/com/acta/service/EnderecoEmpresaService.java index 53070d0..6dd766a 100644 --- a/src/main/java/br/com/acta/service/EnderecoEmpresaService.java +++ b/src/main/java/br/com/acta/service/EnderecoEmpresaService.java @@ -37,7 +37,7 @@ public List buscarEndereco(Long idEmpresa) { return enderecoMapper.toResponseList(enderecos); } - @PreAuthorize("hasRole('ADMIN') and authService.isUsuarioByIdEmpresa(#idEmpresa)") + @PreAuthorize("hasRole('ADMIN') and @authService.isUsuarioByIdEmpresa(#idEmpresa)") @Transactional public EnderecoResponseDTO inserirEndereco(Long idEmpresa, EnderecoRequestDTO dto) { authService.configurarUsuarioAtual(); @@ -49,7 +49,7 @@ public EnderecoResponseDTO inserirEndereco(Long idEmpresa, EnderecoRequestDTO dt return enderecoMapper.toResponse(salvo); } - @PreAuthorize("hasRole('ADMIN') and authService.isUsuarioByIdEmpresa(#idEmpresa)") + @PreAuthorize("hasRole('ADMIN') and @authService.isUsuarioByIdEmpresa(#idEmpresa)") @Transactional public void excluirEndereco(Long idEmpresa, Long idEndereco) { authService.configurarUsuarioAtual(); @@ -62,4 +62,4 @@ private Endereco getEndereco(Long idEmpresa, Long idEndereco) { return enderecoRepo.findByEmpresaAndId(empresa, idEndereco) .orElseThrow(() -> new ModelNotFoundException("Endereco", idEndereco)); } -} +} \ No newline at end of file diff --git a/src/main/java/br/com/acta/service/PriorizacaoProblemaService.java b/src/main/java/br/com/acta/service/PriorizacaoProblemaService.java index 259e5e6..c6d532f 100644 --- a/src/main/java/br/com/acta/service/PriorizacaoProblemaService.java +++ b/src/main/java/br/com/acta/service/PriorizacaoProblemaService.java @@ -74,7 +74,7 @@ public PriorizacaoProblemaResponseDTO inserir(Long idProblema, PriorizacaoProble } } - @PreAuthorize("authService.isProprioUsuario(#idUsuario)") + @PreAuthorize("@authService.isProprioUsuario(#idUsuario)") @Transactional public PriorizacaoProblemaResponseDTO patch(Long idProblema, Long idUsuario, Map campos){ authService.configurarUsuarioAtual(); @@ -129,4 +129,4 @@ public ProblemaResponseDTO aplicarPeso(Long idProblema){ Problema salvo = problemaRepo.save(problema); return problemaMapper.toResponse(salvo); } -} +} \ No newline at end of file diff --git a/src/main/java/br/com/acta/service/TelefoneService.java b/src/main/java/br/com/acta/service/TelefoneService.java index ef04438..651fba4 100644 --- a/src/main/java/br/com/acta/service/TelefoneService.java +++ b/src/main/java/br/com/acta/service/TelefoneService.java @@ -39,7 +39,7 @@ public List buscarTelefonesEmpresa(Long idEmpresa) { return telefoneEmpresaMapper.toResponseList(telefones); } - @PreAuthorize("hasRole('ADMIN') and authService.isUsuarioByIdEmpresa(#idEmpresa)") + @PreAuthorize("hasRole('ADMIN') and @authService.isUsuarioByIdEmpresa(#idEmpresa)") @Transactional public TelefoneResponseDTO inserirTelefoneEmpresa(Long idEmpresa, TelefoneRequestDTO dto) { authService.configurarUsuarioAtual(); @@ -54,7 +54,7 @@ public TelefoneResponseDTO inserirTelefoneEmpresa(Long idEmpresa, TelefoneReques return telefoneEmpresaMapper.toResponse(salvo); } - @PreAuthorize("hasRole('ADMIN') and authService.isUsuarioByIdEmpresa(#idEmpresa)") + @PreAuthorize("hasRole('ADMIN') and @authService.isUsuarioByIdEmpresa(#idEmpresa)") @Transactional public void excluirTelefoneEmpresa(Long idEmpresa, Long idTelefone) { authService.configurarUsuarioAtual(); @@ -105,4 +105,4 @@ private TelefoneColaborador getTelefoneColaborador(Long idColaborador, Long idTe return telefoneColaboradorRepo.findByColaboradorIdAndId(colaborador.getId(), idTelefone) .orElseThrow(() -> new ModelNotFoundException("Telefone", idTelefone)); } -} +} \ No newline at end of file diff --git a/src/main/java/br/com/acta/service/UsuarioCicloService.java b/src/main/java/br/com/acta/service/UsuarioCicloService.java index c12109e..b9cb9ad 100644 --- a/src/main/java/br/com/acta/service/UsuarioCicloService.java +++ b/src/main/java/br/com/acta/service/UsuarioCicloService.java @@ -44,7 +44,7 @@ public List buscarPorCiclo(Long idCiclo){ return mapper.toResponseList(usuarios); } - @PreAuthorize("authService.isProprioUsuario(#idUsuario) or hasAnyRole('ADMIN', 'GESTOR') and authService.isUsuarioEmpresa(#idUsuario)") + @PreAuthorize("@authService.isProprioUsuario(#idUsuario) or hasAnyRole('ADMIN', 'GESTOR') and @authService.isUsuarioEmpresa(#idUsuario)") @Transactional(readOnly = true) public List buscarPorUsuario(Long idUsuario){ Usuario usuario = usuarioService.getEntity(idUsuario); @@ -130,4 +130,4 @@ public void excluir(Long idUsuario, Long idCiclo){ repo.delete(usuarioCiclo); } -} +} \ No newline at end of file diff --git a/src/main/java/br/com/acta/service/UsuarioService.java b/src/main/java/br/com/acta/service/UsuarioService.java index dcbf6ee..066b647 100644 --- a/src/main/java/br/com/acta/service/UsuarioService.java +++ b/src/main/java/br/com/acta/service/UsuarioService.java @@ -46,7 +46,7 @@ public UsuarioService(EmpresaService empresaService, UsuarioRepository repo, Usu this.metaRepo = metaRepo; } - @PreAuthorize("authService.isProprioUsuario(#id) or hasAnyRole('ADMIN', 'GESTOR')") + @PreAuthorize("@authService.isProprioUsuario(#id) or hasAnyRole('ADMIN', 'GESTOR')") @Override @Transactional public UsuarioResponseDTO patch(Long id, Map campos) { @@ -75,7 +75,7 @@ public UsuarioResponseDTO patch(Long id, Map campos) { return mapper.toResponse(usuario); } - @PreAuthorize("authService.isProprioUsuario(#id) or hasAnyRole('ADMIN', 'GESTOR')") + @PreAuthorize("@authService.isProprioUsuario(#id) or hasAnyRole('ADMIN', 'GESTOR')") @Transactional public UsuarioResponseDTO excluirFoto(Long id) { configurarUsuarioAtual(); @@ -89,7 +89,7 @@ public UsuarioResponseDTO excluirFoto(Long id) { return mapper.toResponse(salvo); } - @PreAuthorize("hasAnyRole('ADMIN', 'GESTOR') and authService.isUsuarioEmpresa(#idEmpresa)") + @PreAuthorize("hasAnyRole('ADMIN', 'GESTOR') and @authService.isUsuarioEmpresa(#idEmpresa)") public List buscar(Long idEmpresa, TipoUsuario tipo) { List usuarios; @@ -99,7 +99,7 @@ public List buscar(Long idEmpresa, TipoUsuario tipo) { return mapper.toResponseList(usuarios); } - @PreAuthorize("authService.isUsuarioEmpresa(#id) and hasRole('ADMIN')") + @PreAuthorize("@authService.isUsuarioEmpresa(#id) and hasRole('ADMIN')") @Override @Transactional public void excluir(Long id) { @@ -134,7 +134,7 @@ public void excluir(Long id) { repo.save(usuario); } - @PreAuthorize("authService.isProprioUsuario(#id) or hasAnyRole('ADMIN', 'GESTOR')") + @PreAuthorize("@authService.isProprioUsuario(#id) or hasAnyRole('ADMIN', 'GESTOR')") @Override public UsuarioResponseDTO buscar(Long id) { return super.buscar(id); @@ -160,4 +160,4 @@ public Usuario getEntity(Long id) { return repo.findByIdAndEmpresaId(id, atual().idEmpresa()) .orElseThrow(() -> new ModelNotFoundException("Usuário", id)); } -} +} \ No newline at end of file diff --git a/src/main/java/br/com/acta/service/UsuarioTreinamentoService.java b/src/main/java/br/com/acta/service/UsuarioTreinamentoService.java index c9e6dec..fc59566 100644 --- a/src/main/java/br/com/acta/service/UsuarioTreinamentoService.java +++ b/src/main/java/br/com/acta/service/UsuarioTreinamentoService.java @@ -62,7 +62,7 @@ public UsuarioTreinamentoResponseDTO inserir(Long idTreinamento, UsuarioTreiname } } - @PreAuthorize("hasAnyRole('ADMIN', 'GESTOR') or authService.isProprioUsuario(#idUsuario)") + @PreAuthorize("hasAnyRole('ADMIN', 'GESTOR') or @authService.isProprioUsuario(#idUsuario)") @Transactional public UsuarioTreinamentoResponseDTO patchStatus(Long idTreinamento, Long idUsuario, StatusTreinamento status){ authService.configurarUsuarioAtual(); @@ -101,4 +101,4 @@ public void excluir(Long idTreinamento, Long idUsuario){ repo.delete(usuarioTreinamento); } -} +} \ No newline at end of file