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

调整功能

parent 2659e062
Pipeline #218 canceled with stages
......@@ -76,7 +76,7 @@ public class LoginIntercept implements HandlerInterceptor {
returnJson(response, result);
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");
returnJson(response, result);
return false;
......@@ -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)
return false;
List<Role> roleList = user.getRoleList();
......@@ -110,11 +110,10 @@ public class LoginIntercept implements HandlerInterceptor {
if (RoleTable.admin.getId().equals(role.getId()))
return true;
Role complexRole = jurisdictionService.findMenusByRoleId(role.getId());
for (Menu menu : complexRole.getMenuList()) {
if (requestUrl.indexOf(menu.getUrl()) > 0)
if (complexRole.getMenuList().stream().
anyMatch(menu -> menu.getMethod().toUpperCase().equals(method) && requestUrl.contains(menu.getUrl())))
return true;
}
}
return false;
}
......
......@@ -3,7 +3,8 @@ package com.restful.domain;
public class Menu extends BaseInfo {
private String url;
private String remark;//接口描述
private String method;
private String describe;
public String getUrl() {
return url;
......@@ -13,11 +14,19 @@ public class Menu extends BaseInfo {
this.url = url;
}
public String getRemark() {
return remark;
public String getMethod() {
return method;
}
public void setRemark(String remark) {
this.remark = remark;
public void setMethod(String method) {
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