Skip to content

Comments

FGA_3: check()#568

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

FGA_3: check()#568
swaroopAkkineniWorkos wants to merge 1 commit intoENT-5224-python-sdk-for-fga-worktree-fuck-aroundfrom
fga-pr2

Conversation

@swaroopAkkineniWorkos
Copy link

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.

@swaroopAkkineniWorkos swaroopAkkineniWorkos changed the title FGA pt 2 FGA pt 3 Feb 20, 2026
@swaroopAkkineniWorkos swaroopAkkineniWorkos changed the title FGA pt 3 FGA pt 3: check() Feb 20, 2026
@swaroopAkkineniWorkos swaroopAkkineniWorkos changed the title FGA pt 3: check() FGA_3: check() Feb 20, 2026
@swaroopAkkineniWorkos
Copy link
Author

@greptile review

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 21, 2026

Greptile Summary

Added check() method to the authorization module for Fine-Grained Authorization (FGA) access evaluation. The implementation includes both sync and async versions that check if an organization membership has a specific permission on a resource.

  • Implemented check() method in both Authorization and AsyncAuthorization classes with proper parameter validation
  • Added validation to ensure resource_id and resource_external_id are mutually exclusive
  • Enforces resource_type_slug requirement when using resource_external_id
  • Comprehensive test coverage with 7 test cases covering authorized/unauthorized responses, URL construction, payload validation, and error handling
  • Follows existing SDK patterns for dual sync/async support and type safety

Confidence Score: 5/5

  • Safe to merge with no issues found
  • The implementation follows existing SDK patterns precisely, includes proper input validation, has comprehensive test coverage, and introduces no security concerns
  • No files require special attention

Important Files Changed

Filename Overview
src/workos/authorization.py Added check() method to both sync and async authorization modules for access evaluation with proper validation
tests/test_authorization_check.py New comprehensive test suite for check() method covering authorized/unauthorized flows and validation edge cases

Last reviewed commit: b344d14

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