[Fusionforge-commits] FusionForge branch Branch_5_3 updated. ddb7a776b9ac70019ff072a47f2759b2f9ef219c

Franck VILLAUME nerville at fusionforge.org
Sat Feb 15 13:28:59 CET 2014


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "FusionForge".

The branch, Branch_5_3 has been updated
       via  ddb7a776b9ac70019ff072a47f2759b2f9ef219c (commit)
      from  6a121b56e2b815bade0b4b88c242143b0577ce43 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit ddb7a776b9ac70019ff072a47f2759b2f9ef219c
Author: Franck Villaume <franck.villaume at trivialdev.com>
Date:   Sat Feb 15 13:27:17 2014 +0100

    plugin scmgit: personal clone can be request by logged user with read write

diff --git a/src/plugins/scmgit/www/index.php b/src/plugins/scmgit/www/index.php
index 80deb64..8494d5c 100644
--- a/src/plugins/scmgit/www/index.php
+++ b/src/plugins/scmgit/www/index.php
@@ -1,11 +1,12 @@
 <?php
-/*-
+/**
  * scmgit plugin
  *
  * Copyright 2010, Roland Mas <lolando at debian.org>
  * Copyright © 2012
  *	Thorsten Glaser <t.glaser at tarent.de>
  * All rights reserved.
+ * Copyright 2014, Franck Villaume - TrivialDev
  *
  * This file is part of FusionForge. FusionForge is free software;
  * you can redistribute it and/or modify it under the terms of the
@@ -47,32 +48,33 @@ if (preg_match('!^grouppage/([a-z][-a-z0-9_]+)(/.*)$!', $func, $matches)) {
 switch ($func) {
 case 'request-personal-repo':
 	$group_id = getIntFromRequest('group_id');
-	session_require_perm('scm', $group_id, 'write');
-	$user = session_get_user(); // get the session user
-	$result = db_query_params('SELECT * FROM scm_personal_repos WHERE group_id=$1 AND user_id=$2 AND plugin_id=$3',
-				   array($group_id,
-					  $user->getID(),
-					  $plugin_id));
-	if ($result && db_numrows($result) == 1) {
-		scm_header(array('title' => _('SCM Repository'), 'group' => $group_id));
-		echo _('You have already requested a personal Git repository for this project.  If it does not exist yet, it will be created shortly.');
-		scm_footer();
-		exit;
-	}
-
-	$glist = $user->getGroups();
-	foreach ($glist as $g) {
-		if ($g->getID() == $group_id) {
-			$result = db_query_params('INSERT INTO scm_personal_repos (group_id, user_id, plugin_id) VALUES ($1,$2,$3)',
-						   array ($group_id,
-							  $user->getID(),
-							  $plugin_id));
-
+	if (session_loggedin() && forge_check_perm('scm', $group_id, 'read')) {
+		$user = session_get_user(); // get the session user
+		$result = db_query_params('SELECT * FROM scm_personal_repos WHERE group_id=$1 AND user_id=$2 AND plugin_id=$3',
+					array($group_id,
+						$user->getID(),
+						$plugin_id));
+		if ($result && db_numrows($result) == 1) {
 			scm_header(array('title' => _('SCM Repository'), 'group' => $group_id));
-			echo _('You have now requested a personal Git repository for this project.  It will be created shortly.');
+			echo _('You have already requested a personal Git repository for this project.  If it does not exist yet, it will be created shortly.');
 			scm_footer();
 			exit;
 		}
+
+		$glist = $user->getGroups();
+		foreach ($glist as $g) {
+			if ($g->getID() == $group_id) {
+				$result = db_query_params('INSERT INTO scm_personal_repos (group_id, user_id, plugin_id) VALUES ($1,$2,$3)',
+							array ($group_id,
+								$user->getID(),
+								$plugin_id));
+
+				scm_header(array('title' => _('SCM Repository'), 'group' => $group_id));
+				echo _('You have now requested a personal Git repository for this project.  It will be created shortly.');
+				scm_footer();
+				exit;
+			}
+		}
 	}
 	exit_no_group();
 	break;

-----------------------------------------------------------------------

Summary of changes:
 src/plugins/scmgit/www/index.php |   48 ++++++++++++++++++++------------------
 1 file changed, 25 insertions(+), 23 deletions(-)


hooks/post-receive
-- 
FusionForge



More information about the Fusionforge-commits mailing list