UserToolObject.java
1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package com.lecuntao.ordering.tool;
import com.xiniunet.framework.security.Passport;
import com.xiniunet.framework.util.auth.ExtUser;
import com.xiniunet.framework.util.auth.LocalData;
import java.io.Serializable;
import java.util.List;
/**
* Created on 2014/09/15.
*
* @author 沈振家
* @version 0.1.0
*/
public class UserToolObject implements Serializable {
private static final long serialVersionUID = -7507510429755782597L;
public static boolean hasAnyFunction(String... functionCodeList) {
Passport passport = LocalData.getCurrentPassport();
ExtUser extUser = LocalData.getCurrentUser();
if (passport.getUserId().equals(passport.getOwnerId()) ||
passport.getUserId().equals(passport.getAdminId())) {
// 如果是管理员,检查护照信息
return true;
}
List<String> functionList = extUser.getFunctionList();
for (String functionCode : functionCodeList) {
for (String code : functionList) {
if (code.toLowerCase().equals(functionCode)) {
return true;
}
}
}
return false;
}
@Override
public String toString() {
return "";
}
}