Permissions: Import/Export functionality is Disabled by Conditions
Affected module UI
Describe the bug A user with Data producers role does not have the import export options when a condition is added. Without a condition and EditAll permission. you are able to see these options.
Data Producer definition: EditAll on Glossary and Glossary Term with 0 conditions. Different conditions (isOwner(), hasDomain(), matchTeam())
To Reproduce Login as Admin and Create a Data Producer Role with the policy and roles defined above. Assign the role to a user Create a Glossary item and add the above user as the owner Login as the user and you will see import and export options When you log back in as Admin and assign conditions to the policy, the import and export options are not available anymore
Expected behavior Import and Export Options should be available when a user adds conditions to the policy.
Version:
- OS: [e.g. iOS]
- Python version:
- OpenMetadata version: [e.g. 0.8]
- OpenMetadata Ingestion package version: [e.g.
openmetadata-ingestion[docker]==XYZ]
Additional context Add any other context about the problem here.
@umavepachedu-collate Please assign this issue to me. I want to fix this.
I have reproduced this locally:
With condition:
Without condition:
Assign this to me so that i can fix this issue.
Hi, I have investigated this issue regarding the Glossary Import and Export buttons failing to reflect conditional EditAll permissions. I can implement the proper conditional permission checks in the UI. Could you assign this to me?
@umavepachedu-collate I have raised a PR that is fixing this issue. Please have look on it.
I've submitted a fix for this bug in PR #27489. The Import and Export buttons now correctly consider the contextual conditions of the EditAll and All permissions.
Hi @pmbrull, @umavepachedu-collate @harshach sir
I would like to work on this issue as part of the Back to Metadata Hackathon. I have already solved 2 issues in this project and have good experience contributing here.
I've analyzed the root cause here. The importExportPermissions memo in GlossaryHeader.component.tsx strictly relies on globalPermissions via the checkPermission() utility. This utility evaluates static, global role operations but lacks the context to evaluate entity-level conditional policies (like isOwner()).
When conditional policies are evaluated by the backend, the contextual result is passed down via useGenericContext() into the local permissions object.
To properly fix this, we need to short-circuit the permission check by evaluating the local contextual permissions (permissions.All and permissions.EditAll) before falling back to the global checks.
I am raising a PR shortly that implements this optimal short-circuit logic and includes comprehensive unit tests to prevent future regressions on conditional UI rendering.
Test Case Elaborated. Please consider this while building the fix: What I’m trying to do: Assign a rule/policy that allows a user to add another user to their team. Example: a user that’s assigned Domain Owner role and is part of a X team should be able to add anyone to the X team.
What I’ve done: Resources: Team, User Operations: EditAll, ViewAll Effect: Allow Condition: hasDomain()
What I’m seeing: You don't have necessary permissions. Please check with the admin to get the View permission. error, while permission debugger does say it should have access. I would actually prefer the matchTeam() condition for this, but when I switch to this condition, the permission debugger says it is denied and only hasDomain() seems to grant access (although actual user experience says otherwise).