Methods Summary |
---|
public void | add(java.security.Permission perm)
if (!isReadOnly()) {
Permission prev = permissions.put(perm.getName(), perm);
/*
* If the permission already existed but with only "read" or "write"
* set, then replace with both set.
*/
if (prev != null && !prev.getActions().equals(perm.getActions())) {
Permission np = new PropertyPermission(perm.getName(),
"read,write"); //$NON-NLS-1$
permissions.put(perm.getName(), np);
}
} else {
throw new IllegalStateException();
}
|
public java.util.Enumeration | elements()
return permissions.elements();
|
public boolean | implies(java.security.Permission perm)
Enumeration<Permission> elemEnum = elements();
while (elemEnum.hasMoreElements()) {
if ((elemEnum.nextElement()).implies(perm)) {
return true;
}
}
/*
* At this point, the only way it can succeed is if both read and write
* are set, and these are separately granted by two different
* permissions with one representing a parent directory.
*/
return perm.getActions().equals("read,write") //$NON-NLS-1$
&& implies(new PropertyPermission(perm.getName(), "read")) //$NON-NLS-1$
&& implies(new PropertyPermission(perm.getName(), "write")); //$NON-NLS-1$
|
private void | readObject(java.io.ObjectInputStream stream)
ObjectInputStream.GetField fields = stream.readFields();
permissions = (Hashtable<String, Permission>) fields.get(
"permissions", null); //$NON-NLS-1$
|
private void | writeObject(java.io.ObjectOutputStream stream) //$NON-NLS-1$
ObjectOutputStream.PutField fields = stream.putFields();
fields.put("permissions", permissions); //$NON-NLS-1$
fields.put("all_allowed", false); //$NON-NLS-1$
stream.writeFields();
|