Skip to content

[WEB-1506] chore: workspace role demotion#5612

Merged
pushya22 merged 1 commit intopreviewfrom
chore/role-demotion
Sep 16, 2024
Merged

[WEB-1506] chore: workspace role demotion#5612
pushya22 merged 1 commit intopreviewfrom
chore/role-demotion

Conversation

@NarayanBavisetti
Copy link
Collaborator

@NarayanBavisetti NarayanBavisetti commented Sep 16, 2024

chore:

  • If a workspace admin is demoted to a member, their role in all associated projects will also be changed to member.
  • Similarly, if a workspace admin is demoted to a guest, they will be assigned the guest role across all projects.
  • When a workspace member is demoted to guest, their role in all projects they are part of will be updated to guest as well.
  • If a workspace admin joins a project, they will automatically be assigned the admin role for that project.

Summary by CodeRabbit

  • New Features

    • Simplified role assignment for project members, allowing direct reflection of workspace roles.
    • Updated logic for updating workspace member roles, enabling easier role adjustments without restrictions on higher roles.
  • Bug Fixes

    • Improved error handling and validation during workspace member role updates.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 16, 2024

Walkthrough

The changes in this pull request involve modifications to role assignment logic in two files: invite.py and member.py. In invite.py, the role assigned to a ProjectMember is now directly set based on workspace_role, eliminating previous conditional checks. In member.py, the partial_update method has been simplified to allow role updates without restrictions on assigning higher roles, streamlining the update process.

Changes

File Change Summary
apiserver/plane/app/views/project/invite.py Simplified role assignment in create method of ProjectMember, removing conditional logic.
apiserver/plane/app/views/workspace/member.py Updated partial_update method to allow higher role assignments without validation checks.

Possibly related PRs

  • [WEB-2443] fix: project member validation #5601: The changes in this PR also involve role management and validation for project members, which is directly related to the modifications made in the main PR regarding role assignment logic in the ProjectMember instantiation.

Suggested labels

🐛bug, 🌐frontend

Poem

In the meadow where rabbits play,
Roles now shift in a simpler way.
With a hop and a skip, they assign with glee,
No more checks, just let it be!
Hurray for the changes, let’s dance and cheer,
For smoother updates, we hold so dear! 🐇✨


Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between f155a13 and 6eec709.

Files selected for processing (2)
  • apiserver/plane/app/views/project/invite.py (1 hunks)
  • apiserver/plane/app/views/workspace/member.py (4 hunks)
Additional comments not posted (4)
apiserver/plane/app/views/project/invite.py (1)

167-167: LGTM!

The code change simplifies the role assignment process and ensures that the project member's role directly reflects their workspace role. This aligns with the PR objective of maintaining consistency between workspace and project roles when a user's workspace role is updated.

The change does not introduce any apparent issues or edge cases.

apiserver/plane/app/views/workspace/member.py (3)

17-17: LGTM!

The import statement for ROLE is correctly added.


Line range hint 98-115: The role update logic looks good!

The changes simplify the role-checking logic and ensure role consistency across the workspace and its projects by updating the role of the workspace member in all associated projects.


136-136: LGTM!

The formatting change to the @allow_permission decorator improves readability without introducing any functional changes.


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 changed the title chore: workspace role demotion [1506] chore: workspace role demotion Sep 16, 2024
@pushya22 pushya22 changed the title [1506] chore: workspace role demotion [WEB-1506] chore: workspace role demotion Sep 16, 2024
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