cvs: pearweb /sql Makefile addacls.php cvs_acl.sql cvs_group_membership.sql cvs_groups.sql
| From: | Stig Bakken | Date: | Wed, 05 Dec 2001 11:30:27 +0000 |
| Subject: | cvs: pearweb /sql Makefile addacls.php cvs_acl.sql cvs_group_membership.sql cvs_groups.sql | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-1469@lists.php.net to get a copy of this message | ||
ssb Wed Dec 5 06:30:27 2001 EDT
Added files:
/pearweb/sql cvs_group_membership.sql cvs_groups.sql
Modified files:
/pearweb/sql Makefile addacls.php cvs_acl.sql
Log:
* added group tables for cvs acls
Index: pearweb/sql/Makefile
diff -u pearweb/sql/Makefile:1.14 pearweb/sql/Makefile:1.15
--- pearweb/sql/Makefile:1.14 Mon Nov 12 09:04:17 2001
+++ pearweb/sql/Makefile Wed Dec 5 06:30:27 2001
@@ -19,6 +19,8 @@
TABLE_FILES=\
cvs_acl.sql \
+ cvs_groups.sql \
+ cvs_group_membership.sql \
package_acl.sql \
maintains.sql \
categories.sql \
@@ -109,3 +111,5 @@
notes.res: packages.res users.res
categories.res:
cvs_acl.res: users.res
+cvs_groups.res:
+cvs_group_membership.res: users.res cvs_groups.res
Index: pearweb/sql/addacls.php
diff -u pearweb/sql/addacls.php:1.2 pearweb/sql/addacls.php:1.3
--- pearweb/sql/addacls.php:1.2 Thu Nov 15 20:20:28 2001
+++ pearweb/sql/addacls.php Wed Dec 5 06:30:27 2001
@@ -1,18 +1,37 @@
<?php
+require_once "DB.php";
+
+PEAR::setErrorHandling(PEAR_ERROR_DIE, "%s\n");
+$dbh = DB::connect("mysql://pear:pear@localhost/pear");
+
$acl_paths = array();
$acl_users = array();
-$fp = @fopen("avail", "r");
-if (empty($fp)) {
- $fp = @fopen("../../CVSROOT/avail", "r");
-}
-if (empty($fp)) {
- $fp = @fopen("/repository/CVSROOT/avail", "r");
+$op = ini_get("include_path");
+ini_set("include_path", ".:../../CVSROOT:/repository/CVSROOT");
+$m4 = @fopen("gen_acl_file.m4", "r", true);
+$avail = @fopen("avail", "r", true);
+ini_set("include_path", $op);
+
+if (is_resource($m4)) {
+ while ($line = fgets($m4, 10240)) {
+ if (preg_match("/^define\(
([^']+)'\s*,\s*([^']+)'\)/",
$line, $m)) {
+ list(,$group,$members) = $m;
+ print "$group ($comment): ";
+ print sizeof(preg_split('/\s*,\s*/', $members));
+ print " members\n";
+ } elseif (preg_match('/^dnl\s*(.*)\s*$/', $line, $m)) {
+ $comment = $m[1];
+ }
+ }
+ fclose($m4);
+} else {
+ print "not a resource: \$m4\n";
}
-if (is_resource($fp)) {
- while ($line = fgets($fp, 10240)) {
+if (is_resource($avail)) {
+ while ($line = fgets($avail, 10240)) {
if (substr($line, 0, 6) != "avail|") {
continue;
}
@@ -26,8 +45,9 @@
}
}
}
+ fclose($avail);
print "Setting up CVS ACLs...";
- $sth = $dbh->prepare("INSERT INTO cvs_acl (handle,path,access) ".
+ $sth = $dbh->prepare("INSERT INTO cvs_acl (username,path,access) ".
"VALUES(?,?,?)");
$ent = 0;
foreach ($acl_paths as $path => $acldata) {
Index: pearweb/sql/cvs_acl.sql
diff -u pearweb/sql/cvs_acl.sql:1.1 pearweb/sql/cvs_acl.sql:1.2
--- pearweb/sql/cvs_acl.sql:1.1 Mon Nov 12 09:04:17 2001
+++ pearweb/sql/cvs_acl.sql Wed Dec 5 06:30:27 2001
@@ -1,7 +1,8 @@
CREATE TABLE cvs_acl (
- handle VARCHAR(20) NOT NULL REFERENCES users(handle),
+ username VARCHAR(20), -- NOT NULL REFERENCES users(handle),
+ groupname VARCHAR(20), -- NOT NULL REFERENCES users(handle),
path VARCHAR(250) NOT NULL,
access BOOL,
- UNIQUE INDEX(handle,path)
+ UNIQUE INDEX(username,path)
);
Index: pearweb/sql/cvs_group_membership.sql
+++ pearweb/sql/cvs_group_membership.sql
CREATE TABLE cvs_group_membership (
groupname VARCHAR(20) NOT NULL REFERENCES cvs_groups(name),
username VARCHAR(20) NOT NULL REFERENCES users(handle),
member_since DATETIME,
approved_by VARCHAR(20) NOT NULL REFERENCES users(handle),
UNIQUE INDEX(groupname, username)
);
Index: pearweb/sql/cvs_groups.sql
+++ pearweb/sql/cvs_groups.sql
CREATE TABLE cvs_groups (
groupname VARCHAR(20) NOT NULL,
description VARCHAR(250) NOT NULL,
UNIQUE INDEX(groupname)
);