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.3.3.tar.gz
(36.2 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.3.3.tar.gz.
File metadata
- Download URL: arclet_cithun-1.3.3.tar.gz
- Upload date:
- Size: 36.2 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 |
99bb02a45a46920d2c3c6a1688bddef0269960183b356aeedd7436162e0bdb44
|
|
| MD5 |
6ca05843a1dd41866de6eaced906aa16
|
|
| BLAKE2b-256 |
c111313c94f4e8a62c786d1b9858744a4cb09ffa1f1838adfc565e9197ea01cd
|
File details
Details for the file arclet_cithun-1.3.3-py3-none-any.whl.
File metadata
- Download URL: arclet_cithun-1.3.3-py3-none-any.whl
- Upload date:
- Size: 37.8 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 |
15c0662ecc8791b81e3c32b5469083524c7f4893aecb2ceb0a9c95aa8b134db7
|
|
| MD5 |
a23f93905f2dd3b4ee9474c48aa39937
|
|
| BLAKE2b-256 |
03fbde4e25991588986c4d96d561b0adcdaf23a764ecfce35e6e44097c86e33f
|