プロジェクト

全般

プロフィール

Vote #80835

完了

Include an authentication method name in LDAP connection error messages

Admin Redmine さんが4年以上前に追加. 4年以上前に更新.

ステータス:
Closed
優先度:
通常
担当者:
-
カテゴリ:
Accounts / authentication_7
対象バージョン:
開始日:
2022/05/09
期日:
進捗率:

0%

予定工数:
category_id:
7
version_id:
155
issue_org_id:
33345
author_id:
362529
assigned_to_id:
332
comments:
8
status_id:
5
tracker_id:
2
plus1:
0
affected_version:
closed_on:
affected_version_id:
ステータス-->[Closed]

説明

When LDAP cannot be connected for some reason, the following message is displayed.

!{width:600px;border:1px solid #ccc;}before.png!

The error message is displayed as it is, but I don't know if it is a message from LDAP. You can understand that it is an LDAP message by adding a fixed message to the beginning as shown below.

!{width:600px;border:1px solid #ccc;}after.png!


journals

--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
I think that just simply adding the prefix "LDAP" to an error message is better.

<pre>
LDAP: Connection refused - connect(2) for 192.0.2.1:389
</pre>

The reasons are as follows:

* Adding the prefix "LDAP" is enough to understand that there is a problem with communication with the LDAP server
* We don't have to add a new string to the locales
* Redmine may support new auth sources other than LDAP in the future. The following way of using auth_method_name method can be applied for new auth sources

<pre><code class="diff">
diff --git a/app/models/auth_source_ldap.rb b/app/models/auth_source_ldap.rb
index 8ed7ce27f..846c7d2f3 100644
--- a/app/models/auth_source_ldap.rb
+++ b/app/models/auth_source_ldap.rb
@@ -63,7 +63,7 @@ class AuthSourceLdap < AuthSource
end
end
rescue *NETWORK_EXCEPTIONS => e
- raise AuthSourceException.new(e.message)
+ raise AuthSourceException.new("#{auth_method_name}: #{e.message}")
end

# Test the connection to the LDAP
@@ -77,7 +77,7 @@ class AuthSourceLdap < AuthSource
end
end
rescue *NETWORK_EXCEPTIONS => e
- raise AuthSourceException.new(e.message)
+ raise AuthSourceException.new("#{auth_method_name}: #{e.message}")
end

def auth_method_name
@@ -107,7 +107,7 @@ class AuthSourceLdap < AuthSource
end
results
rescue *NETWORK_EXCEPTIONS => e
- raise AuthSourceException.new(e.message)
+ raise AuthSourceException.new("#{auth_method_name}: #{e.message}")
end

def ldap_mode
</code></pre>

--------------------------------------------------------------------------------
Go MAEDA wrote:
> I think that just simply adding the prefix "LDAP" to an error message is better.
>
> [...]
>
> The reasons are as follows:
>
> * Adding the prefix "LDAP" is enough to understand that there is a problem with communication with the LDAP server
> * We don't have to add a new string to the locales
> * Redmine may support new auth sources other than LDAP in the future. The following way of using auth_method_name method can be applied for new auth sources
>
> [...]

I agree. I think a patch will be simple.
--------------------------------------------------------------------------------
Updated the patch using the code posted in #33345#note-3.
--------------------------------------------------------------------------------
Setting the target version to 5.0.0.
--------------------------------------------------------------------------------
Committed the patch. Thank you.
--------------------------------------------------------------------------------

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0