Merge branch 'feature/set-public-email-through-api' into 'master'
Set public email through api Closes #37675 See merge request gitlab-org/gitlab-ce!21938
This commit is contained in:
commit
051090c804
6 changed files with 79 additions and 22 deletions
|
@ -55,7 +55,6 @@ module Users
|
||||||
:force_random_password,
|
:force_random_password,
|
||||||
:hide_no_password,
|
:hide_no_password,
|
||||||
:hide_no_ssh_key,
|
:hide_no_ssh_key,
|
||||||
:key_id,
|
|
||||||
:linkedin,
|
:linkedin,
|
||||||
:name,
|
:name,
|
||||||
:password,
|
:password,
|
||||||
|
@ -69,7 +68,10 @@ module Users
|
||||||
:twitter,
|
:twitter,
|
||||||
:username,
|
:username,
|
||||||
:website_url,
|
:website_url,
|
||||||
:private_profile
|
:private_profile,
|
||||||
|
:organization,
|
||||||
|
:location,
|
||||||
|
:public_email
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
title: Add support for setting the public email through the api
|
||||||
|
merge_request: 21938
|
||||||
|
author: Alexis Reigel
|
||||||
|
type: added
|
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
title: Allow setting user's organization and location attributes through the API by adding them to the list of allowed parameters
|
||||||
|
merge_request: 21938
|
||||||
|
author: Alexis Reigel
|
||||||
|
type: fixed
|
|
@ -288,6 +288,7 @@ Parameters:
|
||||||
- `provider` (optional) - External provider name
|
- `provider` (optional) - External provider name
|
||||||
- `bio` (optional) - User's biography
|
- `bio` (optional) - User's biography
|
||||||
- `location` (optional) - User's location
|
- `location` (optional) - User's location
|
||||||
|
- `public_email` (optional) - The public email of the user
|
||||||
- `admin` (optional) - User is admin - true or false (default)
|
- `admin` (optional) - User is admin - true or false (default)
|
||||||
- `can_create_group` (optional) - User can create groups - true or false
|
- `can_create_group` (optional) - User can create groups - true or false
|
||||||
- `skip_confirmation` (optional) - Skip confirmation - true or false (default)
|
- `skip_confirmation` (optional) - Skip confirmation - true or false (default)
|
||||||
|
@ -319,6 +320,7 @@ Parameters:
|
||||||
- `provider` - External provider name
|
- `provider` - External provider name
|
||||||
- `bio` - User's biography
|
- `bio` - User's biography
|
||||||
- `location` (optional) - User's location
|
- `location` (optional) - User's location
|
||||||
|
- `public_email` (optional) - The public email of the user
|
||||||
- `admin` (optional) - User is admin - true or false (default)
|
- `admin` (optional) - User is admin - true or false (default)
|
||||||
- `can_create_group` (optional) - User can create groups - true or false
|
- `can_create_group` (optional) - User can create groups - true or false
|
||||||
- `skip_reconfirmation` (optional) - Skip reconfirmation - true or false (default)
|
- `skip_reconfirmation` (optional) - Skip reconfirmation - true or false (default)
|
||||||
|
|
|
@ -42,12 +42,12 @@ module API
|
||||||
optional :provider, type: String, desc: 'The external provider'
|
optional :provider, type: String, desc: 'The external provider'
|
||||||
optional :bio, type: String, desc: 'The biography of the user'
|
optional :bio, type: String, desc: 'The biography of the user'
|
||||||
optional :location, type: String, desc: 'The location of the user'
|
optional :location, type: String, desc: 'The location of the user'
|
||||||
|
optional :public_email, type: String, desc: 'The public email of the user'
|
||||||
optional :admin, type: Boolean, desc: 'Flag indicating the user is an administrator'
|
optional :admin, type: Boolean, desc: 'Flag indicating the user is an administrator'
|
||||||
optional :can_create_group, type: Boolean, desc: 'Flag indicating the user can create groups'
|
optional :can_create_group, type: Boolean, desc: 'Flag indicating the user can create groups'
|
||||||
optional :external, type: Boolean, desc: 'Flag indicating the user is an external user'
|
optional :external, type: Boolean, desc: 'Flag indicating the user is an external user'
|
||||||
optional :avatar, type: File, desc: 'Avatar image for user'
|
optional :avatar, type: File, desc: 'Avatar image for user'
|
||||||
optional :private_profile, type: Boolean, desc: 'Flag indicating the user has a private profile'
|
optional :private_profile, type: Boolean, desc: 'Flag indicating the user has a private profile'
|
||||||
optional :min_access_level, type: Integer, values: Gitlab::Access.all_values, desc: 'Limit by minimum access level of authenticated user'
|
|
||||||
all_or_none_of :extern_uid, :provider
|
all_or_none_of :extern_uid, :provider
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,49 @@ describe Users::BuildService do
|
||||||
expect(service.execute).to be_valid
|
expect(service.execute).to be_valid
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'allowed params' do
|
||||||
|
let(:params) do
|
||||||
|
{
|
||||||
|
access_level: 1,
|
||||||
|
admin: 1,
|
||||||
|
avatar: anything,
|
||||||
|
bio: 1,
|
||||||
|
can_create_group: 1,
|
||||||
|
color_scheme_id: 1,
|
||||||
|
email: 1,
|
||||||
|
external: 1,
|
||||||
|
force_random_password: 1,
|
||||||
|
hide_no_password: 1,
|
||||||
|
hide_no_ssh_key: 1,
|
||||||
|
linkedin: 1,
|
||||||
|
name: 1,
|
||||||
|
password: 1,
|
||||||
|
password_automatically_set: 1,
|
||||||
|
password_expires_at: 1,
|
||||||
|
projects_limit: 1,
|
||||||
|
remember_me: 1,
|
||||||
|
skip_confirmation: 1,
|
||||||
|
skype: 1,
|
||||||
|
theme_id: 1,
|
||||||
|
twitter: 1,
|
||||||
|
username: 1,
|
||||||
|
website_url: 1,
|
||||||
|
private_profile: 1,
|
||||||
|
organization: 1,
|
||||||
|
location: 1,
|
||||||
|
public_email: 1
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'sets all allowed attributes' do
|
||||||
|
admin_user # call first so the admin gets created before setting `expect`
|
||||||
|
|
||||||
|
expect(User).to receive(:new).with(hash_including(params)).and_call_original
|
||||||
|
|
||||||
|
service.execute
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
context 'with "user_default_external" application setting' do
|
context 'with "user_default_external" application setting' do
|
||||||
using RSpec::Parameterized::TableSyntax
|
using RSpec::Parameterized::TableSyntax
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue