MCPcopy Create free account
hub / github.com/EhsanTang/ApiManager / hasAuth

Method hasAuth

api/src/main/java/cn/crap/utils/Tools.java:240–263  ·  view source on GitHub ↗
(String authPassport)

Source from the content-addressed store, hash-verified

238 }
239
240 public static boolean hasAuth(String authPassport) throws MyException {
241 LoginInfoDto user = Tools.getUser();
242 if(user == null ){
243 throw new MyException("000003");
244 }
245
246 String authority = user.getAuthStr();
247 if( user != null && (","+user.getRoleId()).indexOf(","+Const.SUPER+",")>=0){
248 return true;//超级管理员
249 }
250
251 // 管理员修改自己的资料
252 if(authPassport.equals("USER")){
253 // 如果session中的管理员id和参数中的id一致
254 if( MyString.isEquals( user.getId(), user.getId() ) ){
255 return true;
256 }
257 }
258
259 if(authority.indexOf(","+authPassport+",")>=0){
260 return true;
261 }
262 throw new MyException("000003");
263 }
264
265 /**
266 * 构造查询Map集合

Callers 1

preHandleMethod · 0.95

Calls 5

getUserMethod · 0.95
getAuthStrMethod · 0.95
getRoleIdMethod · 0.95
isEqualsMethod · 0.95
getIdMethod · 0.95

Tested by

no test coverage detected