fix: 权限初始化脚本指定 SAGE_RBAC_DB=ocai_cms 避免数据库不匹配

This commit is contained in:
yumoqing 2026-06-03 17:11:55 +08:00
parent 208625415a
commit 15a0d4b8bb
2 changed files with 7 additions and 2 deletions

View File

@ -92,12 +92,15 @@ def scan_bricks(bricks_dir):
def set_any_perms(paths):
"""为路径列表设置any权限"""
count = 0
env = os.environ.copy()
env['SAGE_RBAC_DB'] = 'ocai_cms'
for p in paths:
result = subprocess.run(
[py, sp, "any", p],
cwd=sage_root,
capture_output=True,
text=True
text=True,
env=env
)
status = "" if result.returncode == 0 else ""
print(f" {status} any {p}")

View File

@ -29,9 +29,11 @@ if not sp:
def run(role, paths):
assert sp is not None, "set_role_perm.py not found"
env = os.environ.copy()
env['SAGE_RBAC_DB'] = 'ocai_cms'
for p in paths:
print(f" {role:30s} {p}")
subprocess.run([py, sp, role, p], cwd=sage_root, capture_output=True)
subprocess.run([py, sp, role, p], cwd=sage_root, capture_output=True, env=env)
# ─── superuser — 所有权限 ───
superuser_paths = [