I am developing a custom Web Interface Browser for Subversion Repositories with C#/ASP.NET and SVNKit (Converted to .NET assemblies using IKVM.NET). Is there any clean way to locally add a new subversion user (that is added by the administrator) using C# code?
I can't offer C#, but I doubt the implementation language has any impact on things. All you need to do is read / write to a text file. Changes to the configuration files takes place immediately (unlike Apache). It's very not complicated.
If you pop into the conf folder in your repository (not your working copy) you'll find three files:
svnserve.conf controls the repo's authentication file (passwd), which is disabled by default. To activate account-based authentication you simply uncomment the line in .conf that looks like:
password-db = passwd
You'll also probably want to tweak:
anon-access = none
auth-access = write
As the comment in the config file notes, you can specify a path to an external file. This might be what you mean by a "clean" way to tweak stuff. Simply place your passwd file outside the repo and change the repo's svnserve.conf to point to it explicitly. Using this technique you can control access to multiple repos from a single passwd file. For example:
password-db = /home/user/svn-users.conf
The password file itself looks like this:
[users]
user1 = user1pass
user2 = user2pass
The comments in the default files should be pretty clear on how to get things up and running, but if you want more info, the TortoiseSVN manual has an excellent server setup guide. (There's also the SVN Redbean book, but I found Tortoise a bit more clear.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With