Commit 13a27172 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Set user file quota before inserting user record, so that site templates can always be copied


Signed-off-by: default avatarRichard Mansfield <richardm@catalyst.net.nz>
parent 7cc48539
......@@ -514,6 +514,14 @@ class User {
return true;
}
public function quota_init() {
if (!$this->get('quota')) {
if ($defaultquota = get_config_plugin('artefact', 'file', 'defaultquota')) {
$this->set('quota', $defaultquota);
}
}
}
public function join_institution($institution) {
if ($institution != 'mahara' && !$this->in_institution($institution)) {
require_once('institution.php');
......
......@@ -1528,10 +1528,14 @@ function create_user($user, $profile=array(), $institution=null, $remoteauth=nul
db_begin();
if ($user instanceof User) {
$user->quota_init();
$user->commit();
$user = $user->to_stdclass();
}
else {
if (empty($user->quota)) {
$user->quota = get_config_plugin('artefact', 'file', 'defaultquota');
}
$user->id = insert_record('usr', $user, 'id', true);
}
// Bypass access check for 'copynewuser' institution/site views, because this user may not be logged in yet
......
Supports Markdown
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