Skip to main content

File management solution for Masonite

Project description

Masonite Permission

GitHub Workflow Status PyPI issues Python Version GitHub release (latest by date including pre-releases) License star downloads Code style: black

Introduction

Associate users with roles and permissions

Features

Installation

pip install masonite-permission

Configuration

Add PermissionProvider to your project in config/providers.py:

# config/providers.py
# ...
from masonite_permission import PermissionProvider

# ...
PROVIDERS = [
    # ...
    # Third Party Providers
    PermissionProvider,
    # ...
]

Then you can publish the package resources (if needed) by doing:

python craft package:publish masonite-permission

Usage

""" Permission Syncing """
permissions = Permission.all()
role.sync_permissions(permissions) # sync permissions to role
role.sync_permissions([]) # remove all permissions from role

""" Attach/Detatch Permission """
permission = Permission.first()
role.attach_permission(permission) # add permission to role, ignores if permission already exists
role.detach_permission(permission) # remove permission from role, ignores if permission doesn't exist

""" Role Syncing """
roles = Role.all()
permission.sync_roles(roles) # sync roles to role
permissioin.sync_roles([]) # remove all roles from role

""" Attach/Detatch Role """
role = Role.first()
permission.attach_role(role) # add role to permission, ignores if role already exists
permission.detach_role(role) # remove role from permission, ignores if role doesn't exist

Contributing

Please read the Contributing Documentation here.

Maintainers

License

Masonite Permission is open-sourced software licensed under the MIT license.

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

masonite-permission-0.1.2.tar.gz (77.8 kB view details)

Uploaded Source

Built Distribution

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

masonite_permission-0.1.2-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file masonite-permission-0.1.2.tar.gz.

File metadata

  • Download URL: masonite-permission-0.1.2.tar.gz
  • Upload date:
  • Size: 77.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

File hashes

Hashes for masonite-permission-0.1.2.tar.gz
Algorithm Hash digest
SHA256 f9c87ef23f3da57d120e89f6c0a34d47f18d18bed110aa2389509fdd238ce601
MD5 7c478cffdb65fb285fbcdea8e829a34d
BLAKE2b-256 bfae0ff349163ac1fe2f4cb5f85b2e2124d32fb3b89d4d85122fdab2558b80f6

See more details on using hashes here.

File details

Details for the file masonite_permission-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: masonite_permission-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 8.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

File hashes

Hashes for masonite_permission-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 66284fcef87844da7f7945f095470d0de00031a0e7829444717b0a49eb322f99
MD5 5dd8d321fefd7dcbe10b476ff373a697
BLAKE2b-256 2936f9cf71518c59c8b43165d4afc3d7cc4fe4ccacd3a98b7c333dbb9e2b29c7

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