Rename whitelisted domains settings to internal domains, and have a setting to restrict sign up to internals
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Description
Currently, there is no way for an external user to be created by signing up. The field is marked true only through the admin panel.
Proposal
Rename whitelisted domains settings to internal domains, and have a setting to restrict sign up to internals. So these scenarios will be possible:
When an internal domain is set, and external users are allowed to sign-up
context 'when an internal domain is set, and external users are allowed to sign-up' do
before do
allow_any_instance_of(ApplicationSetting).to receive(:internal_domains).and_return(['example.com'])
allow_any_instance_of(ApplicationSetting).to receive(:allow_external_signup).and_return(true)
end
it 'accepts info@example.com as an internal user' do
user = build(:user, email: "info@example.com")
expect(user).to be_valid
expect(user.external).to eq(false)
end
it 'accepts example@test.com as an external user' do
user = build(:user, email: "example@test.com")
expect(user).to be_valid
expect(user.external).to eq(true)
end
end
When an internal domain is set, and external users are denied to sign-up
context 'when an internal domain is set, and external users are denied to sign-up' do
before do
allow_any_instance_of(ApplicationSetting).to receive(:internal_domains).and_return(['example.com'])
allow_any_instance_of(ApplicationSetting).to receive(:allow_external_signup).and_return(false)
end
it 'accepts info@example.com as an internal user' do
user = build(:user, email: "info@example.com")
expect(user).to be_valid
expect(user.external).to eq(false)
end
it 'rejects example@test.com' do
user = build(:user, email: "example@test.com")
expect(user).to be_invalid
end
end
Links / references
- gitlab-ce#25279
- gitlab-ce!8575
Edited by 🤖 GitLab Bot 🤖