gentoo-overlay/www-apps/gitlabhq/files/gitlabhq-7.0.0-ldap-custom-mapping.patch

84 lines
2.6 KiB
Diff

diff --git a/Gemfile b/Gemfile
index de4217b..8723eda 100644
--- a/Gemfile
+++ b/Gemfile
@@ -39,7 +39,8 @@ gem "gitlab_git", '~> 6.0'
gem 'gitlab-grack', '~> 2.0.0.pre', require: 'grack'
# LDAP Auth
-gem 'gitlab_omniauth-ldap', '1.0.4', require: "omniauth-ldap"
+# Patched for attributes mapping customization
+gem 'gitlab_omniauth-ldap', '1.0.4', require: 'omniauth-ldap', git: 'https://github.com/jirutka/omniauth-ldap.git', ref: 'b55852bfc9b46ecf790a2c5526386702350eab89'
# Git Wiki
gem 'gollum-lib', '~> 3.0.0'
diff --git a/Gemfile.lock b/Gemfile.lock
index 68c8f41..225089f 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -5,6 +5,17 @@ GIT
specs:
charlock_holmes (0.6.9.4)
+GIT
+ remote: https://github.com/jirutka/omniauth-ldap.git
+ revision: b55852bfc9b46ecf790a2c5526386702350eab89
+ ref: b55852bfc9b46ecf790a2c5526386702350eab89
+ specs:
+ gitlab_omniauth-ldap (1.0.4)
+ net-ldap (~> 0.3.1)
+ omniauth (~> 1.0)
+ pyu-ruby-sasl (~> 0.0.3.1)
+ rubyntlm (~> 0.1.1)
+
GEM
remote: https://rubygems.org/
specs:
@@ -188,11 +199,6 @@ GEM
gitlab-linguist (~> 3.0)
rugged (~> 0.19.0)
gitlab_meta (7.0)
- gitlab_omniauth-ldap (1.0.4)
- net-ldap (~> 0.3.1)
- omniauth (~> 1.0)
- pyu-ruby-sasl (~> 0.0.3.1)
- rubyntlm (~> 0.1.1)
gollum-lib (3.0.0)
github-markup (~> 1.1.0)
gitlab-grit (~> 2.6.5)
@@ -609,7 +615,7 @@ DEPENDENCIES
gitlab_emoji (~> 0.0.1.1)
gitlab_git (~> 6.0)
gitlab_meta (= 7.0)
- gitlab_omniauth-ldap (= 1.0.4)
+ gitlab_omniauth-ldap (= 1.0.4)!
gollum-lib (~> 3.0.0)
gon (~> 5.0.0)
grape (~> 0.6.1)
diff --git a/config/gitlab.yml.example b/config/gitlab.yml.example
index 806984e..b2b8f56 100644
--- a/config/gitlab.yml.example
+++ b/config/gitlab.yml.example
@@ -132,6 +132,10 @@ production: &base
method: 'ssl' # "tls" or "ssl" or "plain"
bind_dn: '_the_full_dn_of_the_user_you_will_bind_with'
password: '_the_password_of_the_bind_user'
+ mapping:
+ username: 'uid'
+ name: 'cn'
+ email: 'mail'
# If allow_username_or_email_login is enabled, GitLab will ignore everything
# after the first '@' in the LDAP username submitted by the user on login.
#
diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb
index 50669ec..881081b 100644
--- a/config/initializers/devise.rb
+++ b/config/initializers/devise.rb
@@ -223,6 +223,7 @@ Devise.setup do |config|
method: Gitlab.config.ldap['method'],
bind_dn: Gitlab.config.ldap['bind_dn'],
password: Gitlab.config.ldap['password'],
+ mapping: Gitlab.config.ldap['mapping'],
name_proc: email_stripping_proc
end