diff options
author | Gabriel Mazetto <gabriel@gitlab.com> | 2016-01-06 10:38:52 +0300 |
---|---|---|
committer | Gabriel Mazetto <gabriel@gitlab.com> | 2016-01-08 21:26:04 +0300 |
commit | ec67e9be1d7486199b47e19c766202a8bfdefe93 (patch) | |
tree | 2499ddcd631bb0935b77d510a6a137ba4b2b1ac4 /app/models | |
parent | d6dc088affeee4568e771e1d7894e0bcdb955af8 (diff) |
Repair ldap_blocked state when no ldap identity exist anymore
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/identity.rb | 4 | ||||
-rw-r--r-- | app/models/user.rb | 1 |
2 files changed, 5 insertions, 0 deletions
diff --git a/app/models/identity.rb b/app/models/identity.rb index 8bcdc194953..830b99fa3f2 100644 --- a/app/models/identity.rb +++ b/app/models/identity.rb @@ -18,4 +18,8 @@ class Identity < ActiveRecord::Base validates :provider, presence: true validates :extern_uid, allow_blank: true, uniqueness: { scope: :provider } validates :user_id, uniqueness: { scope: :provider } + + def is_ldap? + provider.starts_with?('ldap') + end end diff --git a/app/models/user.rb b/app/models/user.rb index 67b47b0f329..5eed9cf91c7 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -196,6 +196,7 @@ class User < ActiveRecord::Base state_machine :state, initial: :active do event :block do transition active: :blocked + transition ldap_blocked: :blocked end event :ldap_block do |