diff options
author | Richard Steinmetz <richard@steinmetz.cloud> | 2024-07-17 20:15:32 +0200 |
---|---|---|
committer | Richard Steinmetz <richard@steinmetz.cloud> | 2024-07-22 22:35:46 +0200 |
commit | b37fb43a32fd8ab91738aeb39a678ddc24f75116 (patch) | |
tree | b22c456c9aec2f0ebeb92b675f4bf535d2ae43fe /apps/provisioning_api | |
parent | 8cc996155e77e10a626906550a74953fb4a6928d (diff) | |
download | nextcloud-server-b37fb43a32fd8ab91738aeb39a678ddc24f75116.tar.gz nextcloud-server-b37fb43a32fd8ab91738aeb39a678ddc24f75116.zip |
feat: let users configure their first day of week
Signed-off-by: Richard Steinmetz <richard@steinmetz.cloud>
Diffstat (limited to 'apps/provisioning_api')
-rw-r--r-- | apps/provisioning_api/lib/Controller/AUserData.php | 1 | ||||
-rw-r--r-- | apps/provisioning_api/lib/Controller/UsersController.php | 13 |
2 files changed, 14 insertions, 0 deletions
diff --git a/apps/provisioning_api/lib/Controller/AUserData.php b/apps/provisioning_api/lib/Controller/AUserData.php index d7db48dc33f..a35795baba6 100644 --- a/apps/provisioning_api/lib/Controller/AUserData.php +++ b/apps/provisioning_api/lib/Controller/AUserData.php @@ -39,6 +39,7 @@ abstract class AUserData extends OCSController { public const USER_FIELD_DISPLAYNAME = 'display'; public const USER_FIELD_LANGUAGE = 'language'; public const USER_FIELD_LOCALE = 'locale'; + public const USER_FIELD_FIRST_DAY_OF_WEEK = 'first_day_of_week'; public const USER_FIELD_PASSWORD = 'password'; public const USER_FIELD_QUOTA = 'quota'; public const USER_FIELD_MANAGER = 'manager'; diff --git a/apps/provisioning_api/lib/Controller/UsersController.php b/apps/provisioning_api/lib/Controller/UsersController.php index 1cdc1392596..956e06e0015 100644 --- a/apps/provisioning_api/lib/Controller/UsersController.php +++ b/apps/provisioning_api/lib/Controller/UsersController.php @@ -913,6 +913,7 @@ class UsersController extends AUserData { $this->groupManager->isAdmin($currentLoggedInUser->getUID()) ) { $permittedFields[] = self::USER_FIELD_LOCALE; + $permittedFields[] = self::USER_FIELD_FIRST_DAY_OF_WEEK; } $permittedFields[] = IAccountManager::PROPERTY_PHONE; @@ -965,6 +966,7 @@ class UsersController extends AUserData { $permittedFields[] = self::USER_FIELD_PASSWORD; $permittedFields[] = self::USER_FIELD_LANGUAGE; $permittedFields[] = self::USER_FIELD_LOCALE; + $permittedFields[] = self::USER_FIELD_FIRST_DAY_OF_WEEK; $permittedFields[] = IAccountManager::PROPERTY_PHONE; $permittedFields[] = IAccountManager::PROPERTY_ADDRESS; $permittedFields[] = IAccountManager::PROPERTY_WEBSITE; @@ -1056,6 +1058,17 @@ class UsersController extends AUserData { } $this->config->setUserValue($targetUser->getUID(), 'core', 'locale', $value); break; + case self::USER_FIELD_FIRST_DAY_OF_WEEK: + $intValue = (int)$value; + if ($intValue < -1 || $intValue > 6) { + throw new OCSException($this->l10n->t('Invalid first day of week'), 102); + } + if ($intValue === -1) { + $this->config->deleteUserValue($targetUser->getUID(), 'core', AUserData::USER_FIELD_FIRST_DAY_OF_WEEK); + } else { + $this->config->setUserValue($targetUser->getUID(), 'core', AUserData::USER_FIELD_FIRST_DAY_OF_WEEK, $value); + } + break; case self::USER_FIELD_NOTIFICATION_EMAIL: $success = false; if ($value === '' || filter_var($value, FILTER_VALIDATE_EMAIL)) { |