-
Notifications
You must be signed in to change notification settings - Fork 2.2k
[WEB-2443] fix: project intake edit permission #5588
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
Warning Rate limit exceeded@anmolsinghbhatia has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 12 minutes and 41 seconds before requesting another review. How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. WalkthroughThe changes enhance user permissions and visibility controls in the inbox and project invitation functionalities. Modifications in the Changes
Possibly related PRs
Suggested labels
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 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 (
|
…lane/plane into fix-project-intake-role-validation
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
Outside diff range and nitpick comments (2)
apiserver/plane/app/views/project/invite.py (1)
59-73
: Excellent work on improving the role validation logic!The new role validation logic is more robust compared to the previous implementation. It ensures that invited users cannot have a different role than what is defined in the workspace. The logic correctly handles the case when the invited user's role is either 5 or 20 and returns an appropriate error response if there is a mismatch.
The code changes are well-structured and easy to understand. This modification enhances the integrity of the user invitation process by enforcing stricter role validation.
To further improve the code maintainability and reusability, consider extracting the role validation logic into a separate helper function. This will make the code more modular and easier to test.
apiserver/plane/app/views/inbox/base.py (1)
173-173
: LGTM!The retrieval of the
Project
object using theproject_id
from the URL parameters is a valid operation.Please remove the trailing whitespace at the end of line 173 to maintain consistent formatting.
Tools
GitHub Check: Codacy Static Code Analysis
[notice] 173-173: apiserver/plane/app/views/inbox/base.py#L173
Trailing whitespace
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (3)
- apiserver/plane/app/views/inbox/base.py (5 hunks)
- apiserver/plane/app/views/project/invite.py (3 hunks)
- web/core/components/inbox/content/root.tsx (4 hunks)
Additional context used
GitHub Check: Codacy Static Code Analysis
apiserver/plane/app/views/inbox/base.py
[notice] 173-173: apiserver/plane/app/views/inbox/base.py#L173
Trailing whitespace
Additional comments not posted (9)
web/core/components/inbox/content/root.tsx (5)
8-8
: LGTM!The import statement for the
useUser
hook is correct and consistent with the other imports.
37-37
: LGTM!The
useUser
hook is correctly used to retrieve the current user's data, and the retrieved data is destructured and assigned to thecurrentUser
variable.
40-40
: LGTM!The import statement for the
projectPermissionsByWorkspaceSlugAndProjectId
function from theuseUserPermissions
hook is correct and consistent with the other imports.
65-68
: LGTM!The addition of the
EUserPermissions.GUEST
permission to theallowPermissions
function is consistent with the PR objective of allowing guests to edit their own issues.
69-70
: LGTM!The introduction of the
isGuest
andreadOnly
variables enhances the component's logic regarding user permissions and editing capabilities. ThereadOnly
variable ensures that editing is disabled when the user is a guest and the creator of the issue, and the update to theisEditable
condition is consistent with this change.Also applies to: 96-96
apiserver/plane/app/views/project/invite.py (1)
48-48
: LGTM!The
@allow_permission([ROLE.ADMIN])
decorator is correctly implemented and aligns with the objective of enforcing stricter role validation for creating invitations. This change enhances security by ensuring that only authorized users with the admin role can create invitations.apiserver/plane/app/views/inbox/base.py (3)
203-212
: LGTM!The additional permission checks based on the user's role and project settings are implemented correctly. They ensure that guests with role 5 can only view their own issues if the project restricts guest access to all features. This enhances the security and privacy of issue visibility within the project.
524-524
: LGTM!Adding the
ROLE.GUEST
role to the allowed roles for theretrieve
method is a valid change. It allows guest users to retrieve inbox issues, subject to the additional permission checks implemented in theretrieve
method.
Line range hint
533-574
: LGTM!The additional permission checks in the
retrieve
method are implemented correctly. They ensure that guests with role 5 cannot view issues that they did not create if the project restricts guest access to all features. This aligns with the permission checks introduced in thelist
method and enhances the security and privacy of issue visibility within the 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.
Approving frontend changes
Changes:
This PR resolves the project intake permission issue, where a guest was unable to edit their own issue.
Reference:
[WEB-2443]
Summary by CodeRabbit
New Features
Improvements
Bug Fixes