1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package eu.ehri.project.acl;
21
22 import com.tinkerpop.blueprints.Vertex;
23 import eu.ehri.project.definitions.Entities;
24 import eu.ehri.project.models.Group;
25 import eu.ehri.project.models.PermissionGrant;
26 import eu.ehri.project.models.base.Accessor;
27 import eu.ehri.project.models.base.Entity;
28
29 import java.util.Collections;
30
31
32
33
34 public enum AnonymousAccessor implements Accessor {
35
36 INSTANCE;
37
38
39
40
41
42 public static Accessor getInstance() {
43 return INSTANCE;
44 }
45
46 @Override
47 public <T extends Entity> T as(Class<T> cls) {
48 throw new UnsupportedOperationException();
49 }
50
51 @Override
52 public boolean isAdmin() {
53 return false;
54 }
55
56 @Override
57 public boolean isAnonymous() {
58 return true;
59 }
60
61 @Override
62 public String getId() {
63 return Group.ANONYMOUS_GROUP_IDENTIFIER;
64 }
65
66 @Override
67 public String getType() {
68 return Entities.GROUP;
69 }
70
71 @Override
72 public Vertex asVertex() {
73 return null;
74 }
75
76 @Override
77 public String getIdentifier() {
78 return Group.ANONYMOUS_GROUP_IDENTIFIER;
79 }
80
81 @Override
82 public Iterable<Accessor> getParents() {
83 return Collections.emptyList();
84 }
85
86 @Override
87 public Iterable<Accessor> getAllParents() {
88 return Collections.emptyList();
89 }
90
91 @Override
92 public Iterable<PermissionGrant> getPermissionGrants() {
93 return Collections.emptyList();
94 }
95
96 @Override
97 public void addPermissionGrant(PermissionGrant grant) {
98 throw new UnsupportedOperationException();
99 }
100
101 @Override
102 public <T> T getProperty(String key) {
103 return null;
104 }
105
106 @Override
107 public <T> T getProperty(Enum<?> key) {
108 return null;
109 }
110
111 @Override
112 public java.util.Set<String> getPropertyKeys() {
113 return Collections.emptySet();
114 }
115 }