Add support for mapping the quota

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
This commit is contained in:
Roeland Jago Douma 2018-03-14 21:15:04 +01:00
parent 2d167fd365
commit 9bf0d3eb3d
No known key found for this signature in database
GPG key ID: F941078878347C0C
2 changed files with 14 additions and 0 deletions

View file

@ -98,6 +98,11 @@ class Admin implements ISettings {
'type' => 'line',
'required' => true,
],
'quota_mapping' => [
'text' => $this->l10n->t('Attribute to map the quota to.'),
'type' => 'line',
'required' => false,
],
];
$type = $this->config->getAppValue('user_saml', 'type');

View file

@ -455,6 +455,11 @@ class UserBackend implements IApacheBackend, UserInterface, IUserBackend {
} catch (\InvalidArgumentException $e) {
$newDisplayname = null;
}
try {
$newQuota = $this->getAttributeValue('saml-attribute-mapping-quota_mapping', $attributes);
} catch (\InvalidArgumentException $e) {
$newQuota = null;
}
if ($user !== null) {
$currentEmail = (string)$user->getEMailAddress();
@ -474,6 +479,10 @@ class UserBackend implements IApacheBackend, UserInterface, IUserBackend {
);
$this->setDisplayName($uid, $newDisplayname);
}
if ($newQuota !== null) {
$user->setQuota($newQuota);
}
}
}
}