-
Notifications
You must be signed in to change notification settings - Fork 2
fix(rbac): Improve member removal permissions & enhance hackathon retrieval logic #354
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
…cluding owners) and introduce redirect skipping in role protection for invitation flows.
… API routes to use it, while restricting hackathon deletion to company owners or admins.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Caution Review failedThe pull request is closed. WalkthroughThis pull request enhances authorization and lookup mechanisms across company member management and hackathon operations. It expands member removal permissions to include admins while preventing admins from removing owners, improves hackathon API routes with stricter authentication and better error handling, introduces a new ID/slug-based hackathon lookup utility, and extends role protection to support conditional redirect skipping for invitation flows. Changes
Sequence Diagram(s)sequenceDiagram
participant Admin as Admin User
participant UI as TeamManagement UI
participant API as Members API
rect rgb(200, 220, 240)
Note over Admin,API: New Admin Flow - Remove Member
end
Admin->>UI: Click Remove Member (non-owner)
activate UI
UI->>UI: Check canRemoveMembers<br/>(owner OR admin)
UI->>UI: Check: isOwner(targetMember)?
UI-->>Admin: Show Remove option
deactivate UI
Admin->>API: DELETE /members/[userId]
activate API
API->>API: Verify user is owner/admin
alt Target is Owner
API-->>Admin: 403 Forbidden<br/>Only owners can remove owners
else Target is Member
API->>API: Remove member & send email
API-->>Admin: 204 Success
end
deactivate API
sequenceDiagram
participant Req as Request Handler
participant Service as HackathonsService
participant DB as Database
rect rgb(220, 240, 200)
Note over Req,DB: Delete Hackathon - Enhanced Auth & Lookup
end
Req->>Req: Verify user is owner/admin
alt Not Authorized
Req-->>Req: 403 Forbidden
else Authorized
Req->>Service: deleteHackathon(idOrSlug)
activate Service
Service->>Service: getHackathonByIdOrSlug(idOrSlug)
Service->>DB: Query by ID or slug
DB-->>Service: Hackathon found
alt Not Found
Service-->>Req: null
else Found
Service->>DB: DELETE hackathon by ID
Service->>Service: Clear cache
Service-->>Req: Success
end
deactivate Service
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes
Possibly related PRs
Poem
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (6)
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. Comment |
This PR introduces improvements to RBAC logic and enhances the flexibility of hackathon data retrieval.
🔐 RBAC Fixes
🧩 Hackathon Retrieval Improvements
🎯 Why This Matters
🗂️ Summary
Authored by: @akshay0611
Summary by CodeRabbit
New Features
Bug Fixes