use of com.netsteadfast.greenstep.base.model.ServiceMethodType in project bamboobsc by billchen198318.
the class ServiceAuthorityCheckAspect method isServiceMethodAuthority.
private boolean isServiceMethodAuthority(String serviceId, Annotation[] annotations, Subject subject) {
if (annotations == null || annotations.length < 1) {
// 沒有 @ServiceMethodAuthority 不要檢查權限
return true;
}
boolean status = false;
boolean foundServiceMethodAuthority = false;
for (Annotation anno : annotations) {
if (anno instanceof ServiceMethodAuthority) {
foundServiceMethodAuthority = true;
ServiceMethodType[] types = ((ServiceMethodAuthority) anno).type();
for (int i = 0; types != null && !status && i < types.length; i++) {
ServiceMethodType type = types[i];
// 如 core.service.logic.ApplicationSystemLogicService#INSERT
String methodPerm = serviceId + Constants.SERVICE_ID_TYPE_DISTINGUISH_SYMBOL + type.toString();
if (subject.isPermitted(methodPerm)) {
status = true;
}
}
}
}
if (!foundServiceMethodAuthority) {
// 沒有 @ServiceMethodAuthority 不要檢查權限
return true;
}
return status;
}
Aggregations