Skip to content
Browse files

mnet/multiauth: table setup scripts

  • Loading branch information...
1 parent 63b1e35 commit 5cd129c7f93539558e31bf605cd01271d025ebbb martinlanghoff committed
Showing with 483 additions and 6 deletions.
  1. +158 −5 lib/db/install.xml
  2. +324 −0 lib/db/upgrade.php
  3. +1 −1 version.php
View
163 lib/db/install.xml
@@ -523,8 +523,9 @@
<FIELD NAME="auth" TYPE="char" LENGTH="20" NOTNULL="true" DEFAULT="manual" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="confirmed"/>
<FIELD NAME="confirmed" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="auth" NEXT="policyagreed"/>
<FIELD NAME="policyagreed" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="confirmed" NEXT="deleted"/>
- <FIELD NAME="deleted" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="policyagreed" NEXT="username"/>
- <FIELD NAME="username" TYPE="char" LENGTH="100" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="deleted" NEXT="password"/>
+ <FIELD NAME="deleted" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="policyagreed" NEXT="mnethostid"/>
+ <FIELD NAME="mnethostid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" UNSIGNED="true" SEQUENCE="false" ENUM="false" PREVIOUS="deleted" NEXT="username"/>
+ <FIELD NAME="username" TYPE="char" LENGTH="100" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="mnethostid" NEXT="password"/>
<FIELD NAME="password" TYPE="char" LENGTH="32" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="username" NEXT="idnumber"/>
<FIELD NAME="idnumber" TYPE="char" LENGTH="64" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="password" NEXT="firstname"/>
<FIELD NAME="firstname" TYPE="char" LENGTH="100" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="idnumber" NEXT="lastname"/>
@@ -571,7 +572,7 @@
<KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="Primary key for user"/>
</KEYS>
<INDEXES>
- <INDEX NAME="username" UNIQUE="true" FIELDS="username" NEXT="deleted"/>
+ <INDEX NAME="username" UNIQUE="true" FIELDS="mnethostid, username" NEXT="deleted"/>
<INDEX NAME="deleted" UNIQUE="false" FIELDS="deleted" PREVIOUS="username" NEXT="confirmed"/>
<INDEX NAME="confirmed" UNIQUE="false" FIELDS="confirmed" PREVIOUS="deleted" NEXT="firstname"/>
<INDEX NAME="firstname" UNIQUE="false" FIELDS="firstname" PREVIOUS="confirmed" NEXT="lastname"/>
@@ -964,7 +965,7 @@
<KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="primary key of the table, please edit me"/>
</KEYS>
</TABLE>
- <TABLE NAME="user_info_data" COMMENT="Data for the customisable user fields" PREVIOUS="user_info_category">
+ <TABLE NAME="user_info_data" COMMENT="Data for the customisable user fields" PREVIOUS="user_info_category" NEXT="mnet_enrol_course">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" SEQUENCE="true" ENUM="false" COMMENT="id of the table, please edit me" NEXT="userid"/>
<FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="id from the user table" PREVIOUS="id" NEXT="fieldid"/>
@@ -975,6 +976,158 @@
<KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="primary key of the table, please edit me"/>
</KEYS>
</TABLE>
+ <TABLE NAME="mnet_enrol_course" COMMENT="Information about courses on remote hosts" PREVIOUS="user_info_data" NEXT="mnet_enrol_assignments">
+ <FIELDS>
+ <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" SEQUENCE="true" ENUM="false" COMMENT="Unique remote-course ID" NEXT="hostid"/>
+ <FIELD NAME="hostid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="remoteid"/>
+ <FIELD NAME="remoteid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" COMMENT="Unique ID of course on its home server" ENUM="false" PREVIOUS="hostid" NEXT="cat_id"/>
+ <FIELD NAME="cat_id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="remoteid" NEXT="cat_name"/>
+ <FIELD NAME="cat_name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="cat_id" NEXT="cat_description"/>
+ <FIELD NAME="cat_description" TYPE="text" LENGTH="medium" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="cat_name" NEXT="sortorder"/>
+ <FIELD NAME="sortorder" TYPE="int" LENGTH="4" UNSIGNED="true" NOTNULL="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="cat_description" NEXT="fullname"/>
+ <FIELD NAME="fullname" TYPE="char" LENGTH="254" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="sortorder" NEXT="shortname"/>
+ <FIELD NAME="shortname" TYPE="char" LENGTH="15" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="fullname" NEXT="idnumber"/>
+ <FIELD NAME="idnumber" TYPE="char" LENGTH="100" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="shortname" NEXT="summary"/>
+ <FIELD NAME="summary" TYPE="text" LENGTH="medium" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="idnumber" NEXT="startdate"/>
+ <FIELD NAME="startdate" TYPE="int" LENGTH="10" UNSIGNED="true" NOTNULL="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="summary" NEXT="cost"/>
+ <FIELD NAME="cost" TYPE="char" LENGTH="10" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="startdate" NEXT="currency"/>
+ <FIELD NAME="currency" TYPE="char" LENGTH="3" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="cost" NEXT="defaultroleid"/>
+ <FIELD NAME="defaultroleid" TYPE="int" LENGTH="4" UNSIGNED="true" NOTNULL="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="currency" NEXT="defaultrolename"/>
+ <FIELD NAME="defaultrolename" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="defaultroleid"/>
+ </FIELDS>
+ <KEYS>
+ <KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="primary key of the mnet_course table"/>
+ </KEYS>
+ </TABLE>
+ <TABLE NAME="mnet_enrol_assignments" COMMENT="Information about enrolments on courses on remote hosts" PREVIOUS="mnet_enrol_course" NEXT="mnet_host">
+ <FIELDS>
+ <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" SEQUENCE="true" ENUM="false" COMMENT="Unique enrollment ID" NEXT="userid"/>
+ <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" COMMENT="Unique ID of user on *this* server" ENUM="false" PREVIOUS="id" NEXT="mnetcourseid"/>
+ <FIELD NAME="mnetcourseid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="userid" NEXT="hostid"/>
+ <FIELD NAME="hostid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="mnetcourseid" NEXT="courseid"/>
+ <FIELD NAME="courseid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" COMMENT="Unique ID of course on its home server" ENUM="false" PREVIOUS="hostid" NEXT="rolename"/>
+ <FIELD NAME="rolename" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="courseid" NEXT="enroltime"/>
+ <FIELD NAME="enroltime" TYPE="int" LENGTH="10" UNSIGNED="true" NOTNULL="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="rolename" NEXT="enroltype"/>
+ <FIELD NAME="enroltype" TYPE="char" LENGTH="20" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="enroltime"/>
+ </FIELDS>
+ <KEYS>
+ <KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="primary key of the mnet_enrol_assignments table"/>
+ </KEYS>
+ </TABLE>
+ <TABLE NAME="mnet_host" COMMENT="Information about the local and remote hosts for RPC" PREVIOUS="mnet_enrol_assignments" NEXT="mnet_host2service">
+ <FIELDS>
+ <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" SEQUENCE="true" ENUM="false" COMMENT="Unique Host ID" NEXT="deleted"/>
+ <FIELD NAME="deleted" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="wwwroot"/>
+ <FIELD NAME="wwwroot" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="deleted" NEXT="ip_address"/>
+ <FIELD NAME="ip_address" TYPE="char" LENGTH="39" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="wwwroot" NEXT="name"/>
+ <FIELD NAME="name" TYPE="char" LENGTH="80" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="ip_address" NEXT="public_key"/>
+ <FIELD NAME="public_key" TYPE="text" LENGTH="medium" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="name" NEXT="public_key_expires"/>
+ <FIELD NAME="public_key_expires" TYPE="int" LENGTH="10" UNSIGNED="true" NOTNULL="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="public_key" NEXT="transport"/>
+ <FIELD NAME="transport" TYPE="int" LENGTH="2" UNSIGNED="true" NOTNULL="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="public_key_expires" NEXT="portno"/>
+ <FIELD NAME="portno" TYPE="int" LENGTH="2" UNSIGNED="true" NOTNULL="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="transport" NEXT="last_connect_time"/>
+ <FIELD NAME="last_connect_time" TYPE="int" LENGTH="10" UNSIGNED="true" NOTNULL="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="portno" NEXT="last_log_id"/>
+ <FIELD NAME="last_log_id" TYPE="int" LENGTH="10" UNSIGNED="true" NOTNULL="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="last_connect_time"/>
+ </FIELDS>
+ <KEYS>
+ <KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="primary key of the mnet_host table"/>
+ </KEYS>
+ </TABLE>
+ <TABLE NAME="mnet_host2service" COMMENT="Information about the services for a given host" PREVIOUS="mnet_host" NEXT="mnet_log">
+ <FIELDS>
+ <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" SEQUENCE="true" ENUM="false" NEXT="hostid"/>
+ <FIELD NAME="hostid" TYPE="int" LENGTH="10" DEFAULT="0" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="serviceid"/>
+ <FIELD NAME="serviceid" TYPE="int" LENGTH="10" DEFAULT="0" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" ENUM="false" PREVIOUS="hostid" NEXT="publish"/>
+ <FIELD NAME="publish" TYPE="int" LENGTH="2" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="serviceid" NEXT="subscribe"/>
+ <FIELD NAME="subscribe" TYPE="int" LENGTH="2" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="publish"/>
+ </FIELDS>
+ <KEYS>
+ <KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="primary key of the mnet_host2service table"/>
+ </KEYS>
+ </TABLE>
+ <TABLE NAME="mnet_log" COMMENT="Store session data from users migrating to other sites" PREVIOUS="mnet_host2service" NEXT="mnet_rpc">
+ <FIELDS>
+ <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="hostid"/>
+ <FIELD NAME="hostid" TYPE="int" LENGTH="10" DEFAULT="0" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" ENUM="false" COMMENT="Unique host ID" PREVIOUS="id" NEXT="remoteid"/>
+ <FIELD NAME="remoteid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" ENUM="false" PREVIOUS="hostid" NEXT="time"/>
+ <FIELD NAME="time" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="remoteid" NEXT="userid"/>
+ <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="time" NEXT="ip"/>
+ <FIELD NAME="ip" TYPE="char" LENGTH="15" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="userid" NEXT="course"/>
+ <FIELD NAME="course" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="ip" NEXT="coursename"/>
+ <FIELD NAME="coursename" TYPE="char" LENGTH="40" NOTNULL="true" DEFAULT="" SEQUENCE="false" ENUM="false" PREVIOUS="course" NEXT="module"/>
+ <FIELD NAME="module" TYPE="char" LENGTH="20" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="coursename" NEXT="cmid"/>
+ <FIELD NAME="cmid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="module" NEXT="action"/>
+ <FIELD NAME="action" TYPE="char" LENGTH="40" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="cmid" NEXT="url"/>
+ <FIELD NAME="url" TYPE="char" LENGTH="100" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="action" NEXT="info"/>
+ <FIELD NAME="info" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="url"/>
+ </FIELDS>
+ <KEYS>
+ <KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="primary key of the mnet_session table"/>
+ </KEYS>
+ </TABLE>
+ <TABLE NAME="mnet_rpc" COMMENT="Functions or methods that we may publish or subscribe to" PREVIOUS="mnet_log" NEXT="mnet_service">
+ <FIELDS>
+ <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" SEQUENCE="true" ENUM="false" COMMENT="Unique Function ID" NEXT="function_name"/>
+ <FIELD NAME="function_name" TYPE="char" LENGTH="40" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="xmlrpc_path"/>
+ <FIELD NAME="xmlrpc_path" TYPE="char" LENGTH="80" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="function_name" NEXT="parent_type"/>
+ <FIELD NAME="parent_type" TYPE="char" LENGTH="6" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="xmlrpc_path" NEXT="parent"/>
+ <FIELD NAME="parent" TYPE="char" LENGTH="20" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="parent_type" NEXT="enabled"/>
+ <FIELD NAME="enabled" TYPE="int" LENGTH="2" UNSIGNED="true" NOTNULL="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="parent" NEXT="help"/>
+ <FIELD NAME="help" TYPE="text" LENGTH="medium" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="enabled" NEXT="profile"/>
+ <FIELD NAME="profile" TYPE="text" LENGTH="medium" NOTNULL="true" SEQUENCE="false" ENUM="false" COMMENT="Method signature" PREVIOUS="help"/>
+ </FIELDS>
+ <KEYS>
+ <KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="primary key of the mnet_rpc table"/>
+ </KEYS>
+ </TABLE>
+ <TABLE NAME="mnet_service" COMMENT="A service is a group of functions" PREVIOUS="mnet_rpc" NEXT="mnet_service2rpc">
+ <FIELDS>
+ <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" SEQUENCE="true" ENUM="false" COMMENT="Unique Service ID" NEXT="name"/>
+ <FIELD NAME="name" TYPE="char" LENGTH="40" NOTNULL="true" SEQUENCE="false" ENUM="false" NEXT="description" PREVIOUS="id"/>
+ <FIELD NAME="description" TYPE="char" LENGTH="40" NOTNULL="true" SEQUENCE="false" ENUM="false" NEXT="apiversion" PREVIOUS="name"/>
+ <FIELD NAME="apiversion" TYPE="char" LENGTH="10" NOTNULL="true" SEQUENCE="false" ENUM="false" NEXT="offer" PREVIOUS="description"/>
+ <FIELD NAME="offer" TYPE="int" LENGTH="2" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" COMMENT="Do we even offer this service?" ENUM="false" PREVIOUS="apiversion"/>
+ </FIELDS>
+ <KEYS>
+ <KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="primary key of the mnet_service table"/>
+ </KEYS>
+ </TABLE>
+ <TABLE NAME="mnet_service2rpc" COMMENT="Group functions or methods under a service" PREVIOUS="mnet_service" NEXT="mnet_session">
+ <FIELDS>
+ <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" SEQUENCE="true" ENUM="false" COMMENT="Required ID field" NEXT="serviceid"/>
+ <FIELD NAME="serviceid" TYPE="int" LENGTH="10" DEFAULT="0" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" ENUM="false" COMMENT="Unique service ID" PREVIOUS="id" NEXT="rpcid"/>
+ <FIELD NAME="rpcid" TYPE="int" LENGTH="10" DEFAULT="0" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" ENUM="false" COMMENT="Unique Function ID" PREVIOUS="serviceid"/>
+ </FIELDS>
+ <KEYS>
+ <KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="primary key of the mnet_service2rpc table"/>
+ </KEYS>
+ </TABLE>
+ <TABLE NAME="mnet_session" COMMENT="Store session data from users migrating to other sites" PREVIOUS="mnet_service2rpc" NEXT="mnet_sso_access_control">
+ <FIELDS>
+ <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" SEQUENCE="true" ENUM="false" COMMENT="Required ID field" NEXT="userid"/>
+ <FIELD NAME="userid" TYPE="int" LENGTH="10" DEFAULT="0" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" ENUM="false" COMMENT="Unique user ID" PREVIOUS="id" NEXT="username"/>
+ <FIELD NAME="username" TYPE="char" LENGTH="100" DEFAULT="" NOTNULL="true" SEQUENCE="false" ENUM="false" COMMENT="Unique username" PREVIOUS="userid" NEXT="token"/>
+ <FIELD NAME="token" TYPE="char" LENGTH="40" DEFAULT="" NOTNULL="true" SEQUENCE="false" ENUM="false" COMMENT="Unique SHA1 Token" PREVIOUS="username" NEXT="mnethostid"/>
+ <FIELD NAME="mnethostid" TYPE="int" LENGTH="10" DEFAULT="0" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" ENUM="false" COMMENT="Unique remote host ID" PREVIOUS="token" NEXT="useragent"/>
+ <FIELD NAME="useragent" TYPE="char" LENGTH="40" DEFAULT="" NOTNULL="true" SEQUENCE="false" ENUM="false" COMMENT="SHA1 hash of User Agent" PREVIOUS="mnethostid" NEXT="confirm_timeout"/>
+ <FIELD NAME="confirm_timeout" TYPE="int" LENGTH="10" DEFAULT="0" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" ENUM="false" COMMENT="UNIX timestamp for expiry of session" PREVIOUS="useragent" NEXT="session_id"/>
+ <FIELD NAME="session_id" TYPE="char" LENGTH="40" DEFAULT="" NOTNULL="true" SEQUENCE="false" ENUM="false" COMMENT="The PHP Session ID" PREVIOUS="confirm_timeout" NEXT="expires"/>
+ <FIELD NAME="expires" TYPE="int" LENGTH="10" DEFAULT="0" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" ENUM="false" COMMENT="Expire time of session on peer" PREVIOUS="session_id"/>
+ </FIELDS>
+ <KEYS>
+ <KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="primary key of the mnet_session table"/>
+ </KEYS>
+ </TABLE>
+ <TABLE NAME="mnet_sso_access_control" COMMENT="Users by host permitted (or not) to login from a remote provider" PREVIOUS="mnet_session">
+ <FIELDS>
+ <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" SEQUENCE="true" ENUM="false" COMMENT="Required ID field" NEXT="username"/>
+ <FIELD NAME="username" TYPE="char" LENGTH="100" DEFAULT="" NOTNULL="true" SEQUENCE="false" ENUM="false" COMMENT="Username" PREVIOUS="id" NEXT="mnet_host_id"/>
+ <FIELD NAME="mnet_host_id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" ENUM="false" COMMENT="id of mnet host" PREVIOUS="username" NEXT="access"/>
+ <FIELD NAME="access" TYPE="char" LENGTH="20" DEFAULT="allow" NOTNULL="true" SEQUENCE="false" ENUM="false" COMMENT="Whether or not this user/host can login" PREVIOUS="mnet_host_id"/>
+ </FIELDS>
+ <KEYS>
+ <KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="primary key of the mnet_sso_access_control table"/>
+ </KEYS>
+ </TABLE>
</TABLES>
<STATEMENTS>
<STATEMENT NAME="insert log_display" TYPE="insert" TABLE="log_display" COMMENT="Initial insert of records on table log_display">
@@ -998,4 +1151,4 @@
</SENTENCES>
</STATEMENT>
</STATEMENTS>
-</XMLDB>
+</XMLDB>
View
324 lib/db/upgrade.php
@@ -131,6 +131,330 @@ function xmldb_main_upgrade($oldversion=0) {
}
}
+ // Move the auth plugin settings into the config_plugin table
+ if ($oldversion < 2007010300) {
+ $authplugins = get_list_of_plugins('auth');
+ foreach ($CFG as $k => $v) {
+ if (strpos($k, 'auth_') !== 0) {
+ continue;
+ }
+ $authsetting = substr($k, 5);
+ foreach ($authplugins as $auth) {
+ if (strpos($authsetting, $auth) !== 0) {
+ continue;
+ }
+ $setting = substr($authsetting, strlen($auth));
+ if (set_config($setting, $v, "auth/$auth")) {
+ delete_records('config', 'name', $k);
+ unset($CFG->{$k});
+ }
+ break; // don't check the rest of the auth plugin names
+ }
+ }
+ }
+
+ if ($oldversion < 2007010301) {
+ //
+ // Core MNET tables
+ //
+ $table = new XMLDBTable('mnet_host');
+ $table->comment = 'Information about the local and remote hosts for RPC';
+ // fields
+ $f = $table->addFieldInfo('id', XMLDB_TYPE_INTEGER, '10', false,
+ XMLDB_NOTNULL, XMLDB_SEQUENCE, null, null, null);
+ $f->comment = 'Unique Host ID';
+ $f = $table->addFieldInfo('deleted', XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED,
+ XMLDB_NOTNULL, null, null, null, 0);
+ $f = $table->addFieldInfo('wwwroot', XMLDB_TYPE_CHAR, '255', null,
+ XMLDB_NOTNULL, null, null, null, '');
+ $f = $table->addFieldInfo('ip_address', XMLDB_TYPE_CHAR, '39', null,
+ XMLDB_NOTNULL, null, null, null, '');
+ $f = $table->addFieldInfo('name', XMLDB_TYPE_CHAR, '80', null,
+ XMLDB_NOTNULL, null, null, null, '');
+ $f = $table->addFieldInfo('public_key', XMLDB_TYPE_TEXT, null, null,
+ XMLDB_NOTNULL, null, null, null, null);
+ $f = $table->addFieldInfo('public_key_expires', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED,
+ XMLDB_NOTNULL, null, null, null, 0);
+ $f = $table->addFieldInfo('transport', XMLDB_TYPE_INTEGER, '2', XMLDB_UNSIGNED,
+ XMLDB_NOTNULL, null, null, null, 0);
+ $f = $table->addFieldInfo('portno', XMLDB_TYPE_INTEGER, '2', XMLDB_UNSIGNED,
+ XMLDB_NOTNULL, null, null, null, 0);
+ $f = $table->addFieldInfo('last_connect_time', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED,
+ XMLDB_NOTNULL, null, null, null, 0);
+ $f = $table->addFieldInfo('last_log_id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED,
+ XMLDB_NOTNULL, null, null, null, 0);
+ // PK and indexes
+ $table->addKeyInfo('primary', XMLDB_KEY_PRIMARY, array('id'));
+ // Create the table
+ $result = $result && create_table($table);
+
+ $table = new XMLDBTable('mnet_host2service');
+ $table->comment = 'Information about the services for a given host';
+ // fields
+ $f = $table->addFieldInfo('id', XMLDB_TYPE_INTEGER, '10', false,
+ XMLDB_NOTNULL, XMLDB_SEQUENCE, null, null, null);
+ $f = $table->addFieldInfo('hostid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED,
+ XMLDB_NOTNULL, NULL, null, null, 0);
+ $f = $table->addFieldInfo('serviceid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED,
+ XMLDB_NOTNULL, NULL, null, null, 0);
+ $f = $table->addFieldInfo('publish', XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED,
+ XMLDB_NOTNULL, NULL, null, null, 0);
+ $f = $table->addFieldInfo('subscribe', XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED,
+ XMLDB_NOTNULL, NULL, null, null, 0);
+ // PK and indexes
+ $table->addKeyInfo('primary', XMLDB_KEY_PRIMARY, array('id'));
+ $table->addIndexInfo('hostid_serviceid', XMLDB_INDEX_UNIQUE, array('hostid', 'serviceid'));
+ // Create the table
+ $result = $result && create_table($table);
+
+ $table = new XMLDBTable('mnet_log');
+ $table->comment = 'Store session data from users migrating to other sites';
+ // fields
+ $f = $table->addFieldInfo('id', XMLDB_TYPE_INTEGER, '10', false,
+ XMLDB_NOTNULL, XMLDB_SEQUENCE, null, null, null);
+ $f = $table->addFieldInfo('hostid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED,
+ XMLDB_NOTNULL, NULL, null, null, 0);
+ $f = $table->addFieldInfo('remoteid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED,
+ XMLDB_NOTNULL, NULL, null, null, 0);
+ $f = $table->addFieldInfo('time', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED,
+ XMLDB_NOTNULL, NULL, null, null, 0);
+ $f = $table->addFieldInfo('userid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED,
+ XMLDB_NOTNULL, NULL, null, null, 0);
+ $f = $table->addFieldInfo('ip', XMLDB_TYPE_CHAR, '15', null,
+ XMLDB_NOTNULL, NULL, null, null, null);
+ $f = $table->addFieldInfo('course', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED,
+ XMLDB_NOTNULL, NULL, null, null, 0);
+ $f = $table->addFieldInfo('coursename', XMLDB_TYPE_CHAR, '40', null,
+ XMLDB_NOTNULL, NULL, null, null, null);
+ $f = $table->addFieldInfo('module', XMLDB_TYPE_CHAR, '20', null,
+ XMLDB_NOTNULL, NULL, null, null, null);
+ $f = $table->addFieldInfo('cmid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED,
+ XMLDB_NOTNULL, NULL, null, null, 0);
+ $f = $table->addFieldInfo('action', XMLDB_TYPE_CHAR, '40', null,
+ XMLDB_NOTNULL, NULL, null, null, null);
+ $f = $table->addFieldInfo('url', XMLDB_TYPE_CHAR, '100', null,
+ XMLDB_NOTNULL, NULL, null, null, null);
+ $f = $table->addFieldInfo('info', XMLDB_TYPE_CHAR, '255', null,
+ XMLDB_NOTNULL, NULL, null, null, null);
+ // PK and indexes
+ $table->addKeyInfo('primary', XMLDB_KEY_PRIMARY, array('id'));
+ $table->addIndexInfo('host_user_course', XMLDB_INDEX_NOTUNIQUE, array('hostid', 'userid', 'course'));
+ // Create the table
+ $result = $result && create_table($table);
+
+
+ $table = new XMLDBTable('mnet_rpc');
+ $table->comment = 'Functions or methods that we may publish or subscribe to';
+ // fields
+ $f = $table->addFieldInfo('id', XMLDB_TYPE_INTEGER, '10', false,
+ XMLDB_NOTNULL, XMLDB_SEQUENCE, null, null, null);
+ $f = $table->addFieldInfo('function_name', XMLDB_TYPE_CHAR, '40', null,
+ XMLDB_NOTNULL, NULL, null, null, null);
+ $f = $table->addFieldInfo('xmlrpc_path', XMLDB_TYPE_CHAR, '80', null,
+ XMLDB_NOTNULL, NULL, null, null, null);
+ $f = $table->addFieldInfo('parent_type', XMLDB_TYPE_CHAR, '6', null,
+ XMLDB_NOTNULL, NULL, null, null, null);
+ $f = $table->addFieldInfo('parent', XMLDB_TYPE_CHAR, '20', null,
+ XMLDB_NOTNULL, NULL, null, null, null);
+ $f = $table->addFieldInfo('enabled', XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED,
+ XMLDB_NOTNULL, NULL, null, null, 0);
+ $f = $table->addFieldInfo('help', XMLDB_TYPE_TEXT, 'medium', null,
+ XMLDB_NOTNULL, NULL, null, null, null);
+ $f = $table->addFieldInfo('profile', XMLDB_TYPE_TEXT, 'medium', null,
+ XMLDB_NOTNULL, NULL, null, null, null);
+ // PK and indexes
+ $table->addKeyInfo('primary', XMLDB_KEY_PRIMARY, array('id'));
+ $table->addIndexInfo('enabled_xpath', XMLDB_INDEX_NOTUNIQUE, array('enabled', 'xmlrpc_path'));
+ // Create the table
+ $result = $result && create_table($table);
+
+ $table = new XMLDBTable('mnet_service');
+ $table->comment = 'A service is a group of functions';
+ // fields
+ $f = $table->addFieldInfo('id', XMLDB_TYPE_INTEGER, '10', false,
+ XMLDB_NOTNULL, XMLDB_SEQUENCE, null, null, null);
+ $f = $table->addFieldInfo('name', XMLDB_TYPE_CHAR, '40', null,
+ XMLDB_NOTNULL, NULL, null, null, null);
+ $f = $table->addFieldInfo('description', XMLDB_TYPE_CHAR, '40', null,
+ XMLDB_NOTNULL, NULL, null, null, null);
+ $f = $table->addFieldInfo('apiversion', XMLDB_TYPE_CHAR, '10', null,
+ XMLDB_NOTNULL, NULL, null, null, null);
+ $f = $table->addFieldInfo('offer', XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED,
+ XMLDB_NOTNULL, NULL, null, null, 0);
+ // PK and indexes
+ $table->addKeyInfo('primary', XMLDB_KEY_PRIMARY, array('id'));
+ // Create the table
+ $result = $result && create_table($table);
+
+ $table = new XMLDBTable('mnet_service2rpc');
+ // fields
+ $f = $table->addFieldInfo('id', XMLDB_TYPE_INTEGER, '10', false,
+ XMLDB_NOTNULL, XMLDB_SEQUENCE, null, null, null);
+ $f = $table->addFieldInfo('serviceid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED,
+ XMLDB_NOTNULL, NULL, null, null, 0);
+ $f = $table->addFieldInfo('rpcid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED,
+ XMLDB_NOTNULL, NULL, null, null, 0);
+ // PK and indexes
+ $table->addKeyInfo('primary', XMLDB_KEY_PRIMARY, array('id'));
+ $table->addIndexInfo('unique', XMLDB_INDEX_UNIQUE, array('rpcid', 'serviceid'));
+ // Create the table
+ $result = $result && create_table($table);
+
+ //
+ // Prime MNET configuration entries -- will be needed later by auth/mnet
+ //
+ include_once $CFG->dirroot . '/mnet/lib.php';
+ $env = new mnet_environment();
+ $env->init();
+ unset($env);
+
+ // add mnethostid to user-
+ $table = new XMLDBTable('user');
+ $field = new XMLDBField('mnethostid');
+ $field->setType(XMLDB_TYPE_INTEGER);
+ $field->setLength(10);
+ $field->setNotNull(true);
+ $field->setSequence(null);
+ $field->setEnum(null);
+ $field->setDefault('0');
+ $field->setPrevious("deleted");
+ $field->setNext("username");
+ $result = $result && add_field($table, $field);
+
+ // The default mnethostid is zero... we need to update this for all
+ // users of the local IdP service.
+ set_field('user',
+ 'mnethostid', $CFG->mnet_localhost_id,
+ 'mnethostid', '0');
+
+
+ $index = new XMLDBIndex('username');
+ $index->setUnique(true);
+ $index->setFields(array('username'));
+ drop_index($table, $index);
+ $index->setFields(array('mnethostid', 'username'));
+ $result = $result && add_index($table, $index);
+
+ unset($table, $field, $index);
+
+ /**
+ ** auth/mnet tables
+ **/
+ $table = new XMLDBTable('mnet_session');
+ $table->comment='Store session data from users migrating to other sites';
+ // fields
+ $f = $table->addFieldInfo('id', XMLDB_TYPE_INTEGER, '10', false,
+ XMLDB_NOTNULL,XMLDB_SEQUENCE, null, null, null);
+ $f = $table->addFieldInfo('userid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED,
+ XMLDB_NOTNULL, NULL, null, null, 0);
+ $f = $table->addFieldInfo('username', XMLDB_TYPE_CHAR, '100', null,
+ XMLDB_NOTNULL, NULL, null, null, null);
+ $f = $table->addFieldInfo('token', XMLDB_TYPE_CHAR, '40', null,
+ XMLDB_NOTNULL, NULL, null, null, null);
+ $f = $table->addFieldInfo('mnethostid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED,
+ XMLDB_NOTNULL, NULL, null, null, 0);
+ $f = $table->addFieldInfo('useragent', XMLDB_TYPE_CHAR, '40', null,
+ XMLDB_NOTNULL, NULL, null, null, null);
+ $f = $table->addFieldInfo('confirm_timeout', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED,
+ XMLDB_NOTNULL, NULL, null, null, 0);
+ $f = $table->addFieldInfo('session_id', XMLDB_TYPE_CHAR, '40', null,
+ XMLDB_NOTNULL, NULL, null, null, null);
+ $f = $table->addFieldInfo('expires', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED,
+ XMLDB_NOTNULL, NULL, null, null, 0);
+ // PK and indexes
+ $table->addKeyInfo('primary', XMLDB_KEY_PRIMARY, array('id'));
+ $table->addIndexInfo('token', XMLDB_INDEX_NOTUNIQUE, array('token'));
+ // Create the table
+ $result = $result && create_table($table);
+
+
+ $table = new XMLDBTable('mnet_sso_access_control');
+ $table->comment = 'Users by host permitted (or not) to login from a remote provider';
+ $f = $table->addFieldInfo('id', XMLDB_TYPE_INTEGER, '10', false,
+ XMLDB_NOTNULL,XMLDB_SEQUENCE, null, null, null);
+ $f = $table->addFieldInfo('username', XMLDB_TYPE_CHAR, '100', null,
+ XMLDB_NOTNULL, NULL, null, null, null);
+ $f = $table->addFieldInfo('mnet_host_id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED,
+ XMLDB_NOTNULL, NULL, null, null, 0);
+ $f = $table->addFieldInfo('access', XMLDB_TYPE_CHAR, '20', null,
+ XMLDB_NOTNULL, NULL, null, null, 'allow');
+ // PK and indexes
+ $table->addKeyInfo('primary', XMLDB_KEY_PRIMARY, array('id'));
+ $table->addIndexInfo('mnethostid_username', XMLDB_INDEX_UNIQUE, array('mnet_host_id', 'username'));
+ // Create the table
+ $result = $result && create_table($table);
+
+ /**
+ ** enrol/mnet tables
+ **/
+ $table = new XMLDBTable('mnet_enrol_course');
+ $table->comment = 'Information about courses on remote hosts';
+ $f = $table->addFieldInfo('id', XMLDB_TYPE_INTEGER, '10', false,
+ XMLDB_NOTNULL,XMLDB_SEQUENCE, null, null, null);
+ $f = $table->addFieldInfo('hostid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED,
+ XMLDB_NOTNULL, NULL, null, null, 0);
+ $f = $table->addFieldInfo('remoteid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED,
+ XMLDB_NOTNULL, NULL, null, null, 0);
+ $f = $table->addFieldInfo('cat_id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED,
+ XMLDB_NOTNULL, NULL, null, null, 0);
+ $f = $table->addFieldInfo('cat_name', XMLDB_TYPE_CHAR, '255', null,
+ XMLDB_NOTNULL, NULL, null, null, null);
+ $f = $table->addFieldInfo('cat_description', XMLDB_TYPE_TEXT, 'medium', null,
+ XMLDB_NOTNULL, NULL, null, null, null);
+ $f = $table->addFieldInfo('sortorder', XMLDB_TYPE_INTEGER, '4', XMLDB_UNSIGNED,
+ XMLDB_NOTNULL, NULL, null, null, 0);
+ $f = $table->addFieldInfo('fullname', XMLDB_TYPE_CHAR, '254', null,
+ XMLDB_NOTNULL, NULL, null, null, '');
+ $f = $table->addFieldInfo('shortname', XMLDB_TYPE_CHAR, '15', null,
+ XMLDB_NOTNULL, NULL, null, null, null);
+ $f = $table->addFieldInfo('idnumber', XMLDB_TYPE_CHAR, '100', null,
+ XMLDB_NOTNULL, NULL, null, null, null);
+ $f = $table->addFieldInfo('summary', XMLDB_TYPE_TEXT, 'medium', null,
+ XMLDB_NOTNULL, NULL, null, null, null);
+ $f = $table->addFieldInfo('startdate', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED,
+ XMLDB_NOTNULL, NULL, null, null, 0);
+ $f = $table->addFieldInfo('cost', XMLDB_TYPE_CHAR, '10', null,
+ XMLDB_NOTNULL, NULL, null, null, null);
+ $f = $table->addFieldInfo('currency', XMLDB_TYPE_CHAR, '3', null,
+ XMLDB_NOTNULL, NULL, null, null, null);
+ $f = $table->addFieldInfo('defaultroleid', XMLDB_TYPE_INTEGER, '4', XMLDB_UNSIGNED,
+ XMLDB_NOTNULL, NULL, null, null, 0);
+ $f = $table->addFieldInfo('defaultrolename', XMLDB_TYPE_CHAR, '255', null,
+ XMLDB_NOTNULL, NULL, null, null, null);
+ // PK and indexes
+ $table->addKeyInfo('primary', XMLDB_KEY_PRIMARY, array('id'));
+ $table->addIndexInfo('hostid_remoteid', XMLDB_INDEX_UNIQUE, array('hostid', 'remoteid'));
+ // Create the table
+ $result = $result && create_table($table);
+
+
+ $table = new XMLDBTable('mnet_enrol_assignments');
+
+ $table->comment = 'Information about enrolments on courses on remote hosts';
+ $f = $table->addFieldInfo('id', XMLDB_TYPE_INTEGER, '10', false,
+ XMLDB_NOTNULL,XMLDB_SEQUENCE, null, null, null);
+ $f = $table->addFieldInfo('userid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED,
+ XMLDB_NOTNULL, NULL, null, null, 0);
+ $f = $table->addFieldInfo('hostid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED,
+ XMLDB_NOTNULL, NULL, null, null, 0);
+ $f = $table->addFieldInfo('courseid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED,
+ XMLDB_NOTNULL, NULL, null, null, 0);
+ $f = $table->addFieldInfo('rolename', XMLDB_TYPE_CHAR, '255', null,
+ XMLDB_NOTNULL, NULL, null, null, null);
+ $f = $table->addFieldInfo('enroltime', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED,
+ XMLDB_NOTNULL, NULL, null, null, 0);
+ $f = $table->addFieldInfo('enroltype', XMLDB_TYPE_CHAR, '20', null,
+ XMLDB_NOTNULL, NULL, null, null, null);
+
+ // PK and indexes
+ $table->addKeyInfo('primary', XMLDB_KEY_PRIMARY, array('id'));
+ $table->addIndexInfo('hostid_courseid', XMLDB_INDEX_NOTUNIQUE, array('hostid', 'courseid'));
+ $table->addIndexInfo('userid', XMLDB_INDEX_UNIQUE, array('userid'));
+ // Create the table
+ $result = $result && create_table($table);
+
+ }
+
return $result;
}
View
2 version.php
@@ -6,7 +6,7 @@
// This is compared against the values stored in the database to determine
// whether upgrades should be performed (see lib/db/*.php)
- $version = 2006120700; // YYYYMMDD = date
+ $version = 2007010300; // YYYYMMDD = date
// XY = increments within a single day
$release = '1.8 dev'; // Human-friendly version name

0 comments on commit 5cd129c

Please sign in to comment.
Something went wrong with that request. Please try again.