Make sure all the users have RO access to the repo

This commit is contained in:
2013-11-28 15:09:37 +06:00
parent 137df8c6d3
commit 53bb3ac361

View File

@@ -39,14 +39,22 @@ function handleSingleUserPHID(
$repository_name = getSVNRepositoryName($repository);
$repository_rootpath = $repository_name . ':/';
if (!array_key_exists($repository_rootpath, $access)) {
$access[$repository_rootpath]['RW'] = array();
$access[$repository_rootpath]['RO'] = array();
}
$access[$repository_rootpath]['RO'][] = $user_name;
// Store write access settings to current subath
$subpath = $repository->getDetail('svn-subpath');
$subpath = rtrim($subpath, '/');
$repository_pathname = "$repository_name:/$subpath";
if (!array_key_exists($repository_pathname, $access)) {
$access[$repository_pathname] = array();
$access[$repository_pathname]['RW'] = array();
$access[$repository_pathname]['RO'] = array();
}
$access[$repository_pathname][] = $user_name;
$access[$repository_pathname]['RW'][] = $user_name;
}
// Parse repository and put it's members to the config file
@@ -62,7 +70,8 @@ function handleSingleRepository(
// Make sure repository is always available for read-only access
$repository_rootpath = getSVNRepositoryName($repository) . ':/';
if (!array_key_exists($repository_rootpath, $access)) {
$access[$repository_rootpath] = array();
$access[$repository_rootpath]['RW'] = array();
$access[$repository_rootpath]['RO'] = array();
}
if ($type == PhabricatorProjectPHIDTypeProject::TYPECONST) {
@@ -112,8 +121,15 @@ function rebuildConfiguration($what) {
else if ($what == 'ACCESS') {
foreach ($access as $repository => $users) {
print("[$repository]\n");
foreach ($users as $user) {
$rw_users = array();
foreach ($users['RW'] as $user) {
print("$user = rw\n");
$rw_users[$user] = true;
}
foreach ($users['RO'] as $user) {
if (!array_key_exists($user, $rw_users)) {
print("$user = r\n");
}
}
print("anonsvn = r\n");
print("* = r\n\n");