Methods Summary |
---|
public void | add(java.security.Permission p)
if (!(p instanceof XYZPayrollPermission))
throw new IllegalArgumentException("Wrong permission type");
XYZPayrollPermission xyz = (XYZPayrollPermission) p;
String name = xyz.getName();
XYZPayrollPermission other = (XYZPayrollPermission) permissions.get(name);
if (other != null)
xyz = merge(xyz, other);
if (name.equals("*")) {
addedAdmin = true;
adminMask = xyz.mask;
}
permissions.put(name, xyz);
|
public java.util.Enumeration | elements()
return permissions.elements();
|
public boolean | implies(java.security.Permission p)
if (!(p instanceof XYZPayrollPermission))
return false;
XYZPayrollPermission xyz = (XYZPayrollPermission) p;
if (addedAdmin && (adminMask & xyz.mask) != 0)
return true;
Permission inTable = (Permission) permissions.get(xyz.getName());
if (inTable == null)
return false;
return inTable.implies(xyz);
|
private XYZPayrollPermission | merge(XYZPayrollPermission a, XYZPayrollPermission b)
String aAction = a.getActions();
if (aAction.equals(""))
return b;
String bAction = b.getActions();
if (bAction.equals(""))
return a;
return new XYZPayrollPermission(a.getName(), aAction + "," + bAction);
|