This commit is contained in:
wangkang
2017-07-29 10:18:34 +08:00
parent 20f57fba7e
commit c75bd34391
2 changed files with 7 additions and 9 deletions
@@ -19,7 +19,7 @@ import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;
import com.egridcloud.udf.core.RestResponse;
import com.egridcloud.udf.core.exception.SystemRuntimeException;
import com.egridcloud.udf.core.exception.PermissionException;
import com.egridcloud.udf.rms.mate.AuthMate;
import com.egridcloud.udf.rms.mate.PathMate;
@@ -123,15 +123,13 @@ public class Rms {
//获取路径元数据
PathMate pathMate = rmsProperties.getService().get(springApplicationName);
//判断路径访问权限
if (authMate.getPurview() != null) {
if (!authMate.getAll()) {
if (authMate.getDisabled()) {
throw new SystemRuntimeException(springApplicationName + " is disabled");
throw new PermissionException(springApplicationName + " is disabled");
}
if (!authMate.getAll() && authMate.getPurview().indexOf(serviceCode) == -1) {
throw new SystemRuntimeException(serviceCode + " no access");
if (authMate.getPurview().indexOf(serviceCode) == -1) {
throw new PermissionException("no access to this servoceCode : " + serviceCode);
}
} else {
throw new SystemRuntimeException(springApplicationName + " purview is null");
}
StringBuilder url = new StringBuilder(Constant.HTTP);
url.append(rmsProperties.getService().get(pathMate.getApplicationName()));
@@ -87,7 +87,7 @@ public class RmsAuthHandlerInterceptor implements HandlerInterceptor {
if (!authMate.getAll()) {
//判断是否禁止调用所有服务权限
if (authMate.getDisabled()) {
throw new PermissionException("all services are disabled");
throw new PermissionException(rmsApplicationName + " is disabled");
}
//判断是否有调用该服务的权限
if (authMate.getPurview().indexOf(rmsServiceCode) != -1) {
@@ -103,7 +103,7 @@ public class RmsAuthHandlerInterceptor implements HandlerInterceptor {
throw new AuthException("service code not exist");
}
} else {
throw new PermissionException("no access to this url : " + url + ", method : " + method);
throw new PermissionException("no access to this servoceCode : " + rmsServiceCode);
}
}
} else {