Merge branch 'mmonaco/gitlab-ce-api-user-noconfirm' into 'master'
Add 'confirm' option to users api For #1990 Based on https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/129 See merge request !1610
This commit is contained in:
commit
c85935c42a
3 changed files with 6 additions and 1 deletions
|
@ -12,6 +12,7 @@ v 7.9.0 (unreleased)
|
|||
- Mobile UI improvements: make aside content expandable
|
||||
- Generalize image upload in drag and drop in markdown to all files (Hannes Rosenögger)
|
||||
- Fix mass-unassignment of issues (Robert Speicher)
|
||||
- Allow user confirmation to be skipped for new users via API
|
||||
|
||||
v 7.8.1
|
||||
- Fix run of custom post receive hooks
|
||||
|
|
|
@ -170,6 +170,7 @@ Parameters:
|
|||
- `bio` (optional) - User's biography
|
||||
- `admin` (optional) - User is admin - true or false (default)
|
||||
- `can_create_group` (optional) - User can create groups - true or false
|
||||
- `confirm` (optional) - Require confirmation - true (default) or false
|
||||
|
||||
## User modification
|
||||
|
||||
|
|
|
@ -54,15 +54,18 @@ module API
|
|||
# bio - Bio
|
||||
# admin - User is admin - true or false (default)
|
||||
# can_create_group - User can create groups - true or false
|
||||
# confirm - Require user confirmation - true (default) or false
|
||||
# Example Request:
|
||||
# POST /users
|
||||
post do
|
||||
authenticated_as_admin!
|
||||
required_attributes! [:email, :password, :name, :username]
|
||||
attrs = attributes_for_keys [:email, :name, :password, :skype, :linkedin, :twitter, :projects_limit, :username, :bio, :can_create_group, :admin]
|
||||
attrs = attributes_for_keys [:email, :name, :password, :skype, :linkedin, :twitter, :projects_limit, :username, :bio, :can_create_group, :admin, :confirm]
|
||||
user = User.build_user(attrs)
|
||||
admin = attrs.delete(:admin)
|
||||
user.admin = admin unless admin.nil?
|
||||
confirm = !(attrs.delete(:confirm) =~ (/(false|f|no|0)$/i))
|
||||
user.skip_confirmation! unless confirm
|
||||
|
||||
identity_attrs = attributes_for_keys [:provider, :extern_uid]
|
||||
if identity_attrs.any?
|
||||
|
|
Loading…
Reference in a new issue