Skip to content

feat(5308): Add endpoints to support permission debugging #5408

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

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

gagantrivedi
Copy link
Member

@gagantrivedi gagantrivedi commented May 1, 2025

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

Implement Endpoints defined here

How did you test this code?

  • tested manually with rbac installed to make sure tags/role stuff is working correctly
  • Adds unit tests

Copy link

vercel bot commented May 1, 2025

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

3 Skipped Deployments
Name Status Preview Comments Updated (UTC)
docs ⬜️ Ignored (Inspect) Visit Preview May 7, 2025 11:53am
flagsmith-frontend-preview ⬜️ Ignored (Inspect) Visit Preview May 7, 2025 11:53am
flagsmith-frontend-staging ⬜️ Ignored (Inspect) Visit Preview May 7, 2025 11:53am

@github-actions github-actions bot added api Issue related to the REST API feature New feature or request labels May 1, 2025
Copy link
Contributor

github-actions bot commented May 1, 2025

Uffizzi Ephemeral Environment Deploying

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

⚙️ Updating now by workflow run 14882706414.

What is Uffizzi? Learn more!

@github-actions github-actions bot added feature New feature or request and removed feature New feature or request labels May 1, 2025
@gagantrivedi gagantrivedi requested a review from Copilot May 1, 2025 08:06
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 implements new endpoints and corresponding tests for retrieving detailed permissions information for projects, organisations, and environments to aid in permission debugging. Key changes include:

  • Addition of new detailed permissions endpoints and related test cases.
  • Updates to serializers and permission calculation logic to support the detailed permissions structure.
  • Modifications to views and permission checks to ensure only authorized users can access detailed permission information.

Reviewed Changes

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

Show a summary per file
File Description
api/tests/unit/projects/test_unit_projects_views.py Added tests for detailed permissions endpoint for projects.
api/tests/unit/permissions/test_unit_permissions_calculator.py Added a new test for converting permission data to detailed permissions, along with updates for role permission data.
api/tests/unit/organisations/test_unit_organisations_views.py Added tests for detailed permissions endpoint for organisations.
api/tests/unit/environments/test_unit_environments_views.py Added tests for detailed permissions endpoint for environments.
api/projects/views.py Introduced a new action (detailed_permissions) to get detailed permissions for a user.
api/projects/permissions.py Extended permission check to include the detailed_permissions action.
api/permissions/serializers.py Added detailed permissions serializers to support the new endpoint responses.
api/permissions/rbac_wrapper.py Removed an unused RolePermissionData import.
api/permissions/permissions_calculator.py Updated permission data classes and added a method to convert permission data into detailed permissions data.
api/organisations/views.py Added a detailed_permissions endpoint for organisations.
api/organisations/permissions/permissions.py Updated permission checks for detailed permissions in organisations.
api/environments/views.py Added a detailed_permissions endpoint for environments.
api/environments/permissions/permissions.py Updated permission checks for detailed permissions in environments.

Copy link

codecov bot commented May 1, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.64%. Comparing base (8dc92c3) to head (c723941).
Report is 29 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5408      +/-   ##
==========================================
+ Coverage   97.61%   97.64%   +0.02%     
==========================================
  Files        1237     1239       +2     
  Lines       42975    43303     +328     
==========================================
+ Hits        41952    42285     +333     
+ Misses       1023     1018       -5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions github-actions bot added feature New feature or request and removed feature New feature or request labels May 7, 2025
@github-actions github-actions bot added feature New feature or request and removed feature New feature or request labels May 7, 2025
@@ -29,7 +28,7 @@
from environments.models import Environment
from users.models import FFAdminUser


# Some random comment
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
# Some random comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Issue related to the REST API feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants