feat: add unique super administrator and role management
This commit is contained in:
1 parent
9e731e47b9
commit
386d15cde2
16 files changed
+455
-24
No files matched your search
@@ -45,6 +45,8 @@ public class AuthController {
|
||||
|
||||
public record InvitationRequest(String label, Integer maxUses, OffsetDateTime expiresAt) {}
|
||||
|
||||
public record RoleRequest(String role) {}
|
||||
|
||||
@PostMapping("/auth/login")
|
||||
public Map<String, Object> login(
|
||||
@RequestBody LoginRequest input,
|
||||
@@ -86,6 +88,15 @@ public class AuthController {
|
||||
return Map.of("users", authService.listUsers(sessionToken(request)));
|
||||
}
|
||||
|
||||
@PostMapping("/admin/users/{id}/role")
|
||||
public Map<String, Object> changeRole(
|
||||
@PathVariable UUID id,
|
||||
@RequestBody RoleRequest input,
|
||||
HttpServletRequest request
|
||||
) {
|
||||
return Map.of("user", authService.changeRole(sessionToken(request), id, input.role(), meta(request)));
|
||||
}
|
||||
|
||||
@GetMapping("/admin/invitations")
|
||||
public Map<String, Object> invitations(HttpServletRequest request) {
|
||||
return Map.of("invitations", authService.listInvitations(sessionToken(request)));
|
||||
|
||||
Reference in new issue
Block a user