fix:영업권 삭제 권한을 admin으로 제한
- 뷰에서 삭제 버튼 admin만 표시 - 컨트롤러에서 삭제 권한 체크 추가 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -171,9 +171,10 @@ public function destroy(int $id)
|
||||
->with('error', '이미 테넌트로 전환된 영업권은 삭제할 수 없습니다.');
|
||||
}
|
||||
|
||||
// 본인 또는 관리자만 삭제 가능
|
||||
if ($prospect->registered_by !== auth()->id()) {
|
||||
// TODO: 관리자 권한 체크 추가
|
||||
// 관리자만 삭제 가능
|
||||
if (!auth()->user()->isAdmin()) {
|
||||
return redirect()->route('sales.prospects.index')
|
||||
->with('error', '삭제 권한이 없습니다. 본사 운영팀에 문의하세요.');
|
||||
}
|
||||
|
||||
$prospect->delete();
|
||||
|
||||
@@ -117,6 +117,7 @@ class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none foc
|
||||
<button type="button" onclick="openProspectShowModal({{ $prospect->id }})" class="text-blue-600 hover:text-blue-900 mr-3">상세</button>
|
||||
@if(!$prospect->isConverted())
|
||||
<button type="button" onclick="openProspectEditModal({{ $prospect->id }})" class="text-indigo-600 hover:text-indigo-900 mr-3">수정</button>
|
||||
@if(auth()->user()->isAdmin())
|
||||
<form action="{{ route('sales.prospects.destroy', $prospect->id) }}" method="POST" class="inline"
|
||||
onsubmit="return confirm('정말 삭제하시겠습니까?')">
|
||||
@csrf
|
||||
@@ -124,6 +125,7 @@ class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none foc
|
||||
<button type="submit" class="text-red-600 hover:text-red-900">삭제</button>
|
||||
</form>
|
||||
@endif
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
@empty
|
||||
|
||||
Reference in New Issue
Block a user