URI[] listPossibleReleaseAttributes(Principal principal, String requester, URL resource)
throws ArpProcessingException {
Set possibleReleaseSet = new HashSet();
+ Set anyValueDenies = new HashSet();
Rule[] rules = createEffectiveArp(principal, requester, resource).getAllRules();
for (int i = 0; rules.length > i; i++) {
Rule.Attribute[] attributes = rules[i].getAttributes();
for (int j = 0; attributes.length > j; j++) {
if (attributes[j].releaseAnyValue()) {
possibleReleaseSet.add(attributes[j].getName());
+ } else if (attributes[j].denyAnyValue()) {
+ anyValueDenies.add(attributes[j].getName());
} else {
Rule.AttributeValue[] values = attributes[j].getValues();
for (int k = 0; values.length > k; k++) {
}
}
}
+ possibleReleaseSet.removeAll(anyValueDenies);
return (URI[]) possibleReleaseSet.toArray(new URI[0]);
}
{
new URI("urn:mace:eduPerson:1.0:eduPersonAffiliation"),
new URI("urn:mace:eduPerson:1.0:eduPersonPrincipalName")};
+ URI[] list3 = new URI[0];
//Test with just a site ARP
InputStream inStream = new FileInputStream("test/arp1.xml");
repository.update(arp7);
possibleAttributes = engine.listPossibleReleaseAttributes(principal1, "shar.example.edu", url1);
assertTrue("Incorrectly computed possible release set.", Arrays.equals(possibleAttributes, list2));
+
+ //Ensure that explicit denies on any value are not in the release set
+ inStream = new FileInputStream("test/arp6.xml");
+ parser.parse(new InputSource(inStream));
+ Arp arp6 = new Arp();
+ arp6.setPrincipal(principal1);
+ arp6.marshall(parser.getDocument().getDocumentElement());
+ repository.update(arp6);
+ possibleAttributes = engine.listPossibleReleaseAttributes(principal1, "shar.example.edu", url1);
+ assertTrue("Incorrectly computed possible release set.", Arrays.equals(possibleAttributes, list3));
+
} catch (Exception e) {
e.printStackTrace();
fail("Failed to marshall ARP: " + e);
return false;
}
+ boolean denyAnyValue() {
+ if (anyValueRelease.equals("deny")) {
+ return anyValue;
+ }
+ return false;
+ }
+
URI getName() {
return name;
}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<AttributeReleasePolicy xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="ARP.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <Description>Any Target. One attribute with no values.</Description>
+ <Rule>
+ <Target>
+ <AnyTarget/>
+ </Target>
+ <Attribute name="urn:mace:eduPerson:1.0:eduPersonAffiliation">
+ <AnyValue release="deny"/>
+ </Attribute>
+ </Rule>
+</AttributeReleasePolicy>
\ No newline at end of file
+<?xml version="1.0" encoding="UTF-8"?>
<AttributeReleasePolicy xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="ARP.xsd">
<Description>A specific SHAR and a regex resource.</Description>
<Rule>