save transport of registration in db
This commit is contained in:
parent
e42b7b34ad
commit
af104a63f2
3 changed files with 32 additions and 3 deletions
|
@ -107,7 +107,7 @@ class SubscriptionManagementPlugin extends ServerPlugin {
|
||||||
$subscriptionParameterIncluded = True;
|
$subscriptionParameterIncluded = True;
|
||||||
|
|
||||||
if(sizeof($parameter["value"]) == 1) {
|
if(sizeof($parameter["value"]) == 1) {
|
||||||
$subscriptionType = $parameter["value"][0]["name"];
|
$subscriptionType = preg_replace('/^\{DAV:Push\}/', '', $parameter["value"][0]["name"]);
|
||||||
$subscriptionOptions = $parameter["value"][0]["value"];
|
$subscriptionOptions = $parameter["value"][0]["value"];
|
||||||
} else {
|
} else {
|
||||||
$errors[] = "only one subscription allowed";
|
$errors[] = "only one subscription allowed";
|
||||||
|
@ -121,7 +121,7 @@ class SubscriptionManagementPlugin extends ServerPlugin {
|
||||||
$errors[] = "no subscription included";
|
$errors[] = "no subscription included";
|
||||||
}
|
}
|
||||||
|
|
||||||
$transport = $this->transportManager->getTransport(preg_replace('/^\{DAV:Push\}/', '', $subscriptionType));
|
$transport = $this->transportManager->getTransport($subscriptionType);
|
||||||
|
|
||||||
if($transport === null) {
|
if($transport === null) {
|
||||||
$errors[] = $subscriptionType . " transport does not exist";
|
$errors[] = $subscriptionType . " transport does not exist";
|
||||||
|
@ -151,6 +151,7 @@ class SubscriptionManagementPlugin extends ServerPlugin {
|
||||||
$subscription = new Subscription();
|
$subscription = new Subscription();
|
||||||
$subscription->setUserId($this->userId);
|
$subscription->setUserId($this->userId);
|
||||||
$subscription->setCollectionName($node->getName());
|
$subscription->setCollectionName($node->getName());
|
||||||
|
$subscription->setTransport($subscriptionType);
|
||||||
$subscription->setCreationTimestamp(time());
|
$subscription->setCreationTimestamp(time());
|
||||||
if(!$subscriptionExpires) {
|
if(!$subscriptionExpires) {
|
||||||
$subscription->setExpirationTimestamp(0);
|
$subscription->setExpirationTimestamp(0);
|
||||||
|
|
|
@ -9,6 +9,7 @@ use OCP\AppFramework\Db\Entity;
|
||||||
class Subscription extends Entity implements JsonSerializable {
|
class Subscription extends Entity implements JsonSerializable {
|
||||||
protected $userId;
|
protected $userId;
|
||||||
protected $collectionName;
|
protected $collectionName;
|
||||||
|
protected $transport;
|
||||||
protected $data;
|
protected $data;
|
||||||
protected $creationTimestamp;
|
protected $creationTimestamp;
|
||||||
protected $expirationTimestamp;
|
protected $expirationTimestamp;
|
||||||
|
@ -23,9 +24,10 @@ class Subscription extends Entity implements JsonSerializable {
|
||||||
'id' => $this->id,
|
'id' => $this->id,
|
||||||
'userId' => $this->userId,
|
'userId' => $this->userId,
|
||||||
'collectionName' => $this->collectionName,
|
'collectionName' => $this->collectionName,
|
||||||
|
'transport' => $this->transport,
|
||||||
'data' => $this->data,
|
'data' => $this->data,
|
||||||
'creationTimestamp' => $this->creationTimestamp,
|
'creationTimestamp' => $this->creationTimestamp,
|
||||||
'expirationTimestamp' => $this->expirationTimestampv
|
'expirationTimestamp' => $this->expirationTimestamp
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -4,6 +4,28 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace OCA\DavPush\Migration;
|
namespace OCA\DavPush\Migration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @copyright 2024 Jonathan Treffler <mail@jonathan-treffler.de>
|
||||||
|
*
|
||||||
|
* @author Jonathan Treffler <mail@jonathan-treffler.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/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
use Closure;
|
use Closure;
|
||||||
use OCP\DB\Types;
|
use OCP\DB\Types;
|
||||||
use OCP\DB\ISchemaWrapper;
|
use OCP\DB\ISchemaWrapper;
|
||||||
|
@ -38,6 +60,10 @@ class Version001Date20240515221000 extends SimpleMigrationStep {
|
||||||
'notnull' => true,
|
'notnull' => true,
|
||||||
'length' => 100,
|
'length' => 100,
|
||||||
]);
|
]);
|
||||||
|
$table->addColumn('transport', Types::STRING, [
|
||||||
|
'notnull' => true,
|
||||||
|
'length' => 100,
|
||||||
|
]);
|
||||||
$table->addColumn('data', Types::TEXT, [
|
$table->addColumn('data', Types::TEXT, [
|
||||||
'notnull' => true,
|
'notnull' => true,
|
||||||
]);
|
]);
|
||||||
|
|
Loading…
Reference in a new issue