Skip to main content

Reusable Django application that provides structured permission grouping

Project description

gs-django-authplus

Reusable Django application authplus provides structured permission grouping.

When having a lot of defined models, managing permissions for users and groups can be quite a challenge. This application allows organizing permissions into permission packages, just like users are organized into groups. This makes it more natural than using groups for everything.

Organizing user groups into subgroups is also provided. User that is a member of a group is also member of all parent groups of that group.

Installation

If using Astral's uv for virtual environment and project dependencies:

$ uv add gs-django-authplus

Or, with pip in your virtual environment:

$ pip install gs-django-authplus

Quick setup

Add application to settings.py:

INSTALLED_APPS = [
    ...
    "authplus",
]

Models

PermissionsPackage

Permissions package is a generic way to categorize permissions.

Permissions packages are used for easier applying a bunch of related permissions to a user or user groups. This can also be achieved using django.contrib.auth.models.Group, but it seems more natural to separate permission groups and user groups.

PermissionPackage is based on abstract class AbstractPermissionsPackage to allow easier extension and customizations.

UserGroup

User group is a generic way to categorize users.

User groups have a hierarchical structure so each group can have several subgroups. User that is a member of a group is also member of all parent groups of that group.

Permissions for user groups can be granted using individual permissions or permissions packages.

UserGroup is based on abstract class AbstractUserGroup to allow easier extension and customizations.

AbstractUserPlus

Abstract class for project user which inherits from class django.contrib.auth.models.AbstractUser and allows using PermissionsPackage and UserGroup for defining permissions granted to user.

User

Project user based on AbstractUserPlus.

Translations

Package comes with translations to:

  • Croatian (hr)

To create translations for new language:

$ git clone git@gitlab.com:gs-django-authplus.git
$ cd gs-django-authplus
$ uv sync
$ uv run django-admin makemessages -l language_code
# edit django.po file for the new language
$ make compilemessages
# build will also automatically compile messages
$ uv build

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

gs_django_authplus-1.0.0.tar.gz (13.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gs_django_authplus-1.0.0-py3-none-any.whl (19.3 kB view details)

Uploaded Python 3

File details

Details for the file gs_django_authplus-1.0.0.tar.gz.

File metadata

  • Download URL: gs_django_authplus-1.0.0.tar.gz
  • Upload date:
  • Size: 13.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.8.11

File hashes

Hashes for gs_django_authplus-1.0.0.tar.gz
Algorithm Hash digest
SHA256 7f1d8a58441ffd3b0b8b5311dea4e3d5667617680ef89997275aff4fb175d66f
MD5 2d4659402660e63451c9c9ebc2ecdaa1
BLAKE2b-256 fd489bff365208fca8359b6e195b28a645250eb2b5d70150e21242107b2cfd25

See more details on using hashes here.

File details

Details for the file gs_django_authplus-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for gs_django_authplus-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8608ebca6eb0dc319aafcd774eea99ef5e112eb3042ff2dbf077d520a64ef28c
MD5 9b25525929cedfcbca4322a8810a7b4e
BLAKE2b-256 a33cdc41b990f73ecc027ccf05a2ba5e403976777778f1117854787c443cb03e

See more details on using hashes here.

Supported by

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