This commit is contained in:
yumoqing 2026-05-06 08:11:39 +08:00
parent b045758ebc
commit af5cce0c45
2 changed files with 16 additions and 3 deletions

View File

@ -291,13 +291,25 @@ async def main():
print(f" 注册权限: {perm_count}, 授权次数: {grant_count}, 错误: {error_count}")
# ---- 4c: 注册数据表页面权限 ----
# ---- 4c: 注册数据表页面权限(按 CRUD json 的 alias 或 tblname ----
print(f"\n [4c] 注册数据表页面权限...")
crud_count = 0
for module, tables in pc.CRUD_TABLES.items():
for table in tables:
page_path = f"/{module}/{table}"
json_dir = os.path.join(APP_ROOT, '..', module, 'json')
if not os.path.isdir(json_dir):
continue
for f in sorted(os.listdir(json_dir)):
if not f.endswith('.json'):
continue
try:
with open(os.path.join(json_dir, f), 'r') as fh:
data = json.loads(fh.read())
tblname = data.get('tblname', '')
alias = data.get('alias', '')
if not tblname:
continue
url_name = alias if alias else tblname
page_path = f"/{module}/{url_name}"
permid = await ensure_permission(sor, page_path, permtype='page')
await grant_perm(sor, role_ids['admin_superuser'], permid)
crud_count += 1

View File

@ -46,6 +46,7 @@
"id": "btn_logout",
"options": {
"label": "退出登录",
"bgcolor": "#3a73e8",
"color": "white"
}
}