diff options
author | randx <dmitriy.zaporozhets@gmail.com> | 2012-03-30 08:25:04 +0300 |
---|---|---|
committer | randx <dmitriy.zaporozhets@gmail.com> | 2012-03-30 08:25:04 +0300 |
commit | 464cd59dff0e543cc367c0d468a70ca590334e42 (patch) | |
tree | d3cf2604c2eb4dace743a69b11802a57480e65db /lib | |
parent | 3824f9b372fe9451d101eec478440d129fb2d0b2 (diff) | |
download | gitlab-ce-464cd59dff0e543cc367c0d468a70ca590334e42.tar.gz |
Rake task to provider full repo access for gitolite-owner.\n Automerge requires gitlab user be able to push to any repo
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlabhq/gitolite.rb | 29 | ||||
-rw-r--r-- | lib/tasks/gitlab_enable_automerge.rake | 9 |
2 files changed, 38 insertions, 0 deletions
diff --git a/lib/gitlabhq/gitolite.rb b/lib/gitlabhq/gitolite.rb index 701b9a8f8b4..fabeb7d0fca 100644 --- a/lib/gitlabhq/gitolite.rb +++ b/lib/gitlabhq/gitolite.rb @@ -123,5 +123,34 @@ module Gitlabhq repo end + + def admin_all_repo + ga_repo = ::Gitolite::GitoliteAdmin.new(File.join(@local_dir,'gitolite')) + conf = ga_repo.config + owner_name = "" + + # Read gitolite-admin user + # + begin + repo = conf.get_repo("gitolite-admin") + owner_name = repo.permissions[0]["RW+"][""][0] + raise StandardError if owner_name.blank? + rescue => ex + puts "Cant determine gitolite-admin owner".red + raise StandardError + end + + # @ALL repos premission for gitolite owner + repo_name = "@all" + repo = if conf.has_repo?(repo_name) + conf.get_repo(repo_name) + else + ::Gitolite::Config::Repo.new(repo_name) + end + + repo.add_permission("RW+", "", owner_name) + conf.add_repo(repo, true) + ga_repo.save + end end end diff --git a/lib/tasks/gitlab_enable_automerge.rake b/lib/tasks/gitlab_enable_automerge.rake new file mode 100644 index 00000000000..6ff5003eac1 --- /dev/null +++ b/lib/tasks/gitlab_enable_automerge.rake @@ -0,0 +1,9 @@ +desc "Give gitlab user full access to every repo" +task :gitlab_enable_automerge => :environment do + + Gitlabhq::GitHost.system.new.configure do |git| + git.admin_all_repo + end + + puts "Done!".green +end |