summaryrefslogtreecommitdiff
path: root/lib/gitlab/ldap/dn.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/ldap/dn.rb')
-rw-r--r--lib/gitlab/ldap/dn.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/gitlab/ldap/dn.rb b/lib/gitlab/ldap/dn.rb
index 751219b7334..87a7f1c6bc0 100644
--- a/lib/gitlab/ldap/dn.rb
+++ b/lib/gitlab/ldap/dn.rb
@@ -25,6 +25,12 @@ module Gitlab
UnsupportedDnFormatError = Class.new(StandardError)
class DN
+ def self.normalize_value(given_value)
+ dummy_dn = "placeholder=#{given_value}"
+ normalized_dn = new(*dummy_dn).to_normalized_s
+ normalized_dn.sub(/\Aplaceholder=/, '')
+ end
+
##
# Initialize a DN, escaping as required. Pass in attributes in name/value
# pairs. If there is a left over argument, it will be appended to the dn