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:
@@ -14,6 +14,20 @@ public function authorize(): bool
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare the data for validation.
|
||||
* 일반관리자가 슈퍼관리자를 생성하려는 경우 is_super_admin 필드 제거
|
||||
*/
|
||||
protected function prepareForValidation(): void
|
||||
{
|
||||
// 슈퍼관리자가 아닌 경우 is_super_admin 필드를 false로 강제 설정
|
||||
if (! auth()->user()?->is_super_admin) {
|
||||
$this->merge([
|
||||
'is_super_admin' => false,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user