ishapi 0.1.8.76 → 0.1.8.77

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3f08244e17d894558f1764cf5f2585dee323e332
4
- data.tar.gz: 5f39336e5b1b145875c3dce90758b517ce1e9d81
3
+ metadata.gz: e928f8d7f8c18df7006cbb798e225ab16f2d0226
4
+ data.tar.gz: c981988e44124c5f4d1bc165759e59f708608ee4
5
5
  SHA512:
6
- metadata.gz: e2fa1c6fde6ed681350a45662786a7a3874329415acedf82b320995bf6688f58e64c20368a0d53685b02394ea93dbfd0d76559e2f118f387efc89cc5a1f2fdbc
7
- data.tar.gz: 56c48d8c3575a38a9494a06633bb66f88452815330b665691da0f124208bc460aae0aeb5c2db75f306be8cef222d701399616b7ddfeebd8dc9f8ad903fb57122
6
+ metadata.gz: 4358a06e6ade08f9064129fbe9b06c2c8ccd4fcb98e2ab59a1d4db72a4bd9d39d1458f4308d68e8a014f2dd375380c6c2b90a8bceef598af9eb5c215dcde3bea
7
+ data.tar.gz: 4201d8b43150ef7af7f0a0322e9d8723b518c4ccd989940ba6dd719cb265aa8869e7561ce7394922b3b1ea123b7e3b4291b6a9767f1c7213b71828ea7a79d77c
@@ -1,4 +1,5 @@
1
1
  require_dependency "ishapi/application_controller"
2
+
2
3
  module Ishapi
3
4
  class SitesController < ApplicationController
4
5
 
@@ -16,11 +17,29 @@ module Ishapi
16
17
  @site = ::Site.find_by :domain => domain, :lang => :en
17
18
  authorize! :show, @site
18
19
 
20
+
21
+ if @site.is_private
22
+ if !params[:access_token]
23
+ render :json => { :status => :unauthorized}, :status => :unauthorized
24
+ return
25
+ end
26
+ access_token = params[:access_token]
27
+ @graph = Koala::Facebook::API.new( access_token, ::FB[@site.domain][:secret] )
28
+ @profile = @graph.get_object "me", :fields => 'email'
29
+ if @site.private_user_emails.include?( @profile['email'] )
30
+ ;
31
+ else
32
+ render :json => { :status => :unauthorized}, :status => :unauthorized
33
+ render :status => :unauthorized
34
+ end
35
+ end
36
+
19
37
  @galleries = @site.galleries.limit( 10 )
20
38
  @newsitems = @site.newsitems.limit(10)
21
39
  @reports = @site.reports.limit( 10 )
22
40
  @langs = ::Site.where( :domain => domain ).map( &:lang )
23
41
  @feature_tags = @site.tags.where( :is_feature => true )
42
+
24
43
  end
25
44
 
26
45
  end
data/config/routes.rb CHANGED
@@ -39,6 +39,7 @@ Ishapi::Engine.routes.draw do
39
39
  get 'reports/view/:name_seo', :to => 'reports#show'
40
40
 
41
41
  get 'sites/view/:domain', :to => 'sites#show', :constraints => { :domain => /[^\/]+/ }
42
+ post 'sites/view/:domain', :to => 'sites#show', :constraints => { :domain => /[^\/]+/ }
42
43
  get 'sites/view/:domain/newsitems/:newsitems_page', :to => 'newsitems#index', :constraints => { :domain => /[^\/]+/ }
43
44
  get 'sites/view/:domain/reports', :to => 'reports#index', :constraints => { :domain => /[^\/]+/ }
44
45
  get 'sites/view/:domain/reports/page/:reports_page', :to => 'reports#index', :constraints => { :domain => /[^\/]+/ }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ishapi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8.76
4
+ version: 0.1.8.77
5
5
  platform: ruby
6
6
  authors:
7
7
  - piousbox
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-07-11 00:00:00.000000000 Z
11
+ date: 2018-07-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails