Commit bfcc7bcee0217f34d6a73043eb9abf0745178be8
Exists in
staging
and in
3 other branches
Merge branch 'angular_poc' into staging
Showing
4 changed files
with
27 additions
and
1 deletions
Show diff stats
lib/noosfero/api/api.rb
lib/noosfero/api/session.rb
... | ... | @@ -45,6 +45,7 @@ module Noosfero |
45 | 45 | end |
46 | 46 | |
47 | 47 | post "/login_from_cookie" do |
48 | + return unauthorized! if cookies[:auth_token].blank? | |
48 | 49 | user = User.where(remember_token: cookies[:auth_token]).first |
49 | 50 | return unauthorized! unless user && user.activated? |
50 | 51 | @current_user = user | ... | ... |
lib/noosfero/api/v1/articles.rb
... | ... | @@ -0,0 +1,24 @@ |
1 | +module Noosfero | |
2 | + module API | |
3 | + module V1 | |
4 | + class Profiles < Grape::API | |
5 | + before { authenticate! } | |
6 | + | |
7 | + resource :profiles do | |
8 | + | |
9 | + get do | |
10 | + profiles = select_filtered_collection_of(environment, 'profiles', params) | |
11 | + profiles = profiles.visible_for_person(current_person) if profiles.respond_to?(:visible_for_person) | |
12 | + profiles = profiles.by_location(params) # Must be the last. May return Exception obj. | |
13 | + present profiles, :with => Entities::Profile, :current_person => current_person | |
14 | + end | |
15 | + | |
16 | + get ':id' do | |
17 | + profile = environment.profiles.visible_for_person(current_person).find_by_id(params[:id]) | |
18 | + present profile, :with => Entities::Profile, :current_person => current_person | |
19 | + end | |
20 | + end | |
21 | + end | |
22 | + end | |
23 | + end | |
24 | +end | ... | ... |