Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EntityManager #1320

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 <[email protected]>
* @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 <[email protected]>
*
* @author Maxence Lange <[email protected]>
*
* @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 [];
}
}