Skip to content

tyaga001/django-authorization

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

Django-Authorization

How to Implement Authorization in Django

Hospital System

License

Description

A Django project for managing a hospital system using Permit.io for authorization. The project includes a RESTful API for managing patients, doctors, and appointments. The API is secured using ABAC (Attribute-Based Access Control) and RBAC (Role-Based Access Control) policies. The project also includes a PDP (Policy Decision Point) microservice for evaluating access control policies.

Features

  • ABAC (Attribute-Based Access Control)
  • CRUD operations
  • RESTful API
  • User authentication
  • Role-based access control
  • ReBAC (Relationship-Based Access Control)

Installation

  1. Clone the repository: https://github.com/tyaga001/django-authorization.git
  2. Cd into the project directory: cd hsystem
  3. Install the dependencies: pip install -r requirements.txt
  4. Apply database migrations: python manage.py migrate or python manage.py migrate --run-syncdb || python manage.py makemigrations hsystem || python manage.py migrate
  5. Start the development server: python manage.py runserver 5000

Run your local PDP Microservice container

If you do not have Docker installed as of yet, click here to install Docker.

Pull the container

Run the following command to pull the PDP Microservice container:

docker pull permitio/pdp-v2:latest

Run the container

Remember to replace <YOUR_API_KEY> with the Secret Key you obtained from your dashboard.

docker run -it -p 7766:7000 --env PDP_DEBUG=True --env PDP_API_KEY=<YOUR_API_KEY> permitio/pdp-v2:latest

Usage

  1. Create a superuser: python manage.py createsuperuser
  2. Access the admin panel: http://localhost:5000/admin/
  3. Access the API: http://localhost:5000/api/
  4. Access the documentation: http://localhost:5000/docs/

Test the App

Run the following command in a separate terminal to test whether the app is working as expected:

curl -X GET http://localhost:5000/patients/1/

License

This project is licensed under the MIT License.

Blog

How to Implement Authorization with Django

About

How to Implement Authorization in Django

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages