Subversion: Custom permission each user on specific folder in a repo

Ngày 9 tháng 9 năm 2014 Trương Chương Dương
You can custom read/write a specific user on a subfolder in side a repo, it will overwrite the global permission.
Such as:
  • User harry will have full permission on repo svn://localhost/myproject/trunk but not able to write/commit into svn://localhost/myproject/release
  • User tom can read on both above branch but can commit only on svn://localhost/myproject/release
  • And so on...

Here is the solution:
  1. Open the file conf/svnserve.conf inside your repo folder
  2. Find and uncomment below line:
    authz-db = authz
  3. Create/Open file authz on same folder with svnserve.conf
  4. Create groups for users, such as I have 2 groups one is developer who can commit into trunk and deploymanager who can commit into release:
    [groups]
    # harry, dev1, dev2,  tom and man1 are username which is wrote in password-db, see this page if you don't know how to do it
    developer = harry, dev1, dev2
    deploymanager = tom, man1
    
  5. Then specific the permission for each folder by add below line into bottom of authz file created above:
    #Allow all user can read root folder, change myproject to your repo name
    [myproject:/]
    * = r
    
    [myproject:/trunk]
    @developer = rw
    @deploymanager = r
    
    [myproject:/release]
    @developer = 
    @deploymanager = rw
    
  6. Restart your svnserv service to update the new setting
Đang tải dữ liệu...