Skip to main content

Permission system

Project description

Cithun

仿照 Linux 下的文件权限系统实现的权限管理系统。

WIP

特性

  • 通过类似 Linux 下的文件权限系统的方式管理权限
  • 支持用户组
  • 支持用户组继承

Example

from arclet.cithun import SyncMonitor, NodeState, PE, ROOT, define

monitor = SyncMonitor()

baz = define("foo.bar.baz")
qux = define("foo.bar.baz.qux")

admin = monitor.get_or_new_owner('group:admin', 100)
ROOT.set(admin, baz, NodeState("vma"))

user = monitor.get_or_new_owner('user:cithun')
monitor.inherit(user, admin)

assert ROOT.get(user, baz) == NodeState("vma")
assert not ROOT.get(user, qux).available

ROOT.set(user, qux, NodeState(7))
assert ROOT.get(user, qux).available

ROOT.set(admin, baz, NodeState("v-a"))
try:
    PE(user).set(user, qux, NodeState("vm-"))
except PermissionError as e:
    print(e)  # Permission denied as /baz/ is not modifiable

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

arclet_cithun-0.2.0.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

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

arclet_cithun-0.2.0-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

Details for the file arclet_cithun-0.2.0.tar.gz.

File metadata

  • Download URL: arclet_cithun-0.2.0.tar.gz
  • Upload date:
  • Size: 8.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.19.1 CPython/3.9.13 Windows/10

File hashes

Hashes for arclet_cithun-0.2.0.tar.gz
Algorithm Hash digest
SHA256 549637732f7516665524f4a584cd7792514801b155dfcf0a4a647fd400880cb7
MD5 167a9a0b291978e765e726be2299f919
BLAKE2b-256 67db45873ce580ba3a9a1c6d192ceff41f22cb57f607f9aece280dd8b6d90e9e

See more details on using hashes here.

File details

Details for the file arclet_cithun-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: arclet_cithun-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 9.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.19.1 CPython/3.9.13 Windows/10

File hashes

Hashes for arclet_cithun-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 85f2111c8c7bc729bff5a199d94851eea0f885e758eaf0d7f50d37632ffd43d8
MD5 fc088aafaef1d50b6027bf48f661fb01
BLAKE2b-256 5aba073f30bc162d1f3d157d465f7e5a98da6c9629abe0343301fd7abd31eb1e

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