Skip to content

Commit

Permalink
EntityManager
Browse files Browse the repository at this point in the history
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
  • Loading branch information
ArtificialOwl committed Jun 12, 2023
1 parent 4406560 commit 0ea37a6
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
49 changes: 49 additions & 0 deletions lib/EntityManager.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php

declare(strict_types=1);

/*
* Circles - Bring cloud-users closer together.
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Maxence Lange <maxence@artificial-owl.com>
* @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 <http://www.gnu.org/licenses/>.
*
*/

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 {
}
}
50 changes: 50 additions & 0 deletions lib/EntityManagerSession.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?php

declare(strict_types=1);

/**
* @copyright 2023, Maxence Lange <maxence@artificial-owl.com>
*
* @author Maxence Lange <maxence@artificial-owl.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/>.
*
*/

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 [];
}
}

0 comments on commit 0ea37a6

Please sign in to comment.