관리자 환경설정이 값을 저장은 하지만 실제 동작에는 닿지 않던 결함군을 정리했다. 설정 화면(min/max)·저장 검증(FormRequest)·런타임 적용(Service) 세 계층이 각자 리터럴을 들고 있어 서로 조용히 갈라지던 것이 공통 원인이다. 경계값 SSoT 도입: - config/core.php `settings_limits` 를 단일 출처로 두고, FormRequest 는 이 값으로 규칙을 만들고 화면은 설정 응답의 `_meta.limits` 로 같은 값을 받아 바인딩한다. - 게시판·이커머스도 각 모듈 config 의 limits 를 동일 구조로 노출한다. 적용되지 않던 정책을 실제로 적용: - 비밀번호 최소 길이·특수문자 필수(신규 지정 7개 경로. 로그인은 제외 — 정책을 올렸을 때 기존 회원이 자기 계정에 접근조차 못 하는 데드락을 막기 위함) - 계정 잠금 시간 0 = 무한대(전용 컬럼 분리. timestamp 상한과 NULL 규약 때문에 기존 컬럼 재사용이 불가능하다) + 관리자 수동 해제 경로 - 업로드 최대 크기·허용 확장자, 게시판 첨부 개수·댓글 깊이, 페이지 첨부 정책, 장바구니 수량·구매 한도, 마일리지 사용 한도, 주문 부가세 파생 결함: - 큐 Job(sync 드라이버)이 진행 중인 요청의 Request 바인딩을 덮어써, 뒤이어 실행되는 훅 리스너가 헤더를 잃고 조용히 건너뛰었다. Job 이 원 바인딩을 복원하도록 고치고, 전송 헤더가 필요한 리스너는 동기 실행으로 선언한다. - 확장 업데이트 실패 시 상태만 되돌리고 상태 캐시를 비우지 않아, 그 확장의 관리자 화면만 캐시 TTL(기본 하루) 동안 404 로 남았다. 실패 경로에도 무효화를 대칭으로 두고, 빈 목록 자체를 캐시하지 않는다. - 글 작성 시 첨부 파일이 Service 로 전달되지 않아 검증·권한은 통과하고 첨부만 사라졌다. - 환경설정 저장 실패 안내가 내부 설정 키를 그대로 노출했다(105개 항목에 라벨 부여). 재발 방지: - audit 룰 3종(레이아웃 경계 리터럴 / FormRequest 경계 불일치 / Service 재클램프) - 테스트 실행 범위 강제 훅(check-test-scope) - 트러블슈팅 사례 2건(큐 Job 요청 오염 / 확장 상태 캐시 고착) 공개 이슈: gnuboard/g7
200 lines
9.6 KiB
PHP
200 lines
9.6 KiB
PHP
<?php
|
|
|
|
return [
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| 첨부파일 저장 설정
|
|
|--------------------------------------------------------------------------
|
|
*/
|
|
'attachment' => [
|
|
'disk' => env('SIRSOFT_BOARD_ATTACHMENT_DISK', 'modules'),
|
|
],
|
|
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| 게시판별 권한 정의 (name, description)
|
|
|--------------------------------------------------------------------------
|
|
| 게시판별 동적 권한 생성 시 사용되는 권한 메타데이터입니다.
|
|
| BoardPermissionService에서 permissions 테이블에 레코드 생성 시 사용됩니다.
|
|
|
|
|
| 권한 구조:
|
|
| - admin.* : 관리자 권한 (type: admin, identifier: sirsoft-board.{slug}.admin.*)
|
|
| - 일반 키 : 사용자 권한 (type: user, identifier: sirsoft-board.{slug}.*)
|
|
|--------------------------------------------------------------------------
|
|
*/
|
|
'board_permission_definitions' => [
|
|
// ========================================
|
|
// 관리자 권한 (type: admin)
|
|
// ========================================
|
|
'admin.posts.read' => [
|
|
'name' => ['ko' => '게시글 조회 (관리자)', 'en' => 'View Posts (Admin)'],
|
|
'description' => ['ko' => '관리자 페이지에서 게시글 조회', 'en' => 'View posts in admin page'],
|
|
'scope' => ['resource_route_key' => 'post', 'owner_key' => 'user_id'],
|
|
],
|
|
'admin.posts.write' => [
|
|
'name' => ['ko' => '게시글 작성/수정/삭제 (관리자)', 'en' => 'Create/Edit/Delete Posts (Admin)'],
|
|
'description' => ['ko' => '관리자 페이지에서 게시글 작성 및 수정/삭제', 'en' => 'Create and edit/delete posts in admin page'],
|
|
],
|
|
'admin.posts.read-secret' => [
|
|
'name' => ['ko' => '비밀글 조회 (관리자)', 'en' => 'View Secret Posts (Admin)'],
|
|
'description' => ['ko' => '관리자 페이지에서 비밀글 조회', 'en' => 'View secret posts in admin page'],
|
|
'scope' => ['resource_route_key' => 'post', 'owner_key' => 'user_id'],
|
|
],
|
|
'admin.comments.read' => [
|
|
'name' => ['ko' => '댓글 조회 (관리자)', 'en' => 'View Comments (Admin)'],
|
|
'description' => ['ko' => '관리자 페이지에서 댓글 조회', 'en' => 'View comments in admin page'],
|
|
'scope' => ['resource_route_key' => 'comment', 'owner_key' => 'user_id'],
|
|
],
|
|
'admin.comments.write' => [
|
|
'name' => ['ko' => '댓글 작성/수정/삭제 (관리자)', 'en' => 'Create/Edit/Delete Comments (Admin)'],
|
|
'description' => ['ko' => '관리자 페이지에서 댓글 작성 및 수정/삭제', 'en' => 'Create and edit/delete comments in admin page'],
|
|
],
|
|
'admin.attachments.upload' => [
|
|
'name' => ['ko' => '파일 업로드/삭제 (관리자)', 'en' => 'Upload/Delete Files (Admin)'],
|
|
'description' => ['ko' => '관리자 페이지에서 파일 업로드 및 삭제', 'en' => 'Upload and delete files in admin page'],
|
|
'scope' => ['resource_route_key' => 'attachment', 'owner_key' => 'created_by'],
|
|
],
|
|
'admin.attachments.download' => [
|
|
'name' => ['ko' => '파일 다운로드 (관리자)', 'en' => 'Download Files (Admin)'],
|
|
'description' => ['ko' => '관리자 페이지에서 파일 다운로드', 'en' => 'Download files in admin page'],
|
|
'scope' => ['resource_route_key' => 'attachment', 'owner_key' => 'created_by'],
|
|
],
|
|
'admin.manage' => [
|
|
'name' => ['ko' => '게시판 관리 (관리자)', 'en' => 'Manage Board (Admin)'],
|
|
'description' => ['ko' => '타인 게시글/댓글 관리, 블라인드, 복원, 공지 설정', 'en' => 'Manage others posts/comments, blind, restore, set notice'],
|
|
'scope' => ['resource_route_key' => 'board', 'owner_key' => 'created_by'],
|
|
],
|
|
|
|
// ========================================
|
|
// 사용자 권한 (type: user)
|
|
// ========================================
|
|
'posts.read' => [
|
|
'name' => ['ko' => '게시글 조회', 'en' => 'View Posts'],
|
|
'description' => ['ko' => '게시글 목록 및 상세 조회', 'en' => 'View post list and details'],
|
|
'scope' => ['resource_route_key' => 'post', 'owner_key' => 'user_id'],
|
|
],
|
|
'posts.write' => [
|
|
'name' => ['ko' => '게시글 작성/수정/삭제', 'en' => 'Create/Edit/Delete Posts'],
|
|
'description' => ['ko' => '게시글 작성 및 본인 글 수정/삭제', 'en' => 'Create posts and edit/delete own posts'],
|
|
],
|
|
'posts.read-secret' => [
|
|
'name' => ['ko' => '비밀글 조회', 'en' => 'View Secret Posts'],
|
|
'description' => ['ko' => '비밀글 조회', 'en' => 'View secret posts'],
|
|
'scope' => ['resource_route_key' => 'post', 'owner_key' => 'user_id'],
|
|
],
|
|
'comments.read' => [
|
|
'name' => ['ko' => '댓글 조회', 'en' => 'View Comments'],
|
|
'description' => ['ko' => '댓글 목록 조회', 'en' => 'View comment list'],
|
|
'scope' => ['resource_route_key' => 'comment', 'owner_key' => 'user_id'],
|
|
],
|
|
'comments.write' => [
|
|
'name' => ['ko' => '댓글 작성/수정/삭제', 'en' => 'Create/Edit/Delete Comments'],
|
|
'description' => ['ko' => '댓글 작성 및 본인 댓글 수정/삭제', 'en' => 'Create comments and edit/delete own comments'],
|
|
],
|
|
'attachments.upload' => [
|
|
'name' => ['ko' => '파일 업로드/삭제', 'en' => 'Upload/Delete Files'],
|
|
'description' => ['ko' => '게시글에 파일 첨부 및 삭제', 'en' => 'Attach and delete files to posts'],
|
|
'scope' => ['resource_route_key' => 'attachment', 'owner_key' => 'created_by'],
|
|
],
|
|
'attachments.download' => [
|
|
'name' => ['ko' => '파일 다운로드', 'en' => 'Download Files'],
|
|
'description' => ['ko' => '첨부파일 다운로드', 'en' => 'Download attached files'],
|
|
'scope' => ['resource_route_key' => 'attachment', 'owner_key' => 'created_by'],
|
|
],
|
|
'manager' => [
|
|
'name' => ['ko' => '게시판 관리 (사용자)', 'en' => 'Manage Board (User)'],
|
|
'description' => ['ko' => '사용자 페이지에서 게시판 관리', 'en' => 'Manage board in user page'],
|
|
'scope' => ['resource_route_key' => 'board', 'owner_key' => 'created_by'],
|
|
],
|
|
],
|
|
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| 제한값
|
|
|--------------------------------------------------------------------------
|
|
*/
|
|
'limits' => [
|
|
'per_page_min' => 5,
|
|
'per_page_max' => 100,
|
|
|
|
// 제목 길이 제한 (VARCHAR(200))
|
|
'min_title_length_min' => 0,
|
|
'min_title_length_max' => 200,
|
|
'max_title_length_min' => 1,
|
|
'max_title_length_max' => 1000,
|
|
|
|
// 내용 길이 제한 (LONGTEXT)
|
|
'min_content_length_min' => 0,
|
|
'min_content_length_max' => 10000,
|
|
'max_content_length_min' => 1,
|
|
'max_content_length_max' => 100000,
|
|
|
|
// 댓글 길이 제한 (TEXT)
|
|
'min_comment_length_min' => 0,
|
|
'min_comment_length_max' => 1000,
|
|
'max_comment_length_min' => 1,
|
|
'max_comment_length_max' => 10000,
|
|
|
|
// 파일 업로드 제한 (MB 단위)
|
|
'max_file_size_min' => 1,
|
|
'max_file_size_max' => 200,
|
|
'max_file_count_min' => 1,
|
|
'max_file_count_max' => 20,
|
|
|
|
'category_max' => 50,
|
|
|
|
// 신규 게시글 NEW 배지 표시 기간 (시간 단위, 0 = 표시 안 함)
|
|
'new_display_hours_min' => 0,
|
|
'new_display_hours_max' => 720,
|
|
|
|
// 답글 깊이 제한
|
|
'max_reply_depth_min' => 1,
|
|
'max_reply_depth_max' => 10,
|
|
|
|
// 대댓글 깊이 제한
|
|
'max_comment_depth_min' => 0,
|
|
'max_comment_depth_max' => 10,
|
|
|
|
// 신고 정책
|
|
'auto_hide_threshold_min' => 0,
|
|
'auto_hide_threshold_max' => 100,
|
|
'daily_report_limit_min' => 0,
|
|
'daily_report_limit_max' => 100,
|
|
'rejection_limit_count_min' => 0,
|
|
'rejection_limit_count_max' => 50,
|
|
'rejection_limit_days_min' => 1,
|
|
'rejection_limit_days_max' => 365,
|
|
|
|
// 스팸/보안 쿨다운 (초)
|
|
'post_cooldown_seconds_min' => 0,
|
|
'post_cooldown_seconds_max' => 3600,
|
|
'comment_cooldown_seconds_min' => 0,
|
|
'comment_cooldown_seconds_max' => 3600,
|
|
'report_cooldown_seconds_min' => 0,
|
|
'report_cooldown_seconds_max' => 3600,
|
|
'view_count_cache_ttl_min' => 60,
|
|
'view_count_cache_ttl_max' => 604800,
|
|
],
|
|
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| 캐시 설정
|
|
|--------------------------------------------------------------------------
|
|
| 게시판 통계, 최근 게시글, 인기 게시판 등에 적용되는 캐시 설정입니다.
|
|
*/
|
|
'cache' => [
|
|
'enabled' => env('BOARD_CACHE_ENABLED', true),
|
|
'ttl' => env('BOARD_CACHE_TTL', 60), // 통계/최근글/인기게시판 모두 적용 (초 단위)
|
|
],
|
|
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| 성능 제한
|
|
|--------------------------------------------------------------------------
|
|
| 대용량 게시판 환경에서의 성능 최적화를 위한 설정입니다.
|
|
*/
|
|
'performance' => [
|
|
'max_union_boards' => 50, // UNION 쿼리 최대 게시판 수
|
|
],
|
|
];
|