heimdall_auth 1.3.0 → 1.4.0

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
  SHA256:
3
- metadata.gz: 4274ae024aaafdfed06a07d367a84d6791c3371fea392642ee0472925b52805c
4
- data.tar.gz: 2ceea6e5acb7a85c18c126e81c44613a924b4698e7c11e087e28faf514db1059
3
+ metadata.gz: 5538f6cfc7a18364ba8f0212ccef6666ddc54aedecb5e98431ab696ae00201ad
4
+ data.tar.gz: fe36860b89bb61c225be5204f4522d77d96a87cf07ec9b05c9694f4333780383
5
5
  SHA512:
6
- metadata.gz: a5da2bbf6ea4141f3461ddd4ac57cff7deda52ac2af2abf38fe3ccadae8700e8e1efb3e217f1917945962e6f4093aee25ab6014802507f414a0047ff98bc1ab4
7
- data.tar.gz: 206d5df045f59a22bc9739024bf19d75334f1ee21f814db019eccdbcd1989f4163ec2838312962e354b5c0ba6fbfae73b0cfa8fb818cfb88489902286b68fa95
6
+ metadata.gz: ea5fc9d268377f56cc01eb8a00339331430f417181394b453d0350b146f2af14eea8d6a8f99e1fbe6048bd24d02a9bac357d67328c2a5d0f245fdf28349c97b8
7
+ data.tar.gz: 3a05fcd17f9ab05663de6761468b11b83c0be6b748f1a2b83011a02e272d9d807c015095d756908e858bfec2edc343e7993154c89ff3e7b25bccae6f0533e2c0
@@ -7,7 +7,7 @@ module HeimdallAuth
7
7
  module ControllerAdditions
8
8
 
9
9
  def self.included(base)
10
- base.helper_method :current_user, :current_access_token, :user_signed_in? if base.respond_to? :helper_method
10
+ base.helper_method :current_user, :current_access_token, :current_environment, :user_signed_in? if base.respond_to? :helper_method
11
11
  base.before_action :store_location_in_session
12
12
 
13
13
  base.rescue_from CanCan::AccessDenied do |exception|
@@ -57,6 +57,14 @@ module HeimdallAuth
57
57
  end
58
58
  end
59
59
 
60
+ def current_environment
61
+ begin
62
+ @current_environment ||= current_user.key_environment || params[:environment]
63
+ rescue NoMethodError, Exception => e
64
+ nil
65
+ end
66
+ end
67
+
60
68
  def get_user_from_auth_server(access_token)
61
69
  client = OAuth2::Client.new(ENV['HEIMDALL_APPLICATION_ID'], ENV['HEIMDALL_APPLICATION_SECRET'], :site => ENV['HEIMDALL_SERVER_URL'])
62
70
  user_data = OAuth2::AccessToken.new(client,access_token).get('/me.json').parsed
@@ -3,7 +3,7 @@ class HeimdallAuth::User
3
3
  extend ActiveModel::Naming
4
4
 
5
5
  attr_accessor :is_invalid
6
- attr_accessor :id, :name, :email, :is_editor, :is_operator, :is_admin, :is_user_admin, :is_police, :is_ride_on_demand_provider, :is_ride_on_demand_accounting
6
+ attr_accessor :id, :name, :key_type, :key_environment, :email, :is_editor, :is_operator, :is_admin, :is_user_admin, :is_police, :is_ride_on_demand_provider, :is_ride_on_demand_accounting
7
7
 
8
8
  def initialize(attributes = {})
9
9
  attributes.each do |name, value|
@@ -1,3 +1,3 @@
1
1
  module HeimdallAuth
2
- VERSION = '1.3.0'
2
+ VERSION = '1.4.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: heimdall_auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - René Meye
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-04-08 00:00:00.000000000 Z
11
+ date: 2022-08-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails