|
|
@ -1,10 +1,12 @@
|
|
|
|
package com.dsideal.QingLong.Interceptor;
|
|
|
|
package com.dsideal.QingLong.Interceptor;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.dsideal.QingLong.DataShare.Model.DataShareModel;
|
|
|
|
import com.dsideal.QingLong.Util.CommonUtil;
|
|
|
|
import com.dsideal.QingLong.Util.CommonUtil;
|
|
|
|
import com.dsideal.QingLong.Util.SessionKit;
|
|
|
|
import com.dsideal.QingLong.Util.SessionKit;
|
|
|
|
import com.jfinal.aop.Interceptor;
|
|
|
|
import com.jfinal.aop.Interceptor;
|
|
|
|
import com.jfinal.aop.Invocation;
|
|
|
|
import com.jfinal.aop.Invocation;
|
|
|
|
import com.jfinal.core.Controller;
|
|
|
|
import com.jfinal.core.Controller;
|
|
|
|
|
|
|
|
import com.jfinal.plugin.activerecord.Record;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 需要是系统管理员身份校验
|
|
|
|
* 需要是系统管理员身份校验
|
|
|
@ -13,6 +15,8 @@ import com.jfinal.core.Controller;
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
public class IsSysAdminInterceptor implements Interceptor {
|
|
|
|
public class IsSysAdminInterceptor implements Interceptor {
|
|
|
|
|
|
|
|
DataShareModel dm = new DataShareModel();
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void intercept(Invocation inv) {
|
|
|
|
public void intercept(Invocation inv) {
|
|
|
|
IsSysAdminInterface annotation = inv.getMethod().getAnnotation(IsSysAdminInterface.class);
|
|
|
|
IsSysAdminInterface annotation = inv.getMethod().getAnnotation(IsSysAdminInterface.class);
|
|
|
@ -30,6 +34,17 @@ public class IsSysAdminInterceptor implements Interceptor {
|
|
|
|
inv.invoke();
|
|
|
|
inv.invoke();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
boolean isTrue = false;
|
|
|
|
boolean isTrue = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//如果携带了token
|
|
|
|
|
|
|
|
int identityId = -1;
|
|
|
|
|
|
|
|
String Authorization = con.getRequest().getHeader("Authorization");
|
|
|
|
|
|
|
|
if (Authorization != null) {
|
|
|
|
|
|
|
|
Record record = dm.checkToken(Authorization);
|
|
|
|
|
|
|
|
if (record.getBoolean("success")) {
|
|
|
|
|
|
|
|
identityId = DataShareModel.ShareSystemIdentityId;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
String[] value = annotation.value();
|
|
|
|
String[] value = annotation.value();
|
|
|
|
if (SessionKit.get(con.getRequest(), con.getResponse(), "identity_id") != null) {
|
|
|
|
if (SessionKit.get(con.getRequest(), con.getResponse(), "identity_id") != null) {
|
|
|
|
for (String v : value) {
|
|
|
|
for (String v : value) {
|
|
|
@ -37,6 +52,10 @@ public class IsSysAdminInterceptor implements Interceptor {
|
|
|
|
isTrue = true;
|
|
|
|
isTrue = true;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (identityId == Integer.parseInt(v)) {
|
|
|
|
|
|
|
|
isTrue = true;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (isTrue) {
|
|
|
|
if (isTrue) {
|
|
|
|