@Override public void resourceDeleted(ResourceResponse resourceResponse) { ResourcePath path = resourcePathOf(resourceResponse.resource()); this.subscriptionsTree.objects(path).forEach((subscription) -> subscribeResourceDeleted(path, subscription, resourceResponse)); this.subscriptionsTree.objects(path.parent()).forEach((subscription) -> subscribeResourceDeleted(path.parent(), subscription, resourceResponse)); }
@Override public void resourceCreated(ResourceResponse resourceResponse) { ResourcePath path = resourcePathOf(resourceResponse.resource()); this.subscriptionsTree.objects(path).forEach((subscription) -> subscribeResourceCreated(path, subscription, resourceResponse)); this.subscriptionsTree.objects(path.parent()).forEach((subscription) -> subscribeResourceCreated(path.parent(), subscription, resourceResponse)); }
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); // We want to support '/foo/bar*' which is mapped to both '/foo/bar' and '/foo/bar/*' 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); } }