]>
Commit | Line | Data |
---|---|---|
06f52359 | 1 | This document describes how to use group-based authorization using my |
2 | version of mod_auth_mysql.c. This version is based heavily on my own | |
3 | version of mod_auth_msql.c, which was widely distributed prior to the | |
4 | one currently shipped with Apache. | |
5 | ||
6 | There are two options to using groups. You can put the "user_group" | |
7 | field into the same table as the user database if each user is in only | |
8 | one group, or you can have a separate table that contains the fields | |
9 | "user_name" and "user_group" if each user is a member of multiple | |
10 | groups. | |
11 | ||
12 | If the user_group field is part of the full user table, the table has | |
13 | three fields at least: user_name, user_group, user_passwd. The | |
14 | user_group field must be "PRIMARY KEY" in the user database containing | |
15 | a password. The htaccess file would be this: | |
16 | ||
17 | AuthName My Authorization | |
18 | AuthType Basic | |
19 | AuthGroupFile /dev/null | |
20 | AuthMySQLHost localhost | |
21 | AuthMySQLDB authdata | |
22 | AuthMySQLUserTable user_info | |
23 | AuthMySQLGroupField user_group | |
24 | require group admin | |
25 | ||
26 | If you have a separate database for groups, the two tables would be | |
27 | ||
28 | user_info: user_name, user_passwd (user_name must be PRIMARY KEY) | |
29 | user_group: user_name, user_group (user is not PRIMARY KEY, as we have | |
30 | multiple tuples for user_name,user_group to let a user be in | |
31 | multiple groups) | |
32 | ||
33 | and htaccess would have this: | |
34 | ||
35 | AuthName My Authorzation | |
36 | AuthType Basic | |
37 | AuthGroupFile /dev/null | |
38 | AuthMySQLHost localhost | |
39 | AuthMySQLDB authdata | |
40 | AuthMySQLUserTable user_info | |
41 | ||
42 | AuthMySQLGroupTable my_groups | |
43 | AuthMySQLGroupField user_group | |
44 | require group admin | |
45 | ||
46 | ||
47 | ||
48 | Assuming that the required group name is "admin". |