summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaxence Lange <maxence@artificial-owl.com>2020-12-02 22:28:07 -0100
committerGitHub <noreply@github.com>2020-12-02 22:28:07 -0100
commit45a1f2138c7a557b491d315bd7a6d7cbf3414da8 (patch)
tree05ee9475f86bb2c05fd2b6ad78b18d379c123583
parent381c5105aa4047e8057890b3cbb557c4e672bd99 (diff)
parent3722af564bc7ba30bb3b1fafbf4acb9268640c3b (diff)
Merge pull request #1138 from mnd/activitystream-vocabulary
Support all Actor types from Activity Vocabulary
-rw-r--r--lib/AP.php26
-rw-r--r--lib/Interfaces/Actor/ApplicationInterface.php46
-rw-r--r--lib/Interfaces/Actor/GroupInterface.php46
-rw-r--r--lib/Interfaces/Actor/OrganizationInterface.php46
-rw-r--r--lib/Model/ActivityPub/Actor/Application.php49
-rw-r--r--lib/Model/ActivityPub/Actor/Group.php49
-rw-r--r--lib/Model/ActivityPub/Actor/Organization.php49
7 files changed, 310 insertions, 1 deletions
diff --git a/lib/AP.php b/lib/AP.php
index 7937bb86..2e8a255d 100644
--- a/lib/AP.php
+++ b/lib/AP.php
@@ -47,6 +47,9 @@ use OCA\Social\Interfaces\Activity\UndoInterface;
use OCA\Social\Interfaces\Activity\UpdateInterface;
use OCA\Social\Interfaces\Actor\PersonInterface;
use OCA\Social\Interfaces\Actor\ServiceInterface;
+use OCA\Social\Interfaces\Actor\GroupInterface;
+use OCA\Social\Interfaces\Actor\OrganizationInterface;
+use OCA\Social\Interfaces\Actor\ApplicationInterface;
use OCA\Social\Interfaces\IActivityPubInterface;
use OCA\Social\Interfaces\Internal\SocialAppNotificationInterface;
use OCA\Social\Interfaces\Object\AnnounceInterface;
@@ -67,6 +70,9 @@ use OCA\Social\Model\ActivityPub\Activity\Undo;
use OCA\Social\Model\ActivityPub\Activity\Update;
use OCA\Social\Model\ActivityPub\Actor\Person;
use OCA\Social\Model\ActivityPub\Actor\Service;
+use OCA\Social\Model\ActivityPub\Actor\Group;
+use OCA\Social\Model\ActivityPub\Actor\Organization;
+use OCA\Social\Model\ActivityPub\Actor\Application;
use OCA\Social\Model\ActivityPub\Internal\SocialAppNotification;
use OCA\Social\Model\ActivityPub\Object\Announce;
use OCA\Social\Model\ActivityPub\Object\Document;
@@ -183,6 +189,9 @@ class AP {
$ap->notificationInterface = OC::$server->query(SocialAppNotificationInterface::class);
$ap->personInterface = OC::$server->query(PersonInterface::class);
$ap->serviceInterface = OC::$server->query(ServiceInterface::class);
+ $ap->groupInterface = OC::$server->query(GroupInterface::class);
+ $ap->groupInterface = OC::$server->query(OrganizationInterface::class);
+ $ap->groupInterface = OC::$server->query(ApplicationInterface::class);
$ap->rejectInterface = OC::$server->query(RejectInterface::class);
$ap->removeInterface = OC::$server->query(RemoveInterface::class);
$ap->undoInterface = OC::$server->query(UndoInterface::class);
@@ -366,6 +375,18 @@ class AP {
$item = new Service();
break;
+ case Group::TYPE:
+ $item = new Group();
+ break;
+
+ case Organization::TYPE:
+ $item = new Organization();
+ break;
+
+ case Application::TYPE:
+ $item = new Application();
+ break;
+
case Tombstone::TYPE:
$item = new Tombstone();
break;
@@ -496,7 +517,10 @@ class AP {
$types =
[
Person::TYPE,
- Service::TYPE
+ Service::TYPE,
+ Group::TYPE,
+ Organization::TYPE,
+ Application::TYPE
];
return (in_array($item->getType(), $types));
diff --git a/lib/Interfaces/Actor/ApplicationInterface.php b/lib/Interfaces/Actor/ApplicationInterface.php
new file mode 100644
index 00000000..75696b30
--- /dev/null
+++ b/lib/Interfaces/Actor/ApplicationInterface.php
@@ -0,0 +1,46 @@
+<?php
+declare(strict_types=1);
+
+
+/**
+ * Nextcloud - Social Support
+ *
+ * This file is licensed under the Affero General Public License version 3 or
+ * later. See the COPYING file.
+ *
+ * @author Nikolai Merinov <nikolai.merinov@member.fsf.org>
+ * @copyright 2020, Nikolai Merinov <nikolai.merinov@member.fsf.org>
+ * @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\Social\Interfaces\Actor;
+
+
+use OCA\Social\Interfaces\IActivityPubInterface;
+
+
+/**
+ * Class ApplicationInterface
+ *
+ * @package OCA\Social\Service\ActivityPub
+ */
+class ApplicationInterface extends PersonInterface implements IActivityPubInterface {
+
+}
+
+
diff --git a/lib/Interfaces/Actor/GroupInterface.php b/lib/Interfaces/Actor/GroupInterface.php
new file mode 100644
index 00000000..f1ad1c4b
--- /dev/null
+++ b/lib/Interfaces/Actor/GroupInterface.php
@@ -0,0 +1,46 @@
+<?php
+declare(strict_types=1);
+
+
+/**
+ * Nextcloud - Social Support
+ *
+ * This file is licensed under the Affero General Public License version 3 or
+ * later. See the COPYING file.
+ *
+ * @author Nikolai Merinov <nikolai.merinov@member.fsf.org>
+ * @copyright 2020, Nikolai Merinov <nikolai.merinov@member.fsf.org>
+ * @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\Social\Interfaces\Actor;
+
+
+use OCA\Social\Interfaces\IActivityPubInterface;
+
+
+/**
+ * Class GroupInterface
+ *
+ * @package OCA\Social\Service\ActivityPub
+ */
+class GroupInterface extends PersonInterface implements IActivityPubInterface {
+
+}
+
+
diff --git a/lib/Interfaces/Actor/OrganizationInterface.php b/lib/Interfaces/Actor/OrganizationInterface.php
new file mode 100644
index 00000000..034af88d
--- /dev/null
+++ b/lib/Interfaces/Actor/OrganizationInterface.php
@@ -0,0 +1,46 @@
+<?php
+declare(strict_types=1);
+
+
+/**
+ * Nextcloud - Social Support
+ *
+ * This file is licensed under the Affero General Public License version 3 or
+ * later. See the COPYING file.
+ *
+ * @author Nikolai Merinov <nikolai.merinov@member.fsf.org>
+ * @copyright 2020, Nikolai Merinov <nikolai.merinov@member.fsf.org>
+ * @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\Social\Interfaces\Actor;
+
+
+use OCA\Social\Interfaces\IActivityPubInterface;
+
+
+/**
+ * Class OrganizationInterface
+ *
+ * @package OCA\Social\Service\ActivityPub
+ */
+class OrganizationInterface extends PersonInterface implements IActivityPubInterface {
+
+}
+
+
diff --git a/lib/Model/ActivityPub/Actor/Application.php b/lib/Model/ActivityPub/Actor/Application.php
new file mode 100644
index 00000000..9bfb6b9e
--- /dev/null
+++ b/lib/Model/ActivityPub/Actor/Application.php
@@ -0,0 +1,49 @@
+<?php
+declare(strict_types=1);
+
+
+/**
+ * Nextcloud - Social Support
+ *
+ * This file is licensed under the Affero General Public License version 3 or
+ * later. See the COPYING file.
+ *
+ * @author Nikolai Merinov <nikolai.merinov@member.fsf.org>
+ * @copyright 2020, Nikolai Merinov <nikolai.merinov@member.fsf.org>
+ * @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\Social\Model\ActivityPub\Actor;
+
+
+use JsonSerializable;
+
+
+/**
+ * Class Application
+ *
+ * @package OCA\Social\Model\ActivityPub
+ */
+class Application extends Person implements JsonSerializable {
+
+
+ const TYPE = 'Application';
+
+
+}
+
diff --git a/lib/Model/ActivityPub/Actor/Group.php b/lib/Model/ActivityPub/Actor/Group.php
new file mode 100644
index 00000000..d893f350
--- /dev/null
+++ b/lib/Model/ActivityPub/Actor/Group.php
@@ -0,0 +1,49 @@
+<?php
+declare(strict_types=1);
+
+
+/**
+ * Nextcloud - Social Support
+ *
+ * This file is licensed under the Affero General Public License version 3 or
+ * later. See the COPYING file.
+ *
+ * @author Nikolai Merinov <nikolai.merinov@member.fsf.org>
+ * @copyright 2020, Nikolai Merinov <nikolai.merinov@member.fsf.org>
+ * @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\Social\Model\ActivityPub\Actor;
+
+
+use JsonSerializable;
+
+
+/**
+ * Class Group
+ *
+ * @package OCA\Social\Model\ActivityPub
+ */
+class Group extends Person implements JsonSerializable {
+
+
+ const TYPE = 'Group';
+
+
+}
+
diff --git a/lib/Model/ActivityPub/Actor/Organization.php b/lib/Model/ActivityPub/Actor/Organization.php
new file mode 100644
index 00000000..8e129183
--- /dev/null
+++ b/lib/Model/ActivityPub/Actor/Organization.php
@@ -0,0 +1,49 @@
+<?php
+declare(strict_types=1);
+
+
+/**
+ * Nextcloud - Social Support
+ *
+ * This file is licensed under the Affero General Public License version 3 or
+ * later. See the COPYING file.
+ *
+ * @author Nikolai Merinov <nikolai.merinov@member.fsf.org>
+ * @copyright 2020, Nikolai Merinov <nikolai.merinov@member.fsf.org>
+ * @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\Social\Model\ActivityPub\Actor;
+
+
+use JsonSerializable;
+
+
+/**
+ * Class Organization
+ *
+ * @package OCA\Social\Model\ActivityPub
+ */
+class Organization extends Person implements JsonSerializable {
+
+
+ const TYPE = 'Organization';
+
+
+}
+