Browse Source

Tornando o endpoint /organizations/all público e removendo os números de telefone das instituições ao listar

main
Cauã 9 months ago
parent
commit
561905d43e
  1. 3
      src/main/java/org/waterproofingdata/wpdauth/controller/UsersController.java
  2. 1
      src/main/java/org/waterproofingdata/wpdauth/security/WebSecurityConfig.java

3
src/main/java/org/waterproofingdata/wpdauth/controller/UsersController.java

@ -95,9 +95,10 @@ public class UsersController {
// Endpoint to get all organizations
@GetMapping("/all")
@PreAuthorize("hasRole('ROLE_ADMIN')")
public ResponseEntity<List<EduCemadenOrganizations>> getAllOrganizations() {
List<EduCemadenOrganizations> organizations = organizationsService.getAllOrganizations();
// Remover o campo 'phone' de cada organização
organizations.forEach(org -> org.setPhone(null));
return new ResponseEntity<>(organizations, HttpStatus.OK);
}

1
src/main/java/org/waterproofingdata/wpdauth/security/WebSecurityConfig.java

@ -43,6 +43,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
.antMatchers("/forgotpasswords/findallforgotpasswordquestions").permitAll() //
.antMatchers("/forgotpasswords/loginbyusernameandanswers").permitAll() //
.antMatchers("/forgotpasswords/loginbyusernameandanswers").permitAll()//
.antMatchers("/organizations/all").permitAll()//
// Disallow everything else..
.anyRequest().authenticated();

Loading…
Cancel
Save