Commit dd6fc01f authored by Gabriel Mazetto's avatar Gabriel Mazetto

fixed LDAP activation on login to use new ldap_blocked state

parent fc7e6e8f
......@@ -205,6 +205,7 @@ class User < ActiveRecord::Base
event :activate do
transition blocked: :active
transition ldap_blocked: :active
end
state :blocked, :ldap_blocked do
......
......@@ -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
......
......@@ -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
......
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