Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-09-03 14:52:40 +0400
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-09-03 14:52:40 +0400
commit596bf4c2a59434c35eabd2336e249ebc3eb03f56 (patch)
treeab440378cc41e7581f3c5b57a9034f369bfc6c2b /lib/gitlab
parent00ccaed029efbbdff96a4b64628a3a2d9bf5125d (diff)
parentc0323b40ee5633f2808f52f98bde0509a2f3ee59 (diff)
Merge branch 'feaure-ldap-oauth-tests'
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> Conflicts: spec/lib/gitlab/oauth/user_spec.rb
Diffstat (limited to 'lib/gitlab')
-rw-r--r--lib/gitlab/ldap/access.rb2
-rw-r--r--lib/gitlab/ldap/person.rb2
-rw-r--r--lib/gitlab/ldap/user.rb4
-rw-r--r--lib/gitlab/oauth/user.rb5
4 files changed, 4 insertions, 9 deletions
diff --git a/lib/gitlab/ldap/access.rb b/lib/gitlab/ldap/access.rb
index 62709a12942..c054b6f5865 100644
--- a/lib/gitlab/ldap/access.rb
+++ b/lib/gitlab/ldap/access.rb
@@ -28,7 +28,7 @@ module Gitlab
def allowed?(user)
if Gitlab::LDAP::Person.find_by_dn(user.extern_uid, adapter)
- !Gitlab::LDAP::Person.active_directory_disabled?(user.extern_uid, adapter)
+ !Gitlab::LDAP::Person.disabled_via_active_directory?(user.extern_uid, adapter)
else
false
end
diff --git a/lib/gitlab/ldap/person.rb b/lib/gitlab/ldap/person.rb
index 9ad6618bd46..87c3d711db4 100644
--- a/lib/gitlab/ldap/person.rb
+++ b/lib/gitlab/ldap/person.rb
@@ -16,7 +16,7 @@ module Gitlab
adapter.user('dn', dn)
end
- def self.active_directory_disabled?(dn, adapter=nil)
+ def self.disabled_via_active_directory?(dn, adapter=nil)
adapter ||= Gitlab::LDAP::Adapter.new
adapter.dn_matches_filter?(dn, AD_USER_DISABLED)
end
diff --git a/lib/gitlab/ldap/user.rb b/lib/gitlab/ldap/user.rb
index 79aa145d871..e6aa3890992 100644
--- a/lib/gitlab/ldap/user.rb
+++ b/lib/gitlab/ldap/user.rb
@@ -77,10 +77,6 @@ module Gitlab
model.where("provider = ? and lower(extern_uid) = ?", provider, uid.downcase).last
end
- def username
- auth.info.nickname.to_s.force_encoding("utf-8")
- end
-
def provider
'ldap'
end
diff --git a/lib/gitlab/oauth/user.rb b/lib/gitlab/oauth/user.rb
index a252895493b..9670aad2c5d 100644
--- a/lib/gitlab/oauth/user.rb
+++ b/lib/gitlab/oauth/user.rb
@@ -67,9 +67,7 @@ module Gitlab
end
def uid
- uid = auth.info.uid || auth.uid
- uid = uid.to_s unless uid.nil?
- uid
+ auth.uid.to_s
end
def email
@@ -86,6 +84,7 @@ module Gitlab
end
def username
+ return unless auth.info.respond_to?(:nickname)
auth.info.nickname.to_s.force_encoding("utf-8")
end