Commit 41012341 authored by 李永强's avatar 李永强

调整功能

parent 2659e062
Pipeline #218 canceled with stages
...@@ -76,7 +76,7 @@ public class LoginIntercept implements HandlerInterceptor { ...@@ -76,7 +76,7 @@ public class LoginIntercept implements HandlerInterceptor {
returnJson(response, result); returnJson(response, result);
return false; return false;
} }
if (!getJurisdictionByRoles(user, request.getRequestURL().toString())) { if (!getJurisdictionByRoles(user, request.getRequestURL().toString(), request.getMethod())) {
ApiResult result = new ApiResult(Constants.FAIL, "No access to this interface"); ApiResult result = new ApiResult(Constants.FAIL, "No access to this interface");
returnJson(response, result); returnJson(response, result);
return false; return false;
...@@ -100,7 +100,7 @@ public class LoginIntercept implements HandlerInterceptor { ...@@ -100,7 +100,7 @@ public class LoginIntercept implements HandlerInterceptor {
} }
} }
private boolean getJurisdictionByRoles(User user, String requestUrl) { private boolean getJurisdictionByRoles(User user, String requestUrl, String method) {
if (user == null) if (user == null)
return false; return false;
List<Role> roleList = user.getRoleList(); List<Role> roleList = user.getRoleList();
...@@ -110,11 +110,10 @@ public class LoginIntercept implements HandlerInterceptor { ...@@ -110,11 +110,10 @@ public class LoginIntercept implements HandlerInterceptor {
if (RoleTable.admin.getId().equals(role.getId())) if (RoleTable.admin.getId().equals(role.getId()))
return true; return true;
Role complexRole = jurisdictionService.findMenusByRoleId(role.getId()); Role complexRole = jurisdictionService.findMenusByRoleId(role.getId());
for (Menu menu : complexRole.getMenuList()) { if (complexRole.getMenuList().stream().
if (requestUrl.indexOf(menu.getUrl()) > 0) anyMatch(menu -> menu.getMethod().toUpperCase().equals(method) && requestUrl.contains(menu.getUrl())))
return true; return true;
} }
}
return false; return false;
} }
......
...@@ -3,7 +3,8 @@ package com.restful.domain; ...@@ -3,7 +3,8 @@ package com.restful.domain;
public class Menu extends BaseInfo { public class Menu extends BaseInfo {
private String url; private String url;
private String remark;//接口描述 private String method;
private String describe;
public String getUrl() { public String getUrl() {
return url; return url;
...@@ -13,11 +14,19 @@ public class Menu extends BaseInfo { ...@@ -13,11 +14,19 @@ public class Menu extends BaseInfo {
this.url = url; this.url = url;
} }
public String getRemark() { public String getMethod() {
return remark; return method;
} }
public void setRemark(String remark) { public void setMethod(String method) {
this.remark = remark; this.method = method;
}
public String getDescribe() {
return describe;
}
public void setDescribe(String describe) {
this.describe = describe;
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment