feat: [approval] 결재관리 삭제 권한 기능 추가
- 관리자/슈퍼관리자 모든 상태 결재 문서 삭제 가능 - 일반 사용자는 기존대로 draft + 본인 기안만 삭제 - 진행 중 문서 삭제 시 휴가 연동 취소 처리 - 삭제 API 403 권한 검증 추가 - 상세 페이지 삭제 버튼 + 2중 확인 다이얼로그
This commit is contained in:
@@ -146,7 +146,17 @@ public function update(Request $request, int $id): JsonResponse
|
||||
public function destroy(int $id): JsonResponse
|
||||
{
|
||||
try {
|
||||
$this->service->deleteApproval($id);
|
||||
$user = auth()->user();
|
||||
$approval = $this->service->getApproval($id);
|
||||
|
||||
if (! $approval->isDeletableBy($user)) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => '삭제 권한이 없습니다.',
|
||||
], 403);
|
||||
}
|
||||
|
||||
$this->service->deleteApproval($id, $user);
|
||||
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
|
||||
Reference in New Issue
Block a user