File management solution for Masonite
Project description
Masonite Permission
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
Release history Release notifications | RSS feed
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 hashes)
Built Distribution
Close
Hashes for masonite-permission-0.1.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | f9c87ef23f3da57d120e89f6c0a34d47f18d18bed110aa2389509fdd238ce601 |
|
MD5 | 7c478cffdb65fb285fbcdea8e829a34d |
|
BLAKE2b-256 | bfae0ff349163ac1fe2f4cb5f85b2e2124d32fb3b89d4d85122fdab2558b80f6 |
Close
Hashes for masonite_permission-0.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 66284fcef87844da7f7945f095470d0de00031a0e7829444717b0a49eb322f99 |
|
MD5 | 5dd8d321fefd7dcbe10b476ff373a697 |
|
BLAKE2b-256 | 2936f9cf71518c59c8b43165d4afc3d7cc4fe4ccacd3a98b7c333dbb9e2b29c7 |