Browse Source

权限控制修改

root 5 years ago
parent
commit
f93465d927

BIN
1.dmp


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

@@ -111,7 +111,7 @@ public class ModuleService {
111
      * @param mcode 模块避难
111
      * @param mcode 模块避难
112
      * @return
112
      * @return
113
      */
113
      */
114
-    //@PrivChecker(name = "#name",code = "#mid")
114
+    @PrivChecker(name = "#name",code = "#mid")
115
     public Map getData(String mid,String name, JObject querier) throws Exception{
115
     public Map getData(String mid,String name, JObject querier) throws Exception{
116
         //String strSQL = this.getSource(mid,name);
116
         //String strSQL = this.getSource(mid,name);
117
         Map item = this.getSource(mid,name);
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
 //                if(item.get("name").toString().equals(name) && item.get("action").toString().equals(action))
54
 //                if(item.get("name").toString().equals(name) && item.get("action").toString().equals(action))
55
 //                    return true;
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
             } else if(2 == type){// url资源,淘汰不用
60
             } else if(2 == type){// url资源,淘汰不用
62
 //                if(item.get("name").toString().equals(name)){
61
 //                if(item.get("name").toString().equals(name)){
63
 //                    return true;
62
 //                    return true;
@@ -71,7 +70,7 @@ public class PrivService {
71
 //                    return  true;
70
 //                    return  true;
72
 //                }
71
 //                }
73
             } else if( 6 == type ){
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
                     return true;
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
             moduleCache.add(module);
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
                             "where t.m_code='{0}' and t.code = z.code\n" +
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
             List<Map> list = queryService.select(strSQL,module);
240
             List<Map> list = queryService.select(strSQL,module);
241
             load(list);
241
             load(list);
242
         }
242
         }
@@ -254,6 +254,8 @@ public class UserService {
254
                 }
254
                 }
255
                 else if(type.equals("7")) { // api group
255
                 else if(type.equals("7")) { // api group
256
                     loadApiGroup(name);
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
         //加载API
281
         //加载API
280
         private void loadApi(String apiId) {
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
             List<Map> list = queryService.select(strSQL,apiId);
284
             List<Map> list = queryService.select(strSQL,apiId);
283
 
285
 
284
             privs = ListUtil.merge(privs,list);
286
             privs = ListUtil.merge(privs,list);