[vhffs-dev] [1099] Fixed a bug when using fix perms on a GIT repository.

[ Thread Index | Date Index | More vhffs.org/vhffs-dev Archives ]


Revision: 1099
Author:   beuss
Date:     2007-11-29 07:10:29 +0000 (Thu, 29 Nov 2007)

Log Message:
-----------
Fixed a bug when using fix perms on a GIT repository.

Modified Paths:
--------------
    trunk/vhffs-panel/git/prefs.pl
    trunk/vhffs-panel/templates/git/prefs.tmpl


Modified: trunk/vhffs-panel/git/prefs.pl
===================================================================
--- trunk/vhffs-panel/git/prefs.pl	2007-11-28 19:58:17 UTC (rev 1098)
+++ trunk/vhffs-panel/git/prefs.pl	2007-11-29 07:10:29 UTC (rev 1099)
@@ -101,7 +101,12 @@
         if(save_prefs()) {
             exit;
         }
+    } elsif(defined $cgi->param('fix_perms_submit') ) {
+        if(fix_perms()) {
+            exit;
+        }
     }
+
     $template = new Vhffs::Panel::Template( filename => $templatedir."/panel/git/prefs.tmpl" );
 
     $panel->set_title( gettext("Admin Git Repository") );    
@@ -148,6 +153,25 @@
 $panel->build( $template );
 $panel->display;
 
+sub fix_perms {
+    if(!$user->can_modify($git)) {
+        $panel->add_error( gettext('You are not allowed to modify this GIT repository (ACL rights)') );
+        return 0;
+    }
+
+    $git->set_status(Vhffs::Constants::WAITING_FOR_MODIFICATION);
+
+    if($git->commit < 0) {
+        $panel->add_error( gettext('Unable to apply modifications') );
+        return 0;
+    } else {
+        my $url = '/group/view.pl?project='.$panel->{groupname}.'&msg='.gettext('Modifications applied. Please wait while your repository is being updated');
+        $panel->redirect($url);
+        return 1;
+    }
+
+}
+
 sub save_prefs {
     my $public = $cgi->param('public');
     my $ml_name = $cgi->param('ml_name');

Modified: trunk/vhffs-panel/templates/git/prefs.tmpl
===================================================================
--- trunk/vhffs-panel/templates/git/prefs.tmpl	2007-11-28 19:58:17 UTC (rev 1098)
+++ trunk/vhffs-panel/templates/git/prefs.tmpl	2007-11-29 07:10:29 UTC (rev 1099)
@@ -26,15 +26,15 @@
 
 
 <h2><TMPL_VAR ESCAPE=1 NAME="TITLE_PERM"></h2>
-<form method="post" action="/git/prefs_save.pl" accept-charset="utf-8">
+<form method="post" action="/git/prefs.pl" accept-charset="utf-8">
 	<p>
 		<label for="PUBLIC">
 			<TMPL_VAR ESCAPE=1 NAME="PERM_TEXT">
 		</label>
 	</p>
 	<p class="button" id="buttonModify">
-		<input type="hidden" name="REPO_NAME" value="<TMPL_VAR ESCAPE=1 NAME="TEXT_REPONAME">" />
-		<input type="submit" value="<TMPL_VAR ESCAPE=1 NAME="TEXT_BUTTON_PERM">" />
+		<input type="hidden" name="name" value="<TMPL_VAR ESCAPE=1 NAME="TEXT_REPONAME">" />
+		<input type="submit" value="<TMPL_VAR ESCAPE=1 NAME="TEXT_BUTTON_PERM">" name="fix_perms_submit" />
 	</p>
 </form>
 


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/