Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/polls.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authordartcafe <github@dartcafe.de>2021-04-09 03:14:58 +0300
committerdartcafe <github@dartcafe.de>2021-04-09 03:14:58 +0300
commit2e000492ced0979ee69ebe18bde95b2692fc40ca (patch)
tree76ad0c39fee1fe18b2e93e9dcbaf773354eb3e1a /lib
parent07dcc552d5455f5050e70d8f1001c34ea1da1eb8 (diff)
username as search parameter #1517
Signed-off-by: dartcafe <github@dartcafe.de>
Diffstat (limited to 'lib')
-rw-r--r--lib/Helper/Trace.php54
-rw-r--r--lib/Service/SystemService.php2
2 files changed, 55 insertions, 1 deletions
diff --git a/lib/Helper/Trace.php b/lib/Helper/Trace.php
new file mode 100644
index 00000000..c8cfbea0
--- /dev/null
+++ b/lib/Helper/Trace.php
@@ -0,0 +1,54 @@
+<?php
+/**
+ * @copyright Copyright (c) 2021 René Gieling <github@dartcafe.de>
+ *
+ * @author René Gieling <github@dartcafe.de>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace OCA\Polls\Model;
+
+class Trace implements \JsonSerializable {
+
+ /** @var Array */
+ protected $result = [];
+
+ /** @var string */
+ protected $method;
+
+ public function __construct(
+ string $method,
+ string $payload = ''
+ ) {
+ $this->method = $method;
+ $this->log('Initialization', $payload);
+ }
+
+ public function log($operation, $payload = '') {
+ $this->result[] = [
+ 'method' => $this->method,
+ 'time' => time(),
+ 'operation' => $operation,
+ 'payload' => $payload
+ ];
+ }
+
+ public function jsonSerialize(): array {
+ return $this->result;
+ }
+}
diff --git a/lib/Service/SystemService.php b/lib/Service/SystemService.php
index cd5657da..41c70542 100644
--- a/lib/Service/SystemService.php
+++ b/lib/Service/SystemService.php
@@ -141,7 +141,7 @@ class SystemService {
}
// get all users
- foreach (User::search() as $user) {
+ foreach (User::search($userName) as $user) {
if ($userName === strtolower(trim($user->getId()))
|| $userName === strtolower(trim($user->getDisplayName()))) {
throw new InvalidUsernameException;