fix: 权限初始化脚本指定 SAGE_RBAC_DB=ocai_cms 避免数据库不匹配
This commit is contained in:
parent
208625415a
commit
15a0d4b8bb
@ -92,12 +92,15 @@ def scan_bricks(bricks_dir):
|
|||||||
def set_any_perms(paths):
|
def set_any_perms(paths):
|
||||||
"""为路径列表设置any权限"""
|
"""为路径列表设置any权限"""
|
||||||
count = 0
|
count = 0
|
||||||
|
env = os.environ.copy()
|
||||||
|
env['SAGE_RBAC_DB'] = 'ocai_cms'
|
||||||
for p in paths:
|
for p in paths:
|
||||||
result = subprocess.run(
|
result = subprocess.run(
|
||||||
[py, sp, "any", p],
|
[py, sp, "any", p],
|
||||||
cwd=sage_root,
|
cwd=sage_root,
|
||||||
capture_output=True,
|
capture_output=True,
|
||||||
text=True
|
text=True,
|
||||||
|
env=env
|
||||||
)
|
)
|
||||||
status = "✓" if result.returncode == 0 else "✗"
|
status = "✓" if result.returncode == 0 else "✗"
|
||||||
print(f" {status} any {p}")
|
print(f" {status} any {p}")
|
||||||
|
|||||||
@ -29,9 +29,11 @@ if not sp:
|
|||||||
|
|
||||||
def run(role, paths):
|
def run(role, paths):
|
||||||
assert sp is not None, "set_role_perm.py not found"
|
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:
|
for p in paths:
|
||||||
print(f" {role:30s} {p}")
|
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 — 所有权限 ───
|
||||||
superuser_paths = [
|
superuser_paths = [
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user