[Git][noosfero/noosfero][api] api: treat not_founds on people

Rodrigo Souto gitlab at gitlab.com
Tue Jul 7 11:19:11 BRT 2015


Rodrigo Souto pushed to branch api at Noosfero / noosfero


Commits:
e5ecf4b1 by Rodrigo Souto at 2015-07-07T11:18:59Z
api: treat not_founds on people

- - - - -


1 changed file:

- lib/noosfero/api/v1/people.rb


Changes:

=====================================
lib/noosfero/api/v1/people.rb
=====================================
--- a/lib/noosfero/api/v1/people.rb
+++ b/lib/noosfero/api/v1/people.rb
@@ -44,6 +44,7 @@ module Noosfero
           desc "Return the person information"
           get ':id' do
             person = environment.people.visible_for_person(current_person).find_by_id(params[:id])
+            return not_found! if person.blank?
             present person, :with => Entities::Person
           end
 
@@ -69,6 +70,7 @@ module Noosfero
           desc "Return the person friends"
           get ':id/friends' do
             person = environment.people.visible_for_person(current_person).find_by_id(params[:id])
+            return not_found! if person.blank?
             friends = person.friends.visible
             present friends, :with => Entities::Person
           end
@@ -76,6 +78,7 @@ module Noosfero
           desc "Return the person permissions on other profiles"
           get ":id/permissions" do
             person = environment.people.find(params[:id])
+            return not_found! if person.blank?
             return forbidden! unless current_person == person || environment.admins.include?(current_person)
 
             output = {}



View it on GitLab: https://gitlab.com/noosfero/noosfero/commit/e5ecf4b1e326d81e05fec75b7d30b9cad917d5e6
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20150707/91a274c5/attachment-0001.html>


More information about the Noosfero-dev mailing list