[Xfce4-commits] <xfce-server-scripts:master> Add -f/--fix-repository-admin option to xfce-manage-git-permissions.

Jannis Pohlmann noreply at xfce.org
Wed Jun 9 14:56:01 CEST 2010


Updating branch refs/heads/master
         to e699f8f90c3785c66c711ad307a13d910be00877 (commit)
       from 3957bf5e71baa39ee9ee5cdb57825cb487d56263 (commit)

commit e699f8f90c3785c66c711ad307a13d910be00877
Author: Jannis Pohlmann <jannis at xfce.org>
Date:   Wed Jun 9 14:54:38 2010 +0200

    Add -f/--fix-repository-admin option to xfce-manage-git-permissions.

 bin/xfce-manage-git-permissions |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/bin/xfce-manage-git-permissions b/bin/xfce-manage-git-permissions
index 52d4178..d92ab88 100755
--- a/bin/xfce-manage-git-permissions
+++ b/bin/xfce-manage-git-permissions
@@ -13,6 +13,7 @@ options = OpenStruct.new
 options.config_dir = '/etc/xfce-server-files/git-permissions'
 options.list = false
 options.resolve_groups = false
+options.fix_repository_admin = false
 
 User.load do 
   users = []
@@ -148,6 +149,10 @@ ARGV.options do |opts|
     options.resolve_groups = true
   end
 
+  opts.on('-f', '--fix-repository-admin', 'Adds the group \'repository-admin\' to all repositories') do
+    options.fix_repository_admin = true
+  end
+
 end.parse!
 
 if ARGV.size >= 1
@@ -303,3 +308,18 @@ if options.remove_from_group
   User.save_all
   Group.save_all
 end
+
+if options.fix_repository_admin 
+  # Resolve the admin group
+  group = Group.find_by_name('repository-admin')
+
+  unless group.nil?
+    # Add the admin group to all repositories unless they already include it
+    for repository in Repository.find_all
+      repository.groups << group unless repository.groups.include? group
+    end
+  end
+
+  # Save repositories
+  Repository.save_all
+end



More information about the Xfce4-commits mailing list