SVN - user directory permissions

I use SVN (CollabNet Subversion Edge) and Tortoise SVN to manage a website edited by several people.

I would like to restrict the access of some users to certain directories (so that they do not see the credentials of the database, etc.). They only require read access to the same directory.

Is it possible to do this in SVN?

Thanks!

Edit

They run a combination of XP and Windows 7. The server is located in Windows 2008. The protocol used is http.

+4
source share
4 answers

This can be achieved using the svnaccess.conf file. Assuming you are using Windows domain authentication, here is one way to provide folder-level access to users. (sample section of svnaccess.conf file)

[repo: / trunk / samplefolder]

* =

@repo_restricted_users = r

@repo_super_users = rw

Here, repo_restricted_users and repo_super_users are user groups that must be defined earlier in the svnaccess.conf file - this way:

repo_restricted_users = john.doe, tom.riddle

repo_super_users = harry.potter, lord.voldemort

This will provide read access only to the samplefolder folder in the repository, while other folders will be closed. Hope this helps.

+7
source

Mike's related SVN book gives you a good overview of the available authentication methods.

If you are on Windows and do not mind switching the SVN server, VisualSVN Server is a free svn / Apache shell that can be installed in a few minutes and provides convenient control of users and access from the desktop point of view. I have been using it for many years and I like it.

+3
source

You can do what you want, regardless of the platform, by writing a so-called pre-fix hook. You can learn more about hooks in the svn book . Basically, you will be given the username and location of the update directories, as well as the opportunity to accept or not accept the transaction.

A good example of this can be found on this site . Basically, you'll want to use the script commit -access-control.pl, which is packaged with subversion, to perform a permission check for you. All you have to do is write a simple configuration file that describes where people can write and read.

If you use http with apache, then you can use the apach authz_svn module, which is described here in the book .

+1
source

If they need one directory, I think the easiest way is to create a second / different repository for it and include it with svn:externals in the "main" project (which will still make svn update also extract updates from another repository, etc.) .

+1
source

All Articles