-
Notifications
You must be signed in to change notification settings - Fork 2
refactor(permissions): add owner check #213
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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
There was a problem hiding this 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
NamespaceOwnerInterceptorto validate namespace ownership - Introduced a
@NamespaceOwnerdecorator 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.