BigW Consortium Gitlab

Commit 8f7360f3 by miks

API on adding users to project implemented

parent 19a52197
...@@ -106,6 +106,21 @@ Parameters: ...@@ -106,6 +106,21 @@ Parameters:
Will return created project with status `201 Created` on success, or `404 Not Will return created project with status `201 Created` on success, or `404 Not
found` on fail. 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 ## Project repository branches
......
...@@ -44,6 +44,18 @@ module Gitlab ...@@ -44,6 +44,18 @@ module Gitlab
end end
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 # Get a project repository branches
# #
# Parameters: # Parameters:
......
...@@ -62,6 +62,18 @@ describe Gitlab::API do ...@@ -62,6 +62,18 @@ describe Gitlab::API do
end end
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 describe "GET /projects/:id" do
it "should return a project by id" do it "should return a project by id" do
get api("/projects/#{project.id}", user) get api("/projects/#{project.id}", user)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment