Commit 75709c7c by Nepxion

控制台增加权限拦截判断

parent 44ed139c
......@@ -32,8 +32,6 @@ public abstract class AbstractRestInvoker {
protected List<ServiceInstance> serviceInstances;
protected RestTemplate restTemplate;
private boolean checkPermissionEnabled = true;
public AbstractRestInvoker(List<ServiceInstance> serviceInstances, RestTemplate restTemplate) {
this.serviceInstances = serviceInstances;
this.restTemplate = restTemplate;
......@@ -54,16 +52,16 @@ public abstract class AbstractRestInvoker {
String url = getUrl(host, port);
String result = null;
if (checkPermissionEnabled) {
try {
checkPermission(serviceInstance);
try {
checkPermission(serviceInstance);
result = invokeRest(url);
} catch (Exception e) {
result = e.getMessage();
result = doRest(url);
if (!StringUtils.equals(result, "OK")) {
ConsoleErrorHandler errorHandler = (ConsoleErrorHandler) restTemplate.getErrorHandler();
result = errorHandler.getCause();
}
} else {
result = invokeRest(url);
} catch (Exception e) {
result = e.getMessage();
}
ResultEntity resultEntity = new ResultEntity();
......@@ -80,16 +78,6 @@ public abstract class AbstractRestInvoker {
return ResponseEntity.ok().body(resultEntityList);
}
private String invokeRest(String url) {
String result = doRest(url);
if (!StringUtils.equals(result, "OK")) {
ConsoleErrorHandler errorHandler = (ConsoleErrorHandler) restTemplate.getErrorHandler();
result = errorHandler.getCause();
}
return result;
}
protected void checkDiscoveryControlPermission(ServiceInstance serviceInstance) {
Map<String, String> metaData = serviceInstance.getMetadata();
......
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