*
* Copyright 2009, Roland Mas
* Copyright 2009, Mehdi Dogguy <mehdi@debian.org>
- * Copyright 2012, Franck Villaume - TrivialDev
+ * Copyright 2012-2013, Franck Villaume - TrivialDev
+ * Copyright © 2013
+ * Thorsten Glaser <t.glaser@tarent.de>
+ * http://fusionforge.org
*
* This file is part of FusionForge.
*
fwrite($config_f, "\$stylesheet = '". util_make_url('/plugins/scmgit/gitweb.css')."';\n");
fwrite($config_f, "\$javascript = '". util_make_url('/plugins/scmgit/gitweb.js')."';\n");
fwrite($config_f, "\$prevent_xss = 'true';\n");
+ fwrite($config_f, "\$feature{'actions'}{'default'} = [('project home', '" .
+ util_make_url('/plugins/scmgit/?func=grouppage/%n') .
+ "', 'summary')];\n");
fclose($config_f);
- chmod ($fname.'.new', 0644) ;
- rename ($fname.'.new', $fname) ;
+ chmod($fname.'.new', 0644);
+ rename($fname.'.new', $fname);
- $fname = $config_dir . '/gitweb.list' ;
+ $fname = $config_dir . '/gitweb.list';
+ $f = fopen($fname.'.new', 'w');
- $f = fopen ($fname.'.new', 'w');
+ $engine = RBACEngine::getInstance();
foreach ($list as $project) {
- $repos = $this->getRepositories($rootdir . "/" . $project->getUnixName());
- foreach ($repos as $repo) {
- $reldir = substr($repo, strlen($rootdir) + 1);
- fwrite($f, $reldir . "\n");
- }
+ $repos = $this->getRepositories($rootdir . "/" . $project->getUnixName());
+ foreach ($repos as $repo) {
+ $reldir = substr($repo, strlen($rootdir) + 1);
+ fwrite($f, $reldir . "\n");
+ }
+ $users = $engine->getUsersByAllowedAction('scm',$project->getID(),'write');
+ $password_data = '';
+ foreach ($users as $user) {
+ $password_data .= $user->getUnixName().':'.$user->getUnixPasswd()."\n";
+ }
+ $faname = forge_get_config('data_path').'/gituser-authfile.'.$project->getUnixName();
+ $fa = fopen($faname.'.new', 'w');
+ fwrite($fa, $password_data);
+ fclose($fa);
+ chmod($faname.'.new', 0644);
+ rename($faname.'.new', $faname);
}
fclose($f);
chmod($fname.'.new', 0644);
* scmgit plugin
*
* Copyright 2010, Roland Mas <lolando@debian.org>
+ * Copyright © 2012
+ * Thorsten Glaser <t.glaser@tarent.de>
+ * All rights reserved.
+ *
+ * This file is part of FusionForge. FusionForge is free software;
+ * you can redistribute it and/or modify it under the terms of the
+ * GNU General Public License as published by the Free Software
+ * Foundation; either version 2 of the Licence, or (at your option)
+ * any later version.
+ *
+ * FusionForge is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with FusionForge; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-require_once ('../../../www/env.inc.php');
+require_once '../../../www/env.inc.php';
require_once $gfcommon.'include/pre.php';
require_once $gfwww.'scm/include/scm_utils.php';
+$plugin = plugin_get_object('scmgit');
+$plugin_id = $plugin->getID();
+
$func = getStringFromRequest ('func') ;
+
+ $matches = array();
+ if (preg_match('!^grouppage/([a-z][-a-z0-9_]+)(/.*)$!', $func, $matches)) {
+ $grp = util_ifsetor($matches[1]);
+ if ($grp) {
+ $grp = group_get_object_by_name($grp);
+ }
+ if ($grp && is_object($grp) && !$grp->isError()) {
+ session_redirect('/projects/' . $grp->getUnixName() . '/');
+ }
+ exit_error(sprintf(_('Cannot locate group for func=%s'), $func), 'scm');
+ }
+
switch ($func) {
case 'request-personal-repo':
$group_id = getIntFromRequest ('group_id') ;