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 import Permitronix
from permitronix.permission_node import PermissionNode
from permitronix.permission_table import PermissionTable

# Create a permitronix instance
ptx = Permitronix({})

# Create a permission table
pt = PermissionTable(ptx, '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 Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: Permitronix-1.1.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 85ebf32168a017ce9f1bf63c45a71b67b9ff725166a485bed24b71bc0606ddde
MD5 9b9be47ab159ba8fbf82ebb92705c1cb
BLAKE2b-256 e199613ebb7efd3d3c1088e4886333b4e4c4edfa8be5ec5f945a0987a6d9b7fb

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