diff --git a/init_permissions.py b/init_permissions.py index 583b011..291d1e4 100644 --- a/init_permissions.py +++ b/init_permissions.py @@ -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 权限到各机构已有角色...")