6

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 ?

pmod
  • 9,152
  • 1
  • 32
  • 45
Version Control Buddy
  • 1,416
  • 10
  • 14
  • Would http://stackoverflow.com/questions/81361/how-to-setup-access-control-in-svn/83418#83418 help? – VonC Apr 15 '11 at 10:47
  • VonC: In general the access control talked in the above link have control over read/write permissions. It does not have any control over Add or delete. I am looking for a solution which can let me have a control over add/delete. May be I will clarify this in my original post also. – Version Control Buddy Apr 15 '11 at 14:06
  • good point, I must have read your question a bit too quickly ;) – VonC Apr 15 '11 at 14:25
  • use CVS and chmod 555 the directory in question =) No one ever gives CVS any credit anymore. – FoneyOp Apr 15 '11 at 15:06
  • I would have suggested something like Path-Based Authorization to grant read-only to the directory, then read/write to the files a user can modify, but it doesn't seem SVN supports permissions to specific files? – walkingTarget Apr 15 '11 at 15:32

1 Answers1

2

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.

David W.
  • 98,713
  • 36
  • 205
  • 318
  • Thanks for your answer, however I am not able to access the URL. Can you please check? – Version Control Buddy Apr 18 '11 at 05:58
  • @Version Control Buddy: I just checked and the URL is fine. I can download it from Windows and Macs on various ISPs. This is from my Dropbox and some companies have blocked Dropbox. Could this be an issue? Can you get to http://dropbox.com? If this is the case, can you download it from a place besides work? – David W. Apr 21 '11 at 04:08