diff --git a/lib/noosfero/api/v1/communities.rb b/lib/noosfero/api/v1/communities.rb index 7899269..0c99150 100644 --- a/lib/noosfero/api/v1/communities.rb +++ b/lib/noosfero/api/v1/communities.rb @@ -42,10 +42,7 @@ module Noosfero end get ':id' do - community = environment.communities.find_by_id(params[:id]) - unless community.nil? - community = nil unless community.display_info_to?(current_person) - end + community = environment.communities.visible_for_person(current_person).find_by_id(params[:id]) present community, :with => Entities::Community end diff --git a/lib/noosfero/api/v1/enterprises.rb b/lib/noosfero/api/v1/enterprises.rb index 4426479..aba1e6f 100644 --- a/lib/noosfero/api/v1/enterprises.rb +++ b/lib/noosfero/api/v1/enterprises.rb @@ -26,10 +26,7 @@ module Noosfero desc "Return one enterprise by id" get ':id' do - enterprise = environment.enterprises.find_by_id(params[:id]) - unless enterprise.nil? - enterprise = nil unless enterprise.display_info_to?(current_person) - end + enterprise = environment.enterprises.visible_for_person(current_person).find_by_id(params[:id]) present enterprise, :with => Entities::Enterprise end -- libgit2 0.21.2