Repository navigation
Fixes #32413: gate CustomPropertiesPanel on type resource permissions - #33280
Conversation
Replace isAdminUser gate with userPermissions.hasViewPermissions(ResourceEntity.TYPE) in CustomPropertiesLandingPage, CustomPropertiesPanel, and ProfilePage so non-admin users holding a type-resource policy can access the AI-mode Custom Properties panel. Split the single raw EditAll read in CustomPropertiesDetailPage into three derived flags (canCreate, canDelete, canEditAll) via getDerivedPermissionFlags, matching the backend's per-operation authorization on TypeResource. Add Playwright permission tests: dataConsumer (no type access) sees no nav item; non-admin with full type access sees all entity cards and all action buttons. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
|
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
🔄 Playwright impact map auto-refreshedThis PR touched specs or UI source that changed the source→spec routing map. I regenerated What is this file? It is the auto-generated half of Playwright's PR planner. It routes "if source X changes, run specs Y" by walking spec imports and cross-referencing What if I want to regenerate locally instead? Run this before pushing your next change to skip the bot commit: python3 .github/scripts/generate_playwright_impact_map.py
git add .github/playwright/impact-map.generated.json
git commit --amend --no-edit # or a separate commit |
|
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
✅ Playwright Results — workflow succeededValidated commit ✅ 4510 passed · ❌ 0 failed · 🟡 3 flaky · ⏭️ 1 skipped · 🧰 0 lifecycle flaky PerformanceBlocking targets: ✅ met · Optimization targets: 🟡 in progress Shard-job maxima below are not the full workflow wall time; the linked run includes build, fixture, planning, and reporting. 🕒 Full workflow signal wall (to summary) 54m 25s ⏱️ Max setup 4m 18s · max shard execution 22m 26s · max shard-job elapsed before upload 25m 39s · reporting 18s 🌐 220.58 requests/attempt · 2.23 app boots/UI scenario · 35.30% common-shard skew Optimization targets still in progress:
🟡 3 flaky test(s) (passed on retry)
How to debug locally# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip # view trace |
… use UserClass/PolicyClass/RolesClass helpers Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
🔄 Playwright impact map auto-refreshedThis PR touched specs or UI source that changed the source→spec routing map. I regenerated What is this file? It is the auto-generated half of Playwright's PR planner. It routes "if source X changes, run specs Y" by walking spec imports and cross-referencing What if I want to regenerate locally instead? Run this before pushing your next change to skip the bot commit: python3 .github/scripts/generate_playwright_impact_map.py
git add .github/playwright/impact-map.generated.json
git commit --amend --no-edit # or a separate commit |
…sion per-item - Fix 6 failing CustomPropertiesLandingPage tests by adding ViewBasic to the permissions mock so hasViewPermissions returns true - Filter items by isProtected in the component so unprotected items are explicitly excluded (mirrors getGlobalSettingMenuItem behaviour) - Add isVisible guard to ProfileNavItem so each workspace nav item owns its own permission check instead of gating the entire WORKSPACE_NAV_ITEMS array on hasTypeViewPermission — future items (e.g. workflows) won't be incorrectly hidden by the TYPE resource permission Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
…ertiesLandingPage All CUSTOM_PROPERTIES items in GlobalSettingsClassBase use isProtected: Boolean(isAdminUser), and the component hard-codes isAdminUser=true, so the filter was always a no-op in production. The real permission gate is hasTypeViewPermission. Remove the filter and delete tests that exercised states (isProtected:false items) that production code could never reach. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Code Review ✅ Approved 4 closed / 4 findingsFixes the Custom Properties panel to gate entity-type cards and sidebar navigation on ✅ 4 closed✅ Edge Case: Action-button gates don't match the endpoints they trigger
✅ Bug: canDelete missing from renderRow useCallback deps
✅ Quality: Stale comments contradict assertions in ViewAll-only test
✅ Quality: isProtected filter is a no-op in production, only tests differ
OptionsDisplay: compact → Counting what did not apply, without listing it. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
|
| let viewAllRole: RolesClass; | ||
| let customPropertyName: string; | ||
|
|
||
| test.describe('Custom Properties Panel — user with ViewAll on All only', () => { |
There was a problem hiding this comment.
What dose it mean?
| } | ||
| }); | ||
|
|
||
| test('Custom Properties nav item is not visible in sidebar', async ({ |
There was a problem hiding this comment.
What dose this mean? very generic statement
| } | ||
| }); | ||
|
|
||
| test('detail page does not show Add, Edit, or Delete buttons with ViewAll only', async ({ |
There was a problem hiding this comment.
detail page should not show Add, Edit, or Delete buttons with only ViewAll permission



Describe your changes:
Fixes #32413
The AI-mode Custom Properties panel (
CustomPropertiesPanel) was gating all entity-type cards and the sidebar nav item onisAdminUser, ignoring the backend's policy-engine permission on thetyperesource. Non-admin users with a validtype-resource policy could callPUT /api/v1/metadata/types/{id}successfully via the API but saw an empty panel in the UI.Additionally,
CustomPropertiesDetailPagereadpermission[Operation.EditAll]directly (raw access, banned byopenmetadata-permissions/no-raw-permission-access) and collapsed all three actions into one flag, mismatching the backend's per-operation authorization.Changes (AI-mode panel only — legacy Settings route untouched):
CustomPropertiesLandingPage.tsx/CustomPropertiesPanel.tsx: ReplaceisAdminUser-based filter withuserPermissions.hasViewPermissions(ResourceEntity.TYPE, permissions). Users withViewAllorViewBasicontypesee all entity-type cards; others see nothing.ProfilePage.tsx: GateWORKSPACE_NAV_ITEMS(the "Custom Properties" sidebar entry) on the same permission, so users withouttypeview access never see the nav item.CustomPropertiesDetailPage.tsx: Replace rawpermission[Operation.EditAll]withgetDerivedPermissionFlags(permission)and split into three semantically correct flags —canCreate || canEditAllfor Add,canEditAllfor Edit,canDelete || canEditAllfor Delete — matching whatTypeResourceevaluates on the backend.Type of change:
High-level design:
The backend authorizes custom property management via
MetadataOperation.CREATEon thetyperesource (TypeResource.addOrUpdateProperty). Thetyperesource is entirely separate from data-entity resources (Table,Dashboard, etc.) —EditAllonTabledoes not grant any permission ontype.The fix has two layers:
ProfilePage+CustomPropertiesLandingPage+CustomPropertiesPanel): usesuserPermissions.hasViewPermissions(ResourceEntity.TYPE, permissions)— the same utility already used for Services, Teams, and other settings categories — to control whether the nav item and entity cards render.CustomPropertiesDetailPage):getEntityPermission(ResourceEntity.TYPE, entityType.id)already fetched the correctly-scopedOperationPermission;getDerivedPermissionFlagsderives named flags from it without needing the resource type again. Three flags replace the singlehasEditPermissionboolean.No legacy code (
GlobalSettingsClassBase,SettingsRouter,CustomPropertiesPageV1) was changed.Tests:
Use cases covered
typepermissions → "Custom Properties" nav item absent from AI profile sidebar[Create, Delete, EditAll, ViewAll]ontype→ nav visible, all entity-type cards shown, Add + Edit + Delete buttons visible on Table detail pageViewAllonly ontype(read-only) → nav visible, landing shows cards, zero action buttons (documented in plan; manual-verified scenario)EditAllonTabledata resource but notypewrite permissions → no action buttons (data-resource grants do not bleed into type-resource checks)Unit tests
PermissionDerivation.test.ts; the UI wiring is exercised by the Playwright tests below.Backend integration tests
Ingestion integration tests
Playwright (UI) tests
openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/AIMode/CustomPropertiesPanel.spec.tsCustom Properties Panel — user without type permissions(dataConsumer storageState)Custom Properties Panel — non-admin user with type permissions(creates policy/role/user via admin API inbeforeAll, tears down inafterAll)Manual testing performed
Resources: type,Operations: [Create, Delete, EditAll, ViewAll],Effect: AllowEditAllonTable+ViewAllon All (notypewrite) — nav visible, detail page accessible, zero action buttons confirmedtypepermissions) — "Custom Properties" nav item absentUI screen recording / screenshots:
TODO: attach screen recording — opening as draft until recording is added.
Checklist:
Fixes <issue-number>: <short explanation>Fixes #32413above.