public static ResourceView secure(final ResourceView resourceView, final Set<Right> rights) {
final SecurityContext context = createContext(rights);
return new ResourceView() {
@Override
public ResourceRef viewOf(String viewUri, String childUri, ResourceSystem system) {
ResourceRef ref = resourceView.viewOf(viewUri, childUri, system);
return new SecuredRef(ref, context);
}
};
}