diff options
author | Michael Kozono <mkozono@gmail.com> | 2017-10-06 10:57:00 -0700 |
---|---|---|
committer | Michael Kozono <mkozono@gmail.com> | 2017-10-07 10:28:13 -0700 |
commit | ac5784368fb23260abd4050a48c4443017c87bfc (patch) | |
tree | d92592ad8dd99e7561f9bed185435ed8d5ab7dab | |
parent | 2df7d03586dbe9daa883ccd660d77d7522df29f8 (diff) | |
download | gitlab-ce-ac5784368fb23260abd4050a48c4443017c87bfc.tar.gz |
Sync up hard coded DN class in migrationmk-normalize-ldap-user-dns
-rw-r--r-- | lib/gitlab/background_migration/normalize_ldap_extern_uids_range.rb | 48 |
1 files changed, 28 insertions, 20 deletions
diff --git a/lib/gitlab/background_migration/normalize_ldap_extern_uids_range.rb b/lib/gitlab/background_migration/normalize_ldap_extern_uids_range.rb index cf7eafcff3b..bc53e6d7f94 100644 --- a/lib/gitlab/background_migration/normalize_ldap_extern_uids_range.rb +++ b/lib/gitlab/background_migration/normalize_ldap_extern_uids_range.rb @@ -37,26 +37,6 @@ module Gitlab end end - def initialize_array(args) - buffer = StringIO.new - - args.each_with_index do |arg, index| - if index.even? # key - buffer << "," if index > 0 - buffer << arg - else # value - buffer << "=" - buffer << self.class.escape(arg) - end - end - - @dn = buffer.string - end - - def initialize_string(arg) - @dn = arg.to_s - end - ## # Parse a DN into key value pairs using ASN from # http://tools.ietf.org/html/rfc2253 section 3. @@ -270,6 +250,28 @@ module Gitlab escaped.gsub(HEX_ESCAPE_RE) { |char| HEX_ESCAPES[char] } end + private + + def initialize_array(args) + buffer = StringIO.new + + args.each_with_index do |arg, index| + if index.even? # key + buffer << "," if index > 0 + buffer << arg + else # value + buffer << "=" + buffer << self.class.escape(arg) + end + end + + @dn = buffer.string + end + + def initialize_string(arg) + @dn = arg.to_s + end + ## # Proxy all other requests to the string object, because a DN is mainly # used within the library as a string @@ -277,6 +279,12 @@ module Gitlab def method_missing(method, *args, &block) @dn.send(method, *args, &block) end + + ## + # Redefined to be consistent with redefined `method_missing` behavior + def respond_to?(sym, include_private = false) + @dn.respond_to?(sym, include_private) + end end end end |