Refactor: beter naming for active directory disabled users

parent 26b14dd2
...@@ -28,7 +28,7 @@ module Gitlab ...@@ -28,7 +28,7 @@ module Gitlab
def allowed?(user) def allowed?(user)
if Gitlab::LDAP::Person.find_by_dn(user.extern_uid, adapter) 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 else
false false
end end
......
...@@ -16,7 +16,7 @@ module Gitlab ...@@ -16,7 +16,7 @@ module Gitlab
adapter.user('dn', dn) adapter.user('dn', dn)
end end
def self.active_directory_disabled?(dn, adapter=nil) def self.disabled_via_active_directory?(dn, adapter=nil)
adapter ||= Gitlab::LDAP::Adapter.new adapter ||= Gitlab::LDAP::Adapter.new
adapter.dn_matches_filter?(dn, AD_USER_DISABLED) adapter.dn_matches_filter?(dn, AD_USER_DISABLED)
end end
......
...@@ -16,14 +16,14 @@ describe Gitlab::LDAP::Access do ...@@ -16,14 +16,14 @@ describe Gitlab::LDAP::Access do
context 'when the user is found' do context 'when the user is found' do
before { Gitlab::LDAP::Person.stub(find_by_dn: :ldap_user) } before { Gitlab::LDAP::Person.stub(find_by_dn: :ldap_user) }
context 'and the Active Directory disabled flag is set' do context 'and the user is diabled via active directory' do
before { Gitlab::LDAP::Person.stub(active_directory_disabled?: true) } before { Gitlab::LDAP::Person.stub(disabled_via_active_directory?: true) }
it { should be_false } it { should be_false }
end end
context 'and the Active Directory disabled flag is not set' do context 'and has no disabled flag in active diretory' do
before { Gitlab::LDAP::Person.stub(active_directory_disabled?: false) } before { Gitlab::LDAP::Person.stub(disabled_via_active_directory?: false) }
it { should be_true } it { should be_true }
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment