Skip to content

fix: permissions not revoked after view project disabled #5438

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

tiagoapolo
Copy link
Contributor

Ref: #5432

Thanks for submitting a PR! Please check the boxes below:

  • I have added information to docs/ if required so people know about the feature!
  • I have filled in the "Changes" section below?
  • I have filled in the "How did you test this code" section below?
  • I have used a Conventional Commit title for this Pull Request

Changes

Ref: #5432

https://www.loom.com/share/a321aefb3f8d4298a181876f6b67baab?sid=f652b515-569d-4aee-a957-a93ebcd93466

Please describe.

How did you test this code?

Please describe.

@tiagoapolo tiagoapolo requested a review from a team as a code owner May 8, 2025 23:51
@tiagoapolo tiagoapolo requested review from kyle-ssg and removed request for a team May 8, 2025 23:51
Copy link

vercel bot commented May 8, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
flagsmith-frontend-preview ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 9, 2025 0:25am
flagsmith-frontend-staging ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 9, 2025 0:25am
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
docs ⬜️ Ignored (Inspect) Visit Preview May 9, 2025 0:25am

Copy link
Contributor

github-actions bot commented May 8, 2025

Docker builds report

Image Build Status Security report
ghcr.io/flagsmith/flagsmith-api-test:pr-5438 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-e2e:pr-5438 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-api:pr-5438 Finished ✅ Results
ghcr.io/flagsmith/flagsmith:pr-5438 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-private-cloud:pr-5438 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-frontend:pr-5438 Finished ✅ Results

Copy link
Contributor

github-actions bot commented May 8, 2025

Uffizzi Ephemeral Environment Deploying

☁️ https://app.uffizzi.com/github.com/Flagsmith/flagsmith/pull/5438

⚙️ Updating now by workflow run 14928873199.

What is Uffizzi? Learn more!

@tiagoapolo tiagoapolo requested review from Zaimwa9 and Copilot May 9, 2025 11:05
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR addresses the issue where permissions are not being revoked after a view project is disabled by refactoring the permission lookup and toggle logic, and by improving user feedback during permission changes.

  • Refactored the processResults logic by extracting separate functions for finding permissions by group, role, or user.
  • Introduced a new RemoveViewPermissionModal component to confirm removal of view permissions and replaced direct tag query usage.
  • Added a new utility function (capitalize) to standardize string capitalization and updated toast messages accordingly.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
frontend/web/components/EditPermissions.tsx Refactored permission processing logic, updated permission toggle behavior to use a confirmation modal, and improved button state handling.
frontend/common/utils/utils.tsx Added a new capitalize utility function to improve the consistency of string casing.
Comments suppressed due to low confidence (1)

frontend/web/components/EditPermissions.tsx:985

  • [nitpick] The onChange handler contains nested conditions for handling view permission toggling. Consider extracting this logic into a helper function to improve readability and maintainability.
if (level !== 'organisation' && p.key === viewPermission && hasPermission(viewPermission) && entityPermissions.permissions.length > 1) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix front-end Issue related to the React Front End Dashboard
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants