Skip to content

FGA_4: list/assign/remove role, remove roleAssginment#570

Open
swaroopAkkineniWorkos wants to merge 10 commits intoENT-5224-python-sdk-for-fga-worktree-fuck-aroundfrom
fga-pr4
Open

FGA_4: list/assign/remove role, remove roleAssginment#570
swaroopAkkineniWorkos wants to merge 10 commits intoENT-5224-python-sdk-for-fga-worktree-fuck-aroundfrom
fga-pr4

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
Copy link
Author

@greptile review

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.

3 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

Comment on lines +1 to +15
from typing import Union

from typing_extensions import TypedDict


class ResourceIdentifierById(TypedDict):
resource_id: str


class ResourceIdentifierByExternalId(TypedDict):
resource_external_id: str
resource_type_slug: str


ResourceIdentifier = Union[ResourceIdentifierById, ResourceIdentifierByExternalId]

Choose a reason for hiding this comment

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

this is duplicate of what is in https://github.com/workos/workos-python/pull/568/changes#r2842020033, can consolidate

@swaroopAkkineniWorkos swaroopAkkineniWorkos marked this pull request as ready for review February 23, 2026 17:52
@swaroopAkkineniWorkos swaroopAkkineniWorkos requested a review from a team as a code owner February 23, 2026 17:52
@swaroopAkkineniWorkos swaroopAkkineniWorkos requested review from atainter and gcarvelli and removed request for a team February 23, 2026 17:52
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.

4 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@swaroopAkkineniWorkos
Copy link
Author

@greptile re-review plz

@workos workos deleted a comment from greptile-apps bot Mar 2, 2026
@swaroopAkkineniWorkos
Copy link
Author

@greptile re-review plz

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Mar 2, 2026

Greptile Summary

Added role assignment management functionality to the Python SDK, implementing methods to assign roles, remove roles, remove role assignments by ID, and list role assignments for organization memberships.

Key changes:

  • Implemented assign_role() to assign a role to an organization membership with resource identification via resource_id or resource_external_id + resource_type_slug
  • Implemented remove_role() to remove a role assignment by role slug and resource identifier
  • Implemented remove_role_assignment() to remove a role assignment by its ID
  • Implemented list_role_assignments() with full pagination support (limit, before, after, order)
  • Added both sync and async implementations following existing SDK patterns
  • Comprehensive test coverage with 12 test cases covering all scenarios including edge cases
  • Added mock fixtures for role assignments

Confidence Score: 5/5

  • This PR is safe to merge with no issues detected
  • Implementation follows established SDK patterns perfectly, has comprehensive test coverage for both sync and async execution, properly handles resource identification via multiple methods, and includes appropriate type definitions. No security concerns or logic errors found.
  • No files require special attention

Important Files Changed

Filename Overview
src/workos/authorization.py Added role assignment methods (assign_role, remove_role, remove_role_assignment, list_role_assignments) for both sync and async classes with proper implementation following existing patterns
tests/test_authorization_role_assignments.py Comprehensive test coverage for all role assignment operations with both sync and async execution, covering edge cases and pagination scenarios
tests/utils/fixtures/mock_role_assignment.py Added mock fixtures for RoleAssignment testing with proper type definitions and default values

Last reviewed commit: 554e117

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.

2 participants