Codestyle changes
This commit is contained in:
parent
47e4613f4a
commit
ac6a10f3e8
|
|
@ -19,7 +19,7 @@ class Identity < ActiveRecord::Base
|
||||||
validates :extern_uid, allow_blank: true, uniqueness: { scope: :provider }
|
validates :extern_uid, allow_blank: true, uniqueness: { scope: :provider }
|
||||||
validates :user_id, uniqueness: { scope: :provider }
|
validates :user_id, uniqueness: { scope: :provider }
|
||||||
|
|
||||||
def is_ldap?
|
def ldap?
|
||||||
provider.starts_with?('ldap')
|
provider.starts_with?('ldap')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -303,10 +303,10 @@ module API
|
||||||
|
|
||||||
if !user
|
if !user
|
||||||
not_found!('User')
|
not_found!('User')
|
||||||
elsif !user.ldap_blocked?
|
elsif user.ldap_blocked?
|
||||||
user.activate
|
|
||||||
else
|
|
||||||
forbidden!('LDAP blocked users cannot be unblocked by the API')
|
forbidden!('LDAP blocked users cannot be unblocked by the API')
|
||||||
|
else
|
||||||
|
user.activate
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -28,11 +28,11 @@ RSpec.describe Identity, models: true do
|
||||||
let(:other_identity) { create(:identity, provider: 'twitter') }
|
let(:other_identity) { create(:identity, provider: 'twitter') }
|
||||||
|
|
||||||
it 'returns true if it is a ldap identity' do
|
it 'returns true if it is a ldap identity' do
|
||||||
expect(ldap_identity.is_ldap?).to be_truthy
|
expect(ldap_identity.ldap?).to be_truthy
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'returns false if it is not a ldap identity' do
|
it 'returns false if it is not a ldap identity' do
|
||||||
expect(other_identity.is_ldap?).to be_falsey
|
expect(other_identity.ldap?).to be_falsey
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue