Developer 역할 Spring 골격 smoke (role-developer-live-v3-001)

This commit is contained in:
forge-bot 2026-07-14 08:29:59 +00:00
parent 7dc1a29dfa
commit 0180987ea1

View file

@ -0,0 +1,37 @@
package com.example.demo.controller;
import com.example.demo.service.DeveloperService;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping("/api/roles")
public class DeveloperController {
private final DeveloperService developerService;
public DeveloperController(DeveloperService developerService) {
this.developerService = developerService;
}
@GetMapping
public ResponseEntity<List<String>> getAllRoles() {
return ResponseEntity.ok(developerService.getAllRoles());
}
@GetMapping("/{role}")
public ResponseEntity<Map<String, String>> getRolePermission(@PathVariable String role) {
String permission = developerService.getRolePermission(role);
return ResponseEntity.ok(Map.of("role", role, "permission", permission));
}
@GetMapping("/{role}/check")
public ResponseEntity<Map<String, Boolean>> checkPermission(
@PathVariable String role,
@RequestParam String action) {
boolean allowed = developerService.hasPermission(role, action);
return ResponseEntity.ok(Map.of("action", action, "allowed", allowed));
}
}