Skip to content

Refactor notification authorization to use membership repositories#38

Closed
MarkADom wants to merge 1 commit intorelease/v1.0.0-finalizefrom
codex/refactor-authorization-logic-to-use-repositories
Closed

Refactor notification authorization to use membership repositories#38
MarkADom wants to merge 1 commit intorelease/v1.0.0-finalizefrom
codex/refactor-authorization-logic-to-use-repositories

Conversation

@MarkADom
Copy link
Copy Markdown
Owner

Motivation

  • Move all contextual authorization checks in notifications off aggregate collection traversal and onto membership repository lookups to centralize and speed authorization decisions.
  • Preserve existing controller contracts, transactional boundaries, and domain aggregate collections while avoiding repository injection into controllers.

Description

  • Replaced checks against board.members, project.projectMembers, and task.members in NotificationService with repository calls to existsByBoardIdAndUserId, existsByProjectIdAndUserId, and existsByTaskIdAndUserId respectively.
  • Injected BoardMemberRepository, ProjectMemberRepository, and TaskMemberRepository into NotificationService and used actor id lookups for repository-based authorization while keeping aggregates intact.
  • Updated NotificationServiceTest to mock the new member repositories, adapt board/project/task test fixtures, and add verifications that the membership repository methods are invoked for authorization.
  • No controller signatures were changed and transactional behavior was left unchanged.

Testing

  • Updated unit tests: NotificationServiceTest now includes mocks for BoardMemberRepository, ProjectMemberRepository, and TaskMemberRepository and asserts repository method calls for board/project/task authorization; these test changes are committed.
  • Attempted to run the targeted service tests locally, but test execution was blocked by the environment failing to resolve an external Gradle plugin (io.gitlab.arturbosch.detekt), so automated runs did not complete.
  • The test modifications are structured to be runnable in CI or a local environment with normal Gradle plugin resolution and should pass once dependencies can be resolved.

Codex Task

@MarkADom MarkADom closed this Feb 28, 2026
@MarkADom MarkADom deleted the codex/refactor-authorization-logic-to-use-repositories branch February 28, 2026 19:47
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.

1 participant