-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathMyPermission.java
More file actions
53 lines (43 loc) · 1.22 KB
/
Copy pathMyPermission.java
File metadata and controls
53 lines (43 loc) · 1.22 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
47
48
49
50
51
52
53
package security;
import java.security.Permission;
/**
* Created by max on 2/16/17.
*/
public class MyPermission extends Permission {
private String action;
public MyPermission(String action) {
super(action);
this.action = action;
}
@Override
public boolean implies(Permission permission) {
return false;
// if(!(permission instanceof MyPermission)) {
// return false;
// }
// if(!getName().equals("php")) {
// return true;
// } else if(action.equals("use")) {
// MyPermission myPermission = (MyPermission) permission;
// if(myPermission.action.equals("use")) {
// return true;
// }
// }
// return false;
}
@Override
public String getActions() {
return this.action;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
MyPermission that = (MyPermission) o;
return action != null ? action.equals(that.action) : that.action == null;
}
@Override
public int hashCode() {
return action != null ? action.hashCode() : 0;
}
}