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
8f7360f3
Commit
8f7360f3
authored
Sep 05, 2012
by
miks
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
API on adding users to project implemented
parent
19a52197
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
0 deletions
+39
-0
doc/api/projects.md
doc/api/projects.md
+15
-0
lib/api/projects.rb
lib/api/projects.rb
+12
-0
spec/requests/api/projects_spec.rb
spec/requests/api/projects_spec.rb
+12
-0
No files found.
doc/api/projects.md
View file @
8f7360f3
...
...
@@ -106,6 +106,21 @@ Parameters:
Will return created project with status
`201 Created`
on success, or
`404 Not
found`
on fail.
## Add project users
Add users to exiting project
```
PUT /projects/:id/add_users
```
Parameters:
+
`id`
(required) - The ID or code name of a project
+
`user_ids`
(required) - new project name
+
`project_access`
(required) - new project name
Will return updated project with status
`200 OK`
on success, or
`404 Not found`
on fail.
## Project repository branches
...
...
lib/api/projects.rb
View file @
8f7360f3
...
...
@@ -44,6 +44,18 @@ module Gitlab
end
end
# Add users to project with specified access level
#
# Parameters:
# id (required) - The ID or code name of a project
# user_ids (required) - The ID list of users to add
# project_access (required) - Project access level
# Example Request:
# PUT /projects/:id/add_users
put
":id/add_users"
do
user_project
.
add_users_ids_to_team
(
params
[
:user_ids
],
params
[
:project_access
])
end
# Get a project repository branches
#
# Parameters:
...
...
spec/requests/api/projects_spec.rb
View file @
8f7360f3
...
...
@@ -62,6 +62,18 @@ describe Gitlab::API do
end
end
describe
"PUT /projects/:id/add_users"
do
@user2
=
Factory
:user
@user3
=
Factory
:user
it
"should add users to existing project"
do
expect
{
put
api
(
"/projects/
#{
project
.
code
}
/add_users"
,
user
),
user_ids:
[
@user2
.
id
,
@user3
.
id
],
project_access:
UsersProject
::
DEVELOPER
}.
to
change
{
Project
.
users_projects
.
where
(
:project_access
=>
UsersProject
::
DEVELOPER
).
count
}.
by
(
2
)
end
end
describe
"GET /projects/:id"
do
it
"should return a project by id"
do
get
api
(
"/projects/
#{
project
.
id
}
"
,
user
)
...
...
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