DRF-IAM (Django REST Framework - Identity and Access Management)
A powerful Django application that provides Role-Based Access Control (RBAC) for Django REST Framework applications. Easily manage permissions and roles across your API endpoints.
Features
- 🔒 Role-Based Access Control (RBAC)
- 🎯 Custom policy names for viewsets
- 🔄 Seamless integration with Django's User model
- ⚡ Easy to set up and configure
- 📚 Comprehensive documentation
Installation
pip install drf-iam
Quick Start
- Add
drf_iamto yourINSTALLED_APPSinsettings.py:
INSTALLED_APPS = [
...
'drf_iam',
]
- Add the Role relationship to your User model:
from django.contrib.auth.models import AbstractUser
from drf_iam.models import Role
class User(AbstractUser):
role = models.ForeignKey(Role, on_delete=models.SET_NULL, null=True)
- Run migrations:
python manage.py makemigrations
python manage.py migrate
- Use in your viewsets:
from rest_framework import viewsets
from drf_iam.permissions import IAMPermission
class UserViewSet(viewsets.ModelViewSet):
permission_classes = [IAMPermission]
iam_policy_name = "users" # Optional: Custom policy name for this viewset
Documentation
For detailed documentation, visit https://drf-iam.readthedocs.io/
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Metadata
Release files for drf-iam 0.2.11
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| drf_iam-0.2.11.tar.gz | 11.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| drf_iam-0.2.11-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 23.7 kB
Release files / drf_iam-0.2.11.tar.gz
| Download URL | drf_iam-0.2.11.tar.gz |
|---|---|
| Size | 11.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
20d88f0de1726040b7ef39a61f47a84681f7dadf0eb2013c9e6a2f57fb1a2b3a
|
|
BLAKE2b-256 checksum How to use checksums |
74f7e2d3dca6d49dff2678e6f16ebb931849a23a9a6367d506a0047538dce092
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.12
|
Release files / drf_iam-0.2.11-py3-none-any.whl
| Download URL | drf_iam-0.2.11-py3-none-any.whl |
|---|---|
| Size | 12.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9cb4b703a4f2743b507d34502a70516b1aa03e8d13e4ed6bf10ef4038ff20431
|
|
BLAKE2b-256 checksum How to use checksums |
96bc80a21823893e6ea4091d5e27b79b684817c8ce8e47a880d458e8b99b308f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.12
|