heimdall_auth 1.3.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/heimdall_auth/controller_additions.rb +9 -1
- data/lib/heimdall_auth/user.rb +1 -1
- data/lib/heimdall_auth/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5538f6cfc7a18364ba8f0212ccef6666ddc54aedecb5e98431ab696ae00201ad
|
4
|
+
data.tar.gz: fe36860b89bb61c225be5204f4522d77d96a87cf07ec9b05c9694f4333780383
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/lib/heimdall_auth/user.rb
CHANGED
@@ -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|
|
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.
|
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-
|
11
|
+
date: 2022-08-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|