Skip to content
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

[WEB-2460] chore: restrict member to see private projects #5640

Merged
merged 1 commit into from
Sep 18, 2024

Conversation

NarayanBavisetti
Copy link
Collaborator

@NarayanBavisetti NarayanBavisetti commented Sep 18, 2024

chore:

  • workspace member should not see the private projects.

Issue Link: WEB-2460

Summary by CodeRabbit

  • New Features

    • Updated user role permissions for project access, potentially allowing users with the new role to see additional projects or restricting access to some previously available.
  • Bug Fixes

    • Adjusted filtering logic for project listings based on the updated role value.

Copy link
Contributor

coderabbitai bot commented Sep 18, 2024

Walkthrough

The pull request modifies the role parameter in the list method of a class located in the apiserver/plane/app/views/project/base.py file. The value of the role has been changed from 10 to 15, which likely affects user access levels and permissions when querying projects within a workspace. This change may alter the filtering logic for project accessibility based on the user's role.

Changes

File Path Change Summary
apiserver/plane/app/views/project/base.py Modified the role parameter in the list method from 10 to 15.

Possibly related PRs

Suggested labels

🧹chore

Suggested reviewers

  • sriramveeraghanta
  • SatishGandham
  • pushya22

🐰 In the meadow, where bunnies play,
A change in roles brightens the day.
From ten to fifteen, oh what a leap,
New projects to find, new secrets to keep!
Hopping along, with access so grand,
Together we thrive, in this fluffy land! 🌼


Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 1c0c158 and 999f2c8.

Files selected for processing (1)
  • apiserver/plane/app/views/project/base.py (1 hunks)
Additional comments not posted (1)
apiserver/plane/app/views/project/base.py (1)

176-176: Verify the intended access level for role 15.

The role value in the query has been changed from 10 to 15. This modification could potentially expand the project visibility for users with role 15.

Please ensure that this change aligns with the expected access control for projects. Consider the implications of allowing users with role 15 to view projects they are an active member of or projects with network=2.

To verify the impact of this change, you can run the following script:

This script searches for the specific filter condition applied to projects for users with role 15 and analyzes the filtered projects to ensure the visibility aligns with the expected access control.

Verification successful

Role change to 15 expands project visibility as intended

The change from role 10 to role 15 is verified and intentional. Users with role 15 now have expanded project visibility compared to those with role 5:

  • Role 5 users can only see projects where they are active members.
  • Role 15 users can see projects where they are active members OR projects with network=2.

This change aligns with the expected behavior mentioned in the original review comment. To maintain clarity:

  • Consider documenting the role hierarchy and corresponding access levels for future reference.
  • Ensure that the expansion of visibility for role 15 users is communicated to relevant stakeholders.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash

# Description: Verify the project visibility for users with role 15.

# Test: Search for projects accessible to users with role 15.
# Expect: Only projects that the user is an active member of or projects with network=2.
echo "Searching for projects accessible to users with role 15..."
rg --type python $'WorkspaceMember.objects.filter\(.*role=15.*\).exists\(\).*projects = projects.filter\(.*\)'

echo "Analyzing the filtered projects..."
rg --type python $'projects = projects.filter\(.*\)'

Length of output: 433


Script:

#!/bin/bash

# Description: Verify the project visibility for users with role 15 using a more generic approach.

# Find Python files and search for the role=15 condition
echo "Searching for the role=15 condition in Python files..."
fd '\.py$' | xargs rg 'role\s*=\s*15'

# Search for project filtering logic
echo "Searching for project filtering logic..."
fd '\.py$' | xargs rg 'projects\s*=\s*projects\.filter'

# Search for WorkspaceMember filtering
echo "Searching for WorkspaceMember filtering..."
fd '\.py$' | xargs rg 'WorkspaceMember\.objects\.filter'

Length of output: 4358


Script:

#!/bin/bash

# Description: Examine the context around the role=15 change and associated project filtering logic

echo "Displaying context around role=15 in apiserver/plane/app/views/project/base.py:"
rg -C 10 'role\s*=\s*15' apiserver/plane/app/views/project/base.py

echo "\nDisplaying project filtering logic in apiserver/plane/app/views/project/base.py:"
rg -C 10 'projects\s*=\s*projects\.filter' apiserver/plane/app/views/project/base.py

Length of output: 2247


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?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    -- I pushed a fix in commit <commit_id>, please review it.
    -- Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    -- @coderabbitai generate unit testing code for this file.
    -- @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    -- @coderabbitai generate interesting stats about this repository and render them as a table.
    -- @coderabbitai read src/utils.ts and generate unit testing code.
    -- @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    -- @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@pushya22 pushya22 merged commit 30018d6 into preview Sep 18, 2024
14 of 15 checks passed
@pushya22 pushya22 deleted the chore/private-project branch September 18, 2024 09:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants