protected void addURIPolicyRule(ResourcePath resourcePath, Collection<String> requestTypes, Collection<String> allowedRoles, Collection<String> deniedRoles,
Collection<String> allowedUsers, Collection<String> deniedUsers) {
RolesContainer rolesContainer = new RolesContainer()
.addAllAllowedRoles(allowedRoles).addAllDeniedRoles(deniedRoles)
.addAllAllowedUsers(allowedUsers).addAllDeniedUsers(deniedUsers);
URIPolicyRule rule = new URIPolicyRule(resourcePath, requestTypes, rolesContainer);
String tailName = resourcePath.tail().name();
if (tailName.endsWith("*") && !tailName.equals("*")) {
String lastSegment = tailName.substring(0, tailName.length() - 1);
resourcePath = resourcePath.parent();
resourcePath.appendSegment(lastSegment);
ResourcePath wildcardPath = new ResourcePath(resourcePath);
wildcardPath.appendSegment("*");
this.rulesTree.addObject(rule, resourcePath);
this.rulesTree.addObject(rule, wildcardPath);
} else {
this.rulesTree.addObject(rule, resourcePath);
}
log.debug("Added new URIPolicyRule for resourcePath " + resourcePath + ". Rule: " + rule);
}
}