Created
January 18, 2013 13:19
-
-
Save pboehm/4564508 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From fd8c2f000f6d84cba8db8a76e2590a40c34574b5 Mon Sep 17 00:00:00 2001 | |
From: =?UTF-8?q?Philipp=20B=C3=B6hm?= <[email protected]> | |
Date: Thu, 17 Jan 2013 17:12:45 +0100 | |
Subject: [PATCH] Added global_namespace flag to API | |
You can now create projects in the global namespace through the API. | |
This is made by introducing an optional field `global_namespace` to the | |
method that responds to 'POST /projects'. | |
--- | |
lib/api/projects.rb | 10 ++++++++++ | |
1 file changed, 10 insertions(+) | |
diff --git a/lib/api/projects.rb b/lib/api/projects.rb | |
index 55c81f3..8db3cab 100644 | |
--- a/lib/api/projects.rb | |
+++ b/lib/api/projects.rb | |
@@ -33,8 +33,13 @@ module Gitlab | |
# wall_enabled (optional) - enabled by default | |
# merge_requests_enabled (optional) - enabled by default | |
# wiki_enabled (optional) - enabled by default | |
+ # global_namespace (optional) - create repo in global namespace | |
+ # instead of your private namespace | |
# Example Request | |
# POST /projects | |
+ params do | |
+ optional :global_namespace, type: Boolean | |
+ end | |
post do | |
attrs = attributes_for_keys [:name, | |
:description, | |
@@ -43,6 +48,11 @@ module Gitlab | |
:wall_enabled, | |
:merge_requests_enabled, | |
:wiki_enabled] | |
+ | |
+ if params[:global_namespace] | |
+ attrs[:namespace_id] = Namespace.global_id | |
+ end | |
+ | |
@project = Project.create_by_user(attrs, current_user) | |
if @project.saved? | |
present @project, with: Entities::Project | |
-- | |
1.7.11.7 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment