42 lines
1.2 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/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())