Parent Directory
|
Revision Log
Revision 1806 - (view) (download)
| 1 : | sh002i | 1696 | #!perl |
| 2 : | ################################################################################ | ||
| 3 : | # WeBWorK Online Homework Delivery System | ||
| 4 : | # Copyright © 2000-2003 The WeBWorK Project, http://openwebwork.sf.net/ | ||
| 5 : | sh002i | 1806 | # $CVSHeader: webwork-modperl/conf/database.conf.dist,v 1.6 2004/02/14 00:53:17 sh002i Exp $ |
| 6 : | sh002i | 1696 | # |
| 7 : | # This program is free software; you can redistribute it and/or modify it under | ||
| 8 : | # the terms of either: (a) the GNU General Public License as published by the | ||
| 9 : | # Free Software Foundation; either version 2, or (at your option) any later | ||
| 10 : | # version, or (b) the "Artistic License" which comes with this package. | ||
| 11 : | # | ||
| 12 : | # This program is distributed in the hope that it will be useful, but WITHOUT | ||
| 13 : | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
| 14 : | # FOR A PARTICULAR PURPOSE. See either the GNU General Public License or the | ||
| 15 : | # Artistic License for more details. | ||
| 16 : | ################################################################################ | ||
| 17 : | |||
| 18 : | =head1 NAME | ||
| 19 : | |||
| 20 : | database.conf - define stantad database layouts | ||
| 21 : | |||
| 22 : | =head1 SYNOPSIS | ||
| 23 : | |||
| 24 : | In global.conf: | ||
| 25 : | |||
| 26 : | include "conf/database.conf"; | ||
| 27 : | *dbLayout = $dbLayouts{layoutName}; | ||
| 28 : | |||
| 29 : | =head1 DESCRIPTION | ||
| 30 : | |||
| 31 : | This file contains definitions for the commonly-used database layouts. Database | ||
| 32 : | layouts consist of all the information necessary to describe how to access data | ||
| 33 : | used by WeBWorK. For more information on the format of a database layout, | ||
| 34 : | consult the documentation for the WeBWorK::DB module. | ||
| 35 : | |||
| 36 : | A database layout is selected from the list of possible layouts by adding a | ||
| 37 : | line like the one below to the F<global.conf> or F<course.conf> file. | ||
| 38 : | |||
| 39 : | *dbLayout = $dbLayouts{layoutName}; | ||
| 40 : | |||
| 41 : | =cut | ||
| 42 : | |||
| 43 : | %dbLayouts = (); # layouts are added to this hash below | ||
| 44 : | |||
| 45 : | =head1 THE SQL DATABASE LAYOUT ($dbLayouts{sql}) | ||
| 46 : | |||
| 47 : | The SQL database layout uses an SQL database server to store the tables of the | ||
| 48 : | WeBWorK database. The SQL driver uses two SQL accounts, a read only and a | ||
| 49 : | read-write account. The read-only account must have C<SELECT> access, and the | ||
| 50 : | read-write account needs C<SELECT>, C<INSERT>, C<UPDATE>, and C<DELETE> access. | ||
| 51 : | The names and passwords of these accounts are given as parameters to each table | ||
| 52 : | in the layout. | ||
| 53 : | |||
| 54 : | usernameRO the name of the read-only account | ||
| 55 : | usernameRW the name of the read-write account | ||
| 56 : | passwordRO the password for the read-only account | ||
| 57 : | passwordRW the password for the read-write account | ||
| 58 : | |||
| 59 : | sh002i | 1698 | Be default, the name of the read-only account is "webworkRead", and the name of |
| 60 : | the read-write account is "webworkWrite". There are no passwords by default. | ||
| 61 : | It is not recommended that you use only passwords to secure database access. | ||
| 62 : | Most RDBMSs allow IP-based authorization as well. As the system administrator, | ||
| 63 : | IT IS YOUR RESPONSIBILITY TO SECURE DATABASE ACCESS. | ||
| 64 : | |||
| 65 : | sh002i | 1696 | Don't confuse the accounts above with the accounts of the users of a course. |
| 66 : | These are system-wide accounts which allow WeBWorK to talk to the database | ||
| 67 : | server. | ||
| 68 : | |||
| 69 : | Other parameters that can be given are as follows: | ||
| 70 : | |||
| 71 : | tableOverride an alternate name to use when referrring to the table (used | ||
| 72 : | when a table name is a resereved word) | ||
| 73 : | fieldOverride a hash mapping WeBWorK field names to alternate names to use | ||
| 74 : | when referring to those fields (used when one or more field | ||
| 75 : | names are reserved words) | ||
| 76 : | debug if true, SQL statments are printed before being executed | ||
| 77 : | |||
| 78 : | =cut | ||
| 79 : | |||
| 80 : | my %sqlParams = ( | ||
| 81 : | usernameRO => "webworkRead", | ||
| 82 : | sh002i | 1698 | passwordRO => "", |
| 83 : | sh002i | 1696 | usernameRW => "webworkWrite", |
| 84 : | sh002i | 1698 | passwordRW => "", |
| 85 : | sh002i | 1696 | debug => 0, |
| 86 : | ); | ||
| 87 : | |||
| 88 : | $dbLayouts{sql} = { | ||
| 89 : | password => { | ||
| 90 : | record => "WeBWorK::DB::Record::Password", | ||
| 91 : | schema => "WeBWorK::DB::Schema::SQL", | ||
| 92 : | driver => "WeBWorK::DB::Driver::SQL", | ||
| 93 : | source => "dbi:mysql:webwork_$courseName", | ||
| 94 : | params => { %sqlParams }, | ||
| 95 : | }, | ||
| 96 : | permission => { | ||
| 97 : | record => "WeBWorK::DB::Record::PermissionLevel", | ||
| 98 : | schema => "WeBWorK::DB::Schema::SQL", | ||
| 99 : | driver => "WeBWorK::DB::Driver::SQL", | ||
| 100 : | source => "dbi:mysql:webwork_$courseName", | ||
| 101 : | params => { %sqlParams }, | ||
| 102 : | }, | ||
| 103 : | key => { | ||
| 104 : | record => "WeBWorK::DB::Record::Key", | ||
| 105 : | schema => "WeBWorK::DB::Schema::SQL", | ||
| 106 : | driver => "WeBWorK::DB::Driver::SQL", | ||
| 107 : | source => "dbi:mysql:webwork_$courseName", | ||
| 108 : | params => { | ||
| 109 : | %sqlParams, | ||
| 110 : | tableOverride => "key_not_a_keyword", | ||
| 111 : | fieldOverride => { key => "key_not_a_keyword" }, | ||
| 112 : | }, | ||
| 113 : | }, | ||
| 114 : | user => { | ||
| 115 : | record => "WeBWorK::DB::Record::User", | ||
| 116 : | schema => "WeBWorK::DB::Schema::SQL", | ||
| 117 : | driver => "WeBWorK::DB::Driver::SQL", | ||
| 118 : | source => "dbi:mysql:webwork_$courseName", | ||
| 119 : | params => { %sqlParams }, | ||
| 120 : | }, | ||
| 121 : | set => { | ||
| 122 : | record => "WeBWorK::DB::Record::Set", | ||
| 123 : | schema => "WeBWorK::DB::Schema::SQL", | ||
| 124 : | driver => "WeBWorK::DB::Driver::SQL", | ||
| 125 : | source => "dbi:mysql:webwork_$courseName", | ||
| 126 : | params => { | ||
| 127 : | %sqlParams, | ||
| 128 : | tableOverride => "set_not_a_keyword" | ||
| 129 : | }, | ||
| 130 : | }, | ||
| 131 : | set_user => { | ||
| 132 : | record => "WeBWorK::DB::Record::UserSet", | ||
| 133 : | schema => "WeBWorK::DB::Schema::SQL", | ||
| 134 : | driver => "WeBWorK::DB::Driver::SQL", | ||
| 135 : | source => "dbi:mysql:webwork_$courseName", | ||
| 136 : | params => { %sqlParams }, | ||
| 137 : | }, | ||
| 138 : | problem => { | ||
| 139 : | record => "WeBWorK::DB::Record::Problem", | ||
| 140 : | schema => "WeBWorK::DB::Schema::SQL", | ||
| 141 : | driver => "WeBWorK::DB::Driver::SQL", | ||
| 142 : | source => "dbi:mysql:webwork_$courseName", | ||
| 143 : | params => { %sqlParams }, | ||
| 144 : | }, | ||
| 145 : | problem_user => { | ||
| 146 : | record => "WeBWorK::DB::Record::UserProblem", | ||
| 147 : | schema => "WeBWorK::DB::Schema::SQL", | ||
| 148 : | driver => "WeBWorK::DB::Driver::SQL", | ||
| 149 : | source => "dbi:mysql:webwork_$courseName", | ||
| 150 : | params => { %sqlParams }, | ||
| 151 : | }, | ||
| 152 : | }; | ||
| 153 : | |||
| 154 : | =head1 THE GDBM DATABASE LAYOUT ($dbLayouts{gdbm}) | ||
| 155 : | |||
| 156 : | This layout uses the traditional WeBWorK 1.x database format, using the GDBM | ||
| 157 : | file format. Use this layout if you wish to share courses between WeBWorK 1.x | ||
| 158 : | and WeBWorK 2. | ||
| 159 : | |||
| 160 : | sh002i | 1800 | The C<globalUserID> parameter given for the C<set> and C<problem> tables denotes |
| 161 : | the ID of the user that the GlobalTableEmulator will use to store data for the | ||
| 162 : | C<set> and C<problem> tables. This is set to "global_user" by default. | ||
| 163 : | sh002i | 1696 | |
| 164 : | sh002i | 1800 | If a course will be used under WeBWorK 1.x, this value should be overridden on a |
| 165 : | course-by-course basis to the ID of the professor who is most likely to be | ||
| 166 : | involved in creating new problem sets. Sets which have not been assigned will | ||
| 167 : | only be visible to this user when logging into WeBWorK 1.x. | ||
| 168 : | |||
| 169 : | sh002i | 1696 | Use the following code to override these values in a course's F<course.conf> |
| 170 : | file: | ||
| 171 : | |||
| 172 : | sh002i | 1800 | $dbLayouts{sql}->{set}->{params}->{globalUserID} = "some_user"; |
| 173 : | $dbLayouts{sql}->{problem}->{params}->{globalUserID} = "some_user"; | ||
| 174 : | sh002i | 1696 | |
| 175 : | =cut | ||
| 176 : | |||
| 177 : | my %gdbmGlobalTableParams = ( | ||
| 178 : | sh002i | 1806 | globalUserID => "global_user", |
| 179 : | sh002i | 1696 | ); |
| 180 : | |||
| 181 : | my %gdbmUserSpecificTableParams = ( | ||
| 182 : | sh002i | 1700 | psvnLength => 5, |
| 183 : | sh002i | 1696 | ); |
| 184 : | |||
| 185 : | $dbLayouts{gdbm} = { | ||
| 186 : | password => { | ||
| 187 : | record => "WeBWorK::DB::Record::Password", | ||
| 188 : | schema => "WeBWorK::DB::Schema::Auth1Hash", | ||
| 189 : | driver => "WeBWorK::DB::Driver::GDBM", | ||
| 190 : | source => "$courseDirs{auth_DATA}/$courseName\_password_DB", | ||
| 191 : | }, | ||
| 192 : | permission => { | ||
| 193 : | record => "WeBWorK::DB::Record::PermissionLevel", | ||
| 194 : | schema => "WeBWorK::DB::Schema::Auth1Hash", | ||
| 195 : | driver => "WeBWorK::DB::Driver::GDBM", | ||
| 196 : | source => "$courseDirs{auth_DATA}/$courseName\_permissions_DB", | ||
| 197 : | }, | ||
| 198 : | key => { | ||
| 199 : | record => "WeBWorK::DB::Record::Key", | ||
| 200 : | schema => "WeBWorK::DB::Schema::Auth1Hash", | ||
| 201 : | driver => "WeBWorK::DB::Driver::GDBM", | ||
| 202 : | source => "$courseDirs{auth_DATA}/keys", | ||
| 203 : | }, | ||
| 204 : | user => { | ||
| 205 : | record => "WeBWorK::DB::Record::User", | ||
| 206 : | schema => "WeBWorK::DB::Schema::Classlist1Hash", | ||
| 207 : | driver => "WeBWorK::DB::Driver::GDBM", | ||
| 208 : | source => "$courseDirs{DATA}/$courseName\_classlist_DB", | ||
| 209 : | }, | ||
| 210 : | set => { | ||
| 211 : | record => "WeBWorK::DB::Record::Set", | ||
| 212 : | schema => "WeBWorK::DB::Schema::GlobalTableEmulator", | ||
| 213 : | driver => "WeBWorK::DB::Driver::Null", | ||
| 214 : | params => { %gdbmGlobalTableParams }, | ||
| 215 : | }, | ||
| 216 : | set_user => { | ||
| 217 : | record => "WeBWorK::DB::Record::UserSet", | ||
| 218 : | schema => "WeBWorK::DB::Schema::WW1Hash", | ||
| 219 : | driver => "WeBWorK::DB::Driver::GDBM", | ||
| 220 : | source => "$courseDirs{DATA}/$courseName\_webwork_DB", | ||
| 221 : | params => { %gdbmUserSpecificTableParams }, | ||
| 222 : | }, | ||
| 223 : | problem => { | ||
| 224 : | record => "WeBWorK::DB::Record::Problem", | ||
| 225 : | schema => "WeBWorK::DB::Schema::GlobalTableEmulator", | ||
| 226 : | driver => "WeBWorK::DB::Driver::Null", | ||
| 227 : | params => { %gdbmGlobalTableParams }, | ||
| 228 : | }, | ||
| 229 : | problem_user => { | ||
| 230 : | record => "WeBWorK::DB::Record::UserProblem", | ||
| 231 : | schema => "WeBWorK::DB::Schema::WW1Hash", | ||
| 232 : | driver => "WeBWorK::DB::Driver::GDBM", | ||
| 233 : | source => "$courseDirs{DATA}/$courseName\_webwork_DB", | ||
| 234 : | params => { %gdbmUserSpecificTableParams }, | ||
| 235 : | }, | ||
| 236 : | }; |
| aubreyja at gmail dot com | ViewVC Help |
| Powered by ViewVC 1.0.9 |