driftrock-service 0.4.2 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,7 +2,7 @@ module Driftrock::Service
2
2
  module DriftrockApp
3
3
 
4
4
  def authorise
5
- return if session && session[:user_id] && session[:company_id]
5
+ return unless should_authorise
6
6
  timestamp = params[:timestamp]
7
7
  company_id= params[:company_id]
8
8
  token = params[:token]
@@ -15,7 +15,15 @@ module Driftrock::Service
15
15
  session[:company_id] = params[:company_id]
16
16
  end
17
17
  end
18
+
19
+ def should_authorise?
20
+ has_auth_params = params[:timestamp] && params[:company_id] && params[:token]
21
+ has_session_data = defined?(session) && session[:user_id] &&
22
+ session[:company_id]
18
23
 
24
+ has_auth_params || !has_session_data
25
+ end
26
+
19
27
  def driftrock_app_status
20
28
  render text: "OK"
21
29
  end
@@ -1,5 +1,5 @@
1
1
  module Driftrock
2
2
  module Service
3
- VERSION = "0.4.2"
3
+ VERSION = "0.4.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: driftrock-service
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.4.2
5
+ version: 0.4.3
6
6
  platform: ruby
7
7
  authors:
8
8
  - Max