views:

835

answers:

1

I have subversion repositories that are working fine with password authentication required for all users. My config is posted below. How do I go about modifying this configuration so that I can allow a single user to have read-only access to one of my repositories?

The example provided needs to work with SVNParentPath not SVNPath. The former allows you to specify a directory containing multiple subversion repositories.

<VirtualHost *:80>
    ServerAdmin [email protected]
    DocumentRoot "d:/Apache2/htdocs/"
    ServerName code.mycompany.org
    ErrorLog "logs/src.mycompany.org-error.log"
    CustomLog "logs/src.mycompany.org-access.log" common
    SetOutputFilter DEFLATE

    <Location />
      DAV svn
      SVNParentPath D:\SVN
      AuthType Basic
      AuthName "My Repository"
      AuthUserFile conf/myteam.pwd
      Require valid-user
    </Location>   
</VirtualHost>
+2  A: 

I've worked this out myself using the SVN Book.

First, make sure you have some users setup in the AuthUserFile. Next, create a file for the authorization rules (conf/myteam.authz). Populate this file like this.

[groups]
my-developers = BrianLy
external-developers = JamesKL

[/]
@my-developers = rw

[repository-name-here:/path/here]
@external-developers = r

This creates 2 groups which are then assigned rights. My team has developer access to all repositories. The second rule specifies that the second group has limited access to a specific repository.

Then update your Apache configuration by adding this line below AuthUserFile

AuthzSVNAccessFile conf/myteam.authz

Re-start Apache (required)

BrianLy
Apache restart is needed - Apache only loads the config at startup.Good answer. I never quite had time to figure this out myself. +1
Paulius Maruška