Advertising sustains the DA. Ads are hidden for members. Join today

SVN authentication using mod_auth_mysql

Last updated on
30 April 2025

You are browsing documentation for an older version of Drupal, which is not supported any longer, and the information may not be correct. See current documentation for Contributed modules

Here's a tip by leop:

Note: There are several forks of mod_auth_mysql out there. The following documentation is based on the version found on http://modauthmysql.sourceforge.net/ . Unfortunately the version shipped with Debian and Ubuntu - and probably other distros as well - is incompatible.

On my website I use the svn module for Apache (mod_dav_svn). Together with the mod_auth_mysql module, this allows for the use of the accounts in the Drupal table for Subversion authentication. To get this working, I used the following code in the Apache configuration file where the Subversion authentication rules are specified:

  AuthType Basic
  AuthName "Repository Name"
  AuthMySQLEnable On
  AuthMySQLAuthoritative On

  #MySQL DB
  AuthMySQLHost localhost
  AuthMySQLDB ********
  AuthMySQLUser ********
  AuthMySQLPassword ********

  #User Tables
  AuthMySQLUserTable "users, users_roles"
  AuthMySQLNameField users.name
  AuthMySQLPasswordField users.pass
  AuthMySQLPwEncryption md5

  #Group Tables
  AuthMySQLGroupTable "users, role, users_roles"
  AuthMySQLGroupField role.rid

  #WHERE Clauses
  AuthMySQLUserCondition "users.status = 1 AND users.uid = users_roles.uid AND users_roles.rid IN (5, 6)"
  AuthMySQLGroupCondition "users_roles.uid = users.uid AND users_roles.rid = role.rid"

  #read access
  <Limit GET PROPFIND OPTIONS REPORT>
    Require valid-user
  </Limit>

  #write access
  <LimitExcept GET PROPFIND OPTIONS REPORT>
    Require group 5
  </LimitExcept>

In the above example, the role with rid 5 is allowed to write to the repository, while the role with rid 6 is only granted read access. No anonymous read access is granted.

Help improve this page

Page status: Not set

You can: