4 * Implement CVS ACLs based on GForge roles
6 * Copyright 2004 GForge, LLC
8 * This file is part of GForge.
10 * GForge is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * GForge is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with GForge; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US
25 if (((int) $_SERVER['argc']) < 1) {
26 print "Usage: ".basename(__FILE__)." /cvsroot/projectname\n";
30 require_once dirname(__FILE__).'/../../env.inc.php';
31 require_once $gfwww. 'include/pre.php';
32 require_once $gfcommon.'include/utils.php';
33 require_once $gfconfig.'plugins/scmcvs/config.php';
34 require_once $gfplugins.'scmcvs/common/Snoopy.class.php';
37 $env_cvsroot = (string) $_ENV['CVSROOT'];
40 # 1. Must begin with /cvs/ or /cvsroot/
41 # 2. Then must contain 3 - 25 alphanumeric chars or -
42 preg_match("/^\/\/?(cvs)(root)*\/\/?([[:alnum:]-]{3,25})$/", $env_cvsroot, $matches);
44 if (count($matches) == 0) {
45 print "Invalid CVS directory\n";
49 $projectName = $matches[count($matches)-1];
51 $userArray=posix_getpwuid ( posix_geteuid ( ) );
52 $userName= $userArray['name'];
54 // Our POSTer in Gforge
57 $SubmitUrl=util_make_url('/plugins/scmcvs/acl.php');
58 $SubmitVars['group'] = $projectName;
59 $SubmitVars['user'] = $userName;
61 if ($userName == 'root') {
65 $snoopy->submit($SubmitUrl,$SubmitVars);
66 if (!empty($snoopy->error) || !empty($snoopy->results)) {
67 print $snoopy->results."\n";