heimdall_auth 1.0.2 → 1.2.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: 38c8a1d42dee07871a173a5650c27547fc0e741dec4a3aa2a7262ad7c81e9f63
4
- data.tar.gz: 182f9c31850c850569ee0477d5589a7446243dee605ea3abf26a069ed8557b94
3
+ metadata.gz: 742947664e984d95bc5826204abc96c26772675b25454ec2969381981ebff693
4
+ data.tar.gz: cc454c59ae75aa688d1326c8b86d84123836e8fdeefd6f18426827361f7ec9a4
5
5
  SHA512:
6
- metadata.gz: 49a1700dc3c154529d0d65ddaacac93c3df1a696f97cce34eadcd8b220c00d40f016655b6dff441a0ec7a55b074a2aa6a9cf0919ee3abe712b3f710ea9574ab6
7
- data.tar.gz: 6d4e265c5a581cd1f83b22caea787144f3fca7d570978666aceeac375371b03dfb7b5161a3399191d3ca261489414f5939c8bb10abf325f7982cae0eae8a1f18
6
+ metadata.gz: 8f1f5f7e585eb8df02c7b8401d28e339d5dc04798f7381d132be8abebc850df9bc0a198a656ac2921389a6b6d3f4316d585f0aa97e4b08f322c4484c748efd66
7
+ data.tar.gz: 7f37c2d5d077dd2a600b8c023bbb5f4e1e8ddf2f271a4ae7867099a089978de7d6f25f23ebdda02e44f8c26faadde94ef18e0b61fce206dd6206f0287351a713
data/README.md CHANGED
@@ -2,6 +2,9 @@
2
2
  This makes it easy to equip an empty rails application with our Heimdall Auth features.
3
3
 
4
4
  ## Installation and Usage
5
+
6
+ Example: https://gitlab.vesputi.com/netzmap/nanna
7
+
5
8
  0) Commit the empty rails application (and mention the command you used for generating the app)
6
9
 
7
10
  1) Add this line to your application's Gemfile:
@@ -17,6 +20,7 @@ rails puma_dev:link
17
20
  rails generate heimdall_auth:install
18
21
  rails heimdall:register -- -u"rene@vesputi.com" -p"HeimdallPassword" >> .env
19
22
  bundle install
23
+ killall puma-dev
20
24
  ```
21
25
 
22
26
  3) And please commit directly after executing the lines above so you have clean history
@@ -66,3 +70,13 @@ Parameters:
66
70
  -h"https://heimdall.vesp" (Optional) - Protocol and Domain the heimdall is found at
67
71
  -s"https://foo.vesputi-abc.de" # (Optional) - Protocol and Domain the Service is found at
68
72
  ```
73
+
74
+ ## RSpec
75
+ If you want to test your Applications controller than you have to give it a User
76
+ You do so by mocking `current_user` in ApplicationController
77
+
78
+ ```
79
+ RSpec.describe "/foobar", type: :request do
80
+ before { allow_any_instance_of(ApplicationController).to receive(:current_user) { HeimdallAuth::User.new(is_editor: true) } }
81
+ end
82
+ ```
@@ -8,8 +8,16 @@ module HeimdallAuth
8
8
  # Load ENV variables from .env file development and test
9
9
  gem 'dotenv-rails'
10
10
  end
11
+ end
12
+
13
+ def create_example_file
14
+ copy_file "dot-env.example", ".env.example"
15
+ end
11
16
 
12
- copy_file ".env.example", ".env.example"
17
+ def ignore_dot_env_file
18
+ inject_into_file '.gitignore', after: "/.bundle\n" do
19
+ "/.env\n"
20
+ end
13
21
  end
14
22
  end
15
23
  end
@@ -0,0 +1,3 @@
1
+ HEIMDALL_SERVER_URL=https://heimdall.vesputi-abc.de/
2
+ HEIMDALL_APPLICATION_ID=foo
3
+ HEIMDALL_APPLICATION_SECRET=bar
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+ require "cancancan"
2
3
 
3
4
  module HeimdallAuth
4
5
  # This module is automatically included into all controllers.
@@ -34,7 +35,7 @@ module HeimdallAuth
34
35
 
35
36
  def store_location_in_session
36
37
  session[:last_url] = request.url if storable_location?
37
- logger.info("\033[32m session[:last_url] = #{session[:last_url]} \033[0m")
38
+ ::Rails.logger.info("\033[32m session[:last_url] = #{session[:last_url]} \033[0m")
38
39
  end
39
40
 
40
41
  def storable_location?
@@ -70,6 +71,7 @@ end
70
71
 
71
72
  if defined? ActiveSupport
72
73
  ActiveSupport.on_load(:action_controller) do
74
+ include CanCan::ControllerAdditions
73
75
  include HeimdallAuth::ControllerAdditions
74
76
  end
75
77
  end
@@ -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
6
+ attr_accessor :id, :name, :email, :is_editor, :is_operator, :is_admin, :is_user_admin, :is_police, :is_ride_on_demand_provider
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.0.2'
2
+ VERSION = '1.2.0'
3
3
  end
@@ -2,7 +2,7 @@ namespace :puma_dev do
2
2
  desc 'Fast linking to puma dev'
3
3
  task :link do
4
4
 
5
- application_name = Rails.application.class.parent_name
5
+ application_name = Rails.application.class.try(:parent_name) || Rails.application.class.try(:module_parent_name)
6
6
  puma_dev_app_name = "#{application_name.underscore.dasherize}.vesputi-abc"
7
7
  command = "ln -s #{Rails.root} ~/.puma-dev/#{puma_dev_app_name}"
8
8
 
@@ -7,7 +7,7 @@ namespace :heimdall do
7
7
  desc 'Register application at a Heimdall Application'
8
8
  task :register do
9
9
 
10
- application_name = Rails.application.class.parent_name
10
+ application_name = Rails.application.class.try(:parent_name) || Rails.application.class.try(:module_parent_name)
11
11
 
12
12
  options = {
13
13
  application_name: application_name,
metadata CHANGED
@@ -1,29 +1,35 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: heimdall_auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - René Meye
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-12-24 00:00:00.000000000 Z
11
+ date: 2021-07-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '5.0'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '7.0'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - "~>"
27
+ - - ">="
25
28
  - !ruby/object:Gem::Version
26
29
  version: '5.0'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '7.0'
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: omniauth
29
35
  requirement: !ruby/object:Gem::Requirement
@@ -42,44 +48,44 @@ dependencies:
42
48
  name: omniauth-oauth2
43
49
  requirement: !ruby/object:Gem::Requirement
44
50
  requirements:
45
- - - ">="
51
+ - - "~>"
46
52
  - !ruby/object:Gem::Version
47
- version: '0'
53
+ version: 1.6.0
48
54
  type: :runtime
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
51
57
  requirements:
52
- - - ">="
58
+ - - "~>"
53
59
  - !ruby/object:Gem::Version
54
- version: '0'
60
+ version: 1.6.0
55
61
  - !ruby/object:Gem::Dependency
56
62
  name: cancancan
57
63
  requirement: !ruby/object:Gem::Requirement
58
64
  requirements:
59
- - - ">="
65
+ - - "~>"
60
66
  - !ruby/object:Gem::Version
61
- version: '0'
67
+ version: 3.0.1
62
68
  type: :runtime
63
69
  prerelease: false
64
70
  version_requirements: !ruby/object:Gem::Requirement
65
71
  requirements:
66
- - - ">="
72
+ - - "~>"
67
73
  - !ruby/object:Gem::Version
68
- version: '0'
74
+ version: 3.0.1
69
75
  - !ruby/object:Gem::Dependency
70
76
  name: sqlite3
71
77
  requirement: !ruby/object:Gem::Requirement
72
78
  requirements:
73
- - - ">="
79
+ - - "~>"
74
80
  - !ruby/object:Gem::Version
75
- version: '0'
81
+ version: 1.4.1
76
82
  type: :development
77
83
  prerelease: false
78
84
  version_requirements: !ruby/object:Gem::Requirement
79
85
  requirements:
80
- - - ">="
86
+ - - "~>"
81
87
  - !ruby/object:Gem::Version
82
- version: '0'
88
+ version: 1.4.1
83
89
  description: Description of HeimdallAuth.
84
90
  email:
85
91
  - rene@vesputi.com
@@ -94,6 +100,7 @@ files:
94
100
  - lib/generators/heimdall_auth/cancan/cancan_generator.rb
95
101
  - lib/generators/heimdall_auth/cancan/templates/ability.rb
96
102
  - lib/generators/heimdall_auth/dotenv/dotenv_generator.rb
103
+ - lib/generators/heimdall_auth/dotenv/templates/dot-env.example
97
104
  - lib/generators/heimdall_auth/install/install_generator.rb
98
105
  - lib/generators/heimdall_auth/sessions/sessions_generator.rb
99
106
  - lib/generators/heimdall_auth/standard_pages/standard_pages_generator.rb
@@ -115,7 +122,7 @@ homepage: https://vesputi.com
115
122
  licenses:
116
123
  - MIT
117
124
  metadata: {}
118
- post_install_message:
125
+ post_install_message:
119
126
  rdoc_options: []
120
127
  require_paths:
121
128
  - lib
@@ -130,8 +137,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
130
137
  - !ruby/object:Gem::Version
131
138
  version: '0'
132
139
  requirements: []
133
- rubygems_version: 3.0.3
134
- signing_key:
140
+ rubygems_version: 3.1.6
141
+ signing_key:
135
142
  specification_version: 4
136
143
  summary: Summary of HeimdallAuth.
137
144
  test_files: []