8000 GitHub - domandinho/SmartSecurity at pr_008 · GitHub
[go: up one dir, main page]

Skip to content
10BC8

About

SmartSecurity is an extension of django-guardian package, which allows to delegate object's permissions checking into foreign object called OwnerObject.

Resources

Stars

0 stars

Watchers

1 watching

Forks

 
 

Repository files navigation

https://github.com/domandinho/SmartSecurity/actions/workflows/tests.yml/badge.svg?branch=master https://github.com/domandinho/SmartSecurity/actions/workflows/black.yml/badge.svg?branch=master https://github.com/domandinho/SmartSecurity/actions/workflows/linting.yml/badge.svg?branch=master https://github.com/domandinho/SmartSecurity/actions/workflows/coverage.yml/badge.svg?branch=master

SmartSecurity is an extension of django-guardian package, which allows to delegate object's permissions checking into foreign object called OwnerObject. When object is connected in database to owner object by sequence of relationships than permissions checking can be delegated into the owner object. This allows to optimize memory usage of database as instead of granting every user access to every entity within some namespace, we can just grant it into the owner object.

Implementation

Under the hood SmartSecurity is loading model graphs and looking for the shortest path to the owner model using the BFS algorithm.

Requirements

  • Python 3.8+
  • django-guardian >= 2.0

Configuration

We need to hook django-guardian into our project.

  1. Add extra authorization backend SmartSecurityObjectPermissionBackend to your settings.py:
AUTHENTICATION_BACKENDS = (
    'django.contrib.auth.backends.ModelBackend', # default
    'guardian.backends.ObjectPermissionBackend',
    'smart_security.smart_security.SmartSecurityObjectPermissionBackend',
)
  1. Configure SMART_SECURITY_MODEL_CLASS in django settings.py:

    SMART_SECURITY_MODEL_CLASS = "sample_app.SampleOwner"
    

About

SmartSecurity is an extension of django-guardian package, which allows to delegate object's permissions checking into foreign object called OwnerObject.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages

0