Forráskód Böngészése

♻️ refactor(routes): fix variable name typo in data permission checks

- rename `dataPermissionConfig` to `dataPermission` in view, update and delete permission checks
- ensure consistent variable naming with function parameters
yourname 7 hónapja
szülő
commit
890d3308c8
1 módosított fájl, 6 hozzáadás és 6 törlés
  1. 6 6
      src/server/utils/generic-crud.routes.ts

+ 6 - 6
src/server/utils/generic-crud.routes.ts

@@ -300,13 +300,13 @@ export function createCrudRoutes<
         const user = c.get('user');
         const user = c.get('user');
         
         
         // 如果配置了数据权限,检查用户是否有权限访问该资源
         // 如果配置了数据权限,检查用户是否有权限访问该资源
-        if (dataPermissionService && dataPermissionConfig && user) {
+        if (dataPermissionService && dataPermission && user) {
           const hasPermission = await dataPermissionService.checkDataPermission(
           const hasPermission = await dataPermissionService.checkDataPermission(
             user,
             user,
             entity.name,
             entity.name,
             id,
             id,
             'view',
             'view',
-            dataPermissionConfig
+            dataPermission
           );
           );
           
           
           if (!hasPermission) {
           if (!hasPermission) {
@@ -338,13 +338,13 @@ export function createCrudRoutes<
         const user = c.get('user');
         const user = c.get('user');
         
         
         // 如果配置了数据权限,检查用户是否有权限更新该资源
         // 如果配置了数据权限,检查用户是否有权限更新该资源
-        if (dataPermissionService && dataPermissionConfig && user) {
+        if (dataPermissionService && dataPermission && user) {
           const hasPermission = await dataPermissionService.checkDataPermission(
           const hasPermission = await dataPermissionService.checkDataPermission(
             user,
             user,
             entity.name,
             entity.name,
             id,
             id,
             'update',
             'update',
-            dataPermissionConfig
+            dataPermission
           );
           );
           
           
           if (!hasPermission) {
           if (!hasPermission) {
@@ -375,13 +375,13 @@ export function createCrudRoutes<
         const user = c.get('user');
         const user = c.get('user');
         
         
         // 如果配置了数据权限,检查用户是否有权限删除该资源
         // 如果配置了数据权限,检查用户是否有权限删除该资源
-        if (dataPermissionService && dataPermissionConfig && user) {
+        if (dataPermissionService && dataPermission && user) {
           const hasPermission = await dataPermissionService.checkDataPermission(
           const hasPermission = await dataPermissionService.checkDataPermission(
             user,
             user,
             entity.name,
             entity.name,
             id,
             id,
             'delete',
             'delete',
-            dataPermissionConfig
+            dataPermission
           );
           );
           
           
           if (!hasPermission) {
           if (!hasPermission) {