[Git][noosfero/noosfero][api] api: use visible_for_person instead of display_info_to
Rodrigo Souto
gitlab at gitlab.com
Mon Jun 29 16:03:59 BRT 2015
Rodrigo Souto pushed to branch api at Noosfero / noosfero
Commits:
8f5ebbd1 by Rodrigo Souto at 2015-06-29T16:03:46Z
api: use visible_for_person instead of display_info_to
- - - - -
2 changed files:
- lib/noosfero/api/v1/communities.rb
- lib/noosfero/api/v1/enterprises.rb
Changes:
=====================================
lib/noosfero/api/v1/communities.rb
=====================================
--- 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
=====================================
lib/noosfero/api/v1/enterprises.rb
=====================================
--- 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
View it on GitLab: https://gitlab.com/noosfero/noosfero/commit/8f5ebbd1b2016f491d463fd4ba398a547ba0f290
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20150629/a5c50d2e/attachment-0001.html>
More information about the Noosfero-dev
mailing list