Kaynağa Gözat

接口权限

andy 1 yıl önce
ebeveyn
işleme
936d71d88b

+ 10 - 5
src/main/java/com/scbfkj/uni/api/LogAop.java

@@ -196,22 +196,27 @@ public class LogAop {
                                         throw e;
                                     }
                                 }
+                            } else {
+                                body.put("filterLines", new ArrayList<>());
                             }
                         }
+                        List<String> columns = DATA_BASE.query(Config.getSecurityConnectionStr(), "select pagecode from pageconfiguration where pagetype='column' and pageconfiguration.pageconfigurationid  in (select userpermissions.pageconfigurationid from userpermissions where serviceid = ? and userid =?)", serviceid.get(), RequestUtil.getUserId()).stream().map(it -> it.get("pagecode").toString()).toList();
+                        if (!columns.isEmpty()) {
+                            body.put("filterColumns", columns);
+                        }
                     }
                 }
             }
-            if (Config.isSecurityEnable()) {
 //                    不需要登录也没有设置权限的默认添加一个所有列权限
 
-                if (body != null && !body.containsKey("filterColumns")) {
-                    body.put("filterColumns", Collections.singletonList("*"));
-                }
+            if (!Config.isSecurityEnable() && body != null && !body.containsKey("filterColumns")) {
+                body.put("filterColumns", Collections.singletonList("*"));
             }
+
         }
     }
 
-    private void checkToken( String uri) throws Exception {
+    private void checkToken(String uri) throws Exception {
         if (Config.isSecurityEnable()) {
             List<Map<String, Object>> apiInfos = DATA_BASE.query(Config.getSecurityConnectionStr(), "select * from apiinfo");
 

+ 2 - 2
src/main/java/com/scbfkj/uni/library/script/AuthorizationScriptUtil.java

@@ -140,13 +140,13 @@ public class AuthorizationScriptUtil {
         List<Map<String, Object>> results;
         if ("2".equals(value.get("type").toString())) {
             results = DATABASE.query(Config.getSecurityConnectionStr(), """
-                    select distinct pageconfiguration.*,selectcolumnlist,filterset
+                    select distinct pageconfiguration.*,filterset
                     from usergrouppermissions
                              right join pageconfiguration on pageconfiguration.pageconfigurationid = usergrouppermissions.pageconfigurationid
                     where usergroupid = ?""", id);
         } else {
             results = DATABASE.query(Config.getSecurityConnectionStr(), """
-                    select  distinct pageconfiguration.*,selectcolumnlist,filterset
+                    select  distinct pageconfiguration.*,filterset
                     from userpermissions
                         right join pageconfiguration on pageconfiguration.pageconfigurationid = userpermissions.pageconfigurationid  
                     where userid =?""", id);

+ 0 - 6
src/main/java/com/scbfkj/uni/service/SecurityService.java

@@ -503,9 +503,6 @@ public class SecurityService {
                            charttype,
                            easysearch,
                           triggerserviceid,
-                           null as insetcolumnlist,
-                           null as updatecolumnlist,
-                           null as selectcolumnlist,
                            null as filterset
                     from pageconfiguration""";
             permission = DATABASE.query(Config.getSecurityConnectionStr(), query);
@@ -561,9 +558,6 @@ public class SecurityService {
                           t3.triggerserviceid,
                           t3.charttype,
                           t3.easysearch,
-                           insetcolumnlist,
-                           updatecolumnlist,
-                           selectcolumnlist,
                            filterset
                     from pageconfiguration t3,
                          userpermissions t1