From 3722af564bc7ba30bb3b1fafbf4acb9268640c3b Mon Sep 17 00:00:00 2001 From: Nikolai Merinov Date: Mon, 23 Nov 2020 01:50:16 -0500 Subject: Support all Actor types from Activity Vocabulary Support all types from https://www.w3.org/TR/2017/REC-activitystreams-vocabulary-20170523/ Signed-off-by: Nikolai Merinov --- lib/AP.php | 26 +++++++++++++- lib/Interfaces/Actor/ApplicationInterface.php | 46 ++++++++++++++++++++++++ lib/Interfaces/Actor/GroupInterface.php | 46 ++++++++++++++++++++++++ lib/Interfaces/Actor/OrganizationInterface.php | 46 ++++++++++++++++++++++++ lib/Model/ActivityPub/Actor/Application.php | 49 ++++++++++++++++++++++++++ lib/Model/ActivityPub/Actor/Group.php | 49 ++++++++++++++++++++++++++ lib/Model/ActivityPub/Actor/Organization.php | 49 ++++++++++++++++++++++++++ 7 files changed, 310 insertions(+), 1 deletion(-) create mode 100644 lib/Interfaces/Actor/ApplicationInterface.php create mode 100644 lib/Interfaces/Actor/GroupInterface.php create mode 100644 lib/Interfaces/Actor/OrganizationInterface.php create mode 100644 lib/Model/ActivityPub/Actor/Application.php create mode 100644 lib/Model/ActivityPub/Actor/Group.php create mode 100644 lib/Model/ActivityPub/Actor/Organization.php 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 @@ + + * @copyright 2020, Nikolai Merinov + * @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 . + * + */ + + +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 @@ + + * @copyright 2020, Nikolai Merinov + * @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 . + * + */ + + +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 @@ + + * @copyright 2020, Nikolai Merinov + * @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 . + * + */ + + +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 @@ + + * @copyright 2020, Nikolai Merinov + * @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 . + * + */ + + +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 @@ + + * @copyright 2020, Nikolai Merinov + * @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 . + * + */ + + +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 @@ + + * @copyright 2020, Nikolai Merinov + * @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 . + * + */ + + +namespace OCA\Social\Model\ActivityPub\Actor; + + +use JsonSerializable; + + +/** + * Class Organization + * + * @package OCA\Social\Model\ActivityPub + */ +class Organization extends Person implements JsonSerializable { + + + const TYPE = 'Organization'; + + +} + -- cgit v1.2.3