Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add override_context global permission #5903

Merged
merged 1 commit into from
Mar 4, 2025

Conversation

ogenstad
Copy link
Contributor

@ogenstad ogenstad commented Mar 3, 2025

Changes in this PR:

  • Introduces a new global permission OVERRIDE_CONTEXT which allows a user to override the GraphQL context introduced in Provide option to set GraphQL context information as input to mutations #5874
  • As I'm reusing the old _define_permissions() helper function and adding support for global permissions I've moved this function to a common file that can be shared by multiple tests
  • Add infrahub/permissions/globals.py to remove some boilerplate when defining permissions, this can be reused elsewhere too for some localized cleanup.

@github-actions github-actions bot added the group/backend Issue related to the backend (API Server, Git Agent) label Mar 3, 2025
Copy link

codspeed-hq bot commented Mar 3, 2025

CodSpeed Performance Report

Merging #5903 will not alter performance

Comparing pog-context-override-permission-IFC-1333 (772f5fd) with release-1.2 (6878f6f)

Summary

✅ 10 untouched benchmarks

@ogenstad ogenstad marked this pull request as ready for review March 3, 2025 09:11
@ogenstad ogenstad requested a review from a team as a code owner March 3, 2025 09:11
permission=GlobalPermissions.OVERRIDE_CONTEXT, branch_name=graphql_context.branch.name
)

graphql_context.active_permissions.raise_for_permissions(permissions=[permission])
Copy link
Contributor

Choose a reason for hiding this comment

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

You can just use graphql_context.active_permissions.raise_for_permission(permission=permission)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah right, I missed that one. I'll replace it.

@ogenstad ogenstad force-pushed the pog-context-override-permission-IFC-1333 branch from 757a1b8 to 719c3ce Compare March 3, 2025 15:28
@ogenstad ogenstad force-pushed the pog-context-override-permission-IFC-1333 branch from 719c3ce to 772f5fd Compare March 4, 2025 05:58
@ogenstad ogenstad merged commit 9bcb57c into release-1.2 Mar 4, 2025
34 checks passed
@ogenstad ogenstad deleted the pog-context-override-permission-IFC-1333 branch March 4, 2025 07:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
group/backend Issue related to the backend (API Server, Git Agent)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants