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 ...@@ -205,6 +205,7 @@ class User < ActiveRecord::Base
event :activate do event :activate do
transition blocked: :active transition blocked: :active
transition ldap_blocked: :active
end end
state :blocked, :ldap_blocked do state :blocked, :ldap_blocked do
......
...@@ -40,9 +40,7 @@ module Gitlab ...@@ -40,9 +40,7 @@ module Gitlab
user.ldap_block user.ldap_block
false false
else else
if (user.blocked? && !ldap_config.block_auto_created_users) || user.ldap_blocked? user.activate if user.ldap_blocked?
user.activate
end
true true
end end
else else
......
...@@ -42,7 +42,6 @@ describe Gitlab::LDAP::Access, lib: true do ...@@ -42,7 +42,6 @@ describe Gitlab::LDAP::Access, lib: true do
context 'and has no disabled flag in active diretory' do context 'and has no disabled flag in active diretory' do
before do before do
user.block
allow(Gitlab::LDAP::Person).to receive(:disabled_via_active_directory?).and_return(false) allow(Gitlab::LDAP::Person).to receive(:disabled_via_active_directory?).and_return(false)
end end
...@@ -50,7 +49,7 @@ describe Gitlab::LDAP::Access, lib: true do ...@@ -50,7 +49,7 @@ describe Gitlab::LDAP::Access, lib: true do
context 'when auto-created users are blocked' do context 'when auto-created users are blocked' do
before do before do
allow_any_instance_of(Gitlab::LDAP::Config).to receive(:block_auto_created_users).and_return(true) user.block
end end
it 'does not unblock user in GitLab' do it 'does not unblock user in GitLab' do
...@@ -62,7 +61,7 @@ describe Gitlab::LDAP::Access, lib: true do ...@@ -62,7 +61,7 @@ describe Gitlab::LDAP::Access, lib: true do
context 'when auto-created users are not blocked' do context 'when auto-created users are not blocked' do
before do before do
allow_any_instance_of(Gitlab::LDAP::Config).to receive(:block_auto_created_users).and_return(false) user.ldap_block
end end
it 'should unblock user in GitLab' do 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