plane icon indicating copy to clipboard operation
plane copied to clipboard

[WEB-3597] fix: guest work item view access when hyper mode is enabled

Open prateekshourya29 opened this issue 8 months ago • 2 comments

Description

This PR resolves an issue where guest were able to view work items even when view access was disabled for guests.

Type of Change

  • [x] Bug fix (non-breaking change which fixes an issue)

Summary by CodeRabbit

  • New Features

    • Enhanced guest-access controls: Projects now include a setting that indicates if guests can view all features, ensuring that guest users only see data when permitted.
    • Improved issue visibility: When guest access is restricted, guests will no longer see issue data.
  • Refactor

    • Streamlined project settings by removing outdated configuration fields for better clarity and maintainability.
    • Updated query handling for improved robustness and type safety in issue retrieval.

prateekshourya29 avatar Mar 20 '25 10:03 prateekshourya29

Walkthrough

The changes add a new field, guest_view_all_features, to the project API response and adjust type definitions accordingly. The API now includes an extra attribute in the ProjectViewSet list method to support guest permissions. In the TypeScript definitions, the field is added to IPartialProject and removed from IProject along with two other properties. Additionally, the local database retrieval logic in Storage.getIssues is updated to enforce an early exit when a guest user attempts to access features not permitted by the project settings.

Changes

File(s) Change Summary
apiserver/.../project/base.py Added the guest_view_all_features field to the list method in ProjectViewSet.
packages/types/.../projects.d.ts Added guest_view_all_features as an optional property to IPartialProject and removed it, along with is_issue_type_enabled and is_time_tracking_enabled, from IProject.
web/core/.../storage.sqlite.ts Enhanced getIssues by modifying parameter types and introducing query sanitization logic.
web/core/.../utils/query-sanitizer.ts Added sanitizeWorkItemQueries function to clean up query parameters based on user permissions.
web/core/.../issue.service.ts Updated getIssues method to enforce type safety for query parameters using TIssueParams.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Storage
    participant RootStore

    User->>Storage: Request issues for a project
    Storage->>RootStore: Retrieve project details & user role
    RootStore-->>Storage: Return project details and role
    alt User is guest and guest view is disallowed
        Storage-->>User: Return empty results
    else
        Storage-->>User: Return issues data
    end

Possibly related PRs

  • makeplane/plane#5787: Modifies the UI to hide the "Log Work" button for guest users, related to handling guest user permissions.
  • makeplane/plane#5695: Enhances access permissions for guest users, complementing the changes made in this PR.
  • makeplane/plane#5588: Directly related to modifications that enhance user permissions based on the guest_view_all_features attribute.

Suggested labels

🐛bug, 🌐frontend, ⚙️backend

Suggested reviewers

  • sriramveeraghanta
  • SatishGandham
  • rahulramesha

Poem

I'm a little code rabbit, hopping by at dawn,
Adding new fields so our projects live on.
A guest view field in a spring of clean code,
Guarding permissions on each little node.
With a hop and a nibble, I debug with delight,
Celebrating changes from morning to night!
🐇✨

✨ Finishing Touches
  • [ ] 📝 Generate Docstrings

🪧 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @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 generate docstrings to generate docstrings for this 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.

coderabbitai[bot] avatar Mar 20 '25 10:03 coderabbitai[bot]

Pull Request Linked with Plane Work Items

Comment Automatically Generated by Plane

makeplane[bot] avatar Mar 20 '25 12:03 makeplane[bot]