aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_external/lib/Config/UserPlaceholderHandler.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_external/lib/Config/UserPlaceholderHandler.php')
-rw-r--r--apps/files_external/lib/Config/UserPlaceholderHandler.php25
1 files changed, 25 insertions, 0 deletions
diff --git a/apps/files_external/lib/Config/UserPlaceholderHandler.php b/apps/files_external/lib/Config/UserPlaceholderHandler.php
new file mode 100644
index 00000000000..d158e6923c1
--- /dev/null
+++ b/apps/files_external/lib/Config/UserPlaceholderHandler.php
@@ -0,0 +1,25 @@
+<?php
+
+/**
+ * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+namespace OCA\Files_External\Config;
+
+class UserPlaceholderHandler extends UserContext implements IConfigHandler {
+ use SimpleSubstitutionTrait;
+
+ /**
+ * @param mixed $optionValue
+ * @return mixed the same type as $optionValue
+ * @since 16.0.0
+ */
+ public function handle($optionValue) {
+ $this->placeholder = 'user';
+ $uid = $this->getUserId();
+ if ($uid === null) {
+ return $optionValue;
+ }
+ return $this->processInput($optionValue, $uid);
+ }
+}