Skip to main content

Django Role-Based Permission App

Project description

Django Role-Based Permissions API

This project implements a powerful and flexible Role-Based Access Control (RBAC) system, providing granular permissions management down to individual URLs or model-based permissions. Designed to integrate seamlessly with Django’s class-based views and viewsets, it offers a high level of control to administrators for securing access to API endpoints.

Features

  • Assign permissions based on models or specific URL paths.
  • Prioritize URL-based permissions over model permissions for fine-grained access control.
  • Easily applicable to API views or viewsets via permission_classes and permission_queryset.

Permission Types

Administrators can set permissions within the Django admin panel. There are two ways to set permissions:

  1. URL-Based Permissions: URL permissions have higher priority and can override model permissions. They allow you to restrict access to specific endpoints without relying on linked models. To use them, make sure to set up the url_path field when creating permission records.

  2. Model-Based Permissions: When more general control is needed, model permissions can be applied. After creating permissions in the admin panel, define permission_classes and permission_queryset with the corresponding ORM class in your views.

Getting Started

Start by cloning this repository into your Django project and include the required files.

Admin Interface: Use the Django admin to configure permissions for specific URL paths or models. To define permissions for a particular view, create an instance of the Permission model with the desired URL or model settings.

Configuration codes To enforce permissions in your API views or viewsets, define the permission_classes and permission_queryset. Here’s an example on how to apply permissions in a sample API view and viewset:

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

RBAC_service-0.1.tar.gz (5.1 kB view details)

Uploaded Source

File details

Details for the file RBAC_service-0.1.tar.gz.

File metadata

  • Download URL: RBAC_service-0.1.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for RBAC_service-0.1.tar.gz
Algorithm Hash digest
SHA256 45e972c365880272269a1bc28f3c9628db0428d9b05349886a00bc58ea9ee34b
MD5 21fcc0bb29231f9c613893d8425ee939
BLAKE2b-256 5946fb64eaaced50b1412301ff9b27f5cb2374d8e2dc09bc3e7d1a20f8582a04

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page