Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
5f682094
Commit
5f682094
authored
Jun 18, 2014
by
Matthew Monaco
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add 'confirm' option to users api
parent
d7c50b4a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
1 deletion
+6
-1
CHANGELOG
CHANGELOG
+1
-0
doc/api/users.md
doc/api/users.md
+1
-0
lib/api/users.rb
lib/api/users.rb
+4
-1
No files found.
CHANGELOG
View file @
5f682094
...
...
@@ -8,6 +8,7 @@ v 7.5.0
- Tie up loose ends with annotated tags: API & UI (Sean Edge)
- Return valid json for deleting branch via API (sponsored by O'Reilly Media)
- Expose username in project events API (sponsored by O'Reilly Media)
- Allow user confirmation to be skipped for new users via API
v 7.4.2
- Fix internal snippet exposing for unauthenticated users
...
...
doc/api/users.md
View file @
5f682094
...
...
@@ -168,6 +168,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
...
...
lib/api/users.rb
View file @
5f682094
...
...
@@ -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
,
:extern_uid
,
:provider
,
:bio
,
:can_create_group
,
:admin
]
attrs
=
attributes_for_keys
[
:email
,
:name
,
:password
,
:skype
,
:linkedin
,
:twitter
,
:projects_limit
,
:username
,
:extern_uid
,
:provider
,
:bio
,
:can_create_group
,
:
confirm
,
:
admin
]
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
if
user
.
save
present
user
,
with:
Entities
::
UserFull
else
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment