summaryrefslogtreecommitdiff
path: root/lib/api/projects.rb
diff options
context:
space:
mode:
authorAngus MacArthur <amacarthur@rim.com>2012-11-14 15:37:52 -0500
committerAngus MacArthur <amacarthur@blackberry.com>2013-03-05 10:38:43 -0500
commit61ffcab60fef2efcd54b8496aa09de79ee999a2c (patch)
tree7a493e25800421cdb94607b52836d50274d5c0f7 /lib/api/projects.rb
parentd5663e148fdf8d1c767479e62c86c7a2b4db654e (diff)
downloadgitlab-ce-61ffcab60fef2efcd54b8496aa09de79ee999a2c.tar.gz
Additional Admin APIs
Diffstat (limited to 'lib/api/projects.rb')
-rw-r--r--lib/api/projects.rb32
1 files changed, 32 insertions, 0 deletions
diff --git a/lib/api/projects.rb b/lib/api/projects.rb
index 8f57e5ac79f..a39aff9900c 100644
--- a/lib/api/projects.rb
+++ b/lib/api/projects.rb
@@ -52,6 +52,38 @@ module Gitlab
end
end
+ # Create new project for a specified user. Only available to admin users.
+ #
+ # Parameters:
+ # user_id (required) - The ID of a user
+ # name (required) - name for new project
+ # description (optional) - short project description
+ # default_branch (optional) - 'master' by default
+ # issues_enabled (optional) - enabled by default
+ # wall_enabled (optional) - enabled by default
+ # merge_requests_enabled (optional) - enabled by default
+ # wiki_enabled (optional) - enabled by default
+ # Example Request
+ # POST /projects/user/:user_id
+ post "user/:user_id" do
+ authenticated_as_admin!
+ user = User.find(params[:user_id])
+ attrs = attributes_for_keys [:name,
+ :description,
+ :default_branch,
+ :issues_enabled,
+ :wall_enabled,
+ :merge_requests_enabled,
+ :wiki_enabled]
+ @project = ::Projects::CreateContext.new(user, attrs).execute
+ if @project.saved?
+ present @project, with: Entities::Project
+ else
+ not_found!
+ end
+ end
+
+
# Get a project team members
#
# Parameters: