[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 2281 - (download) (annotate)
Tue Jun 8 20:03:10 2004 UTC (8 years, 11 months ago) by sh002i
File size: 8138 byte(s)
changed default globalUserID to "global_user"

    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.10 2004/05/21 23:41:49 jj 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 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, but can
  163 be overridden on a course-by-course basis to the ID of the professor who is most
  164 likely to be involved in creating new problem sets. Sets which have not been
  165 assigned will only be visible to this user when logging into WeBWorK 1.x.
  166 
  167 Use the following code to override these values in a course's F<course.conf>
  168 file:
  169 
  170  $dbLayout{set}->{params}->{globalUserID} = "some_user";
  171  $dbLayout{problem}->{params}->{globalUserID} = "some_user";
  172 
  173 =cut
  174 
  175 my %gdbmGlobalTableParams = (
  176   globalUserID => "global_user",
  177 );
  178 
  179 my %gdbmUserSpecificTableParams = (
  180   psvnLength => 5,
  181 );
  182 
  183 $dbLayouts{gdbm} = {
  184   password => {
  185     record => "WeBWorK::DB::Record::Password",
  186     schema => "WeBWorK::DB::Schema::Auth1Hash",
  187     driver => "WeBWorK::DB::Driver::GDBM",
  188     source => "$courseDirs{auth_DATA}/$courseName\_password_DB",
  189   },
  190   permission => {
  191     record => "WeBWorK::DB::Record::PermissionLevel",
  192     schema => "WeBWorK::DB::Schema::Auth1Hash",
  193     driver => "WeBWorK::DB::Driver::GDBM",
  194     source => "$courseDirs{auth_DATA}/$courseName\_permissions_DB",
  195   },
  196   key => {
  197     record => "WeBWorK::DB::Record::Key",
  198     schema => "WeBWorK::DB::Schema::Auth1Hash",
  199     driver => "WeBWorK::DB::Driver::GDBM",
  200     source => "$courseDirs{auth_DATA}/keys",
  201   },
  202   user => {
  203     record => "WeBWorK::DB::Record::User",
  204     schema => "WeBWorK::DB::Schema::Classlist1Hash",
  205     driver => "WeBWorK::DB::Driver::GDBM",
  206     source => "$courseDirs{DATA}/$courseName\_classlist_DB",
  207   },
  208   set => {
  209     record => "WeBWorK::DB::Record::Set",
  210     schema => "WeBWorK::DB::Schema::GlobalTableEmulator",
  211     driver => "WeBWorK::DB::Driver::Null",
  212     params => { %gdbmGlobalTableParams },
  213   },
  214   set_user => {
  215     record => "WeBWorK::DB::Record::UserSet",
  216     schema => "WeBWorK::DB::Schema::WW1Hash",
  217     driver => "WeBWorK::DB::Driver::GDBM",
  218     source => "$courseDirs{DATA}/$courseName\_webwork_DB",
  219     params => { %gdbmUserSpecificTableParams },
  220   },
  221   problem => {
  222     record => "WeBWorK::DB::Record::Problem",
  223     schema => "WeBWorK::DB::Schema::GlobalTableEmulator",
  224     driver => "WeBWorK::DB::Driver::Null",
  225     params => { %gdbmGlobalTableParams },
  226   },
  227   problem_user => {
  228     record => "WeBWorK::DB::Record::UserProblem",
  229     schema => "WeBWorK::DB::Schema::WW1Hash",
  230     driver => "WeBWorK::DB::Driver::GDBM",
  231     source => "$courseDirs{DATA}/$courseName\_webwork_DB",
  232     params => { %gdbmUserSpecificTableParams },
  233   },
  234 };

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9