From 9bf0d3eb3d211c954fc34c40cb9048687404c1ee Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Wed, 14 Mar 2018 21:15:04 +0100 Subject: [PATCH] Add support for mapping the quota Signed-off-by: Roeland Jago Douma --- lib/Settings/Admin.php | 5 +++++ lib/UserBackend.php | 9 +++++++++ 2 files changed, 14 insertions(+) diff --git a/lib/Settings/Admin.php b/lib/Settings/Admin.php index 6761ae9..d7e5511 100644 --- a/lib/Settings/Admin.php +++ b/lib/Settings/Admin.php @@ -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'); diff --git a/lib/UserBackend.php b/lib/UserBackend.php index b6c389d..fbd5b79 100644 --- a/lib/UserBackend.php +++ b/lib/UserBackend.php @@ -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); + } } } }