feat: [users] 슈퍼관리자 보호 기능 구현

- 일반관리자가 슈퍼관리자 수정/삭제 불가
- API Controller: update/destroy에서 403 반환
- Web Controller: edit에서 403 abort
- FormRequest: is_super_admin 필드 강제/유지 처리
- View: 테이블, 모달, 생성/수정 폼에서 버튼/체크박스 숨김

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-30 23:05:07 +09:00
parent 6be0a219c3
commit 049fa7ed61
8 changed files with 88 additions and 11 deletions

View File

@@ -15,6 +15,27 @@ public function authorize(): bool
return true;
}
/**
* Prepare the data for validation.
* 일반관리자가 슈퍼관리자 관련 필드를 변경하려는 경우 처리
*/
protected function prepareForValidation(): void
{
$userId = $this->route('id');
$targetUser = \App\Models\User::find($userId);
$currentUser = auth()->user();
// 슈퍼관리자가 아닌 경우
if (! $currentUser?->is_super_admin) {
// is_super_admin 필드가 있으면 제거 (기존 값 유지)
if ($this->has('is_super_admin')) {
$this->merge([
'is_super_admin' => $targetUser?->is_super_admin ?? false,
]);
}
}
}
/**
* Get the validation rules that apply to the request.
*