Skip to content

feat(bulk-import): add if predicate gating - #4687

Open
debsmita1 wants to merge 1 commit into
redhat-developer:mainfrom
debsmita1:bi-if-predicate
Open

feat(bulk-import): add if predicate gating#4687
debsmita1 wants to merge 1 commit into
redhat-developer:mainfrom
debsmita1:bi-if-predicate

Conversation

@debsmita1

@debsmita1 debsmita1 commented Sep 10, 2026

Copy link
Copy Markdown
Member

Hey, I just made a Pull Request!

Resolves:
https://redhat.atlassian.net/browse/RHIDP-15542

Solution description:

  • Converted bulk.import from resource permission (resourceType: 'bulk-import') to a feature-level BasicPermission with empty attributes, matching how authorization is actually enforced today.
  • Removed all resourceRef usage from frontend and backend authorize() call sites.
  • Register the NFS Bulk Import page with an if predicate (permissions: { $contains: 'bulk.import' }) so the page and sidebar entry are only exposed when the user is allowed.
  • Remove redundant runtime permission checks from AddRepositoriesPage in the NFS flow; legacy (./legacy) still uses usePermission in BulkImportSidebarItem and shows a denied alert on direct navigation.
  • Added Playwright permission e2e tests (allow/deny for sidebar and page access) with multi-locale support.
  • Updated frontend and backend READMEs to document the feature permission model and NFS if predicate behavior.

Note: The previous resource permission provided no real resource-level authorization (every resourceRef was "bulk-import", no conditional rules, no getResources). It also blocked adoption of the NFS if predicate for conditional UI registration. The new model aligns permission definition, RBAC policy (bulk.import, use, allow), backend checks, and NFS visibility.

Screenshot:

Screenshot 2026-09-10 at 5 35 15 PM

✔️ Checklist

  • A changeset describing the change and affected packages. (more info)
  • Added or Updated documentation
  • Tests for new functionality and regression tests for bug fixes
  • Screenshots attached (for UI changes)

@rhdh-gh-app

rhdh-gh-app Bot commented Sep 10, 2026

Copy link
Copy Markdown

Important

This PR includes changes that affect public-facing API. Please ensure you are adding/updating documentation for new features or behavior.

Changed Packages

Package Name Package Path Changeset Bump Current Version
@red-hat-developer-hub/backstage-plugin-bulk-import-backend workspaces/bulk-import/plugins/bulk-import-backend minor v9.0.1
@red-hat-developer-hub/backstage-plugin-bulk-import-common workspaces/bulk-import/plugins/bulk-import-common minor v9.0.1
@red-hat-developer-hub/backstage-plugin-bulk-import workspaces/bulk-import/plugins/bulk-import minor v9.0.1

@codecov

codecov Bot commented Sep 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 62.72%. Comparing base (7533ffd) to head (91fed90).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4687   +/-   ##
=======================================
  Coverage   62.72%   62.72%           
=======================================
  Files        2636     2636           
  Lines      105422   105422           
  Branches    29526    29513   -13     
=======================================
  Hits        66125    66125           
  Misses      37458    37458           
  Partials     1839     1839           
Flag Coverage Δ *Carryforward flag
adoption-insights 84.77% <ø> (ø) Carriedforward from 7533ffd
ai-integrations 78.80% <ø> (ø) Carriedforward from 7533ffd
app-defaults 53.07% <ø> (ø) Carriedforward from 7533ffd
augment 46.67% <ø> (ø) Carriedforward from 7533ffd
boost 83.46% <ø> (ø) Carriedforward from 7533ffd
bulk-import 73.12% <ø> (ø)
cost-management 13.35% <ø> (ø) Carriedforward from 7533ffd
dcm 73.47% <ø> (ø) Carriedforward from 7533ffd
e2e-adoption-insights 60.00% <ø> (ø) Carriedforward from 7533ffd
e2e-extensions 62.31% <ø> (ø) Carriedforward from 7533ffd
e2e-global-header 49.71% <ø> (ø) Carriedforward from 7533ffd
e2e-homepage 61.11% <ø> (ø) Carriedforward from 7533ffd
e2e-intelligent-assistant 46.09% <ø> (ø) Carriedforward from 7533ffd
e2e-orchestrator 49.52% <ø> (ø) Carriedforward from 7533ffd
e2e-orchestrator-plugin 49.51% <ø> (ø) Carriedforward from 7533ffd
e2e-quickstart 55.21% <ø> (ø) Carriedforward from 7533ffd
e2e-scorecard 50.05% <ø> (ø) Carriedforward from 7533ffd
e2e-theme 16.36% <ø> (ø) Carriedforward from 7533ffd
extensions 57.37% <ø> (ø) Carriedforward from 7533ffd
global-floating-action-button 71.18% <ø> (ø) Carriedforward from 7533ffd
global-header 67.88% <ø> (ø) Carriedforward from 7533ffd
homepage 48.39% <ø> (ø) Carriedforward from 7533ffd
install-dynamic-plugins 71.94% <ø> (ø) Carriedforward from 7533ffd
intelligent-assistant 77.26% <ø> (ø) Carriedforward from 7533ffd
konflux 91.98% <ø> (ø) Carriedforward from 7533ffd
lightspeed 69.02% <ø> (ø) Carriedforward from 7533ffd
mcp-integrations 84.46% <ø> (ø) Carriedforward from 7533ffd
orchestrator 72.02% <ø> (ø) Carriedforward from 7533ffd
quickstart 63.74% <ø> (ø) Carriedforward from 7533ffd
sandbox 79.56% <ø> (ø) Carriedforward from 7533ffd
scorecard 88.20% <ø> (ø) Carriedforward from 7533ffd
theme 87.91% <ø> (ø) Carriedforward from 7533ffd
translations 5.12% <ø> (ø) Carriedforward from 7533ffd
x2a 77.18% <ø> (ø) Carriedforward from 7533ffd

*This pull request uses carry forward flags. Click here to find out more.


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7533ffd...91fed90. Read the comment docs.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jrichter1

jrichter1 commented Sep 11, 2026

Copy link
Copy Markdown
Member

It looks like permission is disabled in the app config that the tests use. The test cases that check if bulk import is denied are not working, since there is no call to /api/permission

@debsmita1
debsmita1 force-pushed the bi-if-predicate branch 3 times, most recently from de7d573 to b8f9c2d Compare September 11, 2026 13:53
Signed-off-by: Debsmita Santra <debsmita.santra@gmail.com>
@sonarqubecloud

Copy link
Copy Markdown

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.

2 participants