mirror of
https://github.com/wahyd4/gitlabhq.git
synced 2026-08-18 00:56:41 +10:00
fixed LDAP activation on login to use new ldap_blocked state
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user