Commit e3630183 authored by Aaron Wells's avatar Aaron Wells
Browse files

Turn off "Registration allowed" by default

Bug 1307294

Change-Id: I1b1389e5441645550930d36b79be72d13e0c743e
parent 1ca82920
......@@ -225,7 +225,7 @@ if ($institution || $add) {
$data->displayname = '';
$data->expiry = null;
if (!get_config('usersuniquebyusername')) {
$data->registerallowed = 1;
$data->registerallowed = 0;
$data->registerconfirm = 1;
}
$data->theme = 'sitedefault';
......@@ -796,17 +796,15 @@ function institution_submit(Pieform $form, $values) {
$newinstitution->commit();
if ($add) {
// If registration has been turned on, then we automatically insert an
// internal authentication authinstance
if ($newinstitution->registerallowed) {
$authinstance = (object)array(
'instancename' => 'internal',
'priority' => 0,
'institution' => $newinstitution->name,
'authname' => 'internal',
);
insert_record('auth_instance', $authinstance);
}
// Automatically create an internal authentication authinstance
$authinstance = (object)array(
'instancename' => 'internal',
'priority' => 0,
'institution' => $newinstitution->name,
'authname' => 'internal',
);
insert_record('auth_instance', $authinstance);
// We need to add the default lines to the site_content table for this institution
// We also need to set the institution to be using default static pages to begin with
// so that using custom institution pages is an opt-in situation
......
......@@ -60,7 +60,7 @@
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
<FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true"/>
<FIELD NAME="displayname" TYPE="char" LENGTH="255" NOTNULL="true"/>
<FIELD NAME="registerallowed" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="1"/>
<FIELD NAME="registerallowed" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0"/>
<FIELD NAME="theme" TYPE="char" LENGTH="255" NOTNULL="false"/>
<FIELD NAME="defaultmembershipperiod" TYPE="int" NOTNULL="false" />
<FIELD NAME="maxuseraccounts" TYPE="int" NOTNULL="false" />
......
......@@ -3242,5 +3242,12 @@ function xmldb_core_upgrade($oldversion=0) {
}
}
if ($oldversion < 2014041401) {
$table = new XMLDBTable('institution');
$field = new XMLDBField('registerallowed');
$field->setAttributes(XMLDB_TYPE_INTEGER, 1, null, XMLDB_NOTNULL, null, null, null, '0');
change_field_default($table, $field);
}
return $status;
}
......@@ -40,7 +40,7 @@ class Institution {
static $dbfields = array(
'name' => '',
'displayname' => '',
'registerallowed' => 1,
'registerallowed' => 0,
'registerconfirm' => 1,
'theme' => null,
'defaultmembershipperiod' => 0,
......@@ -296,7 +296,7 @@ class Institution {
}
$userinst = new StdClass;
$userinst->institution = $this->name;
$studentid = get_field('usr_institution_request', 'studentid', 'usr', $user->id,
$studentid = get_field('usr_institution_request', 'studentid', 'usr', $user->id,
'institution', $this->name);
if (!empty($studentid)) {
$userinst->studentid = $studentid;
......
......@@ -15,7 +15,7 @@ $config = new stdClass();
// See https://wiki.mahara.org/index.php/Developer_Area/Version_Numbering_Policy
// For upgrades on stable branches, increment the version by one. On master, use the date.
$config->version = 2014040400;
$config->version = 2014041401;
$config->release = '1.10.0dev';
$config->minupgradefrom = 2009022600;
$config->minupgraderelease = '1.1.0 (release tag 1.1.0_RELEASE)';
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment