pipeline_core/scripts/load_path.py

46 lines
1.4 KiB
Python
Raw 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_core module.
2026-08-28产线管理三功能产线定义/产线步骤/发布记录)已移除,
对应的 pipelines / pipeline_steps / pipeline_versions / pipeline_editor
CRUD 页面与 API 全部删除,注册清单同步清理。
"""
import os, sys, subprocess
MOD = "pipeline_core"
PATHS_LOGINED = [
f"/{MOD}",
]
def main():
# app root: 本脚本位于 <app>/pkgs/<mod>/scripts/,上溯三级即 app 根
script_dir = os.path.dirname(os.path.abspath(__file__))
candidates = [
os.path.dirname(os.path.dirname(os.path.dirname(script_dir))),
os.path.expanduser("~/pipeline"),
]
root = None
for c in candidates:
if os.path.isfile(os.path.join(c, "set_role_perm.py")):
root = c
break
if not root:
print("ERROR: pipeline root not found (set_role_perm.py missing)")
sys.exit(1)
set_perm = os.path.join(root, "set_role_perm.py")
py = sys.executable
count = 0
for path in PATHS_LOGINED:
r = subprocess.run([py, set_perm, "logined", path], capture_output=True, text=True, cwd=root)
if r.returncode == 0:
count += 1
else:
print(f" WARN: {path} -> {r.stderr.strip()[-80:]}")
print(f"Registered {count}/{len(PATHS_LOGINED)} paths for {MOD}")
if __name__ == "__main__":
main()