【发布时间】:2013-12-02 16:51:44
【问题描述】:
我团队中的一些开发人员发疯了……他们有时会删除文件。我被指派阻止他们这样做。 到目前为止,我尝试关注(Google 是我最好的朋友)
在“存储库访问规则”下,我已经
######################SVN Groups###################
[groups]
Admins:adm,bdm
DevGrp:abc,bob,rob
Choreograher:bob
Database:abc
##############Folder-Specific-Access-Rules#########
[temp:/trunk/]
@Admins=rw
[temp:/trunk/applications/branches/development/internal/branches]
@DevGrp=rw
[temp:/trunk/applications/branches/development/choreographer/trunk]
@Choreograher=rw
[temp:/trunk/applications/branches/development/databse/trunk]
@Database=rw
现在我需要从整个 svn 中撤销所有组(当然管理员除外)的删除权限。 我读到了https://github.com/qazwart/SVN-Precommit-Kitchen-Sink-Hook 但不知道如何使用两个不同的文件(Collabnet 自己的文件之一,不知道 itz 存储的位置和其他作为 pre-commit-hook 的文件)来控制访问规则。
在更改以下详细信息后,我只是尝试将 new-pre-commit-hook.pl 添加到我的挂钩列表中
SVNLOOK_DEFAULT => '/opt/csvn/bin/svnlook',
SVN_REPO_DEFAULT => '/opt/csvn/data/repositories/hooktest/',
.....
use constant { # Control File Type (package Control)
FILE_IN_REPO => "R",
FILE_ON_SERVER => "/opt/csvn/data/repositories/hooktest/hooks/access-control.ini",
};
.....
use constant VALID_ACCESSES => qw(ro rw ao nd na);
....
if ( $case eq "ignore" ? $file_name =~ /$regex/i : $file_name =~ /$regex/ ) {
if ( $access eq "rw" ) {
$permitted = 1;
}
elsif ( $access eq "ro" ) {
$permitted = 0;
$description = $file_rule->Description;
}
elsif ( $access eq "ao" ) {
$permitted = $change_type eq ADDED ? 1 : 0;
$description = $file_rule->Description if not $permitted;
}
elsif ( $access eq "na" ) {
$permitted = $change_type ne ADDED ? 1 : 0;
$description = $file_rule->Description if not $permitted;
}
elsif ( $access eq "nd" ) {
$permitted = $change_type ne DELETED ? 1 : 0;
$description = $file_rule->Description if not $permitted;
}
}
我先尝试了 tags 文件夹。
控制文件:access-control.ini
#SVN Permission Control File
##====================Legends====================##
# Abbr. Description
# ro read-only
# rw read-write
# ao add-only
# nd no-delete
# na no-add
##==============SVN Groups=======================##
[group superadmins]
users = adm,bdm
[group developers]
users = abc,bob,rob
[group all]
users = adm,bdm,abc,bob,rob
##===========Folder Specific Permissions=========##
[file]
file =/tags/**
access = ro
users = @all
[file]
file =/tags/*/*
access = ao
users = @superadmins
[file]
file =/tags/**
access = ro
users = @superadmins
但它没有工作。我对 perl 和 SVN 都很天真。请帮忙。 操作系统:Red Hat Enterprise Linux Server 6.3 版(圣地亚哥) 关于 Subversion Edge:版本:3.2.2
【问题讨论】:
标签: svn pre-commit-hook svn-hooks collabnet subversion-edge