Skip to content

Add authorization permissions support#548

Open
csrbarber wants to merge 1 commit intomainfrom
feature/ent-4799-workos-python-permissions
Open

Add authorization permissions support#548
csrbarber wants to merge 1 commit intomainfrom
feature/ent-4799-workos-python-permissions

Conversation

@csrbarber
Copy link
Contributor

Description

Introduce the authorization module with CRUD operations for permissions including create, list (paginated), get, update (PATCH), and delete. Register the module on both sync and async clients.

Documentation

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

[X] Yes

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

Introduce the authorization module with CRUD operations for permissions
including create, list (paginated), get, update (PATCH), and delete.
Register the module on both sync and async clients.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@csrbarber csrbarber requested a review from a team as a code owner February 13, 2026 15:42
@csrbarber csrbarber requested a review from faroceann February 13, 2026 15:42
@linear
Copy link

linear bot commented Feb 13, 2026

ENT-4799 workos-python

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 13, 2026

Greptile Overview

Greptile Summary

This PR introduces a new authorization module to the WorkOS Python SDK, implementing full CRUD operations for permissions. The implementation follows established SDK patterns perfectly, with both synchronous and asynchronous client support, comprehensive test coverage, and proper integration with the existing client architecture.

Key changes:

  • New Authorization and AsyncAuthorization modules with methods for create, list, get, update (PATCH), and delete operations
  • Permission Pydantic model with proper type definitions
  • Integration with both sync and async clients via lazy-initialized properties
  • Comprehensive test suite using the @pytest.mark.sync_and_async decorator
  • Support for paginated list operations with auto-pagination
  • Added REQUEST_METHOD_PATCH constant to support PATCH requests

The code is well-structured, follows existing patterns, has no security issues, and includes thorough test coverage including edge cases like pagination.

Confidence Score: 5/5

  • This PR is safe to merge with no identified risks
  • The implementation perfectly follows established SDK patterns, includes comprehensive test coverage for all operations, has no security vulnerabilities, and properly supports both sync and async patterns. All custom security rules were checked (no SQL concatenation, no sensitive logging, no TLS issues, no CORS wildcards) and none apply to this code.
  • No files require special attention

Important Files Changed

Filename Overview
workos/authorization.py New authorization module implementing CRUD operations for permissions with both sync and async support, following established SDK patterns
tests/test_authorization.py Comprehensive test suite covering all permission operations including auto-pagination, with sync/async test marker
workos/types/authorization/permission.py Pydantic model for Permission type with proper field definitions
workos/client.py Added authorization module property to sync client with lazy initialization
workos/async_client.py Added authorization module property to async client with lazy initialization

Sequence Diagram

sequenceDiagram
    participant Client
    participant Authorization
    participant HTTPClient
    participant API

    Client->>Authorization: create_permission(slug, name)
    Authorization->>HTTPClient: POST request
    HTTPClient->>API: Send request
    API-->>HTTPClient: Return permission
    HTTPClient-->>Authorization: Process response
    Authorization-->>Client: Return Permission

    Client->>Authorization: list_permissions()
    Authorization->>HTTPClient: GET request with params
    HTTPClient->>API: Send request
    API-->>HTTPClient: Return list
    HTTPClient-->>Authorization: Process response
    Authorization-->>Client: Return WorkOSListResource

    Client->>Authorization: update_permission(slug, name)
    Authorization->>HTTPClient: PATCH request
    HTTPClient->>API: Send request
    API-->>HTTPClient: Return updated permission
    HTTPClient-->>Authorization: Process response
    Authorization-->>Client: Return Permission

    Client->>Authorization: delete_permission(slug)
    Authorization->>HTTPClient: DELETE request
    HTTPClient->>API: Send request
    API-->>HTTPClient: Acknowledge deletion
    HTTPClient-->>Authorization: Process response
    Authorization-->>Client: Return None
Loading

Last reviewed commit: 30cdb9a

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.

10 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