Skip to content

[Refactor] 인증/권한 기능 리펙토링 - #86

Merged
kangcheolung merged 10 commits into
developfrom
refactor/85
Aug 1, 2026
Merged

[Refactor] 인증/권한 기능 리펙토링#86
kangcheolung merged 10 commits into
developfrom
refactor/85

Conversation

@kangcheolung

@kangcheolung kangcheolung commented Aug 1, 2026

Copy link
Copy Markdown
Member

🔍️ 작업 내용

✨ 상세 설명

인증(Auth)

  • AuthCommandService.login()에서 User.recordLogin() 미호출로 MeResponse.lastLoginAt이 항상 null이던 버그 수정
  • login()/getMe()에 중복돼 있던 role 코드 조회 로직을 UserRoleRepository.findRoleCodesByUserId()로 정리
  • /auth/** 블랭킷 permitAll()/auth/signup, /auth/login으로 좁혀 /auth/me 인증 강제를 SecurityConfig에서 명시화
  • AuthCommandService/AuthQueryService 단위 테스트 신규 추가 (기존엔 전무했음)

권한/컬렉션(Permission/Collection)

  • CollectionQueryService.getCollection()에 권한 체크가 전혀 없어 PRIVATE 컬렉션도 아무나 조회 가능하던 문제를 PermissionQueryService.canReadCollection()(OWNER→PUBLIC→USER→ROLE→DEPARTMENT) 추가로 해결
  • canReadCollection/canWriteCollection/canAdminCollection을 ID 버전(조회+필터 후 위임) / 엔티티 버전(조회 없이 판단)으로 분리해, 이미 컬렉션을 조회한 호출부(getCollection, addDocument, grantPermission)의 중복 SELECT 제거
  • 위 ID 버전 내부에 status != DELETED 필터를 추가해 soft-delete된 컬렉션에 접근/권한부여가 가능했던 문제 차단
  • CollectionController.addDocument()의 Swagger description을 실제 인가 규칙(WRITE 권한 보유자, 소유자 포함)에 맞게 수정
  • docs/design/#16,#18,#21,#29 설계 문서를 위 변경사항에 맞게 동기화

🛠️ 추후 리팩토링 및 고도화 계획

  • 문서(DocumentPermissionCommandService) 쪽에도 동일한 중복 쿼리/soft-delete 필터 누락 문제가 있어 별도 후속 작업 필요
  • createCollection()parentCollectionId 조회 시 부모 컬렉션에 대한 권한 체크가 없음 (별도 이슈로 분리 필요)
  • AccessSourceType.OWNER가 정의만 되고 실제 생성되지 않는 dead value로 남아있음
  • 만료된 권한(expiresAt 지난 것) 정리 배치 없음

💬 리뷰 요구사항

  • canReadCollection()에서 컬렉션 visibility=PUBLIC이면 소유자/권한 여부와 무관하게 읽기를 허용하도록 했습니다(canReadDocument()와 동일한 정책). 이 설계 방향이 맞는지 확인 부탁드립니다.
  • 커밋을 인증(auth) 관련과 권한/컬렉션(permission) 관련으로 나눠뒀는데, 리뷰 시 참고해주세요.

Summary by CodeRabbit

  • 새 기능

    • 컬렉션 조회 시 소유자, 공개 여부 및 부여된 읽기 권한을 확인합니다.
    • 삭제된 컬렉션은 조회·문서 추가/삭제·권한 부여 대상에서 제외됩니다.
    • 로그인 성공 시 마지막 로그인 시간이 기록됩니다.
    • 회원가입 및 로그인 엔드포인트만 비인증 접근을 허용합니다.
  • 버그 수정

    • 컬렉션 권한 검증과 권한 부여 과정의 중복 조회 및 잘못된 권한 처리를 개선했습니다.
  • 테스트

    • 인증, 컬렉션 접근 권한, 삭제된 컬렉션 처리에 대한 테스트를 보강했습니다.

kangcheolung and others added 7 commits August 1, 2026 17:16
AuthCommandService.login()에서 User.recordLogin()을 호출하지 않아
MeResponse.lastLoginAt이 항상 null로 응답되던 문제를 수정한다.
UserRoleRepository에 role 코드만 조회하는 쿼리를 추가해
login()/getMe()에 중복돼 있던 role 조회 로직을 정리한다.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
기존에는 /auth/** 전체가 permitAll()이라 /auth/me의 인증 강제가
CurrentUserArgumentResolver의 수동 체크에만 의존하고 있었다.
/auth/signup, /auth/login만 permitAll로 좁혀서 /auth/me는
anyRequest().authenticated()로 걸리도록 명시화한다.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
AuthCommandService(signup/login), AuthQueryService(getMe)에 대한
단위 테스트가 전무했던 것을 추가한다. AuthFixture로 User/Department/
Role/UserRole 생성 헬퍼를 제공한다.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
getCollection()에 권한 체크가 전혀 없어 PRIVATE 컬렉션도 아무나
조회 가능하던 문제를 PermissionQueryService.canReadCollection()
(OWNER→PUBLIC→USER→ROLE→DEPARTMENT) 추가로 해결한다.

canReadCollection/canWriteCollection/canAdminCollection을 ID 버전과
엔티티 버전으로 분리해, 이미 컬렉션을 조회한 호출부(getCollection,
addDocument, grantPermission)가 같은 row를 두 번 SELECT하던 중복을
없앤다. 동시에 ID 버전 내부에 status != DELETED 필터를 추가해
soft-delete된 컬렉션에 접근/권한부여가 가능했던 문제도 함께 막는다.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
canReadCollection 케이스와 삭제된 컬렉션 케이스를 추가하고,
canWriteCollection/canAdminCollection 호출이 엔티티 버전으로
바뀐 서비스들의 stub을 그에 맞게 수정한다.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
#16, #18, #21, #29 문서의 코드 스니펫을 실제 코드(엔티티 오버로드,
status 필터)에 맞게 갱신하고, 해결된 TODO는 취소선 처리 후
해결 내역을 남긴다. target_type CHECK 제약 TODO는 이미 마이그레이션에
반영되어 있던 것으로 확인되어 함께 정리한다.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
이슈 번호를 받아 docs/design/의 해당 설계 문서를 실제 코드와
대조해 갱신하는 /update-design-doc 커맨드를 추가한다.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 1, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@kangcheolung, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 35 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: feee7af9-849a-4177-9350-c7969137b67a

📥 Commits

Reviewing files that changed from the base of the PR and between 43b6c2d and 1f22061.

📒 Files selected for processing (6)
  • .claude/commands/update-design-doc.md
  • docs/design/kangcheolung-#21-permission-query-service.md
  • docs/design/kangcheolung-#29-collection-management.md
  • src/main/java/com/opensource/docgrid/domain/collection/controller/CollectionController.java
  • src/main/java/com/opensource/docgrid/domain/permission/service/query/PermissionQueryService.java
  • src/test/java/com/opensource/docgrid/domain/permission/service/query/PermissionQueryServiceTest.java
📝 Walkthrough

Walkthrough

인증 역할 조회와 로그인 기록을 정리했습니다. 컬렉션 읽기·쓰기·관리 권한과 soft-delete 검증을 강화했습니다. 관련 서비스, 저장소, 컨트롤러, 테스트, 설계 문서를 갱신했습니다.

Changes

인증 흐름

Layer / File(s) Summary
인증 역할 조회 및 로그인 기록
src/main/java/com/opensource/docgrid/domain/auth/..., src/main/java/com/opensource/docgrid/domain/user/..., src/main/java/com/opensource/docgrid/global/config/SecurityConfig.java, src/test/java/com/opensource/docgrid/domain/auth/...
로그인 성공 시각을 기록하고 역할 코드를 직접 조회합니다. 인증 공개 경로를 signup과 login으로 제한합니다. 인증 단위 테스트와 공통 픽스처를 추가했습니다.

컬렉션 권한 흐름

Layer / File(s) Summary
컬렉션 권한 판정
src/main/java/com/opensource/docgrid/domain/permission/repository/..., src/main/java/com/opensource/docgrid/domain/permission/service/query/..., src/test/java/com/opensource/docgrid/domain/permission/service/query/..., docs/design/kangcheolung-#21-permission-query-service.md
canReadCollection과 엔티티 기반 권한 오버로드를 추가했습니다. 소유자, PUBLIC, USER, ROLE, DEPT 순서로 읽기 권한을 확인합니다.
컬렉션 단건 조회 접근 제어
src/main/java/com/opensource/docgrid/domain/collection/controller/CollectionController.java, src/main/java/com/opensource/docgrid/domain/collection/service/query/CollectionQueryService.java, src/test/java/com/opensource/docgrid/domain/collection/service/query/CollectionQueryServiceTest.java, docs/design/kangcheolung-#16-collection-crud.md
단건 조회에 사용자 ID를 전달합니다. 삭제된 컬렉션과 읽기 권한이 없는 조회를 각각 예외 처리합니다.
컬렉션 명령 및 권한 부여 검증
src/main/java/com/opensource/docgrid/domain/collection/service/command/CollectionCommandService.java, src/main/java/com/opensource/docgrid/domain/permission/service/command/CollectionPermissionCommandService.java, src/test/java/com/opensource/docgrid/domain/collection/service/command/..., src/test/java/com/opensource/docgrid/domain/permission/service/command/..., docs/design/kangcheolung-#16-collection-crud.md, docs/design/kangcheolung-#18-permission-grant-revoke.md, docs/design/kangcheolung-#29-collection-management.md
문서 추가·삭제, 컬렉션 삭제, 권한 부여에서 활성 컬렉션만 조회합니다. 권한 검증에 조회된 컬렉션 엔티티를 사용합니다. 관련 테스트와 설계 문서를 갱신했습니다.
설계 문서 동기화 명령
.claude/commands/update-design-doc.md
실제 코드와 이슈별 설계 문서를 대조하고 최소 diff로 갱신하는 명령 절차를 추가했습니다.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant CollectionController
  participant CollectionQueryService
  participant PermissionQueryService
  participant CollectionPermissionRepository
  Client->>CollectionController: 컬렉션 조회 요청
  CollectionController->>CollectionQueryService: userId와 collectionId 전달
  CollectionQueryService->>PermissionQueryService: canReadCollection 호출
  PermissionQueryService->>CollectionPermissionRepository: 직접·역할·부서 읽기 권한 조회
  CollectionPermissionRepository-->>PermissionQueryService: 권한 결과 반환
  PermissionQueryService-->>CollectionQueryService: 허용 또는 거부
  CollectionQueryService-->>CollectionController: 컬렉션 응답 또는 예외
  CollectionController-->>Client: 조회 결과 반환
Loading

Possibly related PRs

  • DocGrid/backend#13: 인증 서비스와 역할 조회, 보안 설정의 기존 변경과 직접 연결됩니다.
  • DocGrid/backend#17: 컬렉션 컨트롤러와 서비스의 후속 접근 제어 변경과 직접 연결됩니다.
  • DocGrid/backend#23: PermissionQueryService와 컬렉션 권한 조회 변경과 직접 연결됩니다.

Suggested labels: 📃 Docs, 🧪 Test

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning .claude/commands/update-design-doc.md 추가는 인증·권한 리팩토링과 직접 관련이 없는 별도 개발 도구 변경으로 보입니다. 해당 커맨드 파일을 별도 PR로 분리하거나, 이슈 #85와의 직접적인 필요성을 설명하고 범위를 명시하세요.
Docstring Coverage ⚠️ Warning Docstring coverage is 36.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed 제목은 인증과 권한 기능 리팩토링이라는 PR의 핵심 변경을 직접 설명하며, 간결하고 구체적입니다.
Description check ✅ Passed 설명은 템플릿의 필수 섹션을 포함하고 인증·권한 변경, 후속 계획, 리뷰 요청을 구체적으로 기록합니다.
Linked Issues check ✅ Passed PR은 이슈 #85의 인증 및 권한 리팩토링 목표를 구현하고 관련 테스트와 설계 문서 동기화를 포함합니다.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/85

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🧹 Nitpick comments (4)
.claude/commands/update-design-doc.md (1)

12-13: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

새 파일과 새 메서드·엔드포인트의 문서 위치를 구분하세요.

"신규 파일" 또는 관련 섹션이라는 표현은 새 메서드나 엔드포인트를 "신규 파일" 섹션에 기록하게 만들 수 있습니다. 새 파일은 "신규 파일"에 기록하고, 기존 파일의 새 메서드·엔드포인트는 해당 API 또는 흐름 섹션에 기록한다고 명시하세요.

수정 예시
-   - 새로 추가된 메서드/엔드포인트가 있는데 문서에 없으면 "신규 파일" 또는 관련 섹션에 추가
+   - 새 파일은 "신규 파일" 섹션에 추가하고, 새 메서드/엔드포인트는 해당 API 또는 흐름 섹션에 추가
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.claude/commands/update-design-doc.md around lines 12 - 13, Update the
documentation guidance in the relevant command instructions to distinguish
placement by change type: record newly added files under the “신규 파일” section,
while documenting new methods or endpoints added to existing files in their
corresponding API or flow section. Preserve the separate “설계 결정 요약” guidance for
newly introduced design decisions.
src/main/java/com/opensource/docgrid/domain/permission/service/query/PermissionQueryService.java (1)

249-287: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

순차 실행 흐름에 단계 번호 주석을 추가하세요.

  • src/main/java/com/opensource/docgrid/domain/permission/service/query/PermissionQueryService.java#L249-L287: OWNER, PUBLIC, USER, ROLE, DEPARTMENT 권한 판정 순서를 1., 2. 형식으로 표시하세요.
  • src/main/java/com/opensource/docgrid/domain/collection/service/command/CollectionCommandService.java#L77-L80: 활성 컬렉션 조회와 쓰기 권한 확인 순서를 번호로 표시하세요.
  • src/main/java/com/opensource/docgrid/domain/collection/service/command/CollectionCommandService.java#L108-L124: 소유자 확인, 캐시 무효화, 권한 삭제, soft delete 순서를 번호로 표시하세요.
  • src/main/java/com/opensource/docgrid/domain/collection/service/command/CollectionCommandService.java#L127-L129: 활성 컬렉션 검증 이후의 제거 흐름을 번호로 표시하세요.
  • src/main/java/com/opensource/docgrid/domain/permission/service/command/CollectionPermissionCommandService.java#L53-L57: 활성 컬렉션 검증과 관리자 권한 확인 순서를 번호로 표시하세요.

As per coding guidelines, “For sequential execution flows, add numbered comments such as 1., 2., 3., and 4. at the relevant steps.”

Source: Coding guidelines

docs/design/kangcheolung-#18-permission-grant-revoke.md (1)

333-340: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

revokePermission()의 중복 조회 계약을 명확히 하세요.

CollectionPermissionCommandService.revokePermission()은 이미 permission.getCollection()으로 컬렉션을 얻습니다. 그러나 canAdminCollection(revokerId, collectionId)를 호출해 ID 오버로드의 getActiveCollection(collectionId)를 다시 실행합니다. 이 경로는 추가 repository 조회를 수행하며, 연관관계가 초기화되지 않았다면 추가 SELECT가 발생할 수 있습니다.

Line 340의 “별도 수정 불필요”는 soft-delete 검사는 설명하지만, 중복 조회 감소 범위는 설명하지 않습니다. 이미 조회한 엔티티의 상태를 확인한 뒤 엔티티 오버로드를 사용하거나, fresh status 조회가 의도된 보호 장치라면 그 이유와 SQL 검증 테스트를 문서화하세요.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/design/kangcheolung-`#18-permission-grant-revoke.md around lines 333 -
340, Update the documented revokePermission() flow to explicitly address
duplicate collection loading: use permission.getCollection() with the entity
overload of canAdminCollection() after validating the entity status, or document
the intentional fresh status lookup and add SQL-verification coverage. Replace
the claim that no change is needed with the chosen behavior and preserve the
soft-delete protection.
src/main/java/com/opensource/docgrid/domain/collection/service/query/CollectionQueryService.java (1)

28-35: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

변경한 순차 흐름에 단계 주석을 추가하세요.

Line 28-35는 컬렉션 조회, soft-delete 필터, 읽기 권한 검사, DTO 변환의 순차 흐름을 추가합니다. 중요한 단계에 1., 2., 3. 주석을 추가하세요. 주석은 soft-delete 및 권한 경계를 설명해야 하며 단순한 문법 반복은 피하세요.

주석 예시
-    // 컬렉션 단건 조회 — 소유자, PUBLIC, 또는 권한을 부여받은 사용자만 가능
+    // 컬렉션 단건 조회
     public CollectionResponse getCollection(Long userId, Long collectionId) {
+        // 1. 삭제된 컬렉션을 제외한다.
         DocumentCollection collection = collectionRepository.findById(collectionId)
                 .filter(c -> c.getStatus() != CollectionStatus.DELETED)
                 .orElseThrow(() -> new DocGridException(ErrorCode.COLLECTION_NOT_FOUND));
+        // 2. 현재 사용자의 읽기 권한을 확인한다.
         if (!permissionQueryService.canReadCollection(userId, collection)) {
             throw new DocGridException(ErrorCode.PERMISSION_DENIED);
         }
+        // 3. 권한이 확인된 컬렉션을 응답 DTO로 변환한다.
         return collectionConverter.toResponse(collection);
     }

As per coding guidelines: “For sequential execution flows, add numbered comments such as 1., 2., 3., and 4. at the relevant steps.”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@src/main/java/com/opensource/docgrid/domain/collection/service/query/CollectionQueryService.java`
around lines 28 - 35, Update getCollection with numbered comments for the
sequential flow: mark collection lookup with the soft-delete exclusion boundary,
mark read-permission validation for the owner/PUBLIC/authorized-user boundary,
and mark the final DTO conversion step. Keep comments descriptive rather than
repeating the statements.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.claude/commands/update-design-doc.md:
- Around line 3-7: Update the argument guidance in the update-design-doc command
to require issue numbers without a leading “#”, and change the design-document
lookup pattern to add the single expected “#” before the numeric argument so
filenames such as kangcheolung-#21-permission-query-service.md match correctly.

In `@docs/design/kangcheolung-`#21-permission-query-service.md:
- Line 37: Update the PermissionQueryService documentation at the referenced
overview and repeated summary to distinguish logical permission groups from Java
method signatures: describe the three document permission methods plus the three
collection permission groups, each exposing ID and DocumentCollection overloads,
for a total of nine public signatures rather than six.

In `@docs/design/kangcheolung-`#29-collection-management.md:
- Line 214: Update the documentation statement describing
CollectionQueryServiceTest so it matches the actual tests: either remove the
claim that getMyCollections cases exist, or add the corresponding
getMyCollections test cases before retaining that claim. Keep the documented
getCollection test count accurate.

In
`@src/main/java/com/opensource/docgrid/domain/collection/controller/CollectionController.java`:
- Around line 98-100: Update the CollectionController operation description for
adding documents to explicitly include ADMIN alongside WRITE and the owner as
permitted users, matching the canWrite policy used by canWriteCollection().

In
`@src/main/java/com/opensource/docgrid/domain/permission/service/query/PermissionQueryService.java`:
- Around line 254-287: Update the DocumentCollection overloads
canReadCollection(Long, DocumentCollection), canWriteCollection(Long,
DocumentCollection), and canAdminCollection(Long, DocumentCollection) to reject
collections whose status is CollectionStatus.DELETED by throwing the existing
COLLECTION_NOT_FOUND exception before any permission checks. Revise the
canReadCollection comment so it no longer relies on callers to guarantee
non-deleted entities.

---

Nitpick comments:
In @.claude/commands/update-design-doc.md:
- Around line 12-13: Update the documentation guidance in the relevant command
instructions to distinguish placement by change type: record newly added files
under the “신규 파일” section, while documenting new methods or endpoints added to
existing files in their corresponding API or flow section. Preserve the separate
“설계 결정 요약” guidance for newly introduced design decisions.

In `@docs/design/kangcheolung-`#18-permission-grant-revoke.md:
- Around line 333-340: Update the documented revokePermission() flow to
explicitly address duplicate collection loading: use permission.getCollection()
with the entity overload of canAdminCollection() after validating the entity
status, or document the intentional fresh status lookup and add SQL-verification
coverage. Replace the claim that no change is needed with the chosen behavior
and preserve the soft-delete protection.

In
`@src/main/java/com/opensource/docgrid/domain/collection/service/query/CollectionQueryService.java`:
- Around line 28-35: Update getCollection with numbered comments for the
sequential flow: mark collection lookup with the soft-delete exclusion boundary,
mark read-permission validation for the owner/PUBLIC/authorized-user boundary,
and mark the final DTO conversion step. Keep comments descriptive rather than
repeating the statements.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 793b3b8f-aef6-4103-8835-ab661852c569

📥 Commits

Reviewing files that changed from the base of the PR and between abc2834 and 43b6c2d.

📒 Files selected for processing (22)
  • .claude/commands/update-design-doc.md
  • docs/design/kangcheolung-#16-collection-crud.md
  • docs/design/kangcheolung-#18-permission-grant-revoke.md
  • docs/design/kangcheolung-#21-permission-query-service.md
  • docs/design/kangcheolung-#29-collection-management.md
  • src/main/java/com/opensource/docgrid/domain/auth/service/command/AuthCommandService.java
  • src/main/java/com/opensource/docgrid/domain/auth/service/query/AuthQueryService.java
  • src/main/java/com/opensource/docgrid/domain/collection/controller/CollectionController.java
  • src/main/java/com/opensource/docgrid/domain/collection/service/command/CollectionCommandService.java
  • src/main/java/com/opensource/docgrid/domain/collection/service/query/CollectionQueryService.java
  • src/main/java/com/opensource/docgrid/domain/permission/repository/CollectionPermissionRepository.java
  • src/main/java/com/opensource/docgrid/domain/permission/service/command/CollectionPermissionCommandService.java
  • src/main/java/com/opensource/docgrid/domain/permission/service/query/PermissionQueryService.java
  • src/main/java/com/opensource/docgrid/domain/user/repository/UserRoleRepository.java
  • src/main/java/com/opensource/docgrid/global/config/SecurityConfig.java
  • src/test/java/com/opensource/docgrid/domain/auth/fixture/AuthFixture.java
  • src/test/java/com/opensource/docgrid/domain/auth/service/command/AuthCommandServiceTest.java
  • src/test/java/com/opensource/docgrid/domain/auth/service/query/AuthQueryServiceTest.java
  • src/test/java/com/opensource/docgrid/domain/collection/service/command/CollectionCommandServiceTest.java
  • src/test/java/com/opensource/docgrid/domain/collection/service/query/CollectionQueryServiceTest.java
  • src/test/java/com/opensource/docgrid/domain/permission/service/command/CollectionPermissionCommandServiceTest.java
  • src/test/java/com/opensource/docgrid/domain/permission/service/query/PermissionQueryServiceTest.java

Comment thread .claude/commands/update-design-doc.md Outdated
Comment thread docs/design/kangcheolung-#21-permission-query-service.md Outdated
Comment thread docs/design/kangcheolung-#29-collection-management.md Outdated
kangcheolung and others added 3 commits August 1, 2026 17:42
canReadCollection/canWriteCollection/canAdminCollection의 엔티티
오버로드가 호출부의 soft-delete 필터링에만 의존하고 있어, 호출부가
필터링을 빠뜨린 엔티티를 넘기면 삭제된 컬렉션도 권한이 통과될 수
있었다. validateActiveCollection()을 엔티티 오버로드 진입 지점에
추가해 추가 쿼리 없이 자체 방어하도록 한다(CodeRabbit 리뷰 반영).

addDocument()의 Swagger description도 canWriteCollection()이 WRITE뿐
아니라 ADMIN 권한자도 통과시킨다는 실제 동작에 맞게 정정한다.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
소유자여도 삭제된 컬렉션 엔티티를 canReadCollection에 직접 넘기면
COLLECTION_NOT_FOUND가 발생하는지 검증한다.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
update-design-doc 커맨드에 $ARGUMENTS는 #없이 숫자만 전달해야 함을
명시(패턴에 이미 #이 포함돼 있어 #21처럼 넘기면 매칭 실패).
#21 문서의 public 메서드 개수 표기를 오버로드 포함 실제 시그니처
개수(9개)에 맞게 정정. #29 문서의 getMyCollections 테스트 관련
설명이 실제로는 존재하지 않는 테스트를 언급하고 있어 바로잡고,
테스트 커버리지 공백으로 기록한다.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@kangcheolung
kangcheolung merged commit fc290c5 into develop Aug 1, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Refactor] 인증/권한 기능 리펙토링

1 participant