Skip to main content

A py permission management module.

Project description

Permitronix

Permitronix is a Python permission management module that allows you to manage permission tables for users and objects.

Installation

Permitronix can be installed via pip:

pip install permitronix

Usage

Permitronix

The Permitronix class allows you to manage permission tables for objects. Here is an example of how to use Permitronix:

from permitronix import Permitronix
from permitronix.permission_node import PermissionNode
from permitronix.permission_table import PermissionTable

# Create a permitronix instance
ptx = Permitronix()

# Set a permission for an object
obj = "example"

with ptx.enter(obj) as v:
    pt: PermissionTable = v.value
    pt.set_permission(PermissionNode('regular_expressions_for_some_permissions_.*', 'scope_id:1145'))

# Get the permission table for an object
pt = ptx.get_permission_table(obj)

# Remove a permission table for an object
ptx.rem_permission_obj(obj)

# Check if a permission table exists for an object
exists = ptx.exists(obj)

Permission Table

The PermissionTable class allows you to define permission tables for users and objects. Here is an example of how to create a permission table:

from permitronix.permission_node import PermissionNode
from permitronix.permission_table import PermissionTable

# Create a permission table
pt = PermissionTable('data')
pt.set_permission(PermissionNode('regular_expressions_for_some_permissions_.*', 'scope_id:1145'))

Permission Node

A PermissionNode is a node in the permission tree. Each node has a name and a permission level. Here is an example of how to create a permission node:

from permitronix.permission_level import PermissionLevel
from permitronix.permission_node import PermissionNode

# Create a permission node
pn = PermissionNode("admin", PermissionLevel("op:12"))

Contributing

We welcome contributions from anyone who is interested in improving this project. If you find any issues, bugs, or have suggestions for improvement, please feel free to open an issue or submit a pull request.

We will review your changes and provide feedback if necessary. Thank you for your contributions!

License

This source code is licensed under the MIT license and may be used for any purpose consistent with local law, provided that the copyright notice is retained.

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

Permitronix-1.1.1.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

Permitronix-1.1.1-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

Details for the file Permitronix-1.1.1.tar.gz.

File metadata

  • Download URL: Permitronix-1.1.1.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.6

File hashes

Hashes for Permitronix-1.1.1.tar.gz
Algorithm Hash digest
SHA256 d63035f22c9c17391753f30184d4c5fa6ca593d409f11b97bdb867baf835d8f9
MD5 16760ab14d7696868730d846d12df76c
BLAKE2b-256 b80a49f103002a98458253bb76573d0983aad86e7a1837c1f3477233d20336d4

See more details on using hashes here.

File details

Details for the file Permitronix-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: Permitronix-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 10.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.6

File hashes

Hashes for Permitronix-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5fd9afa026aafbdc229dc3f02fd6bc8ad6f28a7d668e45e907b13d7b319e3afd
MD5 0f23dcf59ae0e182b2a4702c2f73a3bb
BLAKE2b-256 4fad12b871159c774657aab13bc1d2cce9ee22237b67a117498219f8004a9cbd

See more details on using hashes here.

Supported by

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