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
Kazuhiko Shiozaki
gitlab-ce
Commits
d6a5e3da
Commit
d6a5e3da
authored
Nov 07, 2012
by
Valeriy Sizov
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1735 from NARKOZ/api
API fixes
parents
10d881c9
cf70439e
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
17 additions
and
20 deletions
+17
-20
CHANGELOG
CHANGELOG
+1
-1
doc/api/users.md
doc/api/users.md
+2
-4
lib/api/users.rb
lib/api/users.rb
+5
-6
spec/requests/api/projects_spec.rb
spec/requests/api/projects_spec.rb
+5
-5
spec/requests/api/users_spec.rb
spec/requests/api/users_spec.rb
+4
-4
No files found.
CHANGELOG
View file @
d6a5e3da
...
...
@@ -28,7 +28,7 @@ v 3.0.0
- Reject ssh keys that break gitolite
- [API] list one project hook
- [API] edit project hook
- [API]
add project snippets list
- [API]
list project snippets
- [API] allow to authorize using private token in HTTP header
- [API] add user creation
...
...
doc/api/users.md
View file @
d6a5e3da
...
...
@@ -74,14 +74,12 @@ POST /users
Parameters:
+
`email`
(required) - Email
+
`name`
(required) - Name
+
`password`
(required) - Password
+
`
password_confirmation`
(required) - Password confirmation
+
`
name`
- Name
+
`skype`
- Skype ID
+
`linkedin`
- Linkedin
+
`twitter`
- Twitter account
+
`projects_limit`
- Limit projects wich user can create
+
`projects_limit`
- Number of projects user can create
Will return created user with status
`201 Created`
on success, or
`404 Not
found`
on fail.
...
...
lib/api/users.rb
View file @
d6a5e3da
...
...
@@ -28,19 +28,18 @@ module Gitlab
#
# Parameters:
# email (required) - Email
# name (required) - Name
# password (required) - Password
#
password_confirmation (required) - Password confirmation
#
name - Name
# skype - Skype ID
# linkedin - Linkedin
# twitter - Twitter account
# projects_limit -
Limit projects wich
user can create
# projects_limit -
Number of projects
user can create
# Example Request:
# POST /users
post
do
authenticated_as_admin!
attrs
=
attributes_for_keys
[
:email
,
:name
,
:password
,
:
password_confirmation
,
:
skype
,
:linkedin
,
:twitter
,
:projects_limit
]
user
=
User
.
new
attrs
attrs
=
attributes_for_keys
[
:email
,
:name
,
:password
,
:skype
,
:linkedin
,
:twitter
,
:projects_limit
]
user
=
User
.
new
attrs
,
as: :admin
if
user
.
save
present
user
,
with:
Entities
::
User
else
...
...
spec/requests/api/projects_spec.rb
View file @
d6a5e3da
...
...
@@ -46,7 +46,7 @@ describe Gitlab::API do
response
.
status
.
should
==
201
end
it
"should re
ps
ond with 404 on failure"
do
it
"should re
sp
ond with 404 on failure"
do
post
api
(
"/projects"
,
user
)
response
.
status
.
should
==
404
end
...
...
@@ -192,9 +192,9 @@ describe Gitlab::API do
describe
"PUT /projects/:id/hooks/:hook_id"
do
it
"should update an existing project hook"
do
put
api
(
"/projects/
#{
project
.
code
}
/hooks/
#{
hook
.
id
}
"
,
user
),
url:
'http://example.
com
'
url:
'http://example.
org
'
response
.
status
.
should
==
200
json_response
[
'url'
].
should
==
'http://example.
com
'
json_response
[
'url'
].
should
==
'http://example.
org
'
end
end
...
...
spec/requests/api/users_spec.rb
View file @
d6a5e3da
...
...
@@ -4,7 +4,7 @@ describe Gitlab::API do
include
ApiHelpers
let
(
:user
)
{
Factory
:user
}
let
(
:admin
)
{
Factory
:admin
}
let
(
:admin
)
{
Factory
:admin
}
let
(
:key
)
{
Factory
:key
,
user:
user
}
describe
"GET /users"
do
...
...
@@ -42,9 +42,9 @@ describe Gitlab::API do
end
it
"should create user"
do
expect
{
post
api
(
"/users"
,
admin
),
Factory
.
attributes
(
:user
)
}.
to
change
{
User
.
count
}.
by
(
1
)
expect
{
post
api
(
"/users"
,
admin
),
Factory
.
attributes
(
:user
,
projects_limit:
3
)
}.
to
change
{
User
.
count
}.
by
(
1
)
end
it
"shouldn't available for non admin users"
do
...
...
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