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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
51300d9b
Commit
51300d9b
authored
Mar 17, 2016
by
Zeger-Jan van de Weg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
API support for setting External flag on existing users
parent
cde7eee7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
1 deletion
+9
-1
lib/api/users.rb
lib/api/users.rb
+2
-1
spec/requests/api/users_spec.rb
spec/requests/api/users_spec.rb
+7
-0
No files found.
lib/api/users.rb
View file @
51300d9b
...
@@ -108,12 +108,13 @@ module API
...
@@ -108,12 +108,13 @@ module API
# bio - Bio
# bio - Bio
# admin - User is admin - true or false (default)
# admin - User is admin - true or false (default)
# can_create_group - User can create groups - true or false
# can_create_group - User can create groups - true or false
# external - Is user an external user - true or false(default)
# Example Request:
# Example Request:
# PUT /users/:id
# PUT /users/:id
put
":id"
do
put
":id"
do
authenticated_as_admin!
authenticated_as_admin!
attrs
=
attributes_for_keys
[
:email
,
:name
,
:password
,
:skype
,
:linkedin
,
:twitter
,
:website_url
,
:projects_limit
,
:username
,
:bio
,
:can_create_group
,
:admin
]
attrs
=
attributes_for_keys
[
:email
,
:name
,
:password
,
:skype
,
:linkedin
,
:twitter
,
:website_url
,
:projects_limit
,
:username
,
:bio
,
:can_create_group
,
:admin
,
:external
]
user
=
User
.
find
(
params
[
:id
])
user
=
User
.
find
(
params
[
:id
])
not_found!
(
'User'
)
unless
user
not_found!
(
'User'
)
unless
user
...
...
spec/requests/api/users_spec.rb
View file @
51300d9b
...
@@ -282,6 +282,13 @@ describe API::API, api: true do
...
@@ -282,6 +282,13 @@ describe API::API, api: true do
expect
(
user
.
reload
.
admin
).
to
eq
(
true
)
expect
(
user
.
reload
.
admin
).
to
eq
(
true
)
end
end
it
"should update external status"
do
put
api
(
"/users/
#{
user
.
id
}
"
,
admin
),
{
external:
true
}
expect
(
response
.
status
).
to
eq
200
expect
(
json_response
[
'external'
]).
to
eq
(
true
)
expect
(
user
.
reload
.
external?
).
to
be_truthy
end
it
"should not update admin status"
do
it
"should not update admin status"
do
put
api
(
"/users/
#{
admin_user
.
id
}
"
,
admin
),
{
can_create_group:
false
}
put
api
(
"/users/
#{
admin_user
.
id
}
"
,
admin
),
{
can_create_group:
false
}
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
response
.
status
).
to
eq
(
200
)
...
...
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