Skip to main content

DRF-IAM (Django REST Framework - Identity and Access Management)

PyPI version Documentation Status

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

  1. Add drf_iam to your INSTALLED_APPS in settings.py:
INSTALLED_APPS = [
    ...
    'drf_iam',
]
  1. 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)
  1. Run migrations:
python manage.py makemigrations
python manage.py migrate
  1. 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)

Source distribution for drf-iam 0.2.11
File Size Uploaded
drf_iam-0.2.11.tar.gz 11.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for drf-iam 0.2.11
File Interpreter ABI Platform
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

Release history Release notifications | RSS feed

This release

0.2.11 This release

2 release files

0.2.10

2 release files

0.2.9

2 release files

0.2.8

2 release files

0.2.7

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.0

2 release files

0.1.0

2 release files

0.0.3

2 release files

0.0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page