fix(load_path): set_role_perm.py 用宿主根绝对路径(否则在模块目录执行时找不到文件,0/68 注册)
This commit is contained in:
parent
300d09fe8a
commit
c4e8406c6f
@ -2,12 +2,16 @@
|
|||||||
"""RBAC path registration for pipeline-bidding module.
|
"""RBAC path registration for pipeline-bidding module.
|
||||||
|
|
||||||
与平台惯例一致:静态资源 → any(免登录),页面/CRUD/API → logined。
|
与平台惯例一致:静态资源 → any(免登录),页面/CRUD/API → logined。
|
||||||
由宿主应用根目录执行:py3/bin/python pkgs/pipeline-bidding/scripts/load_path.py
|
在宿主应用根目录执行(set_role_perm.py 位于宿主根):
|
||||||
|
cd <APP_ROOT> && py3/bin/python pkgs/pipeline-bidding/scripts/load_path.py
|
||||||
"""
|
"""
|
||||||
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
MOD = "pipeline-bidding"
|
MOD = "pipeline-bidding"
|
||||||
|
# set_role_perm.py 在宿主应用根目录(本脚本位于 <APP_ROOT>/pkgs/pipeline-bidding/scripts/)
|
||||||
|
APP_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..", ".."))
|
||||||
|
|
||||||
TABLES = [
|
TABLES = [
|
||||||
"bid_mail_accounts", "bid_tenders", "bid_members", "bid_tender_files",
|
"bid_mail_accounts", "bid_tenders", "bid_members", "bid_tender_files",
|
||||||
@ -42,8 +46,8 @@ PATHS_LOGINED += [
|
|||||||
|
|
||||||
|
|
||||||
def _run(role, path):
|
def _run(role, path):
|
||||||
r = subprocess.run([sys.executable, "set_role_perm.py", role, path],
|
r = subprocess.run([sys.executable, os.path.join(APP_ROOT, "set_role_perm.py"), role, path],
|
||||||
capture_output=True, text=True)
|
capture_output=True, text=True, cwd=APP_ROOT)
|
||||||
if r.returncode != 0:
|
if r.returncode != 0:
|
||||||
print(" FAIL [%s] %s: %s" % (role, path, (r.stderr or "").strip()[:120]))
|
print(" FAIL [%s] %s: %s" % (role, path, (r.stderr or "").strip()[:120]))
|
||||||
return r.returncode == 0
|
return r.returncode == 0
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user