Metadata-Version: 2.4
Name: drf-iam
Version: 0.2.0
Summary: IAM-style roles and permissions for Django Rest Framework
Home-page: https://github.com/tushar1328/drf-iam.git
Author: Tushar Patel
Author-email: tushar.patel@gmail.com
Project-URL: Documentation, https://drf-iam.readthedocs.io/en/latest/installation.html
Project-URL: Source, https://github.com/tushar1328/drf-iam.git
Classifier: Framework :: Django
Classifier: Framework :: Django :: 3.2
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.6
Description-Content-Type: text/markdown
Requires-Dist: Django>=3.2
Requires-Dist: djangorestframework>=3.12
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: project-url
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

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

[![PyPI version](https://badge.fury.io/py/drf-iam.svg)](https://badge.fury.io/py/drf-iam)
[![Documentation Status](https://readthedocs.org/projects/drf-iam/badge/?version=latest)](https://drf-iam.readthedocs.io/en/latest/?badge=latest)

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

```bash
pip install drf-iam
```

## Quick Start

1. Add `drf_iam` to your `INSTALLED_APPS` in `settings.py`:

```python
INSTALLED_APPS = [
    ...
    'drf_iam',
]
```

2. Add the Role relationship to your User model:

```python
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)
```

3. Run migrations:

```bash
python manage.py makemigrations
python manage.py migrate
```

4. Use in your viewsets:

```python
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/](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.
