Merge branch '24921-hide-prompt-to-add-ssh-key-if-ssh-protocol-is-disabled' into 'master'
If SSH prototol is disabled don't say the user requires SSH keys Closes #24921 See merge request !7840
This commit is contained in:
commit
668deeaee9
|
@ -512,7 +512,7 @@ class User < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def require_ssh_key?
|
||||
keys.count == 0
|
||||
keys.count == 0 && Gitlab::ProtocolAccess.allowed?('ssh')
|
||||
end
|
||||
|
||||
def require_password?
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
title: Don't display prompt to add SSH keys if SSH protocol is disabled
|
||||
merge_request: 7840
|
||||
author: Andrew Smith (EspadaV8)
|
|
@ -575,6 +575,23 @@ describe User, models: true do
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '#require_ssh_key?' do
|
||||
protocol_and_expectation = {
|
||||
'http' => false,
|
||||
'ssh' => true,
|
||||
'' => true,
|
||||
}
|
||||
|
||||
protocol_and_expectation.each do |protocol, expected|
|
||||
it "has correct require_ssh_key?" do
|
||||
stub_application_setting(enabled_git_access_protocol: protocol)
|
||||
user = build(:user)
|
||||
|
||||
expect(user.require_ssh_key?).to eq(expected)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '.find_by_any_email' do
|
||||
|
|
Loading…
Reference in New Issue