pipeline-sdlc/scripts/load_path.py
ymq 0a339a2b19 refactor(ownership): 三张跨产线表定义删除不留副本(第2轮迁归属,已迁入pipeline-core@4b2fd4c)
- models: sd_projects/sd_project_role_models/pipeline_deliverables 3个JSON删除——归属core,双源必乱
- json: sd_project_list/pipeline_deliverables_list CRUD定义删除(迁core)
- wwwroot/api: 15个CRUD页面依赖的dspy删除(随页面迁core,entire_url相对解析跟页面走)
- wwwroot/sd_project_role_models: 手写角色模型页整目录删除(迁core)
- scripts/load_path.py: 已迁页面的RBAC注册条目删除(sd_projects 5条/sd_project_list 1条/role_models 5条/api 4条)
- json/sd_iteration_list+sd_deploy_env_list+sd_features_list: get_project_options.dspy引用改绝对路径/pipeline_core/api/**(留在sdlc的页面消费迁走的api)
- wwwroot/api/cockpit_cards.dspy: 项目管理弹窗URL改/pipeline_core/sd_projects/index.ui
- init/data.json: 4组字典随表迁core(sd_project_status/sd_project_type/deliverable_type/review_status)
- .gitignore: 已迁生成目录条目清理(sd_projects//pipeline_deliverables/)
- 顺带清死双源: wwwroot/json/整目录(build.sh只读模块根json/,wwwroot/json零消费方+内容漂移:subtables还指着改名前的目录)+wwwroot/sd_project_list/index.ui死占位页(零菜单引用)
2026-09-10 12:33:42 +08:00

159 lines
5.7 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-sdlc module."""
import os, sys, subprocess
MOD = "pipeline-sdlc"
PATHS_ANY = [
f"/{MOD}/index.ui",
# Tree 组件展开/折叠图标bricks.path 指向 / 时,图标走 /imgs/ 而非 /bricks/imgs/
"/imgs/node-expand.svg",
"/imgs/node-collapse.svg",
"/imgs/open-folder.svg",
"/imgs/close-folder.svg",
]
PATHS_LOGINED = [
f"/{MOD}",
# Dashboard
f"/{MOD}/sd_dashboard/index.ui",
f"/{MOD}/sd_dashboard/dashboard_data.dspy",
# Iterations
f"/{MOD}/sd_iterations/index.ui",
f"/{MOD}/sd_iterations/get_sd_iterations.dspy",
f"/{MOD}/sd_iterations/add_sd_iterations.dspy",
f"/{MOD}/sd_iterations/update_sd_iterations.dspy",
f"/{MOD}/sd_iterations/delete_sd_iterations.dspy",
f"/{MOD}/sd_iteration_list/index.ui",
# Test Plans
f"/{MOD}/sd_test_plans/index.ui",
f"/{MOD}/sd_test_plans/get_sd_test_plans.dspy",
f"/{MOD}/sd_test_plans/add_sd_test_plans.dspy",
f"/{MOD}/sd_test_plans/update_sd_test_plans.dspy",
f"/{MOD}/sd_test_plans/delete_sd_test_plans.dspy",
f"/{MOD}/sd_test_plan_list/index.ui",
# Test Cases
f"/{MOD}/sd_test_cases/index.ui",
f"/{MOD}/sd_test_cases/get_sd_test_cases.dspy",
f"/{MOD}/sd_test_cases/add_sd_test_cases.dspy",
f"/{MOD}/sd_test_cases/update_sd_test_cases.dspy",
f"/{MOD}/sd_test_cases/delete_sd_test_cases.dspy",
f"/{MOD}/sd_test_case_list/index.ui",
# Bugs
f"/{MOD}/sd_bugs/index.ui",
f"/{MOD}/sd_bugs/get_sd_bugs.dspy",
f"/{MOD}/sd_bugs/add_sd_bugs.dspy",
f"/{MOD}/sd_bugs/update_sd_bugs.dspy",
f"/{MOD}/sd_bugs/delete_sd_bugs.dspy",
f"/{MOD}/sd_bug_list/index.ui",
# Deploy Envs
f"/{MOD}/sd_deploy_envs/index.ui",
f"/{MOD}/sd_deploy_envs/get_sd_deploy_envs.dspy",
f"/{MOD}/sd_deploy_envs/add_sd_deploy_envs.dspy",
f"/{MOD}/sd_deploy_envs/update_sd_deploy_envs.dspy",
f"/{MOD}/sd_deploy_envs/delete_sd_deploy_envs.dspy",
f"/{MOD}/sd_deploy_env_list/index.ui",
# Review
f"/{MOD}/sd_review/index.ui",
# API
f"/{MOD}/api/bug_close.dspy",
f"/{MOD}/api/bug_confirm.dspy",
f"/{MOD}/api/check_iteration_bugs.dspy",
f"/{MOD}/api/env_verify.dspy",
f"/{MOD}/api/get_iteration_options.dspy",
f"/{MOD}/api/get_test_plan_options.dspy",
f"/{MOD}/api/submit_bug.dspy",
f"/{MOD}/api/sd_bug_create.dspy",
f"/{MOD}/api/sd_bug_update.dspy",
f"/{MOD}/api/sd_bug_delete.dspy",
f"/{MOD}/api/sd_case_create.dspy",
f"/{MOD}/api/sd_case_update.dspy",
f"/{MOD}/api/sd_case_delete.dspy",
f"/{MOD}/api/sd_env_create.dspy",
f"/{MOD}/api/sd_env_update.dspy",
f"/{MOD}/api/sd_env_delete.dspy",
f"/{MOD}/api/sd_iter_create.dspy",
f"/{MOD}/api/sd_iter_update.dspy",
f"/{MOD}/api/sd_iter_delete.dspy",
f"/{MOD}/api/sd_plan_create.dspy",
f"/{MOD}/api/sd_plan_update.dspy",
f"/{MOD}/api/sd_plan_delete.dspy",
f"/{MOD}/api/sd_proj_create.dspy",
f"/{MOD}/api/sd_proj_update.dspy",
f"/{MOD}/api/sd_proj_delete.dspy",
# Search data sources
f"/{MOD}/api/get_search_bug_status.dspy",
f"/{MOD}/api/get_search_case_status.dspy",
f"/{MOD}/api/get_search_case_type.dspy",
f"/{MOD}/api/get_search_env_status.dspy",
f"/{MOD}/api/get_search_env_type.dspy",
f"/{MOD}/api/get_search_iteration_status.dspy",
f"/{MOD}/api/get_search_iteration_type.dspy",
f"/{MOD}/api/get_search_plan_status.dspy",
f"/{MOD}/api/get_search_plan_type.dspy",
f"/{MOD}/api/get_search_priority.dspy",
f"/{MOD}/api/get_search_reporter_type.dspy",
f"/{MOD}/api/get_search_severity.dspy",
# Workspace 文件浏览/编辑
f"/{MOD}/api/workspace_tree.dspy",
f"/{MOD}/api/workspace_files.dspy",
f"/{MOD}/api/workspace_open.dspy",
f"/{MOD}/api/workspace_view.dspy",
f"/{MOD}/api/workspace_file.dspy",
f"/{MOD}/api/download_project.dspy",
f"/{MOD}/api/workspace_upload.dspy",
f"/{MOD}/api/workspace_delete.dspy",
f"/{MOD}/api/workspace_popup.dspy",
f"/{MOD}/workspace_edit.xterm",
# 人类任务清单 + 项目 owner + bug 验收SDLC 项目级人类任务)
f"/{MOD}/api/my_todos.dspy",
f"/{MOD}/api/project_human_count.dspy",
f"/{MOD}/api/human_task_create.dspy",
f"/{MOD}/api/human_task_complete.dspy",
f"/{MOD}/api/bug_accept.dspy",
f"/{MOD}/api/kb_ingest_decide.dspy",
f"/{MOD}/api/fix_stuck.dspy",
# 工作环境 / 部署账号(普通用户可用)
f"/{MOD}/api/work_env.dspy",
f"/{MOD}/api/deploy_account.dspy",
# 机构远程空间配置(页面 loginedorg 级设置由 API 层校验 superuser
f"/{MOD}/sd_org_remote/index.ui",
f"/{MOD}/sd_org_remote",
]
def find_app_root():
# 从 scripts/ 向上逐层查找 set_role_perm.py位于 pipeline-app 根目录)
d = os.path.dirname(os.path.abspath(__file__))
for _ in range(6):
if os.path.isfile(os.path.join(d, "set_role_perm.py")):
return d
parent = os.path.dirname(d)
if parent == d:
break
d = parent
return None
def main():
root = find_app_root()
if not root:
print("ERROR: pipeline root not found")
sys.exit(1)
set_perm = os.path.join(root, "set_role_perm.py")
py = sys.executable
count = 0
for role, paths in [("any", PATHS_ANY), ("logined", PATHS_LOGINED)]:
for path in paths:
cmd = [py, set_perm, role, path]
r = subprocess.run(cmd, 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_ANY)+len(PATHS_LOGINED)} paths for {MOD}")
if __name__ == "__main__":
main()