[system] / trunk / webwork-modperl / conf / database.conf.dist Repository:
ViewVC logotype

View of /trunk/webwork-modperl/conf/database.conf.dist

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1787 - (download) (annotate)
Thu Feb 12 04:25:47 2004 UTC (9 years, 3 months ago) by sh002i
File size: 8141 byte(s)
strings containing email addresses are now single-quoted
globalUserID is now "globaluser"

    1 #!perl
    2 ################################################################################
    3 # WeBWorK Online Homework Delivery System
    4 # Copyright © 2000-2003 The WeBWorK Project, http://openwebwork.sf.net/
    5 # $CVSHeader: webwork-modperl/conf/database.conf.dist,v 1.4 2004/01/05 00:11:07 sh002i Exp $
    6 #
    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 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 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   passwordRO => "",
   83   usernameRW => "webworkWrite",
   84   passwordRW => "",
   85   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 The C<globalUserID> parameter given for the C<set> and C<problem> tables
  161 denotes the ID of the user that the GlobalTableEmulator will use to store data
  162 for the C<set> and C<problem> tables. This is set to "professor" by default,
  163 but should be overridden on a course-by-course basis to the ID of the professor
  164 who is most likely to be involved in creating new problem sets. Sets which have
  165 not been assigned will only be visible to this user when logging into WeBWorK
  166 1.x.
  167 
  168 Use the following code to override these values in a course's F<course.conf>
  169 file:
  170 
  171  $dbLayout{set}->{params}->{globalUserID} = "some_user";
  172  $dbLayout{problem}->{params}->{globalUserID} = "some_user";
  173 
  174 =cut
  175 
  176 my %gdbmGlobalTableParams = (
  177   globalUserID => "globaluser",
  178 );
  179 
  180 my %gdbmUserSpecificTableParams = (
  181   psvnLength => 5,
  182 );
  183 
  184 $dbLayouts{gdbm} = {
  185   password => {
  186     record => "WeBWorK::DB::Record::Password",
  187     schema => "WeBWorK::DB::Schema::Auth1Hash",
  188     driver => "WeBWorK::DB::Driver::GDBM",
  189     source => "$courseDirs{auth_DATA}/$courseName\_password_DB",
  190   },
  191   permission => {
  192     record => "WeBWorK::DB::Record::PermissionLevel",
  193     schema => "WeBWorK::DB::Schema::Auth1Hash",
  194     driver => "WeBWorK::DB::Driver::GDBM",
  195     source => "$courseDirs{auth_DATA}/$courseName\_permissions_DB",
  196   },
  197   key => {
  198     record => "WeBWorK::DB::Record::Key",
  199     schema => "WeBWorK::DB::Schema::Auth1Hash",
  200     driver => "WeBWorK::DB::Driver::GDBM",
  201     source => "$courseDirs{auth_DATA}/keys",
  202   },
  203   user => {
  204     record => "WeBWorK::DB::Record::User",
  205     schema => "WeBWorK::DB::Schema::Classlist1Hash",
  206     driver => "WeBWorK::DB::Driver::GDBM",
  207     source => "$courseDirs{DATA}/$courseName\_classlist_DB",
  208   },
  209   set => {
  210     record => "WeBWorK::DB::Record::Set",
  211     schema => "WeBWorK::DB::Schema::GlobalTableEmulator",
  212     driver => "WeBWorK::DB::Driver::Null",
  213     params => { %gdbmGlobalTableParams },
  214   },
  215   set_user => {
  216     record => "WeBWorK::DB::Record::UserSet",
  217     schema => "WeBWorK::DB::Schema::WW1Hash",
  218     driver => "WeBWorK::DB::Driver::GDBM",
  219     source => "$courseDirs{DATA}/$courseName\_webwork_DB",
  220     params => { %gdbmUserSpecificTableParams },
  221   },
  222   problem => {
  223     record => "WeBWorK::DB::Record::Problem",
  224     schema => "WeBWorK::DB::Schema::GlobalTableEmulator",
  225     driver => "WeBWorK::DB::Driver::Null",
  226     params => { %gdbmGlobalTableParams },
  227   },
  228   problem_user => {
  229     record => "WeBWorK::DB::Record::UserProblem",
  230     schema => "WeBWorK::DB::Schema::WW1Hash",
  231     driver => "WeBWorK::DB::Driver::GDBM",
  232     source => "$courseDirs{DATA}/$courseName\_webwork_DB",
  233     params => { %gdbmUserSpecificTableParams },
  234   },
  235 };

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9