Commit 4c30fab0 authored by Robert Lyon's avatar Robert Lyon Committed by Gerrit Code Review

Merge "Bug 1829431: fixing how we calculate user data on creation"

parents ea95604c b618d858
......@@ -2548,8 +2548,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;
}
......
......@@ -373,7 +373,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');
......@@ -592,6 +592,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