fix(release): 7.0.7 릴리즈 검증 발견 결함 전수 처리 및 출시일 8/18 정렬
7.0.7 페이로드 전수 검증에서 발견된 error 4건·warn 14건을 릴리즈 전에 처리했다. 미출시 분량의 자체 결함(회원 통합검색 500, 관리자 스코프 403 의 500 위장 등)이므로 페이로드에 합류시키고, 출시 대상 26개 CHANGELOG 의 버전 섹션 날짜를 2026-08-18 로 정렬했다. - 통합검색 import 복원 + 이커머스 관리자 typed 403 catch 대칭(테스트 동반) - admin 판정 스니핑 사설 사본 전수 수렴(BoardResource) + 조건 스캔 테스트 - 스케줄 인터프리터 변형 표기(확장자·버전 접미사) 정규화 차단 - ckeditor5 참조 판정 배치화·fail-safe, 결제 플러그인 진단 페이로드 대칭 - 템플릿 다크 대비·상태 Select value-제어 + --production 재빌드 - Upgrade_7_0_7 잔존 중복 색인 정리 스텝, API 문서·i18n(ko/en/ja) 동기
This commit is contained in:
1 parent
ed985dd175
commit
b3d0da9355
110 files changed
+1104
-369
No files matched your search
@@ -4,7 +4,7 @@
|
||||
형식은 [Keep a Changelog](https://keepachangelog.com/ko/1.1.0/)를 따르며,
|
||||
[Semantic Versioning](https://semver.org/lang/ko/)을 준수합니다.
|
||||
|
||||
## [1.0.4] - 2026-08-17
|
||||
## [1.0.4] - 2026-08-18
|
||||
|
||||
### Security
|
||||
|
||||
|
||||
@@ -4377,6 +4377,7 @@ HTTP/1.1 201
|
||||
| postId | path | string | 예 | — | 대상 post의 식별자 |
|
||||
| commentId | path | string | 예 | — | 대상 comment의 식별자 |
|
||||
| password | body | string | 아니오 | min 4, max 20 | 비회원 댓글 삭제 시 소유권 확인용 비밀번호. 형식(문자열, 4~20자)은 `DestroyCommentRequest` 가 검증하며, 배열 주입 등 형식 위반은 422. 소유권 판정 자체는 서비스(`canDelete`)가 수행 |
|
||||
| verification_token | body | string | 아니오 | max 255 | 비회원 댓글 삭제 시 비밀번호 재입력을 대체하는 임시 검증 토큰 (verify-password 로 발급, 1회 소비). 문자열 형식 위반(배열 주입 등)은 422 |
|
||||
|
||||
**요청 예시**
|
||||
|
||||
@@ -4432,6 +4433,9 @@ HTTP/1.1 200
|
||||
| slug | path | string | 예 | — | 대상 리소스의 slug (URL 친화 식별자) |
|
||||
| postId | path | string | 예 | — | 대상 post의 식별자 |
|
||||
| commentId | path | string | 예 | — | 대상 comment의 식별자 |
|
||||
| content | body | string | 예 | 게시판 설정의 min/max 길이 | 수정할 댓글 본문 (금지 키워드 검사 포함) |
|
||||
| password | body | string | 조건부 | min 4, max 20 | 비회원 댓글 수정 시 소유권 확인용 비밀번호 (검증 토큰이 있으면 생략 가능) |
|
||||
| verification_token | body | string | 아니오 | max 255 | 비회원 댓글 수정 시 비밀번호 재입력을 대체하는 임시 검증 토큰 (verify-password 로 발급, 1회 소비) |
|
||||
|
||||
> 이 엔드포인트는 확장이 파라미터를 추가할 수 있습니다 (`sirsoft-board.comment.update_validation_rules`).
|
||||
|
||||
|
||||
@@ -256,12 +256,12 @@ class CommentController extends PublicBaseController
|
||||
);
|
||||
|
||||
// 비회원 댓글: 평문 비밀번호 재전송 대신 검증 토큰으로도 본인 확인 (게시글과 동형)
|
||||
$verificationToken = request()->input('verification_token');
|
||||
$verificationToken = $request->validated('verification_token');
|
||||
if (! $canDelete && ! empty($verificationToken)) {
|
||||
$canDelete = $this->commentService->consumeCommentVerifyToken(
|
||||
$slug,
|
||||
$commentId,
|
||||
(string) $verificationToken
|
||||
$verificationToken
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ class DestroyCommentRequest extends FormRequest
|
||||
{
|
||||
return [
|
||||
'password' => ['nullable', 'string', 'min:4', 'max:20'],
|
||||
'verification_token' => ['nullable', 'string', 'max:255'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ class UpdateCommentRequest extends FormRequest
|
||||
'status' => ['nullable', 'string', Rule::in(PostStatus::values())],
|
||||
// 비회원인 경우 비밀번호 필수 (수정 권한 검증용). 단, 검증 토큰이 있으면 선택.
|
||||
'password' => [$isGuest && ! $hasVerificationToken ? 'required' : 'nullable', 'string', 'min:4', 'max:20'],
|
||||
'verification_token' => ['nullable', 'string'],
|
||||
'verification_token' => ['nullable', 'string', 'max:255'],
|
||||
];
|
||||
|
||||
// 훅: 모듈/플러그인이 validation rules를 동적으로 추가할 수 있도록 필터 제공
|
||||
|
||||
@@ -404,7 +404,7 @@ class BoardResource extends BaseApiResource
|
||||
/** @var User|null $user */
|
||||
$user = Auth::user();
|
||||
$slug = $this->getValue('slug');
|
||||
$isAdminRoute = $this->isAdminRoute($request);
|
||||
$isAdminRoute = $this->isAdminRequest($request);
|
||||
|
||||
// 컨텍스트에 맞는 permissionMap 구성 (PostResource.resolveAbilities()와 동일 키)
|
||||
$permissionMap = $isAdminRoute
|
||||
@@ -493,23 +493,4 @@ class BoardResource extends BaseApiResource
|
||||
|
||||
return $guestRole->permissions()->where('permissions.id', $permission->id)->exists();
|
||||
}
|
||||
|
||||
/**
|
||||
* Admin 라우트 여부를 확인합니다.
|
||||
*
|
||||
* Controller 네임스페이스로 판단합니다.
|
||||
*
|
||||
* @param Request $request HTTP 요청
|
||||
* @return bool Admin 라우트 여부
|
||||
*/
|
||||
private function isAdminRoute(Request $request): bool
|
||||
{
|
||||
$controller = $request->route()?->getController();
|
||||
|
||||
if (! $controller) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return str_contains(get_class($controller), '\\Admin\\');
|
||||
}
|
||||
}
|
||||
@@ -234,25 +234,6 @@ class CommentResource extends BaseApiResource
|
||||
->toArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* Admin 요청 여부를 확인합니다.
|
||||
*
|
||||
* Controller 네임스페이스로 판단합니다.
|
||||
*
|
||||
* @param Request $request HTTP 요청
|
||||
* @return bool Admin 요청 여부
|
||||
*/
|
||||
private function isAdminRequest(Request $request): bool
|
||||
{
|
||||
$controller = $request->route()?->getController();
|
||||
|
||||
if (! $controller) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return str_contains(get_class($controller), '\\Admin\\');
|
||||
}
|
||||
|
||||
// =========================================================================
|
||||
// 콘텐츠 필터링 메서드
|
||||
// =========================================================================
|
||||
|
||||
@@ -339,23 +339,4 @@ class PostCollection extends BaseApiCollection
|
||||
'can_access_admin' => $this->checkBoardPermission($slug, 'admin.manage'),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Admin 요청 여부를 확인합니다.
|
||||
*
|
||||
* Controller 네임스페이스로 판단합니다.
|
||||
*
|
||||
* @param Request $request HTTP 요청
|
||||
* @return bool Admin 요청 여부
|
||||
*/
|
||||
private function isAdminRequest(Request $request): bool
|
||||
{
|
||||
$controller = $request->route()?->getController();
|
||||
|
||||
if (! $controller) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return str_contains(get_class($controller), '\\Admin\\');
|
||||
}
|
||||
}
|
||||
@@ -656,23 +656,6 @@ class PostResource extends BaseApiResource
|
||||
return $abilities;
|
||||
}
|
||||
|
||||
/**
|
||||
* Admin 요청 여부를 확인합니다.
|
||||
*
|
||||
* @param Request $request HTTP 요청
|
||||
* @return bool Admin 요청 여부
|
||||
*/
|
||||
private function isAdminRequest(Request $request): bool
|
||||
{
|
||||
$controller = $request->route()?->getController();
|
||||
|
||||
if (! $controller) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return str_contains(get_class($controller), '\\Admin\\');
|
||||
}
|
||||
|
||||
/**
|
||||
* 비밀글 내용 열람 가능 여부를 확인합니다.
|
||||
*
|
||||
|
||||
@@ -511,11 +511,11 @@ class EcommerceInquiryHookListener implements HookListenerInterface
|
||||
* 해제 판정에 사용합니다. SoftDeletes 전역 스코프가 삭제된 답변을 제외하므로
|
||||
* "살아있는 답변" 만 집계됩니다.
|
||||
*
|
||||
* @param mixed $carry 이전 필터 결과 (초기값: 0)
|
||||
* @param mixed $carry 이전 필터 결과 (초기값: null = 판정 불가)
|
||||
* @param int $parentPostId 부모 문의 Post ID
|
||||
* @return int 살아있는 답변 수 (조회 실패 시 이전 필터 결과 유지)
|
||||
* @return int|null 살아있는 답변 수 (조회 실패 시 이전 필터 결과 유지 — null 이면 소비측이 판정 불가로 no-op)
|
||||
*/
|
||||
public function countReplies(mixed $carry, int $parentPostId): int
|
||||
public function countReplies(mixed $carry, int $parentPostId): ?int
|
||||
{
|
||||
try {
|
||||
return $this->postRepository->countRepliesByParentId($parentPostId);
|
||||
@@ -525,7 +525,9 @@ class EcommerceInquiryHookListener implements HookListenerInterface
|
||||
'error' => $e->getMessage(),
|
||||
]);
|
||||
|
||||
return (int) $carry;
|
||||
// 실패를 0(답변 없음)으로 접으면 소비측이 답변완료를 오해제한다 —
|
||||
// 판정 불가(null)를 그대로 흘려보낸다.
|
||||
return is_numeric($carry) ? (int) $carry : null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1075,7 +1075,8 @@ class PostRepository implements PostRepositoryInterface
|
||||
$activityType = $filters['activity_type'] ?? 'authored';
|
||||
$sort = $filters['sort'] ?? 'latest'; // latest, oldest, views
|
||||
// 열람자 관점. 이 값이 대상 사용자와 다르면(비로그인 포함) **타인 관점**이므로
|
||||
// 비밀글·미발행글을 내보내지 않는다.
|
||||
// 비밀글·미발행글의 **본문(content_plain)만 비운다** — 행·제목·배지는 목록 화면과
|
||||
// 동일하게 유지한다(제목 공개 정책 2026-02-04, 행 제거가 아니라 본문 마스킹이 의도).
|
||||
//
|
||||
// 종전에는 `is_public` 옵트인 플래그로 이 판정을 했는데, 그 키를 설정하는 코드가
|
||||
// 저장소 어디에도 없어서 필터가 한 번도 적용되지 않았다(사문). 옵트인은 호출부가
|
||||
@@ -1776,6 +1777,7 @@ class PostRepository implements PostRepositoryInterface
|
||||
$descendants = [];
|
||||
|
||||
while ($frontier !== []) {
|
||||
// audit:allow query-unbounded-get reason: 대상은 한 원글의 답글 트리 한 레벨 — 삭제/복원은 트리 전체가 하나의 의사표시라 단일 트랜잭션에서 전량 확보해야 하며(부분 반영 시 원글과 답글 상태가 어긋남), visited 가드가 유한 종료를 보장한다
|
||||
$children = Post::withTrashed()
|
||||
->where('board_id', $board->id)
|
||||
->whereIn('parent_id', $frontier)
|
||||
@@ -2008,7 +2010,7 @@ class PostRepository implements PostRepositoryInterface
|
||||
->whereNull('deleted_at')
|
||||
->whereNull('parent_id')
|
||||
// 노출 제한 필터 — 미발행(블라인드·삭제)·비활성 게시판 글은 대시보드 최신글에서 제외한다.
|
||||
// 비밀글은 제목 공개 정책(2026-01-02)에 따라 관리자에게 제목을 노출한다(제외하지 않음).
|
||||
// 비밀글은 제목 공개 정책(2026-02-04)에 따라 관리자에게 제목을 노출한다(제외하지 않음).
|
||||
->where('status', PostStatus::Published->value)
|
||||
->whereHas('board', fn ($q) => $q->where('is_active', true))
|
||||
->with(['board', 'user'])
|
||||
|
||||
@@ -13,6 +13,7 @@ use App\Extension\Traits\ClearsTemplateCaches;
|
||||
use App\Helpers\PermissionHelper;
|
||||
use App\Models\Menu;
|
||||
use App\Models\Role;
|
||||
use App\Models\User;
|
||||
use App\Repositories\Concerns\ResolvesSortSpec;
|
||||
use App\Services\MenuService;
|
||||
use App\Services\RoleService;
|
||||
|
||||
@@ -81,21 +81,4 @@ class SecretContentGate
|
||||
{
|
||||
return $request->route('slug') ?? ($post->relationLoaded('board') ? $post->board?->slug : null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Admin 요청 여부를 확인합니다.
|
||||
*
|
||||
* @param Request $request HTTP 요청
|
||||
* @return bool Admin 요청 여부
|
||||
*/
|
||||
private function isAdminRequest(Request $request): bool
|
||||
{
|
||||
$controller = $request->route()?->getController();
|
||||
|
||||
if (! $controller) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return str_contains(get_class($controller), '\\Admin\\');
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ namespace Modules\Sirsoft\Board\Traits;
|
||||
use App\Enums\PermissionType;
|
||||
use App\Http\Middleware\PermissionMiddleware;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Modules\Sirsoft\Board\Support\BoardPermissionCacheKeys;
|
||||
|
||||
@@ -16,6 +17,26 @@ use Modules\Sirsoft\Board\Support\BoardPermissionCacheKeys;
|
||||
*/
|
||||
trait ChecksBoardPermission
|
||||
{
|
||||
/**
|
||||
* Admin 화면 요청 여부를 컨트롤러 네임스페이스로 판정합니다.
|
||||
*
|
||||
* 판정 규칙의 단일 지점 — Resource/게이트마다 사설 복제본을 두면 규칙 변경 시
|
||||
* 한 곳만 누락되어 경로별 판정이 갈린다.
|
||||
*
|
||||
* @param Request $request HTTP 요청
|
||||
* @return bool Admin 요청 여부
|
||||
*/
|
||||
protected function isAdminRequest(Request $request): bool
|
||||
{
|
||||
$controller = $request->route()?->getController();
|
||||
|
||||
if (! $controller) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return str_contains(get_class($controller), '\\Admin\\');
|
||||
}
|
||||
|
||||
/**
|
||||
* 게시판 권한을 확인합니다.
|
||||
*
|
||||
|
||||
@@ -334,4 +334,46 @@ class ChecksBoardPermissionTest extends ModuleTestCase
|
||||
// Then: false 반환 (guest role에 권한 미할당)
|
||||
$this->assertFalse($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Admin 요청 판정(컨트롤러 네임스페이스 스니핑)은 트레이트 단일 지점이어야 한다
|
||||
*
|
||||
* 판정 규칙이 Resource/게이트마다 사설 복제되면 규칙 변경 시 한 곳만 누락되어
|
||||
* 경로별 판정이 갈린다. 모듈 src 전체를 스캔하여 `getController()` 호출이
|
||||
* ChecksBoardPermission 트레이트에만 존재함을 고정한다 (열거가 아닌 조건 스캔).
|
||||
*/
|
||||
#[Test]
|
||||
public function admin_요청_판정은_트레이트_단일_지점이다(): void
|
||||
{
|
||||
$srcDir = dirname(__DIR__, 3).'/src';
|
||||
$allowed = str_replace('\\', '/', realpath($srcDir.'/Traits/ChecksBoardPermission.php'));
|
||||
$violations = [];
|
||||
|
||||
$iterator = new \RecursiveIteratorIterator(
|
||||
new \RecursiveDirectoryIterator($srcDir, \FilesystemIterator::SKIP_DOTS)
|
||||
);
|
||||
|
||||
foreach ($iterator as $file) {
|
||||
if ($file->getExtension() !== 'php') {
|
||||
continue;
|
||||
}
|
||||
|
||||
$path = str_replace('\\', '/', $file->getRealPath());
|
||||
|
||||
if ($path === $allowed) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (str_contains((string) file_get_contents($path), 'getController(')) {
|
||||
$violations[] = $path;
|
||||
}
|
||||
}
|
||||
|
||||
$this->assertSame(
|
||||
[],
|
||||
$violations,
|
||||
'Admin 요청 판정 사설 복제본 발견 — ChecksBoardPermission::isAdminRequest() 를 사용할 것: '
|
||||
.implode(', ', $violations)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@
|
||||
형식은 [Keep a Changelog](https://keepachangelog.com/ko/1.1.0/)를 따르며,
|
||||
[Semantic Versioning](https://semver.org/lang/ko/)을 준수합니다.
|
||||
|
||||
## [1.1.1] - 2026-08-17
|
||||
## [1.1.1] - 2026-08-18
|
||||
|
||||
### Security
|
||||
|
||||
@@ -34,6 +34,8 @@
|
||||
|
||||
### Fixed
|
||||
|
||||
- 리뷰를 작성할 수 없을 때의 안내 문구에 사유가 영문 식별자(`already_written` 등) 그대로 표시되던 문제를 수정했습니다. 이제 "이미 작성한 리뷰", "구매확정 전" 처럼 번역된 사유가 표시됩니다.
|
||||
|
||||
#### 상품 문의 답변
|
||||
|
||||
- 이미 답변이 등록된 상품 문의에 답변을 다시 등록하면 답변이 중복으로 쌓이던 문제를 수정했습니다. 이제 안내와 함께 거절되며, 기존 답변을 수정하거나 삭제한 뒤 다시 등록할 수 있습니다. (#106 @Tuwasduliebst 님께서 제보해주셨습니다.)
|
||||
|
||||
@@ -312,13 +312,13 @@ HTTP/1.1 200
|
||||
| 상태코드 | 의미 | 발생 조건 |
|
||||
| --- | --- | --- |
|
||||
| 401 | Unauthenticated | 유효한 Bearer 토큰이 없거나 만료된 경우 |
|
||||
| 403 | Forbidden | 요구 권한(`sirsoft-ecommerce.brands.delete`)이 없거나, 대상 브랜드가 요청자의 **스코프 밖**인 경우 (`auth.scope_denied`). 존재하지 않는 ID 도 스코프 판정에서 먼저 걸려 403 이 된다 |
|
||||
| 400 | Bad Request | 연결된 상품이 있어 삭제가 차단된 경우(`exceptions.brand_has_products` — 상품 수 포함), 또는 삭제 처리 중 예외 발생 (`exceptions.operation_failed`) |
|
||||
| 403 | Forbidden | 요구 권한(`sirsoft-ecommerce.brands.delete`)이 없거나, 대상 브랜드가 요청자의 **스코프 밖**인 경우 (`auth.scope_denied`) |
|
||||
| 400 | Bad Request | 해당 `id` 의 브랜드가 없는 경우(`exceptions.brand_not_found`), 연결된 상품이 있어 삭제가 차단된 경우(`exceptions.brand_has_products` — 상품 수 포함), 또는 삭제 처리 중 도메인 규칙 위반 |
|
||||
| 404 | Not Found | path 파라미터 형식이 라우트에 매칭되지 않는 경우 |
|
||||
|
||||
<!-- @generated:end -->
|
||||
|
||||
**설명** 브랜드 1건을 삭제합니다. `auth:sanctum` + `sirsoft-ecommerce.brands.delete` 권한이 필요하며, `BrandService::deleteBrand()`가 삭제 전 연결된 상품 수를 확인합니다. 연결된 상품이 1개 이상이면 예외가 발생해 삭제가 차단되고 400 오류가 반환되므로, 해당 브랜드의 상품을 먼저 정리하거나 다른 브랜드로 이전해야 삭제할 수 있습니다. 대상이 없으면 404를 반환합니다.
|
||||
**설명** 브랜드 1건을 삭제합니다. `auth:sanctum` + `sirsoft-ecommerce.brands.delete` 권한이 필요하며, `BrandService::deleteBrand()`가 삭제 전 연결된 상품 수를 확인합니다. 연결된 상품이 1개 이상이면 예외가 발생해 삭제가 차단되고 400 오류가 반환되므로, 해당 브랜드의 상품을 먼저 정리하거나 다른 브랜드로 이전해야 삭제할 수 있습니다. 존재하지 않는 ID 는 400(`brand_not_found`)을 반환하고, 존재하지만 요청자의 스코프 밖인 대상은 403(`auth.scope_denied`)을 반환합니다.
|
||||
|
||||
|
||||
### PUT /api/modules/sirsoft-ecommerce/admin/brands/{brand}
|
||||
@@ -422,13 +422,13 @@ HTTP/1.1 200
|
||||
| 상태코드 | 의미 | 발생 조건 |
|
||||
| --- | --- | --- |
|
||||
| 401 | Unauthenticated | 유효한 Bearer 토큰이 없거나 만료된 경우 |
|
||||
| 403 | Forbidden | 요구 권한(`sirsoft-ecommerce.brands.update`)이 없는 경우 |
|
||||
| 404 | Not Found | path 파라미터에 해당하는 리소스가 없는 경우 |
|
||||
| 403 | Forbidden | 요구 권한(`sirsoft-ecommerce.brands.update`)이 없거나, 대상 브랜드가 요청자의 **스코프 밖**인 경우 (`auth.scope_denied`) |
|
||||
| 400 | Bad Request | 해당 `brand` 의 브랜드가 없는 경우(`exceptions.brand_not_found`) 또는 수정 처리 중 도메인 규칙 위반 |
|
||||
| 422 | Unprocessable Entity | 요청 파라미터가 검증 규칙을 위반한 경우 (`error.errors` 에 필드별 메시지) |
|
||||
|
||||
<!-- @generated:end -->
|
||||
|
||||
**설명** 기존 브랜드(path의 `brand`)를 수정합니다. `auth:sanctum` + `sirsoft-ecommerce.brands.update` 권한이 필요하며, `BrandService::updateBrand()`가 검증된 데이터로 갱신한 뒤 `BrandResource`를 반환합니다. `name`은 필수이고 `slug`·`website`·`sort_order`·`is_active`는 선택입니다. 대상이 없거나 처리 중 예외가 발생하면 404 또는 400을 반환하며, `sirsoft-ecommerce.brand.update_validation_rules` 필터로 확장이 검증 규칙을 추가할 수 있습니다.
|
||||
**설명** 기존 브랜드(path의 `brand`)를 수정합니다. `auth:sanctum` + `sirsoft-ecommerce.brands.update` 권한이 필요하며, `BrandService::updateBrand()`가 검증된 데이터로 갱신한 뒤 `BrandResource`를 반환합니다. `name`은 필수이고 `slug`·`website`·`sort_order`·`is_active`는 선택입니다. 존재하지 않는 ID 는 400(`brand_not_found`), 스코프 밖 대상은 403(`auth.scope_denied`)을 반환하며, `sirsoft-ecommerce.brand.update_validation_rules` 필터로 확장이 검증 규칙을 추가할 수 있습니다.
|
||||
|
||||
|
||||
### GET /api/modules/sirsoft-ecommerce/admin/brands/{id}
|
||||
@@ -602,8 +602,8 @@ HTTP/1.1 200
|
||||
| 상태코드 | 의미 | 발생 조건 |
|
||||
| --- | --- | --- |
|
||||
| 401 | Unauthenticated | 유효한 Bearer 토큰이 없거나 만료된 경우 |
|
||||
| 403 | Forbidden | 요구 권한(`sirsoft-ecommerce.brands.update`)이 없는 경우 |
|
||||
| 400 | Bad Request | 해당 `id` 의 브랜드가 없거나 토글 처리 중 예외 발생 (`exceptions.operation_failed`) |
|
||||
| 403 | Forbidden | 요구 권한(`sirsoft-ecommerce.brands.update`)이 없거나, 대상 브랜드가 요청자의 **스코프 밖**인 경우 (`auth.scope_denied`) |
|
||||
| 400 | Bad Request | 해당 `id` 의 브랜드가 없는 경우(`exceptions.brand_not_found`) 또는 토글 처리 중 도메인 규칙 위반 |
|
||||
| 404 | Not Found | path 파라미터 형식이 라우트에 매칭되지 않는 경우 |
|
||||
|
||||
<!-- @generated:end -->
|
||||
|
||||
@@ -402,7 +402,7 @@ HTTP/1.1 201
|
||||
|
||||
| 상태코드 | 의미 | 발생 조건 |
|
||||
| --- | --- | --- |
|
||||
| 400 | Bad Request | 파일 저장 중 예외 발생 (`exceptions.operation_failed`) |
|
||||
| 400 | Bad Request | 파일 저장 중 도메인 규칙 위반 (대상 카테고리 부재 등 — `exceptions.category_not_found` 같은 예외별 구체 키로 응답) |
|
||||
| 401 | Unauthenticated | 유효한 Bearer 토큰이 없거나 만료된 경우 |
|
||||
| 403 | Forbidden | 요구 권한(`sirsoft-ecommerce.categories.update`)이 없는 경우 |
|
||||
| 422 | Unprocessable Entity | 요청 파라미터가 검증 규칙을 위반한 경우 (`error.errors` 에 필드별 메시지). `file` 은 필수이며 `jpeg,png,jpg,gif,svg,webp` 이미지만 허용, 최대 10MB |
|
||||
@@ -466,7 +466,7 @@ HTTP/1.1 200
|
||||
|
||||
| 상태코드 | 의미 | 발생 조건 |
|
||||
| --- | --- | --- |
|
||||
| 400 | Bad Request | 순서 갱신 처리 중 예외 발생 (`exceptions.operation_failed`) |
|
||||
| 400 | Bad Request | 순서 갱신 처리 중 도메인 규칙 위반 (`exceptions.category_not_found` 같은 예외별 구체 키로 응답) |
|
||||
| 401 | Unauthenticated | 유효한 Bearer 토큰이 없거나 만료된 경우 |
|
||||
| 403 | Forbidden | 요구 권한(`sirsoft-ecommerce.categories.update`)이 없는 경우 |
|
||||
| 422 | Unprocessable Entity | 요청 파라미터가 검증 규칙을 위반한 경우 (`error.errors` 에 필드별 메시지). `order` 는 1건 이상 필수이며 각 항목에 정수 `id` 와 0 이상의 정수 `order` 가 필요 |
|
||||
@@ -521,7 +521,7 @@ HTTP/1.1 200
|
||||
|
||||
| 상태코드 | 의미 | 발생 조건 |
|
||||
| --- | --- | --- |
|
||||
| 400 | Bad Request | 이미지 삭제 처리 중 예외 발생 (`exceptions.operation_failed`) |
|
||||
| 400 | Bad Request | 이미지 삭제 처리 중 도메인 규칙 위반 (`exceptions.category_not_found` 같은 예외별 구체 키로 응답) |
|
||||
| 401 | Unauthenticated | 유효한 Bearer 토큰이 없거나 만료된 경우 |
|
||||
| 403 | Forbidden | 요구 권한(`sirsoft-ecommerce.categories.update`)이 없는 경우 |
|
||||
| 404 | Not Found | path 의 이미지 `id` 에 해당하는 카테고리 이미지가 없는 경우 (`messages.category_images.not_found`) |
|
||||
@@ -589,7 +589,7 @@ HTTP/1.1 200
|
||||
|
||||
| 상태코드 | 의미 | 발생 조건 |
|
||||
| --- | --- | --- |
|
||||
| 400 | Bad Request | 순서 갱신 트랜잭션 중 예외 발생 (`exceptions.operation_failed`) |
|
||||
| 400 | Bad Request | 순서 갱신 트랜잭션 중 도메인 규칙 위반 (순환 참조·대상 부재 등 — 예외별 구체 키로 응답) |
|
||||
| 401 | Unauthenticated | 유효한 Bearer 토큰이 없거나 만료된 경우 |
|
||||
| 403 | Forbidden | 요구 권한(`sirsoft-ecommerce.categories.update`)이 없는 경우 |
|
||||
| 422 | Unprocessable Entity | 요청 파라미터가 검증 규칙을 위반한 경우 (`error.errors` 에 필드별 메시지). `parent_menus` / `child_menus` 중 최소 하나가 필요하며, 각 항목의 `id` 는 실제 존재하는 카테고리여야 하고 `order` 는 0 이상의 정수 |
|
||||
@@ -816,7 +816,7 @@ HTTP/1.1 201
|
||||
|
||||
| 상태코드 | 의미 | 발생 조건 |
|
||||
| --- | --- | --- |
|
||||
| 400 | Bad Request | 파일 저장 중 예외 발생 (`exceptions.operation_failed`) |
|
||||
| 400 | Bad Request | 파일 저장 중 도메인 규칙 위반 (대상 카테고리 부재 등 — `exceptions.category_not_found` 같은 예외별 구체 키로 응답) |
|
||||
| 401 | Unauthenticated | 유효한 Bearer 토큰이 없거나 만료된 경우 |
|
||||
| 403 | Forbidden | 요구 권한(`sirsoft-ecommerce.categories.update`)이 없는 경우 |
|
||||
| 404 | Not Found | path 파라미터에 해당하는 리소스가 없는 경우 |
|
||||
@@ -879,12 +879,13 @@ HTTP/1.1 200
|
||||
| --- | --- | --- |
|
||||
| 401 | Unauthenticated | 유효한 Bearer 토큰이 없거나 만료된 경우 |
|
||||
| 403 | Forbidden | 요구 권한(`sirsoft-ecommerce.categories.delete`)이 없는 경우 |
|
||||
| 404 | Not Found | path 파라미터에 해당하는 리소스가 없는 경우 |
|
||||
| 400 | Bad Request | 해당 카테고리가 없거나(`exceptions.category_not_found`), 하위 카테고리(`exceptions.category_has_children`)·연결 상품(`exceptions.category_has_products`)이 있어 삭제가 차단된 경우 |
|
||||
| 404 | Not Found | path 파라미터 형식이 라우트에 매칭되지 않는 경우 |
|
||||
| 500 | Internal Server Error | 서버 내부 오류 — 도메인 규칙 위반이 아닌 예외(인프라 장애·코드 결함)는 4xx 로 뭉개지 않고 500 으로 구분한다 |
|
||||
|
||||
<!-- @generated:end -->
|
||||
|
||||
**설명** 카테고리 1건을 삭제합니다. `auth:sanctum` + `sirsoft-ecommerce.categories.delete` 권한이 필요하며, `CategoryService::deleteCategory()`가 삭제 전 안전 검사를 수행합니다. 하위 카테고리가 있거나 연결된 상품이 존재하면 예외가 발생해 삭제가 차단되고 400 오류가 반환되므로, 자식과 상품을 먼저 정리해야 삭제할 수 있습니다. 대상이 없으면 404를 반환합니다.
|
||||
**설명** 카테고리 1건을 삭제합니다. `auth:sanctum` + `sirsoft-ecommerce.categories.delete` 권한이 필요하며, `CategoryService::deleteCategory()`가 삭제 전 안전 검사를 수행합니다. 하위 카테고리가 있거나 연결된 상품이 존재하면 예외가 발생해 삭제가 차단되고 400 오류(사유별 구체 키)가 반환되므로, 자식과 상품을 먼저 정리해야 삭제할 수 있습니다. 대상이 없으면 400(`category_not_found`)을 반환합니다.
|
||||
|
||||
|
||||
### PUT /api/modules/sirsoft-ecommerce/admin/categories/{category}
|
||||
@@ -1007,7 +1008,7 @@ HTTP/1.1 200
|
||||
|
||||
| 상태코드 | 의미 | 발생 조건 |
|
||||
| --- | --- | --- |
|
||||
| 400 | Bad Request | 대상 카테고리가 없거나 수정 트랜잭션 중 예외 발생 (컨트롤러가 예외를 잡아 `exceptions.operation_failed` 로 응답) |
|
||||
| 400 | Bad Request | 대상 카테고리가 없거나(`exceptions.category_not_found`) 수정 트랜잭션 중 도메인 규칙 위반 (예외별 구체 키로 응답) |
|
||||
| 401 | Unauthenticated | 유효한 Bearer 토큰이 없거나 만료된 경우 |
|
||||
| 403 | Forbidden | 요구 권한(`sirsoft-ecommerce.categories.update`)이 없는 경우 |
|
||||
| 404 | Not Found | path 파라미터에 해당하는 리소스가 없는 경우 |
|
||||
@@ -1172,12 +1173,13 @@ HTTP/1.1 200
|
||||
| --- | --- | --- |
|
||||
| 401 | Unauthenticated | 유효한 Bearer 토큰이 없거나 만료된 경우 |
|
||||
| 403 | Forbidden | 요구 권한(`sirsoft-ecommerce.categories.update`)이 없는 경우 |
|
||||
| 404 | Not Found | path 파라미터에 해당하는 리소스가 없는 경우 |
|
||||
| 400 | Bad Request | 해당 카테고리가 없는 경우(`exceptions.category_not_found`) 또는 토글 처리 중 도메인 규칙 위반 |
|
||||
| 404 | Not Found | path 파라미터 형식이 라우트에 매칭되지 않는 경우 |
|
||||
| 500 | Internal Server Error | 서버 내부 오류 — 도메인 규칙 위반이 아닌 예외(인프라 장애·코드 결함)는 4xx 로 뭉개지 않고 500 으로 구분한다 |
|
||||
|
||||
<!-- @generated:end -->
|
||||
|
||||
**설명** 카테고리의 활성 상태를 토글합니다. `auth:sanctum` + `sirsoft-ecommerce.categories.update` 권한이 필요하며, path의 `id`로 `CategoryService::toggleStatus()`를 호출해 현재 `is_active` 값을 반전시킨 뒤 갱신된 `CategoryResource`를 반환합니다. 관리자 목록에서 노출/비노출을 빠르게 전환할 때 사용하며, 대상이 없거나 처리 중 예외가 발생하면 404 또는 400을 반환합니다.
|
||||
**설명** 카테고리의 활성 상태를 토글합니다. `auth:sanctum` + `sirsoft-ecommerce.categories.update` 권한이 필요하며, path의 `id`로 `CategoryService::toggleStatus()`를 호출해 현재 `is_active` 값을 반전시킨 뒤 갱신된 `CategoryResource`를 반환합니다. 관리자 목록에서 노출/비노출을 빠르게 전환할 때 사용하며, 대상이 없으면 400(`category_not_found`), 도메인 규칙 위반 시 사유별 구체 키의 400 을 반환합니다.
|
||||
|
||||
|
||||
### GET /api/modules/sirsoft-ecommerce/categories
|
||||
|
||||
@@ -18,8 +18,32 @@ class CategoryOperationException extends RuntimeException
|
||||
* @param string $messageKey 다국어 메시지 키 (sirsoft-ecommerce::exceptions.*)
|
||||
* @param array<string, mixed> $replace 메시지 치환 파라미터
|
||||
*/
|
||||
public function __construct(string $messageKey, array $replace = [])
|
||||
{
|
||||
public function __construct(
|
||||
private string $messageKey,
|
||||
private array $replace = []
|
||||
) {
|
||||
parent::__construct(__($messageKey, $replace));
|
||||
}
|
||||
|
||||
/**
|
||||
* 다국어 메시지 키를 반환합니다.
|
||||
*
|
||||
* 컨트롤러가 예외 메시지 원문 대신 이 키로 응답을 구성하기 위한 접근자입니다.
|
||||
*
|
||||
* @return string 다국어 메시지 키
|
||||
*/
|
||||
public function getMessageKey(): string
|
||||
{
|
||||
return $this->messageKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* 메시지 치환 파라미터를 반환합니다.
|
||||
*
|
||||
* @return array<string, mixed> 치환 파라미터
|
||||
*/
|
||||
public function getMessageParams(): array
|
||||
{
|
||||
return $this->replace;
|
||||
}
|
||||
}
|
||||
@@ -32,4 +32,21 @@ class ReviewNotWritableException extends RuntimeException
|
||||
{
|
||||
return $this->reason;
|
||||
}
|
||||
|
||||
/**
|
||||
* 작성 불가 사유의 번역 라벨을 반환합니다.
|
||||
*
|
||||
* 사유 식별자를 그대로 :reason 치환자에 실으면 최종 사용자 화면에 원시
|
||||
* 식별자(already_written 등)가 노출된다. 라벨 키가 없는 미지의 사유는
|
||||
* 식별자를 그대로 반환한다 (라벨 미정의가 표시 자체를 깨면 안 된다).
|
||||
*
|
||||
* @return string 번역된 사유 라벨
|
||||
*/
|
||||
public function getReasonLabel(): string
|
||||
{
|
||||
$key = 'sirsoft-ecommerce::messages.reviews.reasons.'.$this->reason;
|
||||
$label = __($key);
|
||||
|
||||
return $label === $key ? $this->reason : $label;
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,7 @@ use Modules\Sirsoft\Ecommerce\Http\Requests\Admin\UpdateBrandRequest;
|
||||
use Modules\Sirsoft\Ecommerce\Http\Resources\BrandCollection;
|
||||
use Modules\Sirsoft\Ecommerce\Http\Resources\BrandResource;
|
||||
use Modules\Sirsoft\Ecommerce\Services\BrandService;
|
||||
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
|
||||
|
||||
/**
|
||||
* 브랜드 관리 컨트롤러
|
||||
@@ -100,12 +101,19 @@ class BrandController extends AdminBaseController
|
||||
new BrandResource($updatedBrand)
|
||||
);
|
||||
} catch (BrandOperationException $e) {
|
||||
// 도메인 규칙 위반 — 운영자에게 안내 가능한 상황이므로 기존 400 유지
|
||||
return ResponseHelper::moduleError(
|
||||
'sirsoft-ecommerce',
|
||||
'exceptions.operation_failed',
|
||||
400
|
||||
// 도메인 규칙 위반 — 기존 400 유지. 구체 사유(미존재/상품 연결)를 전용
|
||||
// 키로 안내한다 — generic 키로 접으면 운영자가 원인을 알 수 없다
|
||||
// (형제 ClaimReason/ShippingCarrier/ProductLabel destroy 와 동형).
|
||||
$messageKey = $e->getMessageKey();
|
||||
|
||||
return ResponseHelper::error(
|
||||
$messageKey,
|
||||
400,
|
||||
null,
|
||||
$e->getMessageParams()
|
||||
);
|
||||
} catch (AccessDeniedHttpException $e) {
|
||||
return ResponseHelper::forbidden('auth.scope_denied');
|
||||
} catch (\Exception $e) {
|
||||
// 서버 결함/인프라 장애 — 4xx 로 뭉개면 장애가 입력 오류로 위장된다
|
||||
return ResponseHelper::moduleError(
|
||||
@@ -133,12 +141,19 @@ class BrandController extends AdminBaseController
|
||||
new BrandResource($updatedBrand)
|
||||
);
|
||||
} catch (BrandOperationException $e) {
|
||||
// 도메인 규칙 위반 — 운영자에게 안내 가능한 상황이므로 기존 400 유지
|
||||
return ResponseHelper::moduleError(
|
||||
'sirsoft-ecommerce',
|
||||
'exceptions.operation_failed',
|
||||
400
|
||||
// 도메인 규칙 위반 — 기존 400 유지. 구체 사유(미존재/상품 연결)를 전용
|
||||
// 키로 안내한다 — generic 키로 접으면 운영자가 원인을 알 수 없다
|
||||
// (형제 ClaimReason/ShippingCarrier/ProductLabel destroy 와 동형).
|
||||
$messageKey = $e->getMessageKey();
|
||||
|
||||
return ResponseHelper::error(
|
||||
$messageKey,
|
||||
400,
|
||||
null,
|
||||
$e->getMessageParams()
|
||||
);
|
||||
} catch (AccessDeniedHttpException $e) {
|
||||
return ResponseHelper::forbidden('auth.scope_denied');
|
||||
} catch (\Exception $e) {
|
||||
// 서버 결함/인프라 장애 — 4xx 로 뭉개면 장애가 입력 오류로 위장된다
|
||||
return ResponseHelper::moduleError(
|
||||
@@ -166,12 +181,19 @@ class BrandController extends AdminBaseController
|
||||
$result
|
||||
);
|
||||
} catch (BrandOperationException $e) {
|
||||
// 도메인 규칙 위반 — 운영자에게 안내 가능한 상황이므로 기존 400 유지
|
||||
return ResponseHelper::moduleError(
|
||||
'sirsoft-ecommerce',
|
||||
'exceptions.operation_failed',
|
||||
400
|
||||
// 도메인 규칙 위반 — 기존 400 유지. 구체 사유(미존재/상품 연결)를 전용
|
||||
// 키로 안내한다 — generic 키로 접으면 운영자가 원인을 알 수 없다
|
||||
// (형제 ClaimReason/ShippingCarrier/ProductLabel destroy 와 동형).
|
||||
$messageKey = $e->getMessageKey();
|
||||
|
||||
return ResponseHelper::error(
|
||||
$messageKey,
|
||||
400,
|
||||
null,
|
||||
$e->getMessageParams()
|
||||
);
|
||||
} catch (AccessDeniedHttpException $e) {
|
||||
return ResponseHelper::forbidden('auth.scope_denied');
|
||||
} catch (\Exception $e) {
|
||||
// 서버 결함/인프라 장애 — 4xx 로 뭉개면 장애가 입력 오류로 위장된다
|
||||
return ResponseHelper::moduleError(
|
||||
|
||||
+63
-35
@@ -127,11 +127,15 @@ class CategoryController extends AdminBaseController
|
||||
new CategoryResource($updatedCategory)
|
||||
);
|
||||
} catch (CategoryOperationException $e) {
|
||||
// 도메인 규칙 위반 — 운영자에게 안내 가능한 상황이므로 기존 400 유지
|
||||
return ResponseHelper::moduleError(
|
||||
'sirsoft-ecommerce',
|
||||
'exceptions.operation_failed',
|
||||
400
|
||||
// 도메인 규칙 위반 — 기존 400 유지. 구체 사유(미존재/하위·상품 연결)를
|
||||
// 전용 키로 안내한다 (형제 Brand/ClaimReason destroy 와 동형).
|
||||
$messageKey = $e->getMessageKey();
|
||||
|
||||
return ResponseHelper::error(
|
||||
$messageKey,
|
||||
400,
|
||||
null,
|
||||
$e->getMessageParams()
|
||||
);
|
||||
} catch (\Exception $e) {
|
||||
// 서버 결함/인프라 장애 — 4xx 로 뭉개면 장애가 입력 오류로 위장된다
|
||||
@@ -160,11 +164,15 @@ class CategoryController extends AdminBaseController
|
||||
$result
|
||||
);
|
||||
} catch (CategoryOperationException $e) {
|
||||
// 도메인 규칙 위반 — 운영자에게 안내 가능한 상황이므로 기존 400 유지
|
||||
return ResponseHelper::moduleError(
|
||||
'sirsoft-ecommerce',
|
||||
'exceptions.operation_failed',
|
||||
400
|
||||
// 도메인 규칙 위반 — 기존 400 유지. 구체 사유(미존재/하위·상품 연결)를
|
||||
// 전용 키로 안내한다 (형제 Brand/ClaimReason destroy 와 동형).
|
||||
$messageKey = $e->getMessageKey();
|
||||
|
||||
return ResponseHelper::error(
|
||||
$messageKey,
|
||||
400,
|
||||
null,
|
||||
$e->getMessageParams()
|
||||
);
|
||||
} catch (\Exception $e) {
|
||||
// 서버 결함/인프라 장애 — 4xx 로 뭉개면 장애가 입력 오류로 위장된다
|
||||
@@ -217,11 +225,15 @@ class CategoryController extends AdminBaseController
|
||||
201
|
||||
);
|
||||
} catch (CategoryOperationException $e) {
|
||||
// 도메인 규칙 위반 — 운영자에게 안내 가능한 상황이므로 기존 400 유지
|
||||
return ResponseHelper::moduleError(
|
||||
'sirsoft-ecommerce',
|
||||
'exceptions.operation_failed',
|
||||
400
|
||||
// 도메인 규칙 위반 — 기존 400 유지. 구체 사유(미존재/하위·상품 연결)를
|
||||
// 전용 키로 안내한다 (형제 Brand/ClaimReason destroy 와 동형).
|
||||
$messageKey = $e->getMessageKey();
|
||||
|
||||
return ResponseHelper::error(
|
||||
$messageKey,
|
||||
400,
|
||||
null,
|
||||
$e->getMessageParams()
|
||||
);
|
||||
} catch (\Exception $e) {
|
||||
// 서버 결함/인프라 장애 — 4xx 로 뭉개면 장애가 입력 오류로 위장된다
|
||||
@@ -257,11 +269,15 @@ class CategoryController extends AdminBaseController
|
||||
'messages.category_images.deleted'
|
||||
);
|
||||
} catch (CategoryOperationException $e) {
|
||||
// 도메인 규칙 위반 — 운영자에게 안내 가능한 상황이므로 기존 400 유지
|
||||
return ResponseHelper::moduleError(
|
||||
'sirsoft-ecommerce',
|
||||
'exceptions.operation_failed',
|
||||
400
|
||||
// 도메인 규칙 위반 — 기존 400 유지. 구체 사유(미존재/하위·상품 연결)를
|
||||
// 전용 키로 안내한다 (형제 Brand/ClaimReason destroy 와 동형).
|
||||
$messageKey = $e->getMessageKey();
|
||||
|
||||
return ResponseHelper::error(
|
||||
$messageKey,
|
||||
400,
|
||||
null,
|
||||
$e->getMessageParams()
|
||||
);
|
||||
} catch (\Exception $e) {
|
||||
// 서버 결함/인프라 장애 — 4xx 로 뭉개면 장애가 입력 오류로 위장된다
|
||||
@@ -291,11 +307,15 @@ class CategoryController extends AdminBaseController
|
||||
'messages.category_images.reordered'
|
||||
);
|
||||
} catch (CategoryOperationException $e) {
|
||||
// 도메인 규칙 위반 — 운영자에게 안내 가능한 상황이므로 기존 400 유지
|
||||
return ResponseHelper::moduleError(
|
||||
'sirsoft-ecommerce',
|
||||
'exceptions.operation_failed',
|
||||
400
|
||||
// 도메인 규칙 위반 — 기존 400 유지. 구체 사유(미존재/하위·상품 연결)를
|
||||
// 전용 키로 안내한다 (형제 Brand/ClaimReason destroy 와 동형).
|
||||
$messageKey = $e->getMessageKey();
|
||||
|
||||
return ResponseHelper::error(
|
||||
$messageKey,
|
||||
400,
|
||||
null,
|
||||
$e->getMessageParams()
|
||||
);
|
||||
} catch (\Exception $e) {
|
||||
// 서버 결함/인프라 장애 — 4xx 로 뭉개면 장애가 입력 오류로 위장된다
|
||||
@@ -355,11 +375,15 @@ class CategoryController extends AdminBaseController
|
||||
new CategoryResource($category)
|
||||
);
|
||||
} catch (CategoryOperationException $e) {
|
||||
// 도메인 규칙 위반 — 운영자에게 안내 가능한 상황이므로 기존 400 유지
|
||||
return ResponseHelper::moduleError(
|
||||
'sirsoft-ecommerce',
|
||||
'exceptions.operation_failed',
|
||||
400
|
||||
// 도메인 규칙 위반 — 기존 400 유지. 구체 사유(미존재/하위·상품 연결)를
|
||||
// 전용 키로 안내한다 (형제 Brand/ClaimReason destroy 와 동형).
|
||||
$messageKey = $e->getMessageKey();
|
||||
|
||||
return ResponseHelper::error(
|
||||
$messageKey,
|
||||
400,
|
||||
null,
|
||||
$e->getMessageParams()
|
||||
);
|
||||
} catch (\Exception $e) {
|
||||
// 서버 결함/인프라 장애 — 4xx 로 뭉개면 장애가 입력 오류로 위장된다
|
||||
@@ -440,11 +464,15 @@ class CategoryController extends AdminBaseController
|
||||
'messages.categories.order_updated'
|
||||
);
|
||||
} catch (CategoryOperationException $e) {
|
||||
// 도메인 규칙 위반 — 운영자에게 안내 가능한 상황이므로 기존 400 유지
|
||||
return ResponseHelper::moduleError(
|
||||
'sirsoft-ecommerce',
|
||||
'exceptions.operation_failed',
|
||||
400
|
||||
// 도메인 규칙 위반 — 기존 400 유지. 구체 사유(미존재/하위·상품 연결)를
|
||||
// 전용 키로 안내한다 (형제 Brand/ClaimReason destroy 와 동형).
|
||||
$messageKey = $e->getMessageKey();
|
||||
|
||||
return ResponseHelper::error(
|
||||
$messageKey,
|
||||
400,
|
||||
null,
|
||||
$e->getMessageParams()
|
||||
);
|
||||
} catch (\Exception $e) {
|
||||
// 서버 결함/인프라 장애 — 4xx 로 뭉개면 장애가 입력 오류로 위장된다
|
||||
|
||||
@@ -17,6 +17,7 @@ use Modules\Sirsoft\Ecommerce\Http\Resources\CouponIssueCollection;
|
||||
use Modules\Sirsoft\Ecommerce\Http\Resources\CouponIssueResource;
|
||||
use Modules\Sirsoft\Ecommerce\Http\Resources\CouponResource;
|
||||
use Modules\Sirsoft\Ecommerce\Services\CouponService;
|
||||
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
|
||||
|
||||
/**
|
||||
* 쿠폰 관리 컨트롤러
|
||||
@@ -114,6 +115,8 @@ class CouponController extends AdminBaseController
|
||||
'exceptions.operation_failed',
|
||||
400
|
||||
);
|
||||
} catch (AccessDeniedHttpException $e) {
|
||||
return ResponseHelper::forbidden('auth.scope_denied');
|
||||
} catch (\Exception $e) {
|
||||
// 서버 결함/인프라 장애 — 4xx 로 뭉개면 장애가 입력 오류로 위장된다
|
||||
return ResponseHelper::moduleError(
|
||||
@@ -147,6 +150,8 @@ class CouponController extends AdminBaseController
|
||||
'exceptions.operation_failed',
|
||||
400
|
||||
);
|
||||
} catch (AccessDeniedHttpException $e) {
|
||||
return ResponseHelper::forbidden('auth.scope_denied');
|
||||
} catch (\Exception $e) {
|
||||
// 서버 결함/인프라 장애 — 4xx 로 뭉개면 장애가 입력 오류로 위장된다
|
||||
return ResponseHelper::moduleError(
|
||||
@@ -212,6 +217,8 @@ class CouponController extends AdminBaseController
|
||||
'exceptions.operation_failed',
|
||||
400
|
||||
);
|
||||
} catch (AccessDeniedHttpException $e) {
|
||||
return ResponseHelper::forbidden('auth.scope_denied');
|
||||
} catch (\Exception $e) {
|
||||
// 서버 결함/인프라 장애 — 4xx 로 뭉개면 장애가 입력 오류로 위장된다
|
||||
return ResponseHelper::moduleError(
|
||||
@@ -250,6 +257,8 @@ class CouponController extends AdminBaseController
|
||||
null,
|
||||
$e->getMessageParams()
|
||||
);
|
||||
} catch (AccessDeniedHttpException $e) {
|
||||
return ResponseHelper::forbidden('auth.scope_denied');
|
||||
} catch (\Exception $e) {
|
||||
// 서버 결함/인프라 장애 — 4xx 로 뭉개면 장애가 입력 오류로 위장된다
|
||||
return ResponseHelper::moduleError(
|
||||
@@ -294,6 +303,8 @@ class CouponController extends AdminBaseController
|
||||
null,
|
||||
$e->getMessageParams()
|
||||
);
|
||||
} catch (AccessDeniedHttpException $e) {
|
||||
return ResponseHelper::forbidden('auth.scope_denied');
|
||||
} catch (\Exception $e) {
|
||||
// 서버 결함/인프라 장애 — 4xx 로 뭉개면 장애가 입력 오류로 위장된다
|
||||
return ResponseHelper::moduleError(
|
||||
|
||||
+15
@@ -14,6 +14,7 @@ use Modules\Sirsoft\Ecommerce\Http\Requests\Admin\ExtraFeeTemplateUpdateRequest;
|
||||
use Modules\Sirsoft\Ecommerce\Http\Resources\ExtraFeeTemplateCollection;
|
||||
use Modules\Sirsoft\Ecommerce\Http\Resources\ExtraFeeTemplateResource;
|
||||
use Modules\Sirsoft\Ecommerce\Services\ExtraFeeTemplateService;
|
||||
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
|
||||
|
||||
/**
|
||||
* 추가배송비 템플릿 관리 컨트롤러
|
||||
@@ -86,6 +87,8 @@ class ExtraFeeTemplateController extends AdminBaseController
|
||||
new ExtraFeeTemplateResource($template),
|
||||
201
|
||||
);
|
||||
} catch (AccessDeniedHttpException $e) {
|
||||
return ResponseHelper::forbidden('auth.scope_denied');
|
||||
} catch (\Exception $e) {
|
||||
// 서버 결함/인프라 장애 — 4xx 로 뭉개면 장애가 입력 오류로 위장된다
|
||||
return ResponseHelper::moduleError(
|
||||
@@ -123,6 +126,8 @@ class ExtraFeeTemplateController extends AdminBaseController
|
||||
'messages.extra_fee_template.updated',
|
||||
new ExtraFeeTemplateResource($updatedTemplate)
|
||||
);
|
||||
} catch (AccessDeniedHttpException $e) {
|
||||
return ResponseHelper::forbidden('auth.scope_denied');
|
||||
} catch (\Exception $e) {
|
||||
// 서버 결함/인프라 장애 — 4xx 로 뭉개면 장애가 입력 오류로 위장된다
|
||||
return ResponseHelper::moduleError(
|
||||
@@ -158,6 +163,8 @@ class ExtraFeeTemplateController extends AdminBaseController
|
||||
'sirsoft-ecommerce',
|
||||
'messages.extra_fee_template.deleted'
|
||||
);
|
||||
} catch (AccessDeniedHttpException $e) {
|
||||
return ResponseHelper::forbidden('auth.scope_denied');
|
||||
} catch (\Exception $e) {
|
||||
// 서버 결함/인프라 장애 — 4xx 로 뭉개면 장애가 입력 오류로 위장된다
|
||||
return ResponseHelper::moduleError(
|
||||
@@ -194,6 +201,8 @@ class ExtraFeeTemplateController extends AdminBaseController
|
||||
'messages.extra_fee_template.toggled',
|
||||
new ExtraFeeTemplateResource($updatedTemplate)
|
||||
);
|
||||
} catch (AccessDeniedHttpException $e) {
|
||||
return ResponseHelper::forbidden('auth.scope_denied');
|
||||
} catch (\Exception $e) {
|
||||
// 서버 결함/인프라 장애 — 4xx 로 뭉개면 장애가 입력 오류로 위장된다
|
||||
return ResponseHelper::moduleError(
|
||||
@@ -220,6 +229,8 @@ class ExtraFeeTemplateController extends AdminBaseController
|
||||
'messages.extra_fee_template.bulk_deleted',
|
||||
['deleted_count' => $count]
|
||||
);
|
||||
} catch (AccessDeniedHttpException $e) {
|
||||
return ResponseHelper::forbidden('auth.scope_denied');
|
||||
} catch (\Exception $e) {
|
||||
// 서버 결함/인프라 장애 — 4xx 로 뭉개면 장애가 입력 오류로 위장된다
|
||||
return ResponseHelper::moduleError(
|
||||
@@ -250,6 +261,8 @@ class ExtraFeeTemplateController extends AdminBaseController
|
||||
'messages.extra_fee_template.bulk_toggled',
|
||||
['updated_count' => $count]
|
||||
);
|
||||
} catch (AccessDeniedHttpException $e) {
|
||||
return ResponseHelper::forbidden('auth.scope_denied');
|
||||
} catch (\Exception $e) {
|
||||
// 서버 결함/인프라 장애 — 4xx 로 뭉개면 장애가 입력 오류로 위장된다
|
||||
return ResponseHelper::moduleError(
|
||||
@@ -277,6 +290,8 @@ class ExtraFeeTemplateController extends AdminBaseController
|
||||
['created_count' => $count],
|
||||
201
|
||||
);
|
||||
} catch (AccessDeniedHttpException $e) {
|
||||
return ResponseHelper::forbidden('auth.scope_denied');
|
||||
} catch (\Exception $e) {
|
||||
// 서버 결함/인프라 장애 — 4xx 로 뭉개면 장애가 입력 오류로 위장된다
|
||||
return ResponseHelper::moduleError(
|
||||
|
||||
@@ -34,6 +34,7 @@ use Modules\Sirsoft\Ecommerce\Services\OrderCancellationService;
|
||||
use Modules\Sirsoft\Ecommerce\Services\OrderOptionService;
|
||||
use Modules\Sirsoft\Ecommerce\Services\OrderProcessingService;
|
||||
use Modules\Sirsoft\Ecommerce\Services\OrderService;
|
||||
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
|
||||
|
||||
/**
|
||||
* 주문 관리 컨트롤러
|
||||
@@ -70,6 +71,8 @@ class OrderController extends AdminBaseController
|
||||
'messages.orders.fetch_success',
|
||||
$collection->withStatistics($statistics)
|
||||
);
|
||||
} catch (AccessDeniedHttpException $e) {
|
||||
return ResponseHelper::forbidden('auth.scope_denied');
|
||||
} catch (Exception $e) {
|
||||
return ResponseHelper::moduleError(
|
||||
'sirsoft-ecommerce',
|
||||
@@ -103,6 +106,8 @@ class OrderController extends AdminBaseController
|
||||
'messages.orders.fetch_success',
|
||||
new OrderResource($order)
|
||||
);
|
||||
} catch (AccessDeniedHttpException $e) {
|
||||
return ResponseHelper::forbidden('auth.scope_denied');
|
||||
} catch (Exception $e) {
|
||||
return ResponseHelper::moduleError(
|
||||
'sirsoft-ecommerce',
|
||||
@@ -135,6 +140,8 @@ class OrderController extends AdminBaseController
|
||||
'messages.orders.update_failed',
|
||||
422
|
||||
);
|
||||
} catch (AccessDeniedHttpException $e) {
|
||||
return ResponseHelper::forbidden('auth.scope_denied');
|
||||
} catch (Exception $e) {
|
||||
return ResponseHelper::moduleError(
|
||||
'sirsoft-ecommerce',
|
||||
@@ -167,6 +174,8 @@ class OrderController extends AdminBaseController
|
||||
'messages.orders.bulk_update_failed',
|
||||
422
|
||||
);
|
||||
} catch (AccessDeniedHttpException $e) {
|
||||
return ResponseHelper::forbidden('auth.scope_denied');
|
||||
} catch (Exception $e) {
|
||||
return ResponseHelper::moduleError(
|
||||
'sirsoft-ecommerce',
|
||||
@@ -193,6 +202,8 @@ class OrderController extends AdminBaseController
|
||||
'messages.orders.deleted',
|
||||
['deleted' => true]
|
||||
);
|
||||
} catch (AccessDeniedHttpException $e) {
|
||||
return ResponseHelper::forbidden('auth.scope_denied');
|
||||
} catch (Exception $e) {
|
||||
return ResponseHelper::moduleError(
|
||||
'sirsoft-ecommerce',
|
||||
@@ -250,6 +261,8 @@ class OrderController extends AdminBaseController
|
||||
'messages.orders.option_status_change_failed',
|
||||
400
|
||||
);
|
||||
} catch (AccessDeniedHttpException $e) {
|
||||
return ResponseHelper::forbidden('auth.scope_denied');
|
||||
} catch (Exception $e) {
|
||||
return ResponseHelper::moduleError(
|
||||
'sirsoft-ecommerce',
|
||||
@@ -276,6 +289,8 @@ class OrderController extends AdminBaseController
|
||||
'sirsoft-ecommerce',
|
||||
'messages.orders.email_sent'
|
||||
);
|
||||
} catch (AccessDeniedHttpException $e) {
|
||||
return ResponseHelper::forbidden('auth.scope_denied');
|
||||
} catch (Exception $e) {
|
||||
return ResponseHelper::moduleError(
|
||||
'sirsoft-ecommerce',
|
||||
@@ -307,6 +322,8 @@ class OrderController extends AdminBaseController
|
||||
'messages.orders.estimate_refund_success',
|
||||
$result->toPreviewArray()
|
||||
);
|
||||
} catch (AccessDeniedHttpException $e) {
|
||||
return ResponseHelper::forbidden('auth.scope_denied');
|
||||
} catch (Exception $e) {
|
||||
Log::error('환불 예상금액 계산 실패', [
|
||||
'order_id' => $order->id,
|
||||
@@ -365,12 +382,17 @@ class OrderController extends AdminBaseController
|
||||
new OrderResource($updatedOrder)
|
||||
);
|
||||
} catch (OrderCancellationException $e) {
|
||||
// 취소 도메인 규칙 위반 — 운영자에게 안내 가능한 상황이므로 422
|
||||
// 취소 도메인 규칙 위반 — 운영자에게 안내 가능한 상황이므로 422.
|
||||
// detail 은 PG 환불 거절 사유 등 조치 근거다 — 관리자 전용 면의 errors
|
||||
// 페이로드는 진단 정보로 허용된다(감추면 서버 로그 없이는 조치 불가).
|
||||
return ResponseHelper::moduleError(
|
||||
'sirsoft-ecommerce',
|
||||
'messages.orders.cancel_failed',
|
||||
422
|
||||
422,
|
||||
['detail' => $e->getMessage()]
|
||||
);
|
||||
} catch (AccessDeniedHttpException $e) {
|
||||
return ResponseHelper::forbidden('auth.scope_denied');
|
||||
} catch (Exception $e) {
|
||||
Log::error('주문 취소 실패 (관리자)', [
|
||||
'order_id' => $order->id,
|
||||
@@ -422,12 +444,17 @@ class OrderController extends AdminBaseController
|
||||
['detail' => $e->getMessage()]
|
||||
);
|
||||
} catch (OrderProcessingException|OrderAmountChangedException $e) {
|
||||
// 입금확인 도메인 규칙 위반(전이 불가 상태/결제예정금액 변동) — 422
|
||||
// 입금확인 도메인 규칙 위반(전이 불가 상태/결제예정금액 변동) — 422.
|
||||
// detail 은 같은 메서드의 PaymentAmountMismatchException 과 동일한 관리자
|
||||
// 진단 통로다 — 한 메서드 안에서 노출 수준이 갈리면 안 된다.
|
||||
return ResponseHelper::moduleError(
|
||||
'sirsoft-ecommerce',
|
||||
'messages.orders.deposit_confirm_failed',
|
||||
422
|
||||
422,
|
||||
['detail' => $e->getMessage()]
|
||||
);
|
||||
} catch (AccessDeniedHttpException $e) {
|
||||
return ResponseHelper::forbidden('auth.scope_denied');
|
||||
} catch (Exception $e) {
|
||||
Log::error('무통장 입금확인 실패 (관리자)', [
|
||||
'order_id' => $order->id,
|
||||
@@ -473,6 +500,8 @@ class OrderController extends AdminBaseController
|
||||
'sirsoft-ecommerce',
|
||||
'messages.orders.guest_password_reset_success'
|
||||
);
|
||||
} catch (AccessDeniedHttpException $e) {
|
||||
return ResponseHelper::forbidden('auth.scope_denied');
|
||||
} catch (Exception $e) {
|
||||
Log::error('비회원 조회 비밀번호 재설정 실패', [
|
||||
'order_id' => $order->id,
|
||||
@@ -505,6 +534,8 @@ class OrderController extends AdminBaseController
|
||||
'messages.orders.logs_fetch_success',
|
||||
ActivityLogResource::collection($logs)->response()->getData(true)
|
||||
);
|
||||
} catch (AccessDeniedHttpException $e) {
|
||||
return ResponseHelper::forbidden('auth.scope_denied');
|
||||
} catch (Exception $e) {
|
||||
return ResponseHelper::moduleError(
|
||||
'sirsoft-ecommerce',
|
||||
|
||||
@@ -31,6 +31,7 @@ use Modules\Sirsoft\Ecommerce\Http\Resources\ProductResource;
|
||||
use Modules\Sirsoft\Ecommerce\Models\Product;
|
||||
use Modules\Sirsoft\Ecommerce\Services\ProductImageService;
|
||||
use Modules\Sirsoft\Ecommerce\Services\ProductService;
|
||||
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
|
||||
|
||||
/**
|
||||
* 상품 관리 컨트롤러
|
||||
@@ -64,6 +65,8 @@ class ProductController extends AdminBaseController
|
||||
'messages.products.fetch_success',
|
||||
$collection->withStatistics($statistics)
|
||||
);
|
||||
} catch (AccessDeniedHttpException $e) {
|
||||
return ResponseHelper::forbidden('auth.scope_denied');
|
||||
} catch (Exception $e) {
|
||||
return ResponseHelper::moduleError(
|
||||
'sirsoft-ecommerce',
|
||||
@@ -111,6 +114,8 @@ class ProductController extends AdminBaseController
|
||||
'product_ids' => $result['product_ids'],
|
||||
]
|
||||
);
|
||||
} catch (AccessDeniedHttpException $e) {
|
||||
return ResponseHelper::forbidden('auth.scope_denied');
|
||||
} catch (Exception $e) {
|
||||
Log::error('상품 옵션 배치 조회 실패', ['message' => $e->getMessage()]);
|
||||
|
||||
@@ -152,6 +157,8 @@ class ProductController extends AdminBaseController
|
||||
'messages.products.fetch_success',
|
||||
new ProductResource($product)
|
||||
);
|
||||
} catch (AccessDeniedHttpException $e) {
|
||||
return ResponseHelper::forbidden('auth.scope_denied');
|
||||
} catch (Exception $e) {
|
||||
return ResponseHelper::moduleError(
|
||||
'sirsoft-ecommerce',
|
||||
@@ -187,6 +194,8 @@ class ProductController extends AdminBaseController
|
||||
422,
|
||||
$e->errors()
|
||||
);
|
||||
} catch (AccessDeniedHttpException $e) {
|
||||
return ResponseHelper::forbidden('auth.scope_denied');
|
||||
} catch (Exception $e) {
|
||||
Log::error('상품 등록 실패', [
|
||||
'message' => $e->getMessage(),
|
||||
@@ -228,6 +237,8 @@ class ProductController extends AdminBaseController
|
||||
422,
|
||||
$e->errors()
|
||||
);
|
||||
} catch (AccessDeniedHttpException $e) {
|
||||
return ResponseHelper::forbidden('auth.scope_denied');
|
||||
} catch (Exception $e) {
|
||||
Log::error('상품 수정 실패', [
|
||||
'product_id' => $product->id,
|
||||
@@ -262,6 +273,8 @@ class ProductController extends AdminBaseController
|
||||
'messages.products.can_delete_checked',
|
||||
$result
|
||||
);
|
||||
} catch (AccessDeniedHttpException $e) {
|
||||
return ResponseHelper::forbidden('auth.scope_denied');
|
||||
} catch (Exception $e) {
|
||||
return ResponseHelper::moduleError(
|
||||
'sirsoft-ecommerce',
|
||||
@@ -312,6 +325,8 @@ class ProductController extends AdminBaseController
|
||||
null,
|
||||
['count' => $count]
|
||||
);
|
||||
} catch (AccessDeniedHttpException $e) {
|
||||
return ResponseHelper::forbidden('auth.scope_denied');
|
||||
} catch (Exception $e) {
|
||||
return ResponseHelper::moduleError(
|
||||
'sirsoft-ecommerce',
|
||||
@@ -350,6 +365,8 @@ class ProductController extends AdminBaseController
|
||||
'messages.products.bulk_update_failed',
|
||||
422
|
||||
);
|
||||
} catch (AccessDeniedHttpException $e) {
|
||||
return ResponseHelper::forbidden('auth.scope_denied');
|
||||
} catch (Exception $e) {
|
||||
return ResponseHelper::moduleError(
|
||||
'sirsoft-ecommerce',
|
||||
@@ -389,6 +406,8 @@ class ProductController extends AdminBaseController
|
||||
'messages.products.bulk_price_update_failed',
|
||||
422
|
||||
);
|
||||
} catch (AccessDeniedHttpException $e) {
|
||||
return ResponseHelper::forbidden('auth.scope_denied');
|
||||
} catch (Exception $e) {
|
||||
return ResponseHelper::moduleError(
|
||||
'sirsoft-ecommerce',
|
||||
@@ -427,6 +446,8 @@ class ProductController extends AdminBaseController
|
||||
'messages.products.bulk_stock_update_failed',
|
||||
422
|
||||
);
|
||||
} catch (AccessDeniedHttpException $e) {
|
||||
return ResponseHelper::forbidden('auth.scope_denied');
|
||||
} catch (Exception $e) {
|
||||
return ResponseHelper::moduleError(
|
||||
'sirsoft-ecommerce',
|
||||
@@ -473,6 +494,8 @@ class ProductController extends AdminBaseController
|
||||
'messages.products.bulk_update_failed',
|
||||
422
|
||||
);
|
||||
} catch (AccessDeniedHttpException $e) {
|
||||
return ResponseHelper::forbidden('auth.scope_denied');
|
||||
} catch (Exception $e) {
|
||||
return ResponseHelper::moduleError(
|
||||
'sirsoft-ecommerce',
|
||||
@@ -497,6 +520,8 @@ class ProductController extends AdminBaseController
|
||||
'messages.products.code_generated',
|
||||
['product_code' => $code]
|
||||
);
|
||||
} catch (AccessDeniedHttpException $e) {
|
||||
return ResponseHelper::forbidden('auth.scope_denied');
|
||||
} catch (Exception $e) {
|
||||
return ResponseHelper::moduleError(
|
||||
'sirsoft-ecommerce',
|
||||
@@ -530,6 +555,8 @@ class ProductController extends AdminBaseController
|
||||
'messages.products.fetch_success',
|
||||
new ProductResource($product)
|
||||
);
|
||||
} catch (AccessDeniedHttpException $e) {
|
||||
return ResponseHelper::forbidden('auth.scope_denied');
|
||||
} catch (Exception $e) {
|
||||
return ResponseHelper::moduleError(
|
||||
'sirsoft-ecommerce',
|
||||
@@ -572,6 +599,8 @@ class ProductController extends AdminBaseController
|
||||
'messages.products.update_failed',
|
||||
422
|
||||
);
|
||||
} catch (AccessDeniedHttpException $e) {
|
||||
return ResponseHelper::forbidden('auth.scope_denied');
|
||||
} catch (Exception $e) {
|
||||
return ResponseHelper::moduleError(
|
||||
'sirsoft-ecommerce',
|
||||
@@ -605,6 +634,8 @@ class ProductController extends AdminBaseController
|
||||
'messages.products.fetch_success',
|
||||
$formData
|
||||
);
|
||||
} catch (AccessDeniedHttpException $e) {
|
||||
return ResponseHelper::forbidden('auth.scope_denied');
|
||||
} catch (Exception $e) {
|
||||
return ResponseHelper::moduleError(
|
||||
'sirsoft-ecommerce',
|
||||
@@ -672,6 +703,8 @@ class ProductController extends AdminBaseController
|
||||
'messages.products.fetch_success',
|
||||
$copyData
|
||||
);
|
||||
} catch (AccessDeniedHttpException $e) {
|
||||
return ResponseHelper::forbidden('auth.scope_denied');
|
||||
} catch (Exception $e) {
|
||||
return ResponseHelper::moduleError(
|
||||
'sirsoft-ecommerce',
|
||||
@@ -731,6 +764,8 @@ class ProductController extends AdminBaseController
|
||||
['max' => $e->maxImages],
|
||||
'sirsoft-ecommerce'
|
||||
);
|
||||
} catch (AccessDeniedHttpException $e) {
|
||||
return ResponseHelper::forbidden('auth.scope_denied');
|
||||
} catch (Exception $e) {
|
||||
// 개수 상한 초과는 위에서 typed 로 분기된다 — 여기 도달하면 서버 결함/인프라 장애다
|
||||
Log::error('상품 이미지 업로드 실패', [
|
||||
@@ -777,6 +812,8 @@ class ProductController extends AdminBaseController
|
||||
'exceptions.operation_failed',
|
||||
400
|
||||
);
|
||||
} catch (AccessDeniedHttpException $e) {
|
||||
return ResponseHelper::forbidden('auth.scope_denied');
|
||||
} catch (Exception $e) {
|
||||
// 서버 결함/인프라 장애 — 4xx 로 뭉개면 장애가 입력 오류로 위장된다
|
||||
return ResponseHelper::moduleError(
|
||||
@@ -810,6 +847,8 @@ class ProductController extends AdminBaseController
|
||||
'exceptions.operation_failed',
|
||||
400
|
||||
);
|
||||
} catch (AccessDeniedHttpException $e) {
|
||||
return ResponseHelper::forbidden('auth.scope_denied');
|
||||
} catch (Exception $e) {
|
||||
// 서버 결함/인프라 장애 — 4xx 로 뭉개면 장애가 입력 오류로 위장된다
|
||||
return ResponseHelper::moduleError(
|
||||
@@ -843,6 +882,8 @@ class ProductController extends AdminBaseController
|
||||
'exceptions.operation_failed',
|
||||
400
|
||||
);
|
||||
} catch (AccessDeniedHttpException $e) {
|
||||
return ResponseHelper::forbidden('auth.scope_denied');
|
||||
} catch (Exception $e) {
|
||||
// 서버 결함/인프라 장애 — 4xx 로 뭉개면 장애가 입력 오류로 위장된다
|
||||
return ResponseHelper::moduleError(
|
||||
@@ -888,6 +929,8 @@ class ProductController extends AdminBaseController
|
||||
'messages.products.logs_fetch_success',
|
||||
ActivityLogResource::collection($logs)->response()->getData(true)
|
||||
);
|
||||
} catch (AccessDeniedHttpException $e) {
|
||||
return ResponseHelper::forbidden('auth.scope_denied');
|
||||
} catch (Exception $e) {
|
||||
return ResponseHelper::moduleError(
|
||||
'sirsoft-ecommerce',
|
||||
|
||||
+15
@@ -14,6 +14,7 @@ use Modules\Sirsoft\Ecommerce\Http\Requests\Admin\UpdateReviewStatusRequest;
|
||||
use Modules\Sirsoft\Ecommerce\Http\Resources\ProductReviewResource;
|
||||
use Modules\Sirsoft\Ecommerce\Models\ProductReview;
|
||||
use Modules\Sirsoft\Ecommerce\Services\ProductReviewService;
|
||||
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
|
||||
|
||||
/**
|
||||
* 상품 리뷰 관리 컨트롤러 (관리자)
|
||||
@@ -44,6 +45,8 @@ class ProductReviewController extends AdminBaseController
|
||||
'messages.reviews.fetch_success',
|
||||
ProductReviewResource::collection($reviews)->response()->getData(true)
|
||||
);
|
||||
} catch (AccessDeniedHttpException $e) {
|
||||
return ResponseHelper::forbidden('auth.scope_denied');
|
||||
} catch (Exception $e) {
|
||||
return ResponseHelper::moduleError(
|
||||
'sirsoft-ecommerce',
|
||||
@@ -69,6 +72,8 @@ class ProductReviewController extends AdminBaseController
|
||||
'messages.reviews.fetch_success',
|
||||
new ProductReviewResource($review)
|
||||
);
|
||||
} catch (AccessDeniedHttpException $e) {
|
||||
return ResponseHelper::forbidden('auth.scope_denied');
|
||||
} catch (Exception $e) {
|
||||
return ResponseHelper::moduleError(
|
||||
'sirsoft-ecommerce',
|
||||
@@ -96,6 +101,8 @@ class ProductReviewController extends AdminBaseController
|
||||
'messages.reviews.updated',
|
||||
new ProductReviewResource($updated)
|
||||
);
|
||||
} catch (AccessDeniedHttpException $e) {
|
||||
return ResponseHelper::forbidden('auth.scope_denied');
|
||||
} catch (Exception $e) {
|
||||
return ResponseHelper::moduleError(
|
||||
'sirsoft-ecommerce',
|
||||
@@ -123,6 +130,8 @@ class ProductReviewController extends AdminBaseController
|
||||
'messages.reviews.reply_saved',
|
||||
new ProductReviewResource($updated)
|
||||
);
|
||||
} catch (AccessDeniedHttpException $e) {
|
||||
return ResponseHelper::forbidden('auth.scope_denied');
|
||||
} catch (Exception $e) {
|
||||
return ResponseHelper::moduleError(
|
||||
'sirsoft-ecommerce',
|
||||
@@ -148,6 +157,8 @@ class ProductReviewController extends AdminBaseController
|
||||
'messages.reviews.reply_deleted',
|
||||
new ProductReviewResource($updated)
|
||||
);
|
||||
} catch (AccessDeniedHttpException $e) {
|
||||
return ResponseHelper::forbidden('auth.scope_denied');
|
||||
} catch (Exception $e) {
|
||||
return ResponseHelper::moduleError(
|
||||
'sirsoft-ecommerce',
|
||||
@@ -175,6 +186,8 @@ class ProductReviewController extends AdminBaseController
|
||||
'messages.reviews.deleted',
|
||||
['deleted' => true]
|
||||
);
|
||||
} catch (AccessDeniedHttpException $e) {
|
||||
return ResponseHelper::forbidden('auth.scope_denied');
|
||||
} catch (Exception $e) {
|
||||
return ResponseHelper::moduleError(
|
||||
'sirsoft-ecommerce',
|
||||
@@ -215,6 +228,8 @@ class ProductReviewController extends AdminBaseController
|
||||
'messages.reviews.bulk_updated',
|
||||
['updated_count' => $count]
|
||||
);
|
||||
} catch (AccessDeniedHttpException $e) {
|
||||
return ResponseHelper::forbidden('auth.scope_denied');
|
||||
} catch (Exception $e) {
|
||||
return ResponseHelper::moduleError(
|
||||
'sirsoft-ecommerce',
|
||||
|
||||
+15
@@ -15,6 +15,7 @@ use Modules\Sirsoft\Ecommerce\Http\Resources\ShippingPolicyCollection;
|
||||
use Modules\Sirsoft\Ecommerce\Http\Resources\ShippingPolicyResource;
|
||||
use Modules\Sirsoft\Ecommerce\Services\OrderCalculationService;
|
||||
use Modules\Sirsoft\Ecommerce\Services\ShippingPolicyService;
|
||||
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
|
||||
|
||||
/**
|
||||
* 배송정책 관리 컨트롤러
|
||||
@@ -63,6 +64,8 @@ class ShippingPolicyController extends AdminBaseController
|
||||
new ShippingPolicyResource($shippingPolicy),
|
||||
201
|
||||
);
|
||||
} catch (AccessDeniedHttpException $e) {
|
||||
return ResponseHelper::forbidden('auth.scope_denied');
|
||||
} catch (\Exception $e) {
|
||||
return ResponseHelper::moduleError(
|
||||
'sirsoft-ecommerce',
|
||||
@@ -126,6 +129,8 @@ class ShippingPolicyController extends AdminBaseController
|
||||
'messages.shipping_policy.updated',
|
||||
new ShippingPolicyResource($updated)
|
||||
);
|
||||
} catch (AccessDeniedHttpException $e) {
|
||||
return ResponseHelper::forbidden('auth.scope_denied');
|
||||
} catch (\Exception $e) {
|
||||
return ResponseHelper::moduleError(
|
||||
'sirsoft-ecommerce',
|
||||
@@ -185,6 +190,8 @@ class ShippingPolicyController extends AdminBaseController
|
||||
'sirsoft-ecommerce',
|
||||
'messages.shipping_policy.deleted'
|
||||
);
|
||||
} catch (AccessDeniedHttpException $e) {
|
||||
return ResponseHelper::forbidden('auth.scope_denied');
|
||||
} catch (\Exception $e) {
|
||||
// 서버 결함/인프라 장애 — 4xx 로 뭉개면 장애가 입력 오류로 위장된다
|
||||
return ResponseHelper::moduleError(
|
||||
@@ -221,6 +228,8 @@ class ShippingPolicyController extends AdminBaseController
|
||||
'messages.shipping_policy.toggled',
|
||||
new ShippingPolicyResource($updatedPolicy)
|
||||
);
|
||||
} catch (AccessDeniedHttpException $e) {
|
||||
return ResponseHelper::forbidden('auth.scope_denied');
|
||||
} catch (\Exception $e) {
|
||||
// 서버 결함/인프라 장애 — 4xx 로 뭉개면 장애가 입력 오류로 위장된다
|
||||
return ResponseHelper::moduleError(
|
||||
@@ -247,6 +256,8 @@ class ShippingPolicyController extends AdminBaseController
|
||||
'messages.shipping_policy.bulk_deleted',
|
||||
['deleted_count' => $count]
|
||||
);
|
||||
} catch (AccessDeniedHttpException $e) {
|
||||
return ResponseHelper::forbidden('auth.scope_denied');
|
||||
} catch (\Exception $e) {
|
||||
// 서버 결함/인프라 장애 — 4xx 로 뭉개면 장애가 입력 오류로 위장된다
|
||||
return ResponseHelper::moduleError(
|
||||
@@ -277,6 +288,8 @@ class ShippingPolicyController extends AdminBaseController
|
||||
'messages.shipping_policy.bulk_toggled',
|
||||
['updated_count' => $count]
|
||||
);
|
||||
} catch (AccessDeniedHttpException $e) {
|
||||
return ResponseHelper::forbidden('auth.scope_denied');
|
||||
} catch (\Exception $e) {
|
||||
// 서버 결함/인프라 장애 — 4xx 로 뭉개면 장애가 입력 오류로 위장된다
|
||||
return ResponseHelper::moduleError(
|
||||
@@ -337,6 +350,8 @@ class ShippingPolicyController extends AdminBaseController
|
||||
'messages.shipping_policy.set_default_success',
|
||||
new ShippingPolicyResource($updatedPolicy)
|
||||
);
|
||||
} catch (AccessDeniedHttpException $e) {
|
||||
return ResponseHelper::forbidden('auth.scope_denied');
|
||||
} catch (\Exception $e) {
|
||||
// 서버 결함/인프라 장애 — 4xx 로 뭉개면 장애가 입력 오류로 위장된다
|
||||
return ResponseHelper::moduleError(
|
||||
|
||||
+2
-1
@@ -73,11 +73,12 @@ class ProductReviewController extends AuthBaseController
|
||||
} catch (ReviewNotWritableException $e) {
|
||||
// 작성 자격 미충족은 도메인 검증 실패 → 422 + 전용 메시지 (메시지 키 + 사유 파라미터).
|
||||
// 예외 메시지 원문을 키 자리에 넘기면 키 해석에 실패해 원문이 그대로 노출된다.
|
||||
// 사유는 원시 식별자(already_written)가 아니라 번역 라벨로 싣는다.
|
||||
return ResponseHelper::error(
|
||||
'messages.reviews.cannot_write',
|
||||
422,
|
||||
null,
|
||||
['reason' => $e->getReason()],
|
||||
['reason' => $e->getReasonLabel()],
|
||||
'sirsoft-ecommerce'
|
||||
);
|
||||
} catch (Exception $e) {
|
||||
|
||||
+1
@@ -50,6 +50,7 @@ class StoreShippingPolicyRequest extends FormRequest
|
||||
'country_settings.*.shipping_method' => [
|
||||
'required',
|
||||
'string',
|
||||
// audit:allow query-unbounded-get reason: 배송유형은 운영자 등록 설정성 테이블 — 허용 어휘 구성용 전량 조회이며 행 수가 데이터 증가에 비례하지 않는다
|
||||
Rule::in(app(ShippingTypeRepositoryInterface::class)->getAll()->pluck('code')->toArray()),
|
||||
],
|
||||
'country_settings.*.custom_shipping_name' => ['nullable', 'array'],
|
||||
|
||||
@@ -114,13 +114,20 @@ class ProductInquiryBoardListener implements HookListenerInterface
|
||||
$pivot = $this->repository->findByInquirable(get_class($post), (int) $post->parent_id);
|
||||
|
||||
if ($pivot && $pivot->is_answered) {
|
||||
$remaining = (int) HookManager::applyFilters(
|
||||
// 기본값을 null(판정 불가)로 두고, 공급자(board 모듈 리스너)가 실제
|
||||
// 집계값을 실어야만 해제를 진행한다. 기본값 0 이면 공급자 부재
|
||||
// (board 비활성/구버전)가 "답변 없음" 으로 읽혀 답변완료가 오해제된다.
|
||||
$remaining = HookManager::applyFilters(
|
||||
'sirsoft-ecommerce.inquiry.count_replies',
|
||||
0,
|
||||
null,
|
||||
(int) $post->parent_id
|
||||
);
|
||||
|
||||
if ($remaining === 0) {
|
||||
if ($remaining === null || ! is_numeric($remaining)) {
|
||||
return; // 공급자 부재 — 판정 불가 시 상태를 건드리지 않는다
|
||||
}
|
||||
|
||||
if ((int) $remaining === 0) {
|
||||
$this->repository->unmarkAnswered($pivot);
|
||||
|
||||
Log::debug('ProductInquiryBoardListener: 답변 글 삭제 → 답변완료 해제', [
|
||||
|
||||
@@ -160,6 +160,7 @@ class ExtraFeeTemplateRepository implements ExtraFeeTemplateRepositoryInterface
|
||||
*/
|
||||
public function getActiveList(): Collection
|
||||
{
|
||||
// audit:allow query-unbounded-get reason: 추가배송비 템플릿은 운영자 등록 설정성 테이블 — 행 수가 운영자 행위(도서산간 우편번호 등록)에 묶여 데이터 증가에 비례하지 않는다
|
||||
return $this->model
|
||||
->active()
|
||||
->orderBy('zipcode')
|
||||
@@ -171,6 +172,7 @@ class ExtraFeeTemplateRepository implements ExtraFeeTemplateRepositoryInterface
|
||||
*/
|
||||
public function getAllAsExtraFeeSettings(): array
|
||||
{
|
||||
// audit:allow query-unbounded-get reason: 추가배송비 템플릿은 운영자 등록 설정성 테이블 — 행 수가 운영자 행위(도서산간 우편번호 등록)에 묶여 데이터 증가에 비례하지 않는다
|
||||
return $this->model
|
||||
->active()
|
||||
->orderBy('zipcode')
|
||||
|
||||
@@ -10,7 +10,6 @@ use Modules\Sirsoft\Ecommerce\Exceptions\BrandOperationException;
|
||||
use Modules\Sirsoft\Ecommerce\Models\Brand;
|
||||
use Modules\Sirsoft\Ecommerce\Repositories\Contracts\BrandRepositoryInterface;
|
||||
use Modules\Sirsoft\Ecommerce\Traits\ReappliesPermissionScope;
|
||||
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
|
||||
|
||||
/**
|
||||
* 브랜드 서비스
|
||||
@@ -112,18 +111,14 @@ class BrandService
|
||||
*/
|
||||
public function updateBrand(int $id, array $data): Brand
|
||||
{
|
||||
$brandForScope = $this->repository->findById($id);
|
||||
if (! $brandForScope) {
|
||||
throw new AccessDeniedHttpException(__('auth.scope_denied'));
|
||||
}
|
||||
$this->assertWithinScope($brandForScope, 'sirsoft-ecommerce.brands.update');
|
||||
|
||||
$brand = $this->repository->findById($id);
|
||||
|
||||
if (! $brand) {
|
||||
throw new BrandOperationException('sirsoft-ecommerce::exceptions.brand_not_found');
|
||||
}
|
||||
|
||||
$this->assertWithinScope($brand, 'sirsoft-ecommerce.brands.update');
|
||||
|
||||
// Before 훅
|
||||
HookManager::doAction('sirsoft-ecommerce.brand.before_update', $id, $data);
|
||||
|
||||
@@ -159,18 +154,14 @@ class BrandService
|
||||
*/
|
||||
public function toggleStatus(int $id): Brand
|
||||
{
|
||||
$brandForScope = $this->repository->findById($id);
|
||||
if (! $brandForScope) {
|
||||
throw new AccessDeniedHttpException(__('auth.scope_denied'));
|
||||
}
|
||||
$this->assertWithinScope($brandForScope, 'sirsoft-ecommerce.brands.update');
|
||||
|
||||
$brand = $this->repository->findById($id);
|
||||
|
||||
if (! $brand) {
|
||||
throw new BrandOperationException('sirsoft-ecommerce::exceptions.brand_not_found');
|
||||
}
|
||||
|
||||
$this->assertWithinScope($brand, 'sirsoft-ecommerce.brands.update');
|
||||
|
||||
// Before 훅
|
||||
HookManager::doAction('sirsoft-ecommerce.brand.before_toggle_status', $brand);
|
||||
|
||||
@@ -196,18 +187,14 @@ class BrandService
|
||||
*/
|
||||
public function deleteBrand(int $id): array
|
||||
{
|
||||
$brandForScope = $this->repository->findById($id);
|
||||
if (! $brandForScope) {
|
||||
throw new AccessDeniedHttpException(__('auth.scope_denied'));
|
||||
}
|
||||
$this->assertWithinScope($brandForScope, 'sirsoft-ecommerce.brands.delete');
|
||||
|
||||
$brand = $this->repository->findById($id);
|
||||
|
||||
if (! $brand) {
|
||||
throw new BrandOperationException('sirsoft-ecommerce::exceptions.brand_not_found');
|
||||
}
|
||||
|
||||
$this->assertWithinScope($brand, 'sirsoft-ecommerce.brands.delete');
|
||||
|
||||
// 연결된 상품 수 확인
|
||||
$productsCount = $this->repository->getProductCount($id);
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@ use Modules\Sirsoft\Ecommerce\Models\CouponIssue;
|
||||
use Modules\Sirsoft\Ecommerce\Repositories\Contracts\CouponIssueRepositoryInterface;
|
||||
use Modules\Sirsoft\Ecommerce\Repositories\Contracts\CouponRepositoryInterface;
|
||||
use Modules\Sirsoft\Ecommerce\Traits\ReappliesPermissionScope;
|
||||
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
|
||||
|
||||
/**
|
||||
* 쿠폰 서비스
|
||||
@@ -144,18 +143,14 @@ class CouponService
|
||||
*/
|
||||
public function updateCoupon(int $id, array $data): Coupon
|
||||
{
|
||||
$coupon = $this->repository->findById($id);
|
||||
if (! $coupon) {
|
||||
throw new AccessDeniedHttpException(__('auth.scope_denied'));
|
||||
}
|
||||
$this->assertWithinScope($coupon, 'sirsoft-ecommerce.promotion-coupon.update');
|
||||
|
||||
$coupon = $this->repository->findById($id);
|
||||
|
||||
if (! $coupon) {
|
||||
throw new CouponOperationException('sirsoft-ecommerce::exceptions.coupon_not_found');
|
||||
}
|
||||
|
||||
$this->assertWithinScope($coupon, 'sirsoft-ecommerce.promotion-coupon.update');
|
||||
|
||||
// Before 훅
|
||||
HookManager::doAction('sirsoft-ecommerce.coupon.before_update', $id, $data);
|
||||
|
||||
@@ -207,18 +202,14 @@ class CouponService
|
||||
*/
|
||||
public function deleteCoupon(int $id): array
|
||||
{
|
||||
$coupon = $this->repository->findById($id);
|
||||
if (! $coupon) {
|
||||
throw new AccessDeniedHttpException(__('auth.scope_denied'));
|
||||
}
|
||||
$this->assertWithinScope($coupon, 'sirsoft-ecommerce.promotion-coupon.delete');
|
||||
|
||||
$coupon = $this->repository->findById($id);
|
||||
|
||||
if (! $coupon) {
|
||||
throw new CouponOperationException('sirsoft-ecommerce::exceptions.coupon_not_found');
|
||||
}
|
||||
|
||||
$this->assertWithinScope($coupon, 'sirsoft-ecommerce.promotion-coupon.delete');
|
||||
|
||||
// Before 훅
|
||||
HookManager::doAction('sirsoft-ecommerce.coupon.before_delete', $coupon);
|
||||
|
||||
@@ -284,9 +275,11 @@ class CouponService
|
||||
public function issueDirectly(int $couponId, array $userIds): array
|
||||
{
|
||||
$coupon = $this->repository->findById($couponId);
|
||||
|
||||
if (! $coupon) {
|
||||
throw new AccessDeniedHttpException(__('auth.scope_denied'));
|
||||
throw new CouponOperationException('sirsoft-ecommerce::exceptions.coupon_not_found');
|
||||
}
|
||||
|
||||
$this->assertWithinScope($coupon, 'sirsoft-ecommerce.promotion-coupon.update');
|
||||
|
||||
HookManager::doAction('sirsoft-ecommerce.coupon.before_direct_issue', $couponId, $userIds);
|
||||
|
||||
@@ -566,13 +566,15 @@ class ProductInquiryService
|
||||
// ② 잔여 답변이 없을 때만 피벗 is_answered=false 업데이트.
|
||||
// 기설치본에는 과거 결함(#106)으로 답변이 여러 건 쌓인 문의가 있을 수 있다 —
|
||||
// 첫 답변만 지웠는데 무조건 해제하면 "답변이 남았는데 미답변" 표기가 된다.
|
||||
$remaining = (int) HookManager::applyFilters(
|
||||
// 기본값 null = 판정 불가: 공급자(board 리스너) 부재 시 0 으로 접혀
|
||||
// 답변완료가 오해제되는 fail-open 을 막는다.
|
||||
$remaining = HookManager::applyFilters(
|
||||
'sirsoft-ecommerce.inquiry.count_replies',
|
||||
0,
|
||||
null,
|
||||
$inquiry->inquirable_id
|
||||
);
|
||||
|
||||
if ($remaining === 0) {
|
||||
if (is_numeric($remaining) && (int) $remaining === 0) {
|
||||
$this->repository->unmarkAnswered($inquiry);
|
||||
}
|
||||
|
||||
|
||||
@@ -1157,6 +1157,14 @@ return [
|
||||
'can_write_checked' => 'Review eligibility checked.',
|
||||
'can_write_check_failed' => 'Failed to check review eligibility.',
|
||||
'cannot_write' => 'Cannot write a review. (Reason: :reason)',
|
||||
// 작성 불가 사유 라벨 — :reason 치환자에 원시 식별자 대신 번역문을 싣는다
|
||||
'reasons' => [
|
||||
'order_option_not_found' => 'order item not found',
|
||||
'not_own_order' => 'not your order',
|
||||
'not_confirmed' => 'purchase not confirmed yet',
|
||||
'deadline_passed' => 'review period has ended',
|
||||
'already_written' => 'review already written',
|
||||
],
|
||||
'forbidden' => 'You do not have permission.',
|
||||
'deleted' => 'Review has been deleted.',
|
||||
'delete_failed' => 'Failed to delete review.',
|
||||
|
||||
@@ -1146,6 +1146,14 @@ return [
|
||||
'can_write_checked' => '리뷰 작성 가능 여부를 확인했습니다.',
|
||||
'can_write_check_failed' => '리뷰 작성 가능 여부 확인에 실패했습니다.',
|
||||
'cannot_write' => '리뷰를 작성할 수 없습니다. (사유: :reason)',
|
||||
// 작성 불가 사유 라벨 — :reason 치환자에 원시 식별자 대신 번역문을 싣는다
|
||||
'reasons' => [
|
||||
'order_option_not_found' => '주문 내역을 찾을 수 없음',
|
||||
'not_own_order' => '본인 주문이 아님',
|
||||
'not_confirmed' => '구매확정 전',
|
||||
'deadline_passed' => '작성 기한 경과',
|
||||
'already_written' => '이미 작성한 리뷰',
|
||||
],
|
||||
'forbidden' => '권한이 없습니다.',
|
||||
'deleted' => '리뷰가 삭제되었습니다.',
|
||||
'delete_failed' => '리뷰 삭제에 실패했습니다.',
|
||||
|
||||
@@ -159,6 +159,57 @@ class ServiceScopeReapplyTest extends ModuleTestCase
|
||||
$this->assertFalse((bool) $theirs->fresh()->is_active);
|
||||
}
|
||||
|
||||
/**
|
||||
* (계약 표면) 스코프 거부는 HTTP 403 으로 표면화되어야 한다.
|
||||
*
|
||||
* 서비스가 던지는 AccessDeniedHttpException 이 컨트롤러 generic catch 에 삼켜지면
|
||||
* 권한 거부가 500 서버 장애로 위장된다 — 서비스 층 단언만으로는 이 회귀를 못 본다.
|
||||
*
|
||||
* @scenario route_shape=static_bulk
|
||||
*
|
||||
* @effects scope_denial_surfaces_as_403_over_http
|
||||
*/
|
||||
public function test_scope_denied_bulk_toggle_surfaces_as_403_over_http(): void
|
||||
{
|
||||
$actor = $this->adminWithScope('sirsoft-ecommerce.shipping-policies.update', 'self');
|
||||
$owner = User::factory()->create();
|
||||
|
||||
$mine = $this->makeTemplate($actor->id, '63004');
|
||||
$theirs = $this->makeTemplate($owner->id, '63005');
|
||||
|
||||
$response = $this->actingAs($actor)->patchJson(
|
||||
'/api/modules/sirsoft-ecommerce/admin/extra-fee-templates/bulk-toggle-active',
|
||||
['ids' => [$mine->id, $theirs->id], 'is_active' => false]
|
||||
);
|
||||
|
||||
$response->assertStatus(403);
|
||||
|
||||
// 전량 거부 — 상태 불변까지 단언한다.
|
||||
$this->assertTrue((bool) $mine->fresh()->is_active);
|
||||
$this->assertTrue((bool) $theirs->fresh()->is_active);
|
||||
}
|
||||
|
||||
/**
|
||||
* (계약 복원) 존재하지 않는 대상은 스코프 거부가 아니라 not_found 400 으로 응답한다.
|
||||
*
|
||||
* 스코프 게이트 도입이 "리소스 부재 = 스코프 거부(→ 500 위장)" 로 기존 400 계약을
|
||||
* 바꾸면 안 된다.
|
||||
*
|
||||
* @scenario route_shape=param_name_mismatch
|
||||
*
|
||||
* @effects missing_target_keeps_not_found_contract
|
||||
*/
|
||||
public function test_missing_brand_returns_not_found_not_scope_denied(): void
|
||||
{
|
||||
$actor = $this->adminWithScope('sirsoft-ecommerce.brands.delete', null);
|
||||
|
||||
$response = $this->actingAs($actor)->deleteJson(
|
||||
'/api/modules/sirsoft-ecommerce/admin/brands/999999'
|
||||
);
|
||||
|
||||
$response->assertStatus(400);
|
||||
}
|
||||
|
||||
/**
|
||||
* 소유자를 지정해 배송정책을 만듭니다 (팩토리 부재 — 기존 테스트와 같은 직접 생성).
|
||||
*
|
||||
|
||||
@@ -30,6 +30,9 @@ effects:
|
||||
# static_bulk — 일괄 경로
|
||||
- static_bulk_route_reapplies_scope_gate
|
||||
- static_bulk_route_allows_global_scoped_actor
|
||||
# HTTP 표면 — 컨트롤러 typed catch (거부가 500 으로 위장되지 않는다)
|
||||
- scope_denial_surfaces_as_403_over_http
|
||||
- missing_target_keeps_not_found_contract
|
||||
|
||||
test_files:
|
||||
- modules/_bundled/sirsoft-ecommerce/tests/Feature/Security/ServiceScopeReapplyTest.php
|
||||
@@ -4,7 +4,7 @@
|
||||
형식은 [Keep a Changelog](https://keepachangelog.com/ko/1.1.0/)를 따르며,
|
||||
[Semantic Versioning](https://semver.org/lang/ko/)을 준수합니다.
|
||||
|
||||
## [1.0.3] - 2026-08-17
|
||||
## [1.0.3] - 2026-08-18
|
||||
|
||||
### Security
|
||||
|
||||
|
||||
Reference in new issue
Block a user