diff --git a/scripts/load_path.py b/scripts/load_path.py new file mode 100644 index 0000000..540cf51 --- /dev/null +++ b/scripts/load_path.py @@ -0,0 +1,41 @@ +#!/usr/bin/env python3 +"""RBAC path registration for pipeline-platform module. + +与平台惯例一致:页面 → logined(工具级权限由能力包代码层门禁再收一道,仅管理员)。 +在宿主应用根目录执行(set_role_perm.py 位于宿主根): + cd && 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())