如果還沒有配置好mac伺服器的童靴,請看上篇mac下配置svn伺服器詳解及使用者的權限管理(親測)。由于時間關系,上次沒有寫完,該篇把使用者的權限管理補上。
1. 在終端進入svn配置檔案目錄, 對authz檔案進行編輯
martins-mac:Users mac22$ cd /Users/mac22/svn/repository/conf/
martins-mac:conf mac22$ ls
authz passwd svnserve.conf
martins-mac:conf mac22$ vi authz
2. 使用者權限檔案authz修改如下
### This file is an example authorization file for svnserve.
### Its format is identical to that of mod_authz_svn authorization
### files.
### As shown below each section defines authorizations for the path and
### (optional) repository specified by the section name.
### The authorizations follow. An authorization line can refer to:
### - a single user,
### - a group of users defined in a special [groups] section,
### - an alias defined in a special [aliases] section,
### - all authenticated users, using the '$authenticated' token,
### - only anonymous users, using the '$anonymous' token,
### - anyone, using the '*' wildcard.
###
### A match can be inverted by prefixing the rule with '~'. Rules can
### grant read ('r') access, read-write ('rw') access, or no access
### ('').
[aliases]
# joe = /C=XZ/ST=Dessert/L=Snake City/O=Snake Oil, Ltd./OU=Research Institute/CN=Joe Average
# 使用者組
[groups]
# admins是組名,admin是組員,可以寫多個,用逗号分隔.如admins=admin,master
admins=admin
ios=jack,martin,tom,story5
android=jason,lili,marry
unity3d=steven,david
# harry_and_sally = harry,sally
# harry_sally_and_joe = harry,sally,&joe
# [/foo/bar]
# harry = rw
# &joe = r
# * =
[/]
# 這裡的意思是admins組的成員都有rw的權限,rw是讀寫得權限,也可以寫成admin=rw,隻賦予某一個使用者有讀寫權限
@admins=rw
# 我的根目錄svnroot,你上傳svn://localhost:3369/svnroot或svn://localhost/svnroot
[/svnroot]
# 如果這裡與/是同一個使用者或組的話,可以不寫
@admins=rw
# 這裡的目錄一定要對清楚,我就是沒有搞清楚,是以搞了很久,因為我這裡少了一級目錄,一定要寫全,否則設定權限就是徒勞了,比如我的svn位址是svn://localhost/svnroot/dev/ios 你這裡就要對應[/svnroot/dev/ios]
[/svnroot/ios]
@ios=rw
[/svnroot/android]
@android=rw
# 比如martin這個員工技術比較全,他除了會搞ios,還會搞android,這裡給他單獨開了一個android目錄的讀寫權限
martin=rw
[svnroot/unity3d]
@unity3d=rw
# 這裡如果不寫的意思是,下一級目錄的使用者不具備繼承關系,也就是沒有通路/的權限,* = r,就是别的使用者隻能遠觀了, * = rw,就讓其他的使用者也有繼承關系了,>就是也可具備讀寫權限
# * =
# [repository:/baz/fuz]
# @harry_and_sally = rw
# * = r
這樣寫基本已經可以完成大部分的需求了,如果需要添加其他功能,可以看 星辰的天空的部落格園。
這裡在提醒大家一點:上面的注釋#不能和具體設定寫在一起,如:martin=rw #.....,這樣它會忽視前面的内容,要注釋就按上面的注釋
3. 最後再附上一張svn伺服器的目錄,讓大家能夠圖文并茂

好了,今天就寫到這裡,有什麼問題和建議請給我留言,謝謝!