feat: [approval] 결재관리 삭제 권한 기능 추가
- 관리자/슈퍼관리자 모든 상태 결재 문서 삭제 가능 - 일반 사용자는 기존대로 draft + 본인 기안만 삭제 - 진행 중 문서 삭제 시 휴가 연동 취소 처리 - 삭제 API 403 권한 검증 추가 - 상세 페이지 삭제 버튼 + 2중 확인 다이얼로그
This commit is contained in:
@@ -214,6 +214,20 @@ public function isDeletable(): bool
|
||||
return $this->status === self::STATUS_DRAFT;
|
||||
}
|
||||
|
||||
public function isDeletableBy(?User $user = null): bool
|
||||
{
|
||||
if (! $user) {
|
||||
return $this->isDeletable();
|
||||
}
|
||||
|
||||
if ($user->isAdmin()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return $this->status === self::STATUS_DRAFT
|
||||
&& $this->drafter_id === $user->id;
|
||||
}
|
||||
|
||||
public function getStatusLabelAttribute(): string
|
||||
{
|
||||
return match ($this->status) {
|
||||
|
||||
Reference in New Issue
Block a user