-
Notifications
You must be signed in to change notification settings - Fork 3.2k
[WEB-3600] fix: private project join issue #6799
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
WalkthroughThe changes add a new Changes
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (2)
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
Pull Request Linked with Plane Work Items
Comment Automatically Generated by Plane |
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
packages/types/src/enums.ts (1)
9-13: Added new enum for project network categorization.The implementation of
EProjectNetworkenum looks good, allowing projects to be categorized as either PRIVATE (0) or PUBLIC (2). This supports the fix for the private project join issue.However, there's a gap in the enum values (0 and 2 with no 1). Is this intentional to align with existing database values? If there's no specific reason, consider using sequential values for better maintainability.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
apiserver/plane/app/views/project/base.py(1 hunks)packages/types/src/enums.ts(1 hunks)web/core/layouts/auth-layout/project-wrapper.tsx(3 hunks)
🧰 Additional context used
🧬 Code Definitions (1)
web/core/layouts/auth-layout/project-wrapper.tsx (1)
web/core/components/auth-screens/project/join-project.tsx (1)
JoinProject(14-57)
🔇 Additional comments (5)
apiserver/plane/app/views/project/base.py (1)
182-182: Added "network" field to project list response.This addition exposes the project's network status to the frontend, which is necessary for implementing the permission logic for joining projects. The field was already being used in queries (lines 122, 205) but wasn't included in the response.
web/core/layouts/auth-layout/project-wrapper.tsx (4)
10-10: Added import for the EProjectNetwork enum.Proper import of the new enum to support the permission checks in this component.
74-78: Added workspace admin permission check.Good addition to determine if the current user has admin permissions at the workspace level, which will be used to allow workspace admins to join private projects.
177-182: Updated project join permission logic.The new logic properly implements the requirement to allow users to join projects that are either:
- Not private (network !== EProjectNetwork.PRIVATE), OR
- Any project if the user is a workspace admin
This fixes the issue where users couldn't join private projects when they should have access.
185-185: Simplified the empty state rendering condition.The condition for rendering the DetailedEmptyState has been simplified while maintaining the correct behavior. This ensures users see the appropriate UI when they don't have permission to access a project.
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.
Actionable comments posted: 0
🧹 Nitpick comments (2)
apiserver/plane/app/views/project/invite.py (1)
140-155: Good implementation of permission check for secret projectsThe added code correctly implements a permission check that prevents non-admin workspace members from joining projects with a SECRET network type, which directly addresses the issue described in the PR objectives.
Two minor points worth noting:
- The error message uses "private project" while the enum uses "SECRET" - consider standardizing terminology.
- If multiple projects are provided with mixed visibility, the request will fail entirely if any single project is SECRET.
apiserver/plane/db/models/project.py (1)
21-27: Well-structured enum implementationThe ProjectNetwork enum provides a clean, type-safe way to represent and reference network types rather than using magic numbers directly in the code.
Note that the enum values (0 and 2) are non-sequential. While this matches the existing NETWORK_CHOICES, it might be worth documenting why value 1 is skipped.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
apiserver/plane/app/views/project/invite.py(3 hunks)apiserver/plane/db/models/project.py(3 hunks)
🧰 Additional context used
🧬 Code Definitions (1)
apiserver/plane/app/views/project/invite.py (1)
apiserver/plane/db/models/project.py (2)
Project(59-178)ProjectNetwork(21-27)
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: Analyze (javascript)
- GitHub Check: Analyze (python)
🔇 Additional comments (4)
apiserver/plane/app/views/project/invite.py (2)
26-29: Import additions are appropriateThe additional imports of
ProjectandProjectNetworkare necessary for the new permission checks implemented in thecreatemethod.
131-131: LGTM: Permission decorator expanded appropriatelyExpanding the permission decorator to allow both admin and member roles at the workspace level aligns with the purpose of fixing the project join issue.
apiserver/plane/db/models/project.py (2)
4-4: LGTM: Added appropriate importThe addition of the Enum import is necessary for the new ProjectNetwork enum class.
126-137: Good addition of helper propertiesThese properties provide a clean interface for checking project network types and accessing the enum value. The type annotations are a nice touch for better IDE support and code clarity.
The implementation correctly compares against the enum values rather than magic numbers, which improves code readability and maintainability.
* fix: private project join issue * chore: return network value * fix: refactor * fix: refactor * fix: type * chore: added restricition for private projects * chore: removed extra validations * chore: added value to access enum --------- Co-authored-by: sangeethailango <[email protected]> Co-authored-by: NarayanBavisetti <[email protected]>
Description
This Pr fixes private Project joining permissions.
References
[WEB-3600]
Summary by CodeRabbit
New Features
Bug Fixes