aptible-rails 0.4.9 → 0.4.10

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
2
  SHA1:
3
- metadata.gz: 3d401509e9551ecfd52e6baa1459cdeb229d76c0
4
- data.tar.gz: 364a1ee40a484f5ecf76e7868749cda18c5084e0
3
+ metadata.gz: fb7735be8de2d51dec59dff474ba14a797078dcd
4
+ data.tar.gz: ff6ed6379626b885f565495fe543a225b09f2553
5
5
  SHA512:
6
- metadata.gz: a9b78056d573b376d41d7520622cc963ca149c9d880097724c797f41ac6604717cfba32301780ea76afee62a0b7122f6adca2f01d47b55a44b1102cbe0a1f2e7
7
- data.tar.gz: b282da1e58ef2ebaac4aebc767b452781353d642fe69429e0a4c31ea641630f6a0b041b1261561c17a6f523e7382346f9b853b3632c3179d53fbe64c433f2154
6
+ metadata.gz: cc2a8e111b3e56240f1d31d13b764ebb5af6159cf592216718670d85e108db56de687f857d4cd48d36ef22e16f59dc121d684aa897d747f1917f972f140165ff
7
+ data.tar.gz: 934f6a2e28be3b56f40d0bcdcc5c20dd2164001fcfa61b384ac2fafe23c3637195c1e42b3de856b9222dd13f916e25d5e86b149a4426e4d3883df3e5469ea4f8
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
23
23
  spec.add_dependency 'aptible-auth', '>= 0.5.0'
24
24
  spec.add_dependency 'aptible-api', '>= 0.5.0'
25
25
  spec.add_dependency 'aptible-gridiron'
26
- spec.add_dependency 'fridge'
26
+ spec.add_dependency 'fridge', '>= 0.2.3'
27
27
  spec.add_dependency 'draper'
28
28
  spec.add_dependency 'garner'
29
29
 
@@ -22,19 +22,27 @@ module Aptible
22
22
  end
23
23
 
24
24
  def current_organization
25
- session[:organization_url] ||= Aptible::Auth::Organization.all(
26
- token: session_token
27
- ).first.href
28
- url = [session[:organization_url], token: service_token]
29
- @current_organization ||= Aptible::Auth::Organization.find_by_url(*url)
30
- rescue
31
- nil
25
+ return @current_organization if @current_organization
26
+ url = read_shared_cookie(:organization_url)
27
+ @current_organization = Aptible::Auth::Organization.find_by_url(
28
+ url, token: session_token
29
+ ) if url
30
+ end
31
+
32
+ def current_organization=(organization)
33
+ write_shared_cookie(:organization_url, organization.href)
32
34
  end
33
35
 
34
36
  def current_user_url
35
37
  token_subject || session_subject
36
38
  end
37
39
 
40
+ # before_action :set_default_organization
41
+ def set_default_organization
42
+ self.current_organization ||=
43
+ Aptible::Auth::Organization.all(token: session_token).first
44
+ end
45
+
38
46
  # before_action :authenticate_user
39
47
  def authenticate_user
40
48
  redirect_to Aptible::Rails.configuration.login_url unless current_user
@@ -28,6 +28,8 @@ module Aptible
28
28
  register_url :contact_url,
29
29
  aptible_config.marketing_root_url + '/contact'
30
30
  register_url :dashboard_url, aptible_config.dashboard_root_url
31
+ register_url :dashboard_session_url,
32
+ aptible_config.dashboard_root_url + '/session'
31
33
  register_url :databases_url,
32
34
  aptible_config.dashboard_root_url + '/databases'
33
35
  register_url :docs_url, aptible_config.marketing_root_url + '/docs'
@@ -1,5 +1,5 @@
1
1
  module Aptible
2
2
  module Rails
3
- VERSION = '0.4.9'
3
+ VERSION = '0.4.10'
4
4
  end
5
5
  end
@@ -26,6 +26,19 @@ module Aptible
26
26
  redirect_uri: callback
27
27
  )
28
28
  end
29
+
30
+ def return_to_context_url(local_assigns)
31
+ href = if controller?('apps')
32
+ apps_url
33
+ elsif controller?('databases')
34
+ databases_url
35
+ elsif local_assigns[:compliance_page]
36
+ compliance_url
37
+ else
38
+ dashboard_url
39
+ end
40
+ URI href
41
+ end
29
42
  end
30
43
  end
31
44
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aptible-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.9
4
+ version: 0.4.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Frank Macreery
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-06 00:00:00.000000000 Z
11
+ date: 2014-08-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gem_config
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: '0'
75
+ version: 0.2.3
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: '0'
82
+ version: 0.2.3
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: draper
85
85
  requirement: !ruby/object:Gem::Requirement