ishapi 0.1.8.84 → 0.1.8.85

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 580afca9946792fc16b0e740aeebe5e668ab4475
4
- data.tar.gz: b1dbcf23e708cbd6e9ed6239ca08c358cf3e675e
2
+ SHA256:
3
+ metadata.gz: e7df53ccd0fa042a10f88a685837f32b05b6b16be632aefc0c3037ce6f8cee41
4
+ data.tar.gz: 2878e809162d18cb96e9dac69f9cba6051158530bda65e8b134c8873e6ab2037
5
5
  SHA512:
6
- metadata.gz: 679fea13081466918b96a8e5766d124f99fc212a97c68f16e6d024f6fc945bab89466fea8e75fab0f25edcd1f21225944e98cd6cbe365a7ec34220730d2f3c3c
7
- data.tar.gz: 15724413ffc4b8b4fc878dde5c28740536f871999c39125607fab5a34557b1417cd454fa3c39ff6f59ce789a3391906b485892387a249764d2a5bcd0882d340c
6
+ metadata.gz: 17ae7286eccc72a13b70a52e97139801f9c8bdb97d5d3ab285ae23ec98e641c1dd866eb7e84332690146ca73038b24f4313df0bbc6aeee2c111abebb0965ec69
7
+ data.tar.gz: 67c346985d52c486a41b2a40734d7e401bf5e58e5204f28ef2997effca0c1e92bd98bba7fc696e1cb1a6f07eb9a13d73a16283f46f54d0366c2a714af7957ad6
@@ -3,19 +3,43 @@ module Ishapi
3
3
  protect_from_forgery :prepend => true, :with => :exception
4
4
  layout :false
5
5
 
6
- before_action :check_profile
7
- before_action :set_current_ability
6
+ before_action :check_profile, except: [ :test ]
7
+ # before_action :set_current_ability
8
8
 
9
9
  check_authorization
10
10
  skip_before_action :verify_authenticity_token
11
11
 
12
+ def test
13
+ end
14
+
12
15
  #
13
16
  # private
14
17
  #
15
18
  private
16
19
 
20
+ def check_multiprofile provider = 'google'
21
+ if provider == 'google'
22
+ # client_secrets = ::Google::APIClient::ClientSecrets.load
23
+ # accessToken = params[:accessToken]
24
+ # authorization = ::Google::Auth.get_application_default
25
+ # result = authorization.apply({ accessToken: params[:accessToken] })
26
+ # puts! result, 'googleauth result'
27
+
28
+ decoded_token = JWT.decode params[:idToken], nil, false
29
+
30
+ @current_user = User.find_by email: decoded_token[0]['email']
31
+ # puts! @current_user.email, 'multiprofile'
32
+
33
+ sign_in @current_user, scope: :user
34
+ set_current_ability
35
+ end
36
+ end
37
+
17
38
  # this doesn't generate long-lived token, doesn't update user_profile
39
+ # this is only for facebook?
18
40
  def check_profile
41
+ return check_multiprofile 'google'
42
+
19
43
  # puts! params, 'params'
20
44
  # puts! current_user, 'current_user'
21
45
  # puts! @current_user, '@current_user'
@@ -92,7 +116,7 @@ module Ishapi
92
116
  end
93
117
 
94
118
  def set_current_ability
95
- puts! @current_user, '@current_user 111'
119
+ puts! current_user.email, '#set_current_ability() :: @current_user'
96
120
  @current_ability ||= ::Ishapi::Ability.new( @current_user )
97
121
  end
98
122
 
@@ -15,6 +15,7 @@ module Ishapi
15
15
  @galleries = @galleries.where( :site => @site )
16
16
  end
17
17
  @galleries = @galleries.page( params[:galleries_page] ).per( 10 )
18
+ byebug
18
19
  end
19
20
 
20
21
  def show
@@ -3,12 +3,18 @@ require_dependency "ishapi/application_controller"
3
3
  module Ishapi
4
4
  class NewsitemsController < ApplicationController
5
5
 
6
+ before_action :check_profile # , except: [ :index ] # @TODO: this is fucked
7
+ # before_action :check_multiprofile, only: [ :index ]
8
+
6
9
  def index
7
10
  if params[:domain]
8
11
  resource = Site.find_by( :domain => params[:domain], :lang => :en )
12
+ else
13
+ resource = current_user.profile
9
14
  end
15
+
10
16
  authorize! :show, resource
11
- @newsitems = resource.newsitems.page( params[:newsitems_page] ).per( resource.newsitems_per_page )
17
+ @newsitems = current_user.profile.newsitems
12
18
  end
13
19
 
14
20
  end
@@ -22,12 +22,16 @@ class Ishapi::Ability
22
22
  true
23
23
  end
24
24
 
25
+
26
+
25
27
  end
26
28
  #
27
29
  # anonymous user
28
30
  #
29
31
  user ||= User.new
30
32
 
33
+ can [ :show ], IshModels::UserProfile
34
+
31
35
  can [ :index, :show ], City
32
36
 
33
37
  can [ :update ], ::CoTailors::Address
@@ -27,6 +27,7 @@ Ishapi::Engine.routes.draw do
27
27
  namespace :my do
28
28
  post 'reports', :to => 'reports#index'
29
29
  get 'reports', :to => 'reports#index'
30
+ get 'newsitems', to: 'newsitems#index'
30
31
 
31
32
  # resources :reports
32
33
  # resources :galleries
@@ -48,7 +49,8 @@ Ishapi::Engine.routes.draw do
48
49
  get 'sites/view/:domain/tags', :to => 'tags#index', :constraints => { :domain => /[^\/]+/ }
49
50
 
50
51
  get 'tags/view/:tagname', :to => 'tags#show'
51
-
52
+ get 'test', to: 'application#test'
53
+
52
54
  namespace :tgm do
53
55
  end
54
56
 
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.84
4
+ version: 0.1.8.85
5
5
  platform: ruby
6
6
  authors:
7
7
  - piousbox
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-10 00:00:00.000000000 Z
11
+ date: 2019-04-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -94,6 +94,20 @@ dependencies:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: '3.0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: googleauth
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: 0.8.0
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: 0.8.0
97
111
  - !ruby/object:Gem::Dependency
98
112
  name: fb_graph
99
113
  requirement: !ruby/object:Gem::Requirement
@@ -281,7 +295,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
281
295
  version: '0'
282
296
  requirements: []
283
297
  rubyforge_project:
284
- rubygems_version: 2.5.1
298
+ rubygems_version: 2.7.3
285
299
  signing_key:
286
300
  specification_version: 4
287
301
  summary: Summary of Ishapi.