I have a Subversion server running with AuthzSVNAccessFile specified in a virtual host. The file "permissions.txt" should be edited by the users themselves to add or remove team members but limited to max. 4 members. Possible via PHP and how to implement it? In PHP each logged in user has the $username = user_x; whereas x is an integer.
The AuthzSVNAccessFile "permissions.txt":
[repo_1001:/]
user_1 = rw
# the lines below only editable by user_1
user_1-member_1 = r
user_1-member_2 = r
user_1-member_3 = r
user_1-member_4 = r
[repo_1002:/]
user_2 = rw
# the lines below only editable by user_2
user_2-member_1 = rw
user_2-member_2 = rw
Reading and writing the file in PHP:
$file_permissions = "/.../permissions.txt";
if (isset($_POST) && ...) {
$textFileContents = $_POST['textFileContents'];
$fd=fopen($file_permissions ,"w");
fwrite($fd, $textFileContents);
fclose($fd);
}
$fd = fopen($file_permissions,"r");
$textFileContents = fread($fd,filesize($file_permissions));
fclose($fd);
var_dump($textFileContents);
I tried "AbraCadaver" mentioned parse-ini-file function but I do not get any output.
Even no errors are seen:
$file_permissions = "/.../permissions.txt";
$textFileContents = parse_ini_file($file_permissions);
var_dump($textFileContents);
The output is just "NULL".
ADD: The cause why I got "NULL" is that my php.ini on the remote server was configured to disable the function parse_ini_file for security reasons.
Now it works!