User permissions for add/remove a file/folder in svn

2.4k views Asked by At

I have a requirement that I need to control the permission to add/delete(not read/modify/write) a file in svn. I checked if svn access control has ways to do it. But it does not seems to have this kind of restriction.

I was checking for some precommits which can do this operation and round the svnperms hook has this functionality. However it also has the similar implementation of access control, so I am not sure if I want to use this in combination with the access control script.

So can I have some suggestion on the best way to implement add/remove permissions for users ?

1

There are 1 answers

2
David W. On

I have a Perl pre-commit hook that allows you to set "add" access. This is mainly used for tags (You can create a tag, but not modify a tag), but I imagine it could be to check to see if a specific file was added. I don't have specific delete only access in my pre-commit hook although this shouldn't be too difficult to add.

My preference has been to use the server's access control list to give read/write access to the repository, then take away write access via my pre-commit hook. (There's no pre-checkout hook, so there's no way to prevent read access in a hook itself.)

Feel free to take a look at it and see if you can add the "add-delete" access you need. Shouldn't be too difficult. I pretty much take the output of svnserve log and parse that to find out if a file has been added, deleted, modified, etc.