app/controllers/groups_controller.rb in radiant-reader-extension-3.0.0.rc4 vs app/controllers/groups_controller.rb in radiant-reader-extension-3.0.0
- old
+ new
@@ -14,22 +14,24 @@
format.html
format.csv {
send_data generate_csv(@readers), :type => 'text/csv; charset=utf-8; header=present', :filename => "#{@group.filename}.csv"
}
format.vcard {
- send_data @readers.map(&:vcard).join("\n"), :filename => "#{@group.filename}.vcf"
+ send_data generate_vcard(@readers), :filename => "#{@group.filename}.vcf"
}
end
end
private
def get_group_or_groups
- @groups = Group.visible_to(current_reader)
- @group = @groups.find(params[:id]).first if params[:id]
+ @groups = Group.roots.visible_to(current_reader)
+ @group = Group.find(params[:id]) if params[:id]
end
def require_group_visibility
- raise ReaderError::AccessDenied if @group && !@group.visible_to?(current_reader)
+ if @group && !@group.visible_to?(current_reader) # nb. @groups is a smaller set
+ raise ReaderError::AccessDenied, "That group is not public and you are not in it."
+ end
end
end