add: saber el rol del usuario, poder crear roles
Some checks failed
Deploy Spring Boot App / build-and-deploy (push) Has been cancelled
Some checks failed
Deploy Spring Boot App / build-and-deploy (push) Has been cancelled
This commit is contained in:
@@ -8,7 +8,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/roles")
|
||||
@RequestMapping("/api/roles")
|
||||
public class RolesController {
|
||||
|
||||
final RolesRepository rolesRepository;
|
||||
|
||||
@@ -12,7 +12,9 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
@RestController
|
||||
@@ -85,6 +87,16 @@ public class UserController {
|
||||
return ResponseEntity.ok(id);
|
||||
}
|
||||
|
||||
@GetMapping("/rol/{username}")
|
||||
public ResponseEntity<Map<String, Long>> obtenerRolUsuario(@PathVariable String username) {
|
||||
Long rolId = service.obtenerIdRolPorUsername(username);
|
||||
|
||||
Map<String, Long> response = new HashMap<>();
|
||||
response.put("rolId", rolId);
|
||||
|
||||
return ResponseEntity.ok(response);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ✅ DTO interno para registro
|
||||
|
||||
Reference in New Issue
Block a user