revert: only add /{modulename}/{tablename} page path permission, remove CRUD API registration

This commit is contained in:
yumoqing 2026-05-05 22:28:20 +08:00
parent 98e1bbe96a
commit f901813244

View File

@ -291,12 +291,11 @@ async def main():
print(f" 注册权限: {perm_count}, 授权次数: {grant_count}, 错误: {error_count}")
# ---- 4c: 注册 CRUD API 权限 + 数据表页面权限 ----
print(f"\n [4c] 注册 CRUD API 和数据表页面权限...")
# ---- 4c: 注册数据表页面权限 ----
print(f"\n [4c] 注册数据表页面权限...")
crud_count = 0
for module, tables in pc.CRUD_TABLES.items():
for table in tables:
# 1) 注册数据表页面路径: /{module}/{table} (menu.ui 中菜单项的 url)
page_path = f"/{module}/{table}"
try:
permid = await ensure_permission(sor, page_path, permtype='page')
@ -304,17 +303,7 @@ async def main():
crud_count += 1
except Exception:
pass
# 2) 注册 CRUD API 端点: list/create/update/delete
for action in ('list', 'create', 'update', 'delete'):
api_path = f"/{module}/api/{table}_{action}.dspy"
try:
permid = await ensure_permission(sor, api_path, permtype='api')
await grant_perm(sor, role_ids['admin_superuser'], permid)
crud_count += 1
except Exception:
pass
print(f" 注册 CRUD 权限: {crud_count}")
print(f" 注册数据表页面: {crud_count}")
# ---- 4d: 同步 admin_superuser 权限到各机构角色 ----
print(f"\n [4d] 同步 admin_superuser 权限到各机构已有角色...")