fixed LDAP activation on login to use new ldap_blocked state

This commit is contained in:
Gabriel Mazetto 2016-01-14 03:31:27 -02:00
parent fc7e6e8ffc
commit dd6fc01ff8
3 changed files with 4 additions and 6 deletions

View file

@ -205,6 +205,7 @@ class User < ActiveRecord::Base
event :activate do
transition blocked: :active
transition ldap_blocked: :active
end
state :blocked, :ldap_blocked do

View file

@ -40,9 +40,7 @@ module Gitlab
user.ldap_block
false
else
if (user.blocked? && !ldap_config.block_auto_created_users) || user.ldap_blocked?
user.activate
end
user.activate if user.ldap_blocked?
true
end
else

View file

@ -42,7 +42,6 @@ describe Gitlab::LDAP::Access, lib: true do
context 'and has no disabled flag in active diretory' do
before do
user.block
allow(Gitlab::LDAP::Person).to receive(:disabled_via_active_directory?).and_return(false)
end
@ -50,7 +49,7 @@ describe Gitlab::LDAP::Access, lib: true do
context 'when auto-created users are blocked' do
before do
allow_any_instance_of(Gitlab::LDAP::Config).to receive(:block_auto_created_users).and_return(true)
user.block
end
it 'does not unblock user in GitLab' do
@ -62,7 +61,7 @@ describe Gitlab::LDAP::Access, lib: true do
context 'when auto-created users are not blocked' do
before do
allow_any_instance_of(Gitlab::LDAP::Config).to receive(:block_auto_created_users).and_return(false)
user.ldap_block
end
it 'should unblock user in GitLab' do