浏览代码

权限控制修改

root 5 年之前
父节点
当前提交
f93465d927

二进制
1.dmp


+ 1 - 1
src/main/java/com/kingkong/bljs/service/ModuleService.java

@@ -111,7 +111,7 @@ public class ModuleService {
111 111
      * @param mcode 模块避难
112 112
      * @return
113 113
      */
114
-    //@PrivChecker(name = "#name",code = "#mid")
114
+    @PrivChecker(name = "#name",code = "#mid")
115 115
     public Map getData(String mid,String name, JObject querier) throws Exception{
116 116
         //String strSQL = this.getSource(mid,name);
117 117
         Map item = this.getSource(mid,name);

+ 4 - 5
src/main/java/com/kingkong/bljs/service/PrivService.java

@@ -54,10 +54,9 @@ public class PrivService {
54 54
 //                if(item.get("name").toString().equals(name) && item.get("action").toString().equals(action))
55 55
 //                    return true;
56 56
             }
57
-            else if(0 == type){ //数据源,淘汰不用
58
-//                if( item.get("m_id").toString().equals(code) && item.get("name").toString().equals(name)
59
-//                        && item.get("action").toString().equals(action))
60
-//                    return true;
57
+            else if(0 == type){ // 数据源访问
58
+                if( item.get("m_id").toString().equals(code) && item.get("name").toString().equals(name))
59
+                    return true;
61 60
             } else if(2 == type){// url资源,淘汰不用
62 61
 //                if(item.get("name").toString().equals(name)){
63 62
 //                    return true;
@@ -71,7 +70,7 @@ public class PrivService {
71 70
 //                    return  true;
72 71
 //                }
73 72
             } else if( 6 == type ){
74
-                if(item.get("code").toString().equals(code) && item.get("method").toString().equals(name))
73
+                if(item.get("code").toString().equals(code) && item.get("name").toString().equals(name))
75 74
                     return true;
76 75
             }
77 76
 

+ 6 - 4
src/main/java/com/kingkong/bljs/service/UserService.java

@@ -233,10 +233,10 @@ public class UserService {
233 233
 
234 234
             moduleCache.add(module);
235 235
 
236
-            String strSQL = "select  z.*\n" +
237
-                            "from k_module_priv t,k_module_priv_detail z\n" +
236
+            String strSQL = "select  z.type,z.name,z.code,a.id m_id \n" +
237
+                            "from k_module_priv t,k_module_priv_detail z,k_module a\n" +
238 238
                             "where t.m_code='{0}' and t.code = z.code\n" +
239
-                            "      and t.code = t.m_code";
239
+                            "      and t.code = t.m_code and a.code = t.m_code";
240 240
             List<Map> list = queryService.select(strSQL,module);
241 241
             load(list);
242 242
         }
@@ -254,6 +254,8 @@ public class UserService {
254 254
                 }
255 255
                 else if(type.equals("7")) { // api group
256 256
                     loadApiGroup(name);
257
+                }else{ //其他角色,直接加入
258
+                    privs.add(map);
257 259
                 }
258 260
             }
259 261
         }
@@ -278,7 +280,7 @@ public class UserService {
278 280
 
279 281
         //加载API
280 282
         private void loadApi(String apiId) {
281
-            String strSQL = "select code,method from k_api where id={0}";
283
+            String strSQL = "select 6 type,method name,code,0 m_id from k_api where id={0}";
282 284
             List<Map> list = queryService.select(strSQL,apiId);
283 285
 
284 286
             privs = ListUtil.merge(privs,list);