Commit d2eb5bbd authored by Bob Van Landuyt's avatar Bob Van Landuyt

Fix setting `last_credential_check` on LDAP-login

parent 08ad0af4
...@@ -16,7 +16,7 @@ module Gitlab ...@@ -16,7 +16,7 @@ module Gitlab
def self.allowed?(user) def self.allowed?(user)
self.open(user) do |access| self.open(user) do |access|
if access.allowed? if access.allowed?
Users::UpdateService.new(user, last_credential_check_a: Time.now).execute Users::UpdateService.new(user, last_credential_check_at: Time.now).execute
true true
else else
......
...@@ -4,6 +4,16 @@ describe Gitlab::LDAP::Access, lib: true do ...@@ -4,6 +4,16 @@ describe Gitlab::LDAP::Access, lib: true do
let(:access) { Gitlab::LDAP::Access.new user } let(:access) { Gitlab::LDAP::Access.new user }
let(:user) { create(:omniauth_user) } let(:user) { create(:omniauth_user) }
describe '.allowed?' do
it 'updates the users `last_credential_check_at' do
expect(access).to receive(:allowed?) { true }
expect(described_class).to receive(:open).and_yield(access)
expect { described_class.allowed?(user) }
.to change { user.last_credential_check_at }
end
end
describe '#allowed?' do describe '#allowed?' do
subject { access.allowed? } subject { access.allowed? }
......
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