aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Collaboration/Resources
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/Collaboration/Resources')
-rw-r--r--lib/private/Collaboration/Resources/Collection.php35
-rw-r--r--lib/private/Collaboration/Resources/Listener.php22
-rw-r--r--lib/private/Collaboration/Resources/Manager.php41
-rw-r--r--lib/private/Collaboration/Resources/ProviderManager.php22
-rw-r--r--lib/private/Collaboration/Resources/Resource.php26
5 files changed, 27 insertions, 119 deletions
diff --git a/lib/private/Collaboration/Resources/Collection.php b/lib/private/Collaboration/Resources/Collection.php
index 3a09fe60051..2481a3e9a09 100644
--- a/lib/private/Collaboration/Resources/Collection.php
+++ b/lib/private/Collaboration/Resources/Collection.php
@@ -3,27 +3,8 @@
declare(strict_types=1);
/**
- * @copyright Copyright (c) 2018 Joas Schilling <coding@schilljs.com>
- *
- * @author Christoph Wurst <christoph@winzerhof-wurst.at>
- * @author Joas Schilling <coding@schilljs.com>
- * @author Roeland Jago Douma <roeland@famdouma.nl>
- *
- * @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/>.
- *
+ * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OC\Collaboration\Resources;
@@ -47,7 +28,7 @@ class Collection implements ICollection {
protected int $id,
protected string $name,
protected ?IUser $userForAccess = null,
- protected ?bool $access = null
+ protected ?bool $access = null,
) {
}
@@ -73,7 +54,7 @@ class Collection implements ICollection {
$query->update(Manager::TABLE_COLLECTIONS)
->set('name', $query->createNamedParameter($name))
->where($query->expr()->eq('id', $query->createNamedParameter($this->getId(), IQueryBuilder::PARAM_INT)));
- $query->execute();
+ $query->executeStatement();
$this->name = $name;
}
@@ -137,7 +118,7 @@ class Collection implements ICollection {
->where($query->expr()->eq('collection_id', $query->createNamedParameter($this->id, IQueryBuilder::PARAM_INT)))
->andWhere($query->expr()->eq('resource_type', $query->createNamedParameter($resource->getType())))
->andWhere($query->expr()->eq('resource_id', $query->createNamedParameter($resource->getId())));
- $query->execute();
+ $query->executeStatement();
if (empty($this->resources)) {
$this->removeCollection();
@@ -183,15 +164,15 @@ class Collection implements ICollection {
}
protected function isSameResource(IResource $resource1, IResource $resource2): bool {
- return $resource1->getType() === $resource2->getType() &&
- $resource1->getId() === $resource2->getId();
+ return $resource1->getType() === $resource2->getType()
+ && $resource1->getId() === $resource2->getId();
}
protected function removeCollection(): void {
$query = $this->connection->getQueryBuilder();
$query->delete(Manager::TABLE_COLLECTIONS)
->where($query->expr()->eq('id', $query->createNamedParameter($this->id, IQueryBuilder::PARAM_INT)));
- $query->execute();
+ $query->executeStatement();
$this->manager->invalidateAccessCacheForCollection($this);
$this->id = 0;
diff --git a/lib/private/Collaboration/Resources/Listener.php b/lib/private/Collaboration/Resources/Listener.php
index 4330f3570bc..dfdde24d78e 100644
--- a/lib/private/Collaboration/Resources/Listener.php
+++ b/lib/private/Collaboration/Resources/Listener.php
@@ -3,26 +3,8 @@
declare(strict_types=1);
/**
- * @copyright Copyright (c) 2019 Joas Schilling <coding@schilljs.com>
- *
- * @author Christoph Wurst <christoph@winzerhof-wurst.at>
- * @author Joas Schilling <coding@schilljs.com>
- *
- * @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/>.
- *
+ * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OC\Collaboration\Resources;
diff --git a/lib/private/Collaboration/Resources/Manager.php b/lib/private/Collaboration/Resources/Manager.php
index 0f4dbd7cbb7..8d1e4b13287 100644
--- a/lib/private/Collaboration/Resources/Manager.php
+++ b/lib/private/Collaboration/Resources/Manager.php
@@ -3,27 +3,8 @@
declare(strict_types=1);
/**
- * @copyright Copyright (c) 2018 Joas Schilling <coding@schilljs.com>
- *
- * @author Daniel Kesselberg <mail@danielkesselberg.de>
- * @author Joas Schilling <coding@schilljs.com>
- * @author Julius Härtl <jus@bitgrid.net>
- *
- * @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/>.
- *
+ * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OC\Collaboration\Resources;
@@ -72,7 +53,7 @@ class Manager implements IManager {
throw new CollectionException('Collection not found');
}
- return new Collection($this, $this->connection, (int) $row['id'], (string) $row['name']);
+ return new Collection($this, $this->connection, (int)$row['id'], (string)$row['name']);
}
/**
@@ -101,12 +82,12 @@ class Manager implements IManager {
throw new CollectionException('Collection not found');
}
- $access = $row['access'] === null ? null : (bool) $row['access'];
+ $access = $row['access'] === null ? null : (bool)$row['access'];
if ($user instanceof IUser) {
- return new Collection($this, $this->connection, (int) $row['id'], (string) $row['name'], $user, $access);
+ return new Collection($this, $this->connection, (int)$row['id'], (string)$row['name'], $user, $access);
}
- return new Collection($this, $this->connection, (int) $row['id'], (string) $row['name'], $user, $access);
+ return new Collection($this, $this->connection, (int)$row['id'], (string)$row['name'], $user, $access);
}
/**
@@ -141,7 +122,7 @@ class Manager implements IManager {
$foundResults = 0;
while ($row = $result->fetch()) {
$foundResults++;
- $access = $row['access'] === null ? null : (bool) $row['access'];
+ $access = $row['access'] === null ? null : (bool)$row['access'];
$collection = new Collection($this, $this->connection, (int)$row['id'], (string)$row['name'], $user, $access);
if ($collection->canAccess($user)) {
$collections[] = $collection;
@@ -205,7 +186,7 @@ class Manager implements IManager {
throw new ResourceException('Resource not found');
}
- $access = $row['access'] === null ? null : (bool) $row['access'];
+ $access = $row['access'] === null ? null : (bool)$row['access'];
if ($user instanceof IUser) {
return new Resource($this, $this->connection, $type, $id, $user, $access);
}
@@ -236,7 +217,7 @@ class Manager implements IManager {
$resources = [];
$result = $query->execute();
while ($row = $result->fetch()) {
- $access = $row['access'] === null ? null : (bool) $row['access'];
+ $access = $row['access'] === null ? null : (bool)$row['access'];
$resources[] = new Resource($this, $this->connection, $row['resource_type'], $row['resource_id'], $user, $access);
}
$result->closeCursor();
@@ -330,7 +311,7 @@ class Manager implements IManager {
$hasAccess = null;
$result = $query->execute();
if ($row = $result->fetch()) {
- $hasAccess = (bool) $row['access'];
+ $hasAccess = (bool)$row['access'];
}
$result->closeCursor();
@@ -350,7 +331,7 @@ class Manager implements IManager {
$hasAccess = null;
$result = $query->execute();
if ($row = $result->fetch()) {
- $hasAccess = (bool) $row['access'];
+ $hasAccess = (bool)$row['access'];
}
$result->closeCursor();
diff --git a/lib/private/Collaboration/Resources/ProviderManager.php b/lib/private/Collaboration/Resources/ProviderManager.php
index 823d6764f58..0ce4ae7155a 100644
--- a/lib/private/Collaboration/Resources/ProviderManager.php
+++ b/lib/private/Collaboration/Resources/ProviderManager.php
@@ -3,26 +3,8 @@
declare(strict_types=1);
/**
- * @copyright Copyright (c) 2019 Daniel Kesselberg <mail@danielkesselberg.de>
- *
- * @author Daniel Kesselberg <mail@danielkesselberg.de>
- * @author Joas Schilling <coding@schilljs.com>
- *
- * @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/>.
- *
+ * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OC\Collaboration\Resources;
diff --git a/lib/private/Collaboration/Resources/Resource.php b/lib/private/Collaboration/Resources/Resource.php
index 059b1802128..19da3da7e7d 100644
--- a/lib/private/Collaboration/Resources/Resource.php
+++ b/lib/private/Collaboration/Resources/Resource.php
@@ -3,26 +3,8 @@
declare(strict_types=1);
/**
- * @copyright Copyright (c) 2018 Joas Schilling <coding@schilljs.com>
- *
- * @author Joas Schilling <coding@schilljs.com>
- * @author Julius Härtl <jus@bitgrid.net>
- *
- * @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/>.
- *
+ * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OC\Collaboration\Resources;
@@ -41,7 +23,7 @@ class Resource implements IResource {
protected string $type,
protected string $id,
protected ?IUser $userForAccess = null,
- protected ?bool $access = null
+ protected ?bool $access = null,
) {
}
@@ -122,7 +104,7 @@ class Resource implements IResource {
$result = $query->execute();
while ($row = $result->fetch()) {
- $collections[] = $this->manager->getCollection((int) $row['collection_id']);
+ $collections[] = $this->manager->getCollection((int)$row['collection_id']);
}
$result->closeCursor();