Skip to content

Conversation

@ycdzj
Copy link
Contributor

@ycdzj ycdzj commented Oct 22, 2025

  • refactor(namespaces): check if user is owner
  • refactor(namespaces): check namespace-owner
  • refactor(groups): use namespace owner interceptor
  • refactor(invitations): check owner

Copilot AI review requested due to automatic review settings October 22, 2025 09:05
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors permission checks by introducing a reusable @NamespaceOwner decorator that verifies user ownership of namespaces. The refactoring eliminates duplicated authorization logic across controllers by centralizing the ownership validation in an interceptor.

Key changes:

  • Created a new NamespaceOwnerInterceptor to validate namespace ownership
  • Introduced a @NamespaceOwner decorator for applying the interceptor to controller methods
  • Replaced inline ownership checks with the decorator across namespaces, groups, and invitations controllers

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/namespaces/namespaces.module.ts Registers the new NamespaceOwnerInterceptor provider
src/namespaces/namespaces.controller.ts Applies @NamespaceOwner decorator to member and namespace management endpoints
src/namespaces/interceptors/namespace-owner.interceptor.ts Implements the ownership validation interceptor
src/namespaces/decorators/namespace-owner.decorator.ts Defines the decorator that applies the interceptor
src/invitations/invitations.module.ts Imports NamespacesModule to support the ownership decorator
src/invitations/invitations.controller.ts Applies @NamespaceOwner decorator to invitation management endpoints
src/groups/groups.controller.ts Removes inline ownership checks and applies @NamespaceOwner decorator to all endpoints

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@ycdzj ycdzj merged commit b80a01c into main Oct 23, 2025
4 checks passed
@ycdzj ycdzj deleted the refactor/permissions branch October 23, 2025 12:25
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.

3 participants