SVN-用户目录权限
我正在使用 SVN (CollabNet Subversion Edge) 和 Tortoise SVN 来管理由多人编辑的网站。
我想限制某些用户对某些目录的访问(以防止他们看到数据库凭据等)。它们只需要对一个目录的读取权限。
在SVN中可以做到这一点吗?
谢谢!
编辑
他们运行的是 XP 和 Windows 7 的混合操作系统。服务器运行的是 Windows 2008。 使用的协议是http。
I'm using SVN (CollabNet Subversion Edge) and Tortoise SVN to manage a website being edited by multiple people.
I'd like to limit access by some users to some directories (to prevent them seeing database credentials etc). They only require read access to one directory.
Is it possible to do this in SVN?
Thanks!
Edit
They are running a mix of XP and Windows 7. The server is on Windows 2008.
The protocol being used is http.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
如果他们需要一个目录,我认为最简单的方法是为此创建第二个/其他存储库,并将其与 svn:externals 一起包含在“主”项目中(这仍然会使
svn update 还可以从其他存储库获取更新等)。
If they need a single directory, I think easiest would be to create a second / other repository for that, and including it with
svn:externals
in the 'main' project (which will still makesvn update
also fetch updates from the other repository etc.).Mike 链接的 SVN 书籍为您提供了可用身份验证方法的良好概述。
如果您使用的是 Windows 并且不介意切换 SVN 服务器,VisualSVN Server 是一个免费的 svn/Apache 包装器可以在几分钟内安装完毕,并提供极其简单的点击式用户/访问管理。我已经使用它很多年了,我喜欢它。
The SVN book as linked by Mike gives you a good overview over the authentication methods available.
If you are on Windows and don't mind switching the SVN server, VisualSVN Server is a free svn/Apache wrapper that can be installed within minutes, and provides brain-dead easy point-and-click user/access management. I've been using it for years and I love it.
您可以通过编写所谓的预提交挂钩,以独立于平台的方式执行您想要的操作。您可以在svn 书籍中阅读有关挂钩的更多信息。基本上,您将获得用户名和更新的目录位置,并且能够决定是否接受交易。
一个很好的例子可以在 此网站。基本上,您需要使用与 subversion 一起打包的脚本 commit-access-control.pl 来为您执行权限检查。您所要做的就是编写一个简单的配置文件来描述人们可以在哪里写入和读取。
如果您碰巧在 apache 中使用 http,那么您可以使用 authz_svn apache 模块描述 在本书中。
You can do what you want in a platform independent way by writing what is called a pre-commit hook. You can read more about hooks in the svn book. Basically, you will be given the user name and the directory location of the updates, and have the ability to decide whether or not to accept the transaction.
A good example of this is found on this site. Basically, you will want to use the script commit-access-control.pl, which is packaged with subversion, to perform the permission check for you. All you have to do is write a simple configuration file which describe where people can write and read.
If you happen to be using http with apache, then you can use the authz_svn apache module describe here in the book.
这可以通过使用 svnaccess.conf 文件来实现。假设您使用 Windows 域身份验证,以下是向 Windows 用户提供文件夹级访问权限的一种方法。
(svnaccess.conf 文件的示例部分)
[repo:/trunk/samplefolder]
*=
@repo_restricted_users = r
@repo_super_users = rw
这里,repo_restricted_users 和 repo_super_users 是必须在 svnaccess.conf 文件中之前定义的用户组 - 因此:
repo_restricted_users = john.doe, tom.riddle
repo_super_users = harry.potter, lord.voldemort
这将提供对存储库中文件夹samplefolder 的读取访问权限,同时保持其他文件夹关闭。希望这有帮助。
This can be achieved by using the svnaccess.conf file. Assuming you use windows domain authentication, here is one way to provide folder-level access to windows users.
(a sample section of the svnaccess.conf file)
[repo:/trunk/samplefolder]
*=
@repo_restricted_users = r
@repo_super_users = rw
Here, repo_restricted_users and repo_super_users are user groups which must be defined earlier in the svnaccess.conf file - thus:
repo_restricted_users = john.doe, tom.riddle
repo_super_users = harry.potter, lord.voldemort
This will provide read access to just the folder samplefolder within the repository while keeping other folders closed. Hope this helps.