Skip to content

fix: project admin feature import permissions - #8421

Merged
bakirFS merged 4 commits into
mainfrom
fix/project-admin-feature-import
Sep 1, 2026
Merged

fix: project admin feature import permissions#8421
bakirFS merged 4 commits into
mainfrom
fix/project-admin-feature-import

Conversation

@bakirFS

@bakirFS bakirFS commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

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

  • I have read the Contributing Guide.
  • 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.

Changes

Closes #8237

How did you test this code?

Verified that you get the message "To manage this feature you need the Administrator permission for this organisation.
Please contact a member of this organisation who has administrator privileges." when trying to import features as a project admin.
After the fix verified that a project admin is allowed to import features.

bakirFS and others added 4 commits August 27, 2026 09:42
Project admins could export features but not import them, since feature
imports required organisation admin while exports require environment
admin. Users who can export should be able to import.

Check environment admin instead, mirroring the export permissions. This
is satisfied by organisation, project and environment admins, so no
existing access is removed, and it matches the per-environment
granularity of the import endpoint.

On the frontend, the Import tab was gated behind AccountStore.isAdmin(),
which is organisation admin. Gate it on project-level ADMIN instead, with
a loading branch so project admins do not see a flash of the
permission-denied message. This also unblocks the LaunchDarkly tab, whose
backend only requires the project-level CREATE_ENVIRONMENT permission.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
toast() defaults its theme to 'success', and the Message component titles
any success-themed toast "Success". A failed import therefore rendered as
"Success / Failed to import flags", which reads as contradictory and hides
the failure.

Pass the 'danger' theme so the toast is titled "Error".

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@bakirFS
bakirFS requested review from a team as code owners August 31, 2026 12:49
@bakirFS
bakirFS requested review from matthewelwell and talissoncosta and removed request for a team August 31, 2026 12:49
@vercel

vercel Bot commented Aug 31, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

3 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs Ignored Ignored Aug 31, 2026 12:49pm
flagsmith-frontend-preview Ignored Ignored Aug 31, 2026 12:49pm
flagsmith-frontend-staging Ignored Ignored Aug 31, 2026 12:49pm

Request Review

@github-actions github-actions Bot added front-end Issue related to the React Front End Dashboard api Issue related to the REST API labels Aug 31, 2026
@github-actions

github-actions Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Docker builds report

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

@coderabbitai

coderabbitai Bot commented Aug 31, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 74c8f098-704b-4cf6-a0e2-c3c6d2799ceb

📥 Commits

Reviewing files that changed from the base of the PR and between 58eb348 and b0c7258.

📒 Files selected for processing (4)
  • api/features/import_export/permissions.py
  • api/tests/unit/features/import_export/test_unit_features_import_export_views.py
  • frontend/web/components/import-export/FeatureImport.tsx
  • frontend/web/components/import-export/ImportPage.tsx

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

Feature import authorisation now uses project administrator permissions in the API and frontend. The API includes a test for project administrators creating imports. The import page shows a loader while permission data loads and denies access when permission is absent. Failed imports now use a danger-styled toast.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: 🟡 Moderate · up to b0c72

Project administrators can now start destructive feature imports. If an import fails partway through or runs concurrently, project data may be left partially applied or inconsistent; this risk should be fixed or explicitly accepted before merge.

✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor
✅ private-cloud · depot-ubuntu-latest-arm-16 — run #19978 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  1 minute, 19 seconds
commit  b0c7258
info  🔄 Run: #19978 (attempt 1)

🗂️ Previous results
✅ private-cloud · depot-ubuntu-latest-16 — run #19978 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-16)

passed  3 passed

Details

stats  3 tests across 3 suites
duration  33.5 seconds
commit  b0c7258
info  🔄 Run: #19978 (attempt 1)

✅ oss · depot-ubuntu-latest-arm-16 — run #19978 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-arm-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  42.5 seconds
commit  b0c7258
info  🔄 Run: #19978 (attempt 1)

✅ oss · depot-ubuntu-latest-16 — run #19978 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  40.3 seconds
commit  b0c7258
info  🔄 Run: #19978 (attempt 1)

@codecov

codecov Bot commented Aug 31, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.81%. Comparing base (bed0b2f) to head (b0c7258).
⚠️ Report is 25 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff            @@
##             main    #8421    +/-   ##
========================================
  Coverage   98.80%   98.81%            
========================================
  Files        1619     1621     +2     
  Lines       65682    66118   +436     
========================================
+ Hits        64898    65334   +436     
  Misses        784      784            

☔ View full report in Codecov by Harness.
📢 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

Copy link
Copy Markdown
Contributor

Visual Regression

19 screenshots compared. See report for details.
View full report

@bakirFS bakirFS changed the title Fix/project admin feature import fix: project admin feature import permissions Aug 31, 2026

@talissoncosta talissoncosta left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good to me on FE side.

@bakirFS
bakirFS merged commit cf77245 into main Sep 1, 2026
40 checks passed
@bakirFS
bakirFS deleted the fix/project-admin-feature-import branch September 1, 2026 07:12
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 front-end Issue related to the React Front End Dashboard

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Project admins can export but not import features

3 participants