28 implements UserSecuritySettings |
28 implements UserSecuritySettings |
29 { |
29 { |
30 private String name; |
30 private String name; |
31 private int currentInteractionMode; |
31 private int currentInteractionMode; |
32 private int[] allowedInteractionModes; |
32 private int[] allowedInteractionModes; |
|
33 private boolean active; |
|
34 |
|
35 public SecurityPolicyPermissionSettings( |
|
36 String name) |
|
37 { |
|
38 this(name, UNDEFINED_INTERACTION_MODE, null, true); |
|
39 } |
33 |
40 |
34 public SecurityPolicyPermissionSettings( |
41 public SecurityPolicyPermissionSettings( |
35 String name, |
42 String name, |
36 int currentInteractionMode, |
43 int currentInteractionMode, |
37 int[] allowedInteractionModes) |
44 int[] allowedInteractionModes) |
38 { |
45 { |
|
46 this(name, currentInteractionMode, allowedInteractionModes, true); |
|
47 } |
|
48 |
|
49 public SecurityPolicyPermissionSettings( |
|
50 String name, |
|
51 int currentInteractionMode, |
|
52 int[] allowedInteractionModes, |
|
53 boolean activeSettings) |
|
54 { |
39 this.name = name; |
55 this.name = name; |
40 this.currentInteractionMode = currentInteractionMode; |
56 this.currentInteractionMode = currentInteractionMode; |
41 this.allowedInteractionModes = allowedInteractionModes; |
57 this.allowedInteractionModes = allowedInteractionModes; |
|
58 this.active = activeSettings; |
|
59 } |
|
60 |
|
61 public boolean isActive() |
|
62 { |
|
63 return active; |
42 } |
64 } |
43 |
65 |
44 public String getName() |
66 public String getName() |
45 { |
67 { |
46 return name; |
68 return name; |
164 oStream.write(allowedInteractionModes[i]); |
186 oStream.write(allowedInteractionModes[i]); |
165 } |
187 } |
166 return oStream.toByteArray(); |
188 return oStream.toByteArray(); |
167 } |
189 } |
168 |
190 |
169 public static SecurityPolicyPermissionSettings getFromBytes(byte[] buf) |
191 public static SecurityPolicyPermissionSettings getFromBytes(byte[] buf, boolean activeSettings) |
170 { |
192 { |
171 int nameLen = buf[SecurityPolicy.index]; |
193 int nameLen = buf[SecurityPolicy.index]; |
172 SecurityPolicy.index++; |
194 SecurityPolicy.index++; |
173 String name = new String(buf, SecurityPolicy.index, nameLen); |
195 String name = new String(buf, SecurityPolicy.index, nameLen); |
174 SecurityPolicy.index += nameLen; |
196 SecurityPolicy.index += nameLen; |
179 for (int i=0; i<allowedInteractionModes.length; i++) |
201 for (int i=0; i<allowedInteractionModes.length; i++) |
180 { |
202 { |
181 allowedInteractionModes[i] = buf[SecurityPolicy.index]; |
203 allowedInteractionModes[i] = buf[SecurityPolicy.index]; |
182 SecurityPolicy.index++; |
204 SecurityPolicy.index++; |
183 } |
205 } |
184 return new SecurityPolicyPermissionSettings(name, currentInteractionMode, allowedInteractionModes); |
206 return new SecurityPolicyPermissionSettings(name, currentInteractionMode, allowedInteractionModes, activeSettings); |
185 } |
207 } |
186 |
208 |
187 } |
209 } |