3

Does anyone know if there is any API exposed to manage repository permissions within SharpSVN? For example, programatically adding read and write permissions on a per repository basis.

Alternatively, any other thoughts on managing permissions with other SVN APIs? Worst case wil be manually managing the contents of svnaccessfile but this is a last resort. Thanks.

Paul Roub
  • 36,322
  • 27
  • 84
  • 93
Troy Hunt
  • 20,345
  • 13
  • 96
  • 151
  • If you use VisualSVN Server 3.4 or newer then you can use its PowerShell cmdlets for access rules management: https://www.visualsvn.com/support/topic/00088/ – bahrep Jan 08 '16 at 13:11

2 Answers2

2

It looks like that because SharpSvn is just a .NET API wrapper around the Subversion command line tool and this does not include a mechanism for managing permissions, this is not doable (see here). Different Subversion distributions manage permissions in different fashions so approaches to controlling this outside of SharpSvn will differ.

Visual SVN server utilises an authz-windows file in the root of the repository for managing AD based permissions. It stores the SID of the user against the repo name all in plain text so I’ve worked around the API problem by just managing the contents of this file directly. Not as elegant as I was hoping for but the end result is the same.

Troy Hunt
  • 20,345
  • 13
  • 96
  • 151
0

As @TroyHunt posted, it is not possible to use SharpSVN to manage Subversion access rules. In fact, every Subversion+Apache server that uses mod_authz_svn can be configured to use a number of authorization lists. They can be per-repository authz files, authz files for the whole sever instance or even in-repo authz files (available beginning with Subversion 1.8). Therefore, there is no standard way for access rules management that will suit all Subversion installations. However, you can always write your own script specifically for your Subversion server installation just because Subversion authz files have a very simple format.

The original answer implies that you were using VisualSVN Server. In such case I have good news for you because VisualSVN Server 3.4 introduced a number of PowerShell cmdlets for server and repos administration. In the most recent 3.5 release, there are actually 29 cmdlets and cmdlets to manage access rules are among them:

For more information about the cmdlets and usage examples, please read the article KB88: VisualSVN Server PowerShell Cmdlet Reference.

bahrep
  • 29,961
  • 12
  • 103
  • 150
  • 7
    This looks much more like an advertisement than an answer, especially as it doesn't actually answer the specific question being posed. You knew that, of course. Tacking this on to a tangentially related question just looks... spammy. Can you make it more like an answer to this question? – Mogsdad Jan 08 '16 at 16:20
  • @Mogsdad The original answer and question by TroyHunt implies that he is using VisualSVN Server. Therefore, the answer is pretty valid IMO. – bahrep Jan 08 '16 at 16:33