fix: project admin feature import permissions - #8421
Conversation
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>
|
The latest updates on your projects. Learn more about Vercel for GitHub. 3 Skipped Deployments
|
Docker builds report
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughFeature 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 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 💡
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. Comment |
✅ private-cloud · depot-ubuntu-latest-arm-16 — run #19978 (attempt 1)Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)Details
🗂️ Previous results✅ private-cloud · depot-ubuntu-latest-16 — run #19978 (attempt 1)Playwright Test Results (private-cloud - depot-ubuntu-latest-16)Details
✅ oss · depot-ubuntu-latest-arm-16 — run #19978 (attempt 1)Playwright Test Results (oss - depot-ubuntu-latest-arm-16)Details
✅ oss · depot-ubuntu-latest-16 — run #19978 (attempt 1)Playwright Test Results (oss - depot-ubuntu-latest-16)Details
|
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
Visual Regression19 screenshots compared. See report for details. |
talissoncosta
left a comment
There was a problem hiding this comment.
Looks good to me on FE side.
Thanks for submitting a PR! Please check the boxes below:
docs/if required so people know about the feature.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.