A permission system modeled on the file permission system under Unix.
Project description
Cithun
仿照 Linux 下的文件权限系统实现的权限管理系统。
特性
- 通过类似 Linux 下的文件权限系统的方式管理权限
- 支持用户组
- 支持用户组继承
Example
from arclet.cithun import Permission
from arclet.cithun.builtins import System
system = System("data.json")
with system.transaction():
AUTH_1 = system.create_role("ROLE_AUTH_1", "AUTH_1")
AUTH_2 = system.create_role("ROLE_AUTH_2", "AUTH_2")
AUTH_3 = system.create_role("ROLE_AUTH_3", "AUTH_3")
AUTH_4 = system.create_role("ROLE_AUTH_4", "AUTH_4")
AUTH_5 = system.create_role("ROLE_AUTH_5", "AUTH_5")
system.inherit(AUTH_2, AUTH_1)
system.inherit(AUTH_3, AUTH_2)
system.inherit(AUTH_4, AUTH_3)
system.inherit(AUTH_5, AUTH_4)
alice = system.create_user("alice", "Alice")
bob = system.create_user("bob", "Bob")
carol = system.create_user("carol", "Carol")
system.inherit(alice, AUTH_1)
system.inherit(bob, AUTH_3)
system.inherit(carol, AUTH_5)
system.assign(AUTH_1, "app", Permission.AVAILABLE)
system.assign(AUTH_3, "app", Permission.VISIT)
system.assign(AUTH_5, "app.data", Permission.AVAILABLE | Permission.VISIT | Permission.MODIFY)
system.assign(AUTH_4, "app.secret", Permission.AVAILABLE | Permission.VISIT)
system.assign(alice, "app.data", Permission.MODIFY)
system.assign(bob, "app.config", Permission.MODIFY)
system.depend(alice, "app.data", AUTH_4, "app.secret", Permission.VISIT)
system.depend(bob, "app.config", alice, "app.data",Permission.VISIT)
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
arclet_cithun-1.2.1.tar.gz
(32.0 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file arclet_cithun-1.2.1.tar.gz.
File metadata
- Download URL: arclet_cithun-1.2.1.tar.gz
- Upload date:
- Size: 32.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.25.6 CPython/3.11.7 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
acb9df56cac2a909ddc05f748f43564539d78b011124ba4c99458c7ae0758fb2
|
|
| MD5 |
989cab909b6abd33f7ebc5b3bf3591d3
|
|
| BLAKE2b-256 |
3e3fd6cbe47e75cc43d44fb51cff3b3311e9a1230dda5ff1cd28559d9957f4a5
|
File details
Details for the file arclet_cithun-1.2.1-py3-none-any.whl.
File metadata
- Download URL: arclet_cithun-1.2.1-py3-none-any.whl
- Upload date:
- Size: 32.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.25.6 CPython/3.11.7 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eb189d9fca7b49c866dcff9b3160957817e5f8b8a2bfe52d89547218fbf066c7
|
|
| MD5 |
14dbf8d78aa04ef6b96c68c60930323d
|
|
| BLAKE2b-256 |
b7022f424215481a2ddb9246dd91844f986b305bf2a87a9502d4e3c748393de0
|