Commit e5ecf4b1e326d81e05fec75b7d30b9cad917d5e6

Authored by Rodrigo Souto
1 parent 55f802bd

api: treat not_founds on people

Showing 1 changed file with 3 additions and 0 deletions   Show diff stats
lib/noosfero/api/v1/people.rb
... ... @@ -44,6 +44,7 @@ module Noosfero
44 44 desc "Return the person information"
45 45 get ':id' do
46 46 person = environment.people.visible_for_person(current_person).find_by_id(params[:id])
  47 + return not_found! if person.blank?
47 48 present person, :with => Entities::Person
48 49 end
49 50  
... ... @@ -69,6 +70,7 @@ module Noosfero
69 70 desc "Return the person friends"
70 71 get ':id/friends' do
71 72 person = environment.people.visible_for_person(current_person).find_by_id(params[:id])
  73 + return not_found! if person.blank?
72 74 friends = person.friends.visible
73 75 present friends, :with => Entities::Person
74 76 end
... ... @@ -76,6 +78,7 @@ module Noosfero
76 78 desc "Return the person permissions on other profiles"
77 79 get ":id/permissions" do
78 80 person = environment.people.find(params[:id])
  81 + return not_found! if person.blank?
79 82 return forbidden! unless current_person == person || environment.admins.include?(current_person)
80 83  
81 84 output = {}
... ...