1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.directory.api.ldap.aci;
21
22
23 import java.util.ArrayList;
24 import java.util.Collection;
25 import java.util.Collections;
26 import java.util.HashSet;
27 import java.util.Set;
28
29 import org.apache.directory.api.i18n.I18n;
30 import org.apache.directory.api.ldap.model.constants.AuthenticationLevel;
31
32
33
34
35
36
37
38
39 public class ACITuple
40 {
41
42 private final Collection<UserClass> userClasses;
43
44
45 private final AuthenticationLevel authenticationLevel;
46
47
48 private final Collection<ProtectedItem> protectedItems;
49
50
51 private final Set<MicroOperation> microOperations;
52
53
54 private final boolean grant;
55
56
57 private final Integer precedence;
58
59
60
61
62
63
64
65
66
67
68
69
70 public ACITuple(
71 Collection<UserClass> userClasses,
72 AuthenticationLevel authenticationLevel,
73 Collection<ProtectedItem> protectedItems,
74 Collection<MicroOperation> microOperations,
75 boolean grant,
76 Integer precedence )
77 {
78 if ( authenticationLevel == null )
79 {
80 throw new IllegalArgumentException( I18n.err( I18n.ERR_04003_NULL_AUTHENTICATION_LEVEL ) );
81 }
82
83 if ( precedence < 0 || precedence > 255 )
84 {
85 throw new IllegalArgumentException( I18n.err( I18n.ERR_04002_BAD_PRECENDENCE, precedence ) );
86 }
87
88 this.userClasses = Collections.unmodifiableCollection( new ArrayList<UserClass>( userClasses ) );
89 this.authenticationLevel = authenticationLevel;
90 this.protectedItems = Collections.unmodifiableCollection( new ArrayList<ProtectedItem>( protectedItems ) );
91 this.microOperations = Collections.unmodifiableSet( new HashSet<MicroOperation>( microOperations ) );
92 this.grant = grant;
93 this.precedence = precedence;
94 }
95
96
97
98
99
100
101
102 public Collection<UserClass> getUserClasses()
103 {
104 return userClasses;
105 }
106
107
108
109
110
111
112
113 public AuthenticationLevel getAuthenticationLevel()
114 {
115 return authenticationLevel;
116 }
117
118
119
120
121
122
123
124 public Collection<ProtectedItem> getProtectedItems()
125 {
126 return protectedItems;
127 }
128
129
130
131
132
133
134
135 public Collection<MicroOperation> getMicroOperations()
136 {
137 return microOperations;
138 }
139
140
141
142
143
144
145
146 public boolean isGrant()
147 {
148 return grant;
149 }
150
151
152
153
154
155
156
157 public Integer getPrecedence()
158 {
159 return precedence;
160 }
161
162
163
164
165
166 @Override
167 public String toString()
168 {
169 return "ACITuple: userClasses=" + userClasses + ", " + "authenticationLevel=" + authenticationLevel + ", "
170 + "protectedItems=" + protectedItems + ", " + ( grant ? "grants=" : "denials=" ) + microOperations + ", "
171 + "precedence=" + precedence;
172 }
173 }