Skip to content

Commit 6412f96

Browse files
authored
Merge pull request #3 from gjovanovicst/main
Enhance API role assignment and user functionality with documentation updates
2 parents 271a94c + 6b947b6 commit 6412f96

10 files changed

Lines changed: 557 additions & 120 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
run: mypy permissio
4444

4545
- name: Run tests
46-
run: pytest --cov=permissio --cov-report=xml
46+
run: pytest -m "not integration" --cov=permissio --cov-report=xml
4747

4848
- name: Upload coverage
4949
uses: codecov/codecov-action@v4

CHANGELOG.md

Lines changed: 43 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,43 @@
1-
# Changelog
2-
3-
All notable changes to the Permissio.io Python SDK will be documented in this file.
4-
5-
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6-
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7-
8-
## [Unreleased]
9-
10-
### Added
11-
- Initial SDK implementation
12-
- Permission checking with `check()` method
13-
- Async support with `check_async()` method
14-
- Auto-scope detection from API key
15-
- Full CRUD operations for Users, Roles, Tenants, and Resources
16-
- FastAPI and Flask middleware integration
17-
- Type hints throughout
18-
- Comprehensive examples
19-
20-
## [0.1.0] - 2024-XX-XX
21-
22-
### Added
23-
- Initial release
24-
- `Permisio` client class
25-
- `PermisioConfig` for configuration
26-
- `User` and `Resource` builders for building check requests
27-
- API clients for Users, Roles, Tenants, Resources, and Role Assignments
28-
- FastAPI middleware for permission enforcement
29-
- Full type hints and documentation
30-
- Examples for common use cases
1+
# Changelog
2+
3+
All notable changes to the Permissio.io Python SDK will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [Unreleased]
9+
10+
No unreleased changes at this time.
11+
12+
---
13+
14+
## [0.1.0-alpha.1] - 2025-03-15
15+
16+
### Added
17+
- **`Permissio` client class**: Main entry point with `token`-based configuration, supporting both sync and async usage patterns
18+
- **`PermissioConfig` dataclass** and **`ConfigBuilder`**: Full configuration support — `token`, `api_url`, `project_id`, `environment_id`, `timeout`, `debug`, `retry_attempts`, `throw_on_error`, `custom_headers`, `http_client`
19+
- **Permission checking (sync)**:
20+
- `check()` — simple boolean permission check
21+
- `check_with_details()` — full `CheckResponse` with reason and debug info (client-side RBAC evaluation)
22+
- `bulk_check()` — batch permission checks
23+
- **Permission checking (async)**:
24+
- `check_async()` — async boolean permission check
25+
- `check_with_details_async()` — async full response
26+
- `bulk_check_async()` — async batch checks
27+
- **Auto-scope detection**: Automatically fetches `project_id` and `environment_id` from the `/v1/api-key/scope` endpoint when not provided
28+
- **Users API** (`api.users`): `list()`, `list_async()`, `get()`, `get_async()`, `create()`, `create_async()`, `update()`, `update_async()`, `delete()`, `delete_async()`, `sync()`, `sync_async()`, `assign_role()`, `assign_role_async()`, `unassign_role()`, `unassign_role_async()`, `get_roles()`, `get_roles_async()`
29+
- **Tenants API** (`api.tenants`): Full sync and async CRUD — `list`, `get`, `create`, `update`, `delete`, plus `sync`
30+
- **Roles API** (`api.roles`): Full sync and async CRUD plus `add_permissions()`, `add_permissions_async()`, `remove_permissions()`, `remove_permissions_async()`
31+
- **Resources API** (`api.resources`): Full sync and async CRUD plus action management (`list_actions`, `create_action`, `delete_action`) and attribute management (`list_attributes`, `create_attribute`, `delete_attribute`)
32+
- **Role Assignments API** (`api.role_assignments`): `list()`, `assign()`, `unassign()`, `bulk_assign()`, `bulk_unassign()`, `list_detailed()` — all with async variants
33+
- **ABAC enforcement builders**:
34+
- `UserBuilder` — fluent builder for `CheckUser` with attributes, first/last name, email
35+
- `ResourceBuilder` — fluent builder for `CheckResource` with key, tenant, and attributes
36+
- `ContextBuilder` — fluent builder for `CheckContext` with arbitrary key/value pairs
37+
- **Convenience methods**: `sync_user()`, `sync_user_async()`, `assign_role()`, `assign_role_async()`, `unassign_role()`, `unassign_role_async()`, `create_tenant()`, `create_tenant_async()`
38+
- **Context manager support**: Both sync (`with Permissio(...) as p:`) and async (`async with Permissio(...) as p:`)
39+
- **`permissio.sync` module**: All classes and types re-exported for sync-first usage patterns
40+
- **Error hierarchy**: `PermissioError``PermissioApiError` (with `PermissioRateLimitError`, `PermissioAuthenticationError`, `PermissioPermissionError`, `PermissioNotFoundError`, `PermissioConflictError`), `PermissioNetworkError``PermissioTimeoutError`, `PermissioValidationError`
41+
- **Full type hints**: Complete type annotations throughout using Python 3.9+ compatible syntax
42+
- **`httpx` HTTP backend**: Async-first HTTP client with connection pooling and timeout support
43+
- **Examples**: Sync, async, and Flask integration examples

0 commit comments

Comments
 (0)