feat: scripts/load_path.py RBAC路径注册(页面→logined)
This commit is contained in:
parent
25e71b548b
commit
b947d3456e
41
scripts/load_path.py
Normal file
41
scripts/load_path.py
Normal file
@ -0,0 +1,41 @@
|
||||
#!/usr/bin/env python3
|
||||
"""RBAC path registration for pipeline-platform module.
|
||||
|
||||
与平台惯例一致:页面 → logined(工具级权限由能力包代码层门禁再收一道,仅管理员)。
|
||||
在宿主应用根目录执行(set_role_perm.py 位于宿主根):
|
||||
cd <APP_ROOT> && py3/bin/python pkgs/pipeline-platform/scripts/load_path.py
|
||||
"""
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
MOD = "pipeline-platform"
|
||||
APP_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..", ".."))
|
||||
|
||||
PATHS_LOGINED = [
|
||||
"/%s" % MOD,
|
||||
"/%s/index.ui" % MOD,
|
||||
"/%s/agent_platform" % MOD,
|
||||
"/%s/agent_platform/index.ui" % MOD,
|
||||
]
|
||||
|
||||
|
||||
def _run(role, path):
|
||||
r = subprocess.run([sys.executable, os.path.join(APP_ROOT, "set_role_perm.py"), role, path],
|
||||
capture_output=True, text=True, cwd=APP_ROOT)
|
||||
if r.returncode != 0:
|
||||
print(" FAIL [%s] %s: %s" % (role, path, (r.stderr or "").strip()[:120]))
|
||||
return r.returncode == 0
|
||||
|
||||
|
||||
def main():
|
||||
print("=== %s RBAC registration ===" % MOD)
|
||||
n = 0
|
||||
for p in PATHS_LOGINED:
|
||||
n += _run("logined", p)
|
||||
print(" logined: %s" % p)
|
||||
print("Done. %d/%d paths registered" % (n, len(PATHS_LOGINED)))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
Loading…
x
Reference in New Issue
Block a user