diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-03-06 22:57:24 -0800 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-03-06 22:57:24 -0800 |
commit | 7c408960ce9cf8a20941c99fd64aa5b1f472f9a0 (patch) | |
tree | 7e81d11387865cd41279c6ba2672c019e1550052 /lib/api/projects.rb | |
parent | 52bf5b0e78edeb1acc8254b00ba164d48a88f39e (diff) | |
parent | 47abdc10ca7daceac8206a65166b42409a76b459 (diff) | |
download | gitlab-ce-7c408960ce9cf8a20941c99fd64aa5b1f472f9a0.tar.gz |
Merge pull request #3146 from amacarthur/AdminAPIs
Additional Admin APIs
Diffstat (limited to 'lib/api/projects.rb')
-rw-r--r-- | lib/api/projects.rb | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/lib/api/projects.rb b/lib/api/projects.rb index 763f90015dd..00b70728c0e 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: |