kadmin 1.0.3 → 1.0.4
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 +4 -4
- data/app/views/layouts/kadmin/application.html.erb +1 -1
- data/lib/kadmin/auth/user_store.rb +28 -19
- data/lib/kadmin/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b3aa3a7daa8c814970c094dc05160e8d8fa64abd57141bc784078e4022802c34
|
4
|
+
data.tar.gz: 754a7866c1f92826a4f3ddf194a1bf368524b3815fc5837369fe8f304afd3817
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9e740d139e1adf2a4484abf74f098e6862a23b544a4bd29d4ae45e139c2d9382498c0e9688469e0a616cb520f318926fe253ea40122d870ace04c2cc5d55a4ac
|
7
|
+
data.tar.gz: b12534a69b80d530b9a604e2f00fb776c869b95e3cecd3b693a28c765d5c5cb28a896c05490d530179d9aa43179f7fc996a4e0666ba05be105d51a4292c10598
|
@@ -22,7 +22,7 @@
|
|
22
22
|
<div class="header-block header-block-nav">
|
23
23
|
<ul class="nav-profile">
|
24
24
|
<% if logged_in? %>
|
25
|
-
<li><%= authorized_user.organization %></li>
|
25
|
+
<li style="padding-right: 10px;"><%= authorized_user.organization %></li>
|
26
26
|
<li><%= link_to(t('kadmin.authorization.logout'), Kadmin::Engine.routes.url_helpers.auth_logout_path) %></li>
|
27
27
|
<% end %>
|
28
28
|
</ul>
|
@@ -1,9 +1,17 @@
|
|
1
1
|
module Kadmin
|
2
2
|
module Auth
|
3
3
|
class UserStore
|
4
|
-
def initialize
|
4
|
+
def initialize(path = nil)
|
5
5
|
@store = {}
|
6
|
-
|
6
|
+
|
7
|
+
path ||= Rails.root.join('config', 'admin_users.yml')
|
8
|
+
if File.exist?(path) && File.readable?(path)
|
9
|
+
definitions = YAML.load_file(path.to_s)
|
10
|
+
create_organizations(definitions['organizations'])
|
11
|
+
load_users(definitions['users'])
|
12
|
+
else
|
13
|
+
Rails.logger.warn("Can't read admin users auth file at #{file}. Auth might not work")
|
14
|
+
end
|
7
15
|
end
|
8
16
|
|
9
17
|
def get(email)
|
@@ -18,25 +26,26 @@ module Kadmin
|
|
18
26
|
@store.key?(email.to_s.downcase)
|
19
27
|
end
|
20
28
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
29
|
+
private
|
30
|
+
|
31
|
+
def load_users(users)
|
32
|
+
users.each do |user|
|
33
|
+
email = user['email']
|
34
|
+
options = {
|
35
|
+
admin: user.fetch('admin', false),
|
36
|
+
accept: Array.wrap(user.fetch('accept', [])).map(&:to_sym),
|
37
|
+
organization: user.fetch('organization', 'offerista') # default organization, needs to exist in DB
|
38
|
+
}
|
39
|
+
|
40
|
+
set(email, Kadmin::Auth.config.user_class.new(email, **options))
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def create_organizations(organizations)
|
45
|
+
organizations.each do |organization|
|
46
|
+
Kadmin::Organization.find_or_create_by(name: organization)
|
37
47
|
end
|
38
48
|
end
|
39
|
-
private :load_users!
|
40
49
|
end
|
41
50
|
end
|
42
51
|
end
|
data/lib/kadmin/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kadmin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nicolas Pepin-Perreault
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2018-
|
13
|
+
date: 2018-11-08 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|
@@ -196,7 +196,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
196
196
|
version: '0'
|
197
197
|
requirements: []
|
198
198
|
rubyforge_project:
|
199
|
-
rubygems_version: 2.7.
|
199
|
+
rubygems_version: 2.7.8
|
200
200
|
signing_key:
|
201
201
|
specification_version: 4
|
202
202
|
summary: Collection of utility, configuration, etc., for admin areas
|