Skip to content

Comments

FGA_5: list_resources_for_membership, list_memberships_for_resource, list_memberships_for_resource_by_external_id#571

Draft
swaroopAkkineniWorkos wants to merge 1 commit intoENT-5224-python-sdk-for-fga-worktree-fuck-aroundfrom
fga-pr5
Draft

FGA_5: list_resources_for_membership, list_memberships_for_resource, list_memberships_for_resource_by_external_id#571
swaroopAkkineniWorkos wants to merge 1 commit intoENT-5224-python-sdk-for-fga-worktree-fuck-aroundfrom
fga-pr5

Conversation

@swaroopAkkineniWorkos
Copy link

…list_memberships_for_resource_by_external_id

Description

Documentation

Does this require changes to the WorkOS Docs? E.g. the API Reference or code snippets need updates.

[ ] Yes

If yes, link a related docs PR and add a docs maintainer as a reviewer. Their approval is required.

…list_memberships_for_resource_by_external_id
@swaroopAkkineniWorkos
Copy link
Author

@greptile review

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 21, 2026

Greptile Summary

Added three new methods to the Authorization module for querying resource-membership relationships in Fine-Grained Authorization (FGA):

  • list_resources_for_membership: Lists resources accessible to an organization membership with a given permission
  • list_memberships_for_resource: Lists organization memberships that have a given permission on a resource
  • list_memberships_for_resource_by_external_id: Same as above but identifies resources by external ID

Key implementation details:

  • Both sync (Authorization) and async (AsyncAuthorization) implementations provided
  • Proper parameter validation for mutually exclusive parent resource identifiers
  • Pagination support using functools.partial for list continuation
  • Type-safe filters using TypedDict with total=False
  • Comprehensive test coverage including validation, pagination, and edge cases

Confidence Score: 5/5

  • Safe to merge - well-structured implementation with comprehensive test coverage
  • The implementation follows established patterns in the codebase, includes proper parameter validation, handles both sync and async cases identically, and has thorough test coverage including edge cases and validation scenarios
  • No files require special attention

Important Files Changed

Filename Overview
src/workos/authorization.py Added three new list methods for querying resource-membership relationships with proper sync/async implementations, parameter validation, and pagination support
tests/test_authorization_resource_memberships.py Comprehensive test coverage for all three new methods including parameter validation, pagination, and edge cases

Last reviewed commit: f3c6575

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

2 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant