SharpSVN 是否有 API 来管理存储库权限
有谁知道 SharpSVN 中是否有公开的 API 来管理存储库权限? 例如,以编程方式在每个存储库的基础上添加读取和写入权限。
或者,对于使用其他 SVN API 管理权限还有其他想法吗? 最坏的情况是手动管理 svnaccessfile 的内容,但这是最后的手段。 谢谢。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看起来是因为 SharpSvn 只是 Subversion 命令行工具的 .NET API 包装器,并且不包含管理权限的机制,所以这是不可行的(请参阅 此处)。 不同的 Subversion 发行版以不同的方式管理权限,因此在 SharpSvn 之外控制权限的方法会有所不同。
Visual SVN 服务器利用存储库根目录中的 authz-windows 文件来管理基于 AD 的权限。 它以纯文本形式存储用户的 SID 与存储库名称,因此我通过直接管理该文件的内容来解决 API 问题。 不像我希望的那么优雅,但最终结果是一样的。
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.
正如 @TroyHunt 所发布的,不可能使用 SharpSVN 来管理 Subversion 访问规则。 事实上,每个使用 mod_authz_svn 的 Subversion+Apache 服务器都可以配置为使用多个授权列表。 它们可以是每个存储库的 authz 文件、整个服务器实例的 authz 文件,甚至是存储库内的 authz 文件(从 Subversion 1.8 开始提供)。 因此,没有适合所有 Subversion 安装的访问规则管理标准方法。 但是,您始终可以专门为 Subversion 服务器安装编写自己的脚本,因为 Subversion authz 文件的格式非常简单。
原始答案暗示您正在使用 VisualSVN Server。 在这种情况下,我有个好消息要告诉您,因为 VisualSVN Server 3.4 引入了许多用于服务器和存储库管理的 PowerShell cmdlet。 在最新的 3.5 版本中,实际上有 29 个 cmdlet,其中有用于管理访问规则的 cmdlet:
添加-SvnAccessRule
Get-SvnAccessRule
选择-SvnAccessRule
Set-SvnAccessRule
Remove-SvnAccessRule
有关 cmdlet 和使用示例的更多信息,请阅读文章 KB88:VisualSVN Server PowerShell Cmdlet参考。
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:
Add-SvnAccessRule
Get-SvnAccessRule
Select-SvnAccessRule
Set-SvnAccessRule
Remove-SvnAccessRule
For more information about the cmdlets and usage examples, please read the article KB88: VisualSVN Server PowerShell Cmdlet Reference.