Commit b618d858 authored by Robert Lyon's avatar Robert Lyon

Bug 1829431: fixing how we calculate user data on creation

behatnotneeded

Change-Id: I59d911e8e11fa70e9618c468a3d8fb960a7fbf53
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent 877d16b4
......@@ -2541,8 +2541,8 @@ function create_user($user, $profile=array(), $institution=null, $remoteauth=nul
}
if (empty($user->quota)) {
$quota = get_config_plugin('artefact', 'file', 'defaultquota');
if (!empty($institution) && !empty($institution->quota)) {
$quota = min($quota, $institution->quota);
if (!empty($institution) && $institution->defaultquota > 0) {
$quota = min($quota, $institution->defaultquota);
}
$user->quota = $quota;
}
......
......@@ -338,7 +338,7 @@ EOD;
$profiles[$field] = $record[$field];
}
}
$user->id = create_user($user, $profiles, $record['institution'], $remoteauth, $record['remoteusername'], $record);
$user->id = create_user($user, $profiles, $institution, $remoteauth, $record['remoteusername'], $record);
if (isset($user->admin) && $user->admin) {
require_once('activity.php');
......@@ -557,6 +557,10 @@ EOD;
$newinstitution->licensedefault = (isset($record['licensedefault'])) ? $record['licensedefault'] : '';
}
if (!empty($record['defaultquota'])) {
// make sure that it is bytes
$record['defaultquota'] = get_real_size($record['defaultquota']);
}
$newinstitution->defaultquota = empty($record['defaultquota']) ? get_config_plugin('artefact', 'file', 'defaultquota') : $record['defaultquota'];
$newinstitution->defaultmembershipperiod = !empty($record['defaultmembershipperiod']) ? intval($record['defaultmembershipperiod']) : null;
......
......@@ -93,7 +93,7 @@ class BehatDataGenerators extends BehatBase {
'skins' => 'bool',
'licensemandatory' => 'bool',
'licensedefault' => 'text',
'defaultquota' => 'number',
'defaultquota' => 'text',
'defaultmembershipperiod' => 'number',
'maxuseraccounts' => 'number',
'expiry' => 'text',
......
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