0

I have a Subversion repo hosted on a CentOS-based server. There are several teams who require access to different parts of the repository. I'd like to allow different users to see different parts of the repo, and hide other parts from them.

I'm aware it's possible to set per-directory permissions via path-based rules, so for example I can restrict the designer user to r/w on myrepo/myapp/media/images/ and myrepo/myapp/core/css/. But that means that the designer has to use those two specific URLs to access the images and css folders. He can't just use the root URL without me giving him read permission.

I'd like him to be able to navigate through the directory tree freely, but only seeing the folders to which he has access, and their parents.

If this was a regular filesystem, I'd use bind --mount commands to create a restricted set of directories inside /home/designer/ like /home/designer/css, /home/designer/images etc.

Can the same thing be done in an SVN repo?

At the very least, could I create a second, "virtual" repository which would contain folders (e.g. images, css) that virtually link to the true folders in the main repo?

1

Yes, it's possible and this is perfect use-case for SVN externals

In your situation it can be:

  • New physical folder in repo outside the usual tree
  • Some "logical" subfolders inside this DESIGNER-ROOT, created as links to real folders (in any other location inside repo or even in foreign repo) with externals

Checkout of DESIGNER-ROOT will bring all externals in WC of designer as real tree (which doesn't exist in repository), commit will transfer all data to real externals-sources

But beware: if you'll change (rename, move) externals sources after creating definitions, these changes will not be reflected automagically in definitions and you have to correct it by hand

0

There is nothing really to prevent this, but it is an odd case with a very high risk of failure. The repository will become inconsistent if the bind mounts are ever disturbed.

Whether this even works depends on how the repository is being accessed. However, it is not a supported case and it is not designed to work, and you should be using path rules.

I suggest what might happen if you muck with folder permissions or make bind mounts is that SVN checkout will just fail for the restricted user, and data would be exposed through the changelog anyway.

If this were me, I would break components into separate repositories.

  • Using path rules would require users to check out directories via their full (long) path, right? In a single case that's fine, but if you have multiple folders across a large codebase, it would be inconvenient and hard to keep track of. So are you suggesting that using mounts to create another repo might work? I've not thought of that; I only mentioned mounts as a comparison. – WackGet Sep 9 '15 at 12:34
  • I don't know why you want to use mounts at all. – Falcon Momot Sep 9 '15 at 19:31
  • Imagine I have 10 directories out of my entire codebase I want the designer user to be able to access. I don't want him to be able to read the contents of any other directories. If I use path-based rules, the designer has to use 10 different specific URLs to access the folders. If I could somehow mount those 10 folders into one "virtual" repo just for the designer, he only has to access one repo and see all 10 folders (and nothing else). Does that clarify? – WackGet Sep 9 '15 at 22:25
  • Yes, but your plan will not work. – Falcon Momot Sep 9 '15 at 22:43

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.