diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index 5b4d2e63e..27c1b4a39 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -36,6 +36,7 @@ use Closure; use OC; +use OCA\Circles\EntityManager; use OCA\Circles\Events\AddingCircleMemberEvent; use OCA\Circles\Events\CircleMemberAddedEvent; use OCA\Circles\Events\DestroyingCircleEvent; @@ -73,6 +74,7 @@ use OCP\AppFramework\Bootstrap\IBootContext; use OCP\AppFramework\Bootstrap\IBootstrap; use OCP\AppFramework\Bootstrap\IRegistrationContext; +use OCP\Circles\IEntityManager; use OCP\Files\Config\IMountProviderCollection; use OCP\Group\Events\GroupCreatedEvent; use OCP\Group\Events\GroupDeletedEvent; @@ -192,6 +194,7 @@ public function register(IRegistrationContext $context): void { */ public function boot(IBootContext $context): void { $serverContainer = $context->getServerContainer(); + $serverContainer->registerAlias(IEntityManager::class, EntityManager::class); $this->configService = $context->getAppContainer() ->get(ConfigService::class); diff --git a/lib/EntityManager.php b/lib/EntityManager.php new file mode 100644 index 000000000..d7c2fff34 --- /dev/null +++ b/lib/EntityManager.php @@ -0,0 +1,49 @@ + + * @copyright 2017 + * @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\Circles; + +use OCP\Circles\Model\IEntity; +use OCP\Circles\IEntityManager; +use OCP\Circles\IEntityManagerSession; + +class EntityManager extends EntityManagerSession implements IEntityManager { + public function isAvailable(): bool { + return true; + } + + public function asEntity(IEntity $entity): IEntityManagerSession { + } + + public function asLocal(string $userId): IEntityManagerSession { + } + + public function asSuper(): IEntityManagerSession { + } +} diff --git a/lib/EntityManagerSession.php b/lib/EntityManagerSession.php new file mode 100644 index 000000000..fbbce4237 --- /dev/null +++ b/lib/EntityManagerSession.php @@ -0,0 +1,50 @@ + + * + * @author Maxence Lange + * + * @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\Circles; + +use OCP\Circles\IEntityManagerSession; +use OCP\Circles\Model\IEntity; + +class EntityManagerSession implements IEntityManagerSession { + private ?IEntity $entity; + private bool $asSuper; + + public function __construct(?IEntity $entity = null, bool $asSuper = false) { + $this->entity = $entity; + $this->asSuper = $asSuper; + } + + public function as(IEntity $entity): void { + } + + public function getCircle(): IEntity { + } + + public function probeCircles(): array { + return []; + } +}