我在Windows Server 2008上安装了Subversion。我想在pre-commit.bat中添加代码,以阻止域foo上域用户jdoe的提交。那段代码是什么样的?我假设它将使用C:\ Program Files(x86)\ VisualSVN Server \ bin \ svnlook。
答案 0 :(得分:1)
svnlook author,但不参与此废话 - 重新阅读有关基于路径的授权并撤消所需区域中所需用户的写访问权限。周期。
答案 1 :(得分:0)
这是我的pre-commit.bat。这很难看,但它确实有效。第一个检查阻止缺少注释的提交。第二个检查阻止用户jdoe提交。
@echo off
::
:: Stops commits that have empty log messages.
::
@echo off
setlocal
rem Subversion sends through the path to the repository and transaction id
set REPOS=%1
set TXN=%2
rem check for an empty log message
"C:\Program Files (x86)\VisualSVN Server\bin\svnlook" log %REPOS% -t %TXN% | findstr . > nul
if %errorlevel% gtr 0 (goto err) else (goto nextcheck)
rem block commits by user jdoe
:nextcheck
"C:\Program Files (x86)\VisualSVN Server\bin\svnlook" author %REPOS% -t %TXN% > c:\windows\temp\author.txt
set /p authorcommitting=<c:\windows\temp\author.txt
if %authorcommitting%==jdoe (goto err1) else exit 0
:err
echo. 1>&2
echo Your commit has been blocked because you didn't supply a log message 1>&2
echo. 1>&2
echo Please add a log message describing the reason for your changes and 1>&2
echo then commit. 1>&2
echo. 1>&2
exit 1
:err1
echo. 1>&2
echo Commits are blocked for this user 1>&2
echo. 1>&2
exit 1
答案 2 :(得分:0)
请详细阅读VisualSVN Server Getting Started指南和Configuring User Permissions部分。
VisualSVN Server提供用于管理用户权限的UI。您可以使用VisualSVN Server Manager MMC console,PowerShell或RepoCfg来管理权限。
不要忘记SVN服务器管理员和存储库管理员必须了解Subversion中的访问控制原则。阅读文章KB33: Understanding VisualSVN Server authorization以获取更多信息。