thecore_ui_rails_admin 3.8.10 → 3.8.11
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e23aff5b3ed267cd5b70dba297813ab83042ac0b2caa073247796a735478a2f9
|
|
4
|
+
data.tar.gz: 8f681b552e1b74935815896b1d1cf2ae7a999fd5d594e116f72d80c051936756
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 35aa4f9c09861055a54937330fe4b4776a96bf05b784a55fd42354e73a1b6e04588aebceef3662bc2ee29f8f8e5f520b211d5c521ebf1cecaa550ece98371f93
|
|
7
|
+
data.tar.gz: 566bff6556bd74c64ed153e283c3fcb53a2a47b617075715ee791b479b01cab6139585b92d964b46919a24d6cc35fc31c0f2dc74a011f29afe128cc0881826a9
|
|
@@ -22,7 +22,7 @@ en:
|
|
|
22
22
|
test_ldap_server:
|
|
23
23
|
title: Test LDAP Server
|
|
24
24
|
success: "The LDAP server is reachable"
|
|
25
|
-
error: "The LDAP server
|
|
25
|
+
error: "The LDAP server test failed: %{error}"
|
|
26
26
|
menu: Test LDAP Server
|
|
27
27
|
breadcrumb: Test LDAP Server
|
|
28
28
|
thecore_blazer_bi:
|
|
@@ -22,7 +22,7 @@ it:
|
|
|
22
22
|
test_ldap_server:
|
|
23
23
|
title: Testa il Server LDAP
|
|
24
24
|
success: "Il server LDAP è raggiungibile"
|
|
25
|
-
error: "
|
|
25
|
+
error: "Test del server LDAP fallito: %{error}"
|
|
26
26
|
menu: Testa il Server LDAP
|
|
27
27
|
breadcrumb: Testa il Server LDAP
|
|
28
28
|
thecore_blazer_bi:
|
|
@@ -10,51 +10,62 @@ RailsAdmin::Config::Actions.add_action "test_ldap_server", :base, :member do
|
|
|
10
10
|
# Adding the controller which is needed to compute calls from the ui
|
|
11
11
|
controller do
|
|
12
12
|
proc do
|
|
13
|
+
failed = ->(reason) do
|
|
14
|
+
@status = "danger"
|
|
15
|
+
@message = I18n.t("admin.actions.test_ldap_server.error", error: reason)
|
|
16
|
+
end
|
|
17
|
+
|
|
13
18
|
@ldap = ::LdapServer.find(@object.id)
|
|
14
|
-
|
|
15
|
-
@ldap.test_connection
|
|
16
|
-
@status = "success"
|
|
17
|
-
|
|
18
|
-
@message = I18n.t("admin.actions.test_ldap_server.success")
|
|
19
|
-
|
|
20
|
-
# From the UI the user can test if the ldap server is reachable and receive a response
|
|
21
|
-
if request.xhr? && request.post? && params[:email].present? && params[:password].present?
|
|
22
|
-
Rails.logger.debug("LDAP Test: Attempting to authenticate user #{params[:email]}")
|
|
23
|
-
authenticator = Ldap::Authenticator.new(
|
|
24
|
-
email: params[:email],
|
|
25
|
-
password: params[:password],
|
|
26
|
-
)
|
|
27
|
-
@ldap_user = authenticator.auth_on_single_server(@ldap)
|
|
28
|
-
@ldap_attributes = {}
|
|
29
|
-
|
|
30
|
-
if @ldap_user.present?
|
|
31
|
-
@ldap_user.each_attribute do |key, values|
|
|
32
|
-
safe_values = values.map do |v|
|
|
33
|
-
s = v.to_s
|
|
34
|
-
|
|
35
|
-
# 1. Declare UTF-8
|
|
36
|
-
s.force_encoding("UTF-8")
|
|
37
|
-
|
|
38
|
-
# 2. Replace invalid / undefined bytes
|
|
39
|
-
s.encode!("UTF-8", invalid: :replace, undef: :replace, replace: "�")
|
|
40
|
-
|
|
41
|
-
s
|
|
42
|
-
end
|
|
19
|
+
connection = @ldap.test_connection
|
|
43
20
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
21
|
+
if connection.success?
|
|
22
|
+
@status = "success"
|
|
23
|
+
@message = I18n.t("admin.actions.test_ldap_server.success")
|
|
24
|
+
|
|
25
|
+
# From the UI the user can test a user's credentials too, and see the LDAP answer: only
|
|
26
|
+
# against a server whose own test succeeded.
|
|
27
|
+
if request.xhr? && request.post? && params[:email].present? && params[:password].present?
|
|
28
|
+
begin
|
|
29
|
+
Rails.logger.debug("LDAP Test: Attempting to authenticate user #{params[:email]}")
|
|
30
|
+
authenticator = Ldap::Authenticator.new(
|
|
31
|
+
email: params[:email],
|
|
32
|
+
password: params[:password],
|
|
33
|
+
)
|
|
34
|
+
@ldap_user = authenticator.auth_on_single_server(@ldap)
|
|
35
|
+
@ldap_attributes = {}
|
|
36
|
+
|
|
37
|
+
if @ldap_user.present?
|
|
38
|
+
@ldap_user.each_attribute do |key, values|
|
|
39
|
+
safe_values = values.map do |v|
|
|
40
|
+
s = v.to_s
|
|
47
41
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
42
|
+
# 1. Declare UTF-8
|
|
43
|
+
s.force_encoding("UTF-8")
|
|
44
|
+
|
|
45
|
+
# 2. Replace invalid / undefined bytes
|
|
46
|
+
s.encode!("UTF-8", invalid: :replace, undef: :replace, replace: "�")
|
|
47
|
+
|
|
48
|
+
s
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
@ldap_attributes[key] = safe_values
|
|
52
|
+
end
|
|
53
|
+
Rails.logger.debug("LDAP Test: Authentication result for user #{params[:email]}: #{@ldap_user.inspect}")
|
|
54
|
+
|
|
55
|
+
@message += " " + I18n.t("admin.actions.test_ldap_server.auth_success", email: params[:email])
|
|
56
|
+
else
|
|
57
|
+
@message += " " + I18n.t("admin.actions.test_ldap_server.auth_failure", email: params[:email])
|
|
58
|
+
@status = "warning"
|
|
59
|
+
end
|
|
60
|
+
# Only connection errors are the server's answer (net-ldap raises the bare Errno for a
|
|
61
|
+
# single host it cannot reach); anything else is a real bug.
|
|
62
|
+
rescue Net::LDAP::Error, SystemCallError => e
|
|
63
|
+
failed.call(e.message)
|
|
64
|
+
end
|
|
52
65
|
end
|
|
53
|
-
|
|
54
|
-
#
|
|
55
|
-
|
|
56
|
-
# @status = "danger"
|
|
57
|
-
# end
|
|
66
|
+
else
|
|
67
|
+
# A refused bind, no admin credentials, an unreachable host (LdapServer#test_connection).
|
|
68
|
+
failed.call(connection.message)
|
|
58
69
|
end
|
|
59
70
|
end
|
|
60
71
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: thecore_ui_rails_admin
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.8.
|
|
4
|
+
version: 3.8.11
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Gabriele Tassoni
|
|
@@ -66,6 +66,20 @@ dependencies:
|
|
|
66
66
|
- - ">="
|
|
67
67
|
- !ruby/object:Gem::Version
|
|
68
68
|
version: '3.8'
|
|
69
|
+
- !ruby/object:Gem::Dependency
|
|
70
|
+
name: thecore_auth_commons
|
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
|
72
|
+
requirements:
|
|
73
|
+
- - ">="
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: 3.6.5
|
|
76
|
+
type: :runtime
|
|
77
|
+
prerelease: false
|
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
- - ">="
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: 3.6.5
|
|
69
83
|
description: Holds all base dependencies and configurations to have a thecore integrated
|
|
70
84
|
with Rails Admin.
|
|
71
85
|
email:
|