提交 | 用户 | 时间
|
e7c126
|
1 |
package com.xxl.job.admin.core.model; |
H |
2 |
|
|
3 |
import org.springframework.util.StringUtils; |
|
4 |
|
|
5 |
/** |
|
6 |
* @author xuxueli 2019-05-04 16:43:12 |
|
7 |
*/ |
|
8 |
public class XxlJobUser { |
|
9 |
|
|
10 |
private int id; |
|
11 |
private String username; // 账号 |
|
12 |
private String password; // 密码 |
|
13 |
private int role; // 角色:0-普通用户、1-管理员 |
|
14 |
private String permission; // 权限:执行器ID列表,多个逗号分割 |
|
15 |
|
|
16 |
public int getId() { |
|
17 |
return id; |
|
18 |
} |
|
19 |
|
|
20 |
public void setId(int id) { |
|
21 |
this.id = id; |
|
22 |
} |
|
23 |
|
|
24 |
public String getUsername() { |
|
25 |
return username; |
|
26 |
} |
|
27 |
|
|
28 |
public void setUsername(String username) { |
|
29 |
this.username = username; |
|
30 |
} |
|
31 |
|
|
32 |
public String getPassword() { |
|
33 |
return password; |
|
34 |
} |
|
35 |
|
|
36 |
public void setPassword(String password) { |
|
37 |
this.password = password; |
|
38 |
} |
|
39 |
|
|
40 |
public int getRole() { |
|
41 |
return role; |
|
42 |
} |
|
43 |
|
|
44 |
public void setRole(int role) { |
|
45 |
this.role = role; |
|
46 |
} |
|
47 |
|
|
48 |
public String getPermission() { |
|
49 |
return permission; |
|
50 |
} |
|
51 |
|
|
52 |
public void setPermission(String permission) { |
|
53 |
this.permission = permission; |
|
54 |
} |
|
55 |
|
|
56 |
// plugin |
|
57 |
public boolean validPermission(int jobGroup){ |
|
58 |
if (this.role == 1) { |
|
59 |
return true; |
|
60 |
} else { |
|
61 |
if (StringUtils.hasText(this.permission)) { |
|
62 |
for (String permissionItem : this.permission.split(",")) { |
|
63 |
if (String.valueOf(jobGroup).equals(permissionItem)) { |
|
64 |
return true; |
|
65 |
} |
|
66 |
} |
|
67 |
} |
|
68 |
return false; |
|
69 |
} |
|
70 |
|
|
71 |
} |
|
72 |
|
|
73 |
} |