Commit ac6a10f3 authored by Gabriel Mazetto's avatar Gabriel Mazetto

Codestyle changes

parent 47e4613f
......@@ -19,7 +19,7 @@ class Identity < ActiveRecord::Base
validates :extern_uid, allow_blank: true, uniqueness: { scope: :provider }
validates :user_id, uniqueness: { scope: :provider }
def is_ldap?
def ldap?
provider.starts_with?('ldap')
end
end
......@@ -303,10 +303,10 @@ module API
if !user
not_found!('User')
elsif !user.ldap_blocked?
user.activate
else
elsif user.ldap_blocked?
forbidden!('LDAP blocked users cannot be unblocked by the API')
else
user.activate
end
end
end
......
......@@ -28,11 +28,11 @@ RSpec.describe Identity, models: true do
let(:other_identity) { create(:identity, provider: 'twitter') }
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
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
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