161 @java.io.Serial
162 private static final long serialVersionUID = -4023755556366636806L;
163
164 private boolean all_allowed; // true if any all permissions have been added
165
166 /**
167 * Create an empty AllPermissions object.
168 *
169 */
170
171 public AllPermissionCollection() {
172 all_allowed = false;
173 }
174
175 /**
176 * Adds a permission to the AllPermissions. The key for the hash is
177 * permission.path.
178 *
179 * @param permission the Permission object to add.
180 *
181 * @exception IllegalArgumentException - if the permission is not a
182 * AllPermission
183 *
184 * @exception SecurityException - if this AllPermissionCollection object
185 * has been marked readonly
186 */
187
188 public void add(Permission permission) {
189 if (! (permission instanceof AllPermission))
190 throw new IllegalArgumentException("invalid permission: "+
191 permission);
192 if (isReadOnly())
193 throw new SecurityException("attempt to add a Permission to a readonly PermissionCollection");
194
195 all_allowed = true; // No sync; staleness OK
196 }
197
198 /**
199 * Check and see if this set of permissions implies the permissions
200 * expressed in "permission".
201 *
202 * @param permission the Permission object to compare
203 *
204 * @return always returns true.
|
161 @java.io.Serial
162 private static final long serialVersionUID = -4023755556366636806L;
163
164 private boolean all_allowed; // true if any all permissions have been added
165
166 /**
167 * Create an empty AllPermissions object.
168 *
169 */
170
171 public AllPermissionCollection() {
172 all_allowed = false;
173 }
174
175 /**
176 * Adds a permission to the AllPermissions. The key for the hash is
177 * permission.path.
178 *
179 * @param permission the Permission object to add.
180 *
181 * @throws IllegalArgumentException - if the permission is not a
182 * AllPermission
183 *
184 * @throws SecurityException - if this AllPermissionCollection object
185 * has been marked readonly
186 */
187
188 public void add(Permission permission) {
189 if (! (permission instanceof AllPermission))
190 throw new IllegalArgumentException("invalid permission: "+
191 permission);
192 if (isReadOnly())
193 throw new SecurityException("attempt to add a Permission to a readonly PermissionCollection");
194
195 all_allowed = true; // No sync; staleness OK
196 }
197
198 /**
199 * Check and see if this set of permissions implies the permissions
200 * expressed in "permission".
201 *
202 * @param permission the Permission object to compare
203 *
204 * @return always returns true.
|