Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hook to make Subversion Read Only for specific users

Tags:

svn

We have an existing Subversion repository that uses LDAP to manage users/passwords. There are some new users who we would like to provide read-only access to SVN. I did some Google searches and found a way to open up read-only access to anonymous users, but this is not what we want. We do not want to open up SVN to everyone. We still want to control login through LDAP, but we would like to prevent certain named users from being able to add/edit/delete.

I am assuming this can be done with a hook (pre-commit?), but I have no experience writing hooks. Can someone show me or point me to an example of how to do this?

like image 392
Shane Avatar asked Dec 22 '25 07:12

Shane


1 Answers

I use an LDAP setup with config similar to:

in /etc/apache2/sites-enabled/mysite

<Location /svn>
  DAV svn
  SVNParentPath /var/svn
  SVNListParentPath on
  AuthBasicProvider ldap
  AuthType Basic
  AuthzLDAPAuthoritative Off
  AuthzSVNAccessFile "/var/svn/conf/svnaccess.conf"
  AuthName "My SVN"
  AuthLDAPBindDN "....."
  AuthLDAPBindPassword "....."
  AuthLDAPURL "....."
  Require valid-user
</Location>

/var/svn/conf/svnaccess.conf

[groups]
readonly = user1, user2

[/]
*=rw
@readonly=r
like image 174
Reuben Mallaby Avatar answered Dec 24 '25 10:12

Reuben Mallaby



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!