switching import to Tools\

Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
This commit is contained in:
Maxence Lange 2022-03-08 10:53:33 -01:00
parent 7f246a395c
commit be8aca2b8a
137 changed files with 673 additions and 548 deletions

View file

@ -22,9 +22,6 @@
"OCA\\Circles\\": "lib/"
}
},
"require": {
"artificial-owl/my-small-php-tools": "~23"
},
"scripts": {
"cs:check": "php-cs-fixer fix --dry-run --diff",
"cs:fix": "php-cs-fixer fix",

View file

@ -31,7 +31,7 @@ declare(strict_types=1);
namespace OCA\Circles;
use ArtificialOwl\MySmallPhpTools\Exceptions\InvalidItemException;
use OCA\Circles\Tools\Exceptions\InvalidItemException;
use OCA\Circles\Exceptions\CircleNotFoundException;
use OCA\Circles\Exceptions\ContactAddressBookNotFoundException;
use OCA\Circles\Exceptions\ContactFormatException;

View file

@ -31,7 +31,7 @@ declare(strict_types=1);
namespace OCA\Circles\Collaboration\v2;
use ArtificialOwl\MySmallPhpTools\Traits\Nextcloud\nc22\TNC22Logger;
use OCA\Circles\Tools\Traits\TNCLogger;
use Exception;
use OC\Share20\Share;
use OCA\Circles\AppInfo\Application;
@ -51,7 +51,7 @@ use OCP\Share\IShare;
* @package OCA\Circles\Collaboration\v2
*/
class CollaboratorSearchPlugin implements ISearchPlugin {
use TNC22Logger;
use TNCLogger;
/** @var IRequest */

View file

@ -31,14 +31,6 @@ declare(strict_types=1);
namespace OCA\Circles\Command;
use ArtificialOwl\MySmallPhpTools\Exceptions\RequestNetworkException;
use ArtificialOwl\MySmallPhpTools\Exceptions\SignatoryException;
use ArtificialOwl\MySmallPhpTools\Model\Nextcloud\nc22\NC22Request;
use ArtificialOwl\MySmallPhpTools\Model\Request;
use ArtificialOwl\MySmallPhpTools\Model\SimpleDataStore;
use ArtificialOwl\MySmallPhpTools\Traits\Nextcloud\nc22\TNC22Request;
use ArtificialOwl\MySmallPhpTools\Traits\TArrayTools;
use ArtificialOwl\MySmallPhpTools\Traits\TStringTools;
use Exception;
use OC;
use OC\AppConfig;
@ -63,6 +55,14 @@ use OCA\Circles\Service\InterfaceService;
use OCA\Circles\Service\RemoteService;
use OCA\Circles\Service\RemoteStreamService;
use OCA\Circles\Service\RemoteUpstreamService;
use OCA\Circles\Tools\Exceptions\RequestNetworkException;
use OCA\Circles\Tools\Exceptions\SignatoryException;
use OCA\Circles\Tools\Model\NCRequest;
use OCA\Circles\Tools\Model\Request;
use OCA\Circles\Tools\Model\SimpleDataStore;
use OCA\Circles\Tools\Traits\TArrayTools;
use OCA\Circles\Tools\Traits\TNCRequest;
use OCA\Circles\Tools\Traits\TStringTools;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
@ -77,7 +77,7 @@ use Symfony\Component\Console\Question\Question;
class CirclesCheck extends Base {
use TStringTools;
use TArrayTools;
use TNC22Request;
use TNCRequest;
public static $checks = [
@ -791,7 +791,7 @@ class CirclesCheck extends Base {
string $route,
array $args = []
): bool {
$request = new NC22Request('', Request::type($type));
$request = new NCRequest('', Request::type($type));
$this->configService->configureLoopbackRequest($request, $route, $args);
$request->setFollowLocation(false);

View file

@ -31,7 +31,7 @@ declare(strict_types=1);
namespace OCA\Circles\Command;
use ArtificialOwl\MySmallPhpTools\Exceptions\InvalidItemException;
use OCA\Circles\Tools\Exceptions\InvalidItemException;
use OC\Core\Command\Base;
use OCA\Circles\Exceptions\CircleNotFoundException;
use OCA\Circles\Exceptions\FederatedItemException;

View file

@ -31,10 +31,10 @@ declare(strict_types=1);
namespace OCA\Circles\Command;
use ArtificialOwl\MySmallPhpTools\Exceptions\RequestNetworkException;
use ArtificialOwl\MySmallPhpTools\Exceptions\SignatoryException;
use ArtificialOwl\MySmallPhpTools\Traits\TArrayTools;
use ArtificialOwl\MySmallPhpTools\Traits\TStringTools;
use OCA\Circles\Tools\Exceptions\RequestNetworkException;
use OCA\Circles\Tools\Exceptions\SignatoryException;
use OCA\Circles\Tools\Traits\TArrayTools;
use OCA\Circles\Tools\Traits\TStringTools;
use OC\Core\Command\Base;
use OCA\Circles\Exceptions\CircleNotFoundException;
use OCA\Circles\Exceptions\FederatedItemException;

View file

@ -31,13 +31,6 @@ declare(strict_types=1);
namespace OCA\Circles\Command;
use ArtificialOwl\MySmallPhpTools\Exceptions\InvalidItemException;
use ArtificialOwl\MySmallPhpTools\Exceptions\ItemNotFoundException;
use ArtificialOwl\MySmallPhpTools\Exceptions\UnknownTypeException;
use ArtificialOwl\MySmallPhpTools\Model\Nextcloud\nc22\NC22TreeNode;
use ArtificialOwl\MySmallPhpTools\Model\SimpleDataStore;
use ArtificialOwl\MySmallPhpTools\Traits\Nextcloud\nc22\TNC22ConsoleTree;
use ArtificialOwl\MySmallPhpTools\Traits\TArrayTools;
use Exception;
use OC\Core\Command\Base;
use OCA\Circles\Db\CircleRequest;
@ -66,6 +59,13 @@ use OCA\Circles\Service\CircleService;
use OCA\Circles\Service\ConfigService;
use OCA\Circles\Service\FederatedUserService;
use OCA\Circles\Service\MembershipService;
use OCA\Circles\Tools\Exceptions\InvalidItemException;
use OCA\Circles\Tools\Exceptions\ItemNotFoundException;
use OCA\Circles\Tools\Exceptions\UnknownTypeException;
use OCA\Circles\Tools\Model\SimpleDataStore;
use OCA\Circles\Tools\Model\TreeNode;
use OCA\Circles\Tools\Traits\TArrayTools;
use OCA\Circles\Tools\Traits\TConsoleTree;
use OCP\IUserManager;
use Symfony\Component\Console\Helper\Table;
use Symfony\Component\Console\Input\InputArgument;
@ -81,7 +81,7 @@ use Symfony\Component\Console\Output\OutputInterface;
*/
class CirclesMemberships extends Base {
use TArrayTools;
use TNC22ConsoleTree;
use TConsoleTree;
/** @var IUserManager */
@ -237,7 +237,7 @@ class CirclesMemberships extends Base {
$output->writeln('');
$tree = new NC22TreeNode(null, new SimpleDataStore(['federatedUser' => $federatedUser]));
$tree = new TreeNode(null, new SimpleDataStore(['federatedUser' => $federatedUser]));
$this->generateTree($federatedUser->getSingleId(), $tree);
$this->drawTree(
@ -255,10 +255,10 @@ class CirclesMemberships extends Base {
/**
* @param string $id
* @param NC22TreeNode $tree
* @param TreeNode $tree
* @param array $knownIds
*/
private function generateTree(string $id, NC22TreeNode $tree, array $knownIds = []) {
private function generateTree(string $id, TreeNode $tree, array $knownIds = []) {
if (in_array($id, $knownIds)) {
return;
}
@ -271,11 +271,11 @@ class CirclesMemberships extends Base {
continue;
}
$item = new NC22TreeNode(
$item = new TreeNode(
$tree, new SimpleDataStore(
[
'member' => $member,
'cycling' => in_array($member->getCircleId(), $knownIds)
'member' => $member,
'cycling' => in_array($member->getCircleId(), $knownIds)
]
)
);

View file

@ -31,13 +31,13 @@ declare(strict_types=1);
namespace OCA\Circles\Command;
use ArtificialOwl\MySmallPhpTools\Exceptions\RequestNetworkException;
use ArtificialOwl\MySmallPhpTools\Exceptions\SignatoryException;
use ArtificialOwl\MySmallPhpTools\Exceptions\SignatureException;
use ArtificialOwl\MySmallPhpTools\Model\Nextcloud\nc22\NC22Request;
use ArtificialOwl\MySmallPhpTools\Model\Nextcloud\nc22\NC22SignedRequest;
use ArtificialOwl\MySmallPhpTools\Traits\Nextcloud\nc22\TNC22WellKnown;
use ArtificialOwl\MySmallPhpTools\Traits\TStringTools;
use OCA\Circles\Tools\Exceptions\RequestNetworkException;
use OCA\Circles\Tools\Exceptions\SignatoryException;
use OCA\Circles\Tools\Exceptions\SignatureException;
use OCA\Circles\Tools\Model\NCRequest;
use OCA\Circles\Tools\Model\NCSignedRequest;
use OCA\Circles\Tools\Traits\TNCWellKnown;
use OCA\Circles\Tools\Traits\TStringTools;
use Exception;
use OC\Core\Command\Base;
use OCA\Circles\AppInfo\Application;
@ -63,7 +63,7 @@ use Symfony\Component\Console\Question\ConfirmationQuestion;
* @package OCA\Circles\Command
*/
class CirclesRemote extends Base {
use TNC22WellKnown;
use TNCWellKnown;
use TStringTools;
@ -395,12 +395,12 @@ class CirclesRemote extends Base {
* @param string $remote
* @param array $payload
*
* @return NC22SignedRequest
* @return NCSignedRequest
* @throws RequestNetworkException
* @throws SignatoryException
*/
private function outgoingTest(string $remote, array $payload): NC22SignedRequest {
$request = new NC22Request();
private function outgoingTest(string $remote, array $payload): NCSignedRequest {
$request = new NCRequest();
$request->basedOnUrl($remote);
$request->setFollowLocation(true);
$request->setLocalAddressAllowed(true);

View file

@ -31,12 +31,9 @@ declare(strict_types=1);
namespace OCA\Circles\Command;
use ArtificialOwl\MySmallPhpTools\Console\Nextcloud\nc22\NC22InteractiveShell;
use ArtificialOwl\MySmallPhpTools\Exceptions\InvalidItemException;
use ArtificialOwl\MySmallPhpTools\IInteractiveShellClient;
use ArtificialOwl\MySmallPhpTools\Model\Nextcloud\nc22\NC22InteractiveShellSession;
use ArtificialOwl\MySmallPhpTools\Traits\Nextcloud\nc22\TNC22Deserialize;
use ArtificialOwl\MySmallPhpTools\Traits\TArrayTools;
use OCA\Circles\Tools\Exceptions\InvalidItemException;
use OCA\Circles\Tools\Traits\TDeserialize;
use OCA\Circles\Tools\Traits\TArrayTools;
use OC\Core\Command\Base;
use OCA\Circles\Exceptions\InitiatorNotFoundException;
use OCA\Circles\Exceptions\UnknownInterfaceException;
@ -63,7 +60,7 @@ use Symfony\Component\Console\Output\OutputInterface;
* @package OCA\Circles\Command
*/
class CirclesReport extends Base implements IInteractiveShellClient {
use TNC22Deserialize;
use TDeserialize;
use TArrayTools;
@ -136,6 +133,8 @@ class CirclesReport extends Base implements IInteractiveShellClient {
* @throws InitiatorNotFoundException
*/
protected function execute(InputInterface $input, OutputInterface $output): int {
throw new \Exception('not available');
$filename = $input->getOption('read');
$local = $input->getOption('local');
$this->output = $output;

View file

@ -31,11 +31,11 @@ declare(strict_types=1);
namespace OCA\Circles\Command;
use ArtificialOwl\MySmallPhpTools\Exceptions\InvalidItemException;
use ArtificialOwl\MySmallPhpTools\Exceptions\ItemNotFoundException;
use ArtificialOwl\MySmallPhpTools\Traits\Nextcloud\nc22\TNC22Deserialize;
use ArtificialOwl\MySmallPhpTools\Traits\TArrayTools;
use ArtificialOwl\MySmallPhpTools\Traits\TStringTools;
use OCA\Circles\Tools\Exceptions\InvalidItemException;
use OCA\Circles\Tools\Exceptions\ItemNotFoundException;
use OCA\Circles\Tools\Traits\TDeserialize;
use OCA\Circles\Tools\Traits\TArrayTools;
use OCA\Circles\Tools\Traits\TStringTools;
use Exception;
use OC\Core\Command\Base;
use OCA\Circles\AppInfo\Application;
@ -63,7 +63,7 @@ use Symfony\Component\Process\Process;
class CirclesTest extends Base {
use TArrayTools;
use TStringTools;
use TNC22Deserialize;
use TDeserialize;
public static $INSTANCES = [

View file

@ -31,13 +31,13 @@ declare(strict_types=1);
namespace OCA\Circles\Command;
use ArtificialOwl\MySmallPhpTools\Exceptions\RequestContentException;
use ArtificialOwl\MySmallPhpTools\Exceptions\RequestNetworkException;
use ArtificialOwl\MySmallPhpTools\Exceptions\RequestResultNotJsonException;
use ArtificialOwl\MySmallPhpTools\Exceptions\RequestResultSizeException;
use ArtificialOwl\MySmallPhpTools\Exceptions\RequestServerException;
use ArtificialOwl\MySmallPhpTools\Model\Nextcloud\nc22\NC22Request;
use ArtificialOwl\MySmallPhpTools\Model\Request;
use OCA\Circles\Tools\Exceptions\RequestContentException;
use OCA\Circles\Tools\Exceptions\RequestNetworkException;
use OCA\Circles\Tools\Exceptions\RequestResultNotJsonException;
use OCA\Circles\Tools\Exceptions\RequestResultSizeException;
use OCA\Circles\Tools\Exceptions\RequestServerException;
use OCA\Circles\Tools\Model\NCRequest;
use OCA\Circles\Tools\Model\Request;
use Exception;
use OC\Core\Command\Base;
use OCA\Circles\Exceptions\FederatedItemException;
@ -162,7 +162,7 @@ class MembersAdd extends Base {
return '';
}
$request = new NC22Request(ConfigService::GS_LOOKUP_USERS, Request::TYPE_GET);
$request = new NCRequest(ConfigService::GS_LOOKUP_USERS, Request::TYPE_GET);
$this->configService->configureRequest($request);
$request->basedOnUrl($lookup);
$request->addParam('search', $search);

View file

@ -31,15 +31,6 @@ declare(strict_types=1);
namespace OCA\Circles\Command;
use ArtificialOwl\MySmallPhpTools\Exceptions\InvalidItemException;
use ArtificialOwl\MySmallPhpTools\Exceptions\ItemNotFoundException;
use ArtificialOwl\MySmallPhpTools\Exceptions\RequestNetworkException;
use ArtificialOwl\MySmallPhpTools\Exceptions\SignatoryException;
use ArtificialOwl\MySmallPhpTools\Exceptions\UnknownTypeException;
use ArtificialOwl\MySmallPhpTools\Model\Nextcloud\nc22\NC22TreeNode;
use ArtificialOwl\MySmallPhpTools\Model\SimpleDataStore;
use ArtificialOwl\MySmallPhpTools\Traits\Nextcloud\nc22\TNC22ConsoleTree;
use ArtificialOwl\MySmallPhpTools\Traits\TStringTools;
use Exception;
use OC\Core\Command\Base;
use OCA\Circles\Db\MemberRequest;
@ -65,6 +56,15 @@ use OCA\Circles\Service\ConfigService;
use OCA\Circles\Service\FederatedUserService;
use OCA\Circles\Service\MemberService;
use OCA\Circles\Service\RemoteService;
use OCA\Circles\Tools\Exceptions\InvalidItemException;
use OCA\Circles\Tools\Exceptions\ItemNotFoundException;
use OCA\Circles\Tools\Exceptions\RequestNetworkException;
use OCA\Circles\Tools\Exceptions\SignatoryException;
use OCA\Circles\Tools\Exceptions\UnknownTypeException;
use OCA\Circles\Tools\Model\SimpleDataStore;
use OCA\Circles\Tools\Model\TreeNode;
use OCA\Circles\Tools\Traits\TConsoleTree;
use OCA\Circles\Tools\Traits\TStringTools;
use Symfony\Component\Console\Helper\Table;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
@ -78,7 +78,7 @@ use Symfony\Component\Console\Output\OutputInterface;
* @package OCA\Circles\Command
*/
class MembersList extends Base {
use TNC22ConsoleTree;
use TConsoleTree;
use TStringTools;
@ -194,7 +194,7 @@ class MembersList extends Base {
$output->writeln('<info>Config</info>: ' . $type);
$output->writeln(' ');
$tree = new NC22TreeNode(null, new SimpleDataStore(['circle' => $circle]));
$tree = new TreeNode(null, new SimpleDataStore(['circle' => $circle]));
$inherited = false;
}
@ -275,7 +275,7 @@ class MembersList extends Base {
* @param string $instance
* @param string $initiator
* @param int $initiatorType
* @param NC22TreeNode|null $tree
* @param TreeNode|null $tree
* @param array $knownIds
*
* @return array
@ -303,7 +303,7 @@ class MembersList extends Base {
string $instance,
string $initiator,
int $initiatorType,
?NC22TreeNode $tree,
?TreeNode $tree,
array $knownIds = []
): array {
if (in_array($circleId, $knownIds)) {
@ -358,12 +358,12 @@ class MembersList extends Base {
);
$circle = $this->circleService->getCircle($member->getSingleId());
}
$node = new NC22TreeNode(
$node = new TreeNode(
$tree, new SimpleDataStore(
[
'circle' => $circle,
'member' => $member,
'cycling' => in_array($member->getSingleId(), $knownIds),
'circle' => $circle,
'member' => $member,
'cycling' => in_array($member->getSingleId(), $knownIds),
]
)
);
@ -378,11 +378,11 @@ class MembersList extends Base {
);
} else {
if ($this->treeType !== 'circles-only') {
new NC22TreeNode(
new TreeNode(
$tree, new SimpleDataStore(
[
'member' => $member,
'cycling' => in_array($member->getSingleId(), $knownIds)
'member' => $member,
'cycling' => in_array($member->getSingleId(), $knownIds)
]
)
);

View file

@ -31,7 +31,7 @@ declare(strict_types=1);
namespace OCA\Circles\Command;
use ArtificialOwl\MySmallPhpTools\Traits\TArrayTools;
use OCA\Circles\Tools\Traits\TArrayTools;
use OC\Core\Command\Base;
use OCA\Circles\Exceptions\FederatedUserException;
use OCA\Circles\Exceptions\FederatedUserNotFoundException;

View file

@ -31,8 +31,8 @@ declare(strict_types=1);
namespace OCA\Circles\Controller;
use ArtificialOwl\MySmallPhpTools\Traits\Nextcloud\nc22\TNC22Deserialize;
use ArtificialOwl\MySmallPhpTools\Traits\Nextcloud\nc22\TNC22Logger;
use OCA\Circles\Tools\Traits\TDeserialize;
use OCA\Circles\Tools\Traits\TNCLogger;
use Exception;
use OCA\Circles\Exceptions\ContactAddressBookNotFoundException;
use OCA\Circles\Exceptions\ContactFormatException;
@ -64,8 +64,8 @@ use OCP\IUserSession;
* @package OCA\Circles\Controller
*/
class AdminController extends OcsController {
use TNC22Deserialize;
use TNC22Logger;
use TDeserialize;
use TNCLogger;
/** @var IUserSession */

View file

@ -31,15 +31,14 @@ declare(strict_types=1);
namespace OCA\Circles\Controller;
use ArtificialOwl\MySmallPhpTools\Traits\Nextcloud\nc22\TNC22Async;
use ArtificialOwl\MySmallPhpTools\Traits\Nextcloud\nc22\TNC22Controller;
use ArtificialOwl\MySmallPhpTools\Traits\TStringTools;
use OCA\Circles\AppInfo\Application;
use OCA\Circles\Service\ConfigService;
use OCA\Circles\Service\EventWrapperService;
use OCA\Circles\Service\FederatedEventService;
use OCA\Circles\Service\RemoteDownstreamService;
use OCA\Circles\Service\RemoteUpstreamService;
use OCA\Circles\Tools\Traits\TAsync;
use OCA\Circles\Tools\Traits\TStringTools;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\DataResponse;
@ -52,8 +51,7 @@ use OCP\IRequest;
*/
class EventWrapperController extends Controller {
use TStringTools;
use TNC22Async;
use TNC22Controller;
use TAsync;
/** @var EventWrapperService */

View file

@ -31,8 +31,8 @@ declare(strict_types=1);
namespace OCA\Circles\Controller;
use ArtificialOwl\MySmallPhpTools\Traits\Nextcloud\nc22\TNC22Deserialize;
use ArtificialOwl\MySmallPhpTools\Traits\Nextcloud\nc22\TNC22Logger;
use OCA\Circles\Tools\Traits\TDeserialize;
use OCA\Circles\Tools\Traits\TNCLogger;
use Exception;
use OCA\Circles\Exceptions\FederatedUserException;
use OCA\Circles\Exceptions\FederatedUserNotFoundException;
@ -62,8 +62,8 @@ use OCP\IUserSession;
* @package OCA\Circles\Controller
*/
class LocalController extends OcsController {
use TNC22Deserialize;
use TNC22Logger;
use TDeserialize;
use TNCLogger;
/** @var IUserSession */

View file

@ -31,25 +31,14 @@ declare(strict_types=1);
namespace OCA\Circles\Controller;
use ArtificialOwl\MySmallPhpTools\Exceptions\InvalidItemException;
use ArtificialOwl\MySmallPhpTools\Exceptions\InvalidOriginException;
use ArtificialOwl\MySmallPhpTools\Exceptions\ItemNotFoundException;
use ArtificialOwl\MySmallPhpTools\Exceptions\JsonNotRequestedException;
use ArtificialOwl\MySmallPhpTools\Exceptions\MalformedArrayException;
use ArtificialOwl\MySmallPhpTools\Exceptions\SignatoryException;
use ArtificialOwl\MySmallPhpTools\Exceptions\SignatureException;
use ArtificialOwl\MySmallPhpTools\Exceptions\UnknownTypeException;
use ArtificialOwl\MySmallPhpTools\Model\Nextcloud\nc22\NC22SignedRequest;
use ArtificialOwl\MySmallPhpTools\Model\SimpleDataStore;
use ArtificialOwl\MySmallPhpTools\Traits\Nextcloud\nc22\TNC22Controller;
use ArtificialOwl\MySmallPhpTools\Traits\Nextcloud\nc22\TNC22Deserialize;
use ArtificialOwl\MySmallPhpTools\Traits\Nextcloud\nc22\TNC22LocalSignatory;
use Exception;
use OC;
use OC\AppFramework\Middleware\Security\Exceptions\NotLoggedInException;
use OCA\Circles\Db\CircleRequest;
use OCA\Circles\Exceptions\FederatedItemException;
use OCA\Circles\Exceptions\FederatedUserException;
use OCA\Circles\Exceptions\FederatedUserNotFoundException;
use OCA\Circles\Exceptions\JsonNotRequestedException;
use OCA\Circles\Exceptions\UnknownInterfaceException;
use OCA\Circles\Model\Circle;
use OCA\Circles\Model\Federated\FederatedEvent;
@ -66,10 +55,22 @@ use OCA\Circles\Service\MemberService;
use OCA\Circles\Service\MembershipService;
use OCA\Circles\Service\RemoteDownstreamService;
use OCA\Circles\Service\RemoteStreamService;
use OCA\Circles\Tools\Exceptions\InvalidItemException;
use OCA\Circles\Tools\Exceptions\InvalidOriginException;
use OCA\Circles\Tools\Exceptions\ItemNotFoundException;
use OCA\Circles\Tools\Exceptions\MalformedArrayException;
use OCA\Circles\Tools\Exceptions\SignatoryException;
use OCA\Circles\Tools\Exceptions\SignatureException;
use OCA\Circles\Tools\Exceptions\UnknownTypeException;
use OCA\Circles\Tools\Model\NCSignedRequest;
use OCA\Circles\Tools\Model\SimpleDataStore;
use OCA\Circles\Tools\Traits\TDeserialize;
use OCA\Circles\Tools\Traits\TNCLocalSignatory;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\DataResponse;
use OCP\IRequest;
use OCP\IUserSession;
/**
* Class RemoteController
@ -77,9 +78,8 @@ use OCP\IRequest;
* @package OCA\Circles\Controller
*/
class RemoteController extends Controller {
use TNC22Controller;
use TNC22LocalSignatory;
use TNC22Deserialize;
use TNCLocalSignatory;
use TDeserialize;
/** @var CircleRequest */
@ -486,12 +486,12 @@ class RemoteController extends Controller {
/**
* @param NC22SignedRequest $signedRequest
* @param NCSignedRequest $signedRequest
*
* @return RemoteInstance
* @throws SignatoryException
*/
private function confirmRemoteInstance(NC22SignedRequest $signedRequest): RemoteInstance {
private function confirmRemoteInstance(NCSignedRequest $signedRequest): RemoteInstance {
/** @var RemoteInstance $signatory */
$signatory = $signedRequest->getSignatory();
@ -534,4 +534,76 @@ class RemoteController extends Controller {
($e->getCode() > 0) ? $e->getCode() : $httpErrorCode
);
}
/**
* use this one if a method from a Controller is only PublicPage when remote client asking for Json
*
* try {
* $this->publicPageJsonLimited();
* return new DataResponse(['test' => 42]);
* } catch (JsonNotRequestedException $e) {}
*
*
* @throws NotLoggedInException
* @throws JsonNotRequestedException
*/
private function publicPageJsonLimited(): void {
if (!$this->jsonRequested()) {
if (!OC::$server->get(IUserSession::class)
->isLoggedIn()) {
throw new NotLoggedInException();
}
throw new JsonNotRequestedException();
}
}
/**
* @return bool
*/
private function jsonRequested(): bool {
return ($this->areWithinAcceptHeader(
[
'application/json',
'application/ld+json',
'application/activity+json'
]
));
}
/**
* @param array $needles
*
* @return bool
*/
private function areWithinAcceptHeader(array $needles): bool {
$request = OC::$server->get(IRequest::class);
$accepts = array_map([$this, 'trimHeader'], explode(',', $request->getHeader('Accept')));
foreach ($accepts as $accept) {
if (in_array($accept, $needles)) {
return true;
}
}
return false;
}
/**
* @param string $header
*
* @return string
*/
private function trimHeader(string $header): string {
$header = trim($header);
$pos = strpos($header, ';');
if ($pos === false) {
return $header;
}
return substr($header, 0, $pos);
}
}

View file

@ -31,7 +31,7 @@ declare(strict_types=1);
namespace OCA\Circles\Cron;
use ArtificialOwl\MySmallPhpTools\Traits\TArrayTools;
use OCA\Circles\Tools\Traits\TArrayTools;
use OC\BackgroundJob\TimedJob;
use OC\Share20\Share;
use OCA\Circles\AppInfo\Application;

View file

@ -31,7 +31,7 @@ declare(strict_types=1);
namespace OCA\Circles\Cron;
use ArtificialOwl\MySmallPhpTools\Model\SimpleDataStore;
use OCA\Circles\Tools\Model\SimpleDataStore;
use OC\BackgroundJob\TimedJob;
use OCA\Circles\Exceptions\MaintenanceException;
use OCA\Circles\Service\ConfigService;

View file

@ -27,7 +27,7 @@
namespace OCA\Circles\Db;
use ArtificialOwl\MySmallPhpTools\Traits\TStringTools;
use OCA\Circles\Tools\Traits\TStringTools;
use OCA\Circles\Exceptions\MemberDoesNotExistException;
class AccountsRequest extends AccountsRequestBuilder {

View file

@ -28,7 +28,7 @@
namespace OCA\Circles\Db;
use ArtificialOwl\MySmallPhpTools\Traits\TArrayTools;
use OCA\Circles\Tools\Traits\TArrayTools;
use OCP\DB\QueryBuilder\IQueryBuilder;
/**

View file

@ -31,7 +31,7 @@ declare(strict_types=1);
namespace OCA\Circles\Db;
use ArtificialOwl\MySmallPhpTools\Exceptions\RowNotFoundException;
use OCA\Circles\Tools\Exceptions\RowNotFoundException;
use OCA\Circles\Exceptions\CircleNotFoundException;
use OCA\Circles\Model\Circle;

View file

@ -31,8 +31,6 @@ declare(strict_types=1);
namespace OCA\Circles\Db;
use ArtificialOwl\MySmallPhpTools\Db\Nextcloud\nc22\NC22ExtendedQueryBuilder;
use ArtificialOwl\MySmallPhpTools\Traits\TArrayTools;
use Doctrine\DBAL\Query\QueryBuilder;
use OC;
use OCA\Circles\Exceptions\RequestBuilderException;
@ -44,6 +42,8 @@ use OCA\Circles\Model\FederatedUser;
use OCA\Circles\Model\Member;
use OCA\Circles\Model\Probes\CircleProbe;
use OCA\Circles\Service\ConfigService;
use OCA\Circles\Tools\Db\ExtendedQueryBuilder;
use OCA\Circles\Tools\Traits\TArrayTools;
use OCP\DB\QueryBuilder\ICompositeExpression;
use OCP\DB\QueryBuilder\IQueryBuilder;
@ -52,7 +52,7 @@ use OCP\DB\QueryBuilder\IQueryBuilder;
*
* @package OCA\Circles\Db
*/
class CoreQueryBuilder extends NC22ExtendedQueryBuilder {
class CoreQueryBuilder extends ExtendedQueryBuilder {
use TArrayTools;
@ -267,7 +267,7 @@ class CoreQueryBuilder extends NC22ExtendedQueryBuilder {
* @param string $id
*/
public function limitToCircleId(string $id): void {
$this->limitToDBField('circle_id', $id, true);
$this->limit('circle_id', $id, '', true);
}
/**
@ -295,14 +295,14 @@ class CoreQueryBuilder extends NC22ExtendedQueryBuilder {
* @param int $config
*/
public function limitToConfig(int $config): void {
$this->limitToDBFieldInt('config', $config);
$this->limitInt('config', $config);
}
/**
* @param int $source
*/
public function limitToSource(int $source): void {
$this->limitToDBFieldInt('source', $source);
$this->limitInt('source', $source);
}
/**
@ -318,7 +318,7 @@ class CoreQueryBuilder extends NC22ExtendedQueryBuilder {
* @param string $singleId
*/
public function limitToSingleId(string $singleId): void {
$this->limitToDBField('single_id', $singleId, true);
$this->limit('single_id', $singleId, '', true);
}
@ -326,7 +326,7 @@ class CoreQueryBuilder extends NC22ExtendedQueryBuilder {
* @param string $itemId
*/
public function limitToItemId(string $itemId): void {
$this->limitToDBField('item_id', $itemId, true);
$this->limit('item_id', $itemId, '', true);
}
@ -334,7 +334,7 @@ class CoreQueryBuilder extends NC22ExtendedQueryBuilder {
* @param string $host
*/
public function limitToInstance(string $host): void {
$this->limitToDBField('instance', $host, false);
$this->limit('instance', $host, '', false);
}
@ -342,7 +342,7 @@ class CoreQueryBuilder extends NC22ExtendedQueryBuilder {
* @param int $userType
*/
public function limitToUserType(int $userType): void {
$this->limitToDBFieldInt('user_type', $userType);
$this->limitInt('user_type', $userType);
}
@ -350,7 +350,7 @@ class CoreQueryBuilder extends NC22ExtendedQueryBuilder {
* @param int $shareType
*/
public function limitToShareType(int $shareType): void {
$this->limitToDBFieldInt('share_type', $shareType);
$this->limitInt('share_type', $shareType);
}
@ -358,7 +358,7 @@ class CoreQueryBuilder extends NC22ExtendedQueryBuilder {
* @param string $shareWith
*/
public function limitToShareWith(string $shareWith): void {
$this->limitToDBField('share_with', $shareWith);
$this->limit('share_with', $shareWith, '', true);
}
@ -366,14 +366,14 @@ class CoreQueryBuilder extends NC22ExtendedQueryBuilder {
* @param int $nodeId
*/
public function limitToFileSource(int $nodeId): void {
$this->limitToDBFieldInt('file_source', $nodeId);
$this->limitInt('file_source', $nodeId);
}
/**
* @param array $files
*/
public function limitToFileSourceArray(array $files): void {
$this->limitToDBFieldInArray('file_source', $files);
$this->limitArray('file_source', $files);
}
@ -381,7 +381,7 @@ class CoreQueryBuilder extends NC22ExtendedQueryBuilder {
* @param int $shareId
*/
public function limitToShareParent(int $shareId): void {
$this->limitToDBFieldInt('parent', $shareId);
$this->limitInt('parent', $shareId);
}

View file

@ -27,7 +27,7 @@
namespace OCA\Circles\Db;
use ArtificialOwl\MySmallPhpTools\Traits\TStringTools;
use OCA\Circles\Tools\Traits\TStringTools;
use Doctrine\DBAL\Exception\UniqueConstraintViolationException;
use Exception;
use OCA\Circles\Exceptions\GSStatusException;

View file

@ -31,7 +31,7 @@ declare(strict_types=1);
namespace OCA\Circles\Db;
use ArtificialOwl\MySmallPhpTools\Exceptions\RowNotFoundException;
use OCA\Circles\Tools\Exceptions\RowNotFoundException;
use OCA\Circles\Exceptions\EventWrapperNotFoundException;
use OCA\Circles\Model\Federated\EventWrapper;

View file

@ -27,7 +27,7 @@
namespace OCA\Circles\Db;
use ArtificialOwl\MySmallPhpTools\Traits\TStringTools;
use OCA\Circles\Tools\Traits\TStringTools;
use OCA\Circles\Model\GlobalScale\GSShare;
use OCA\Circles\Model\GlobalScale\GSShareMountpoint;
use OCA\Circles\Model\DeprecatedMember;

View file

@ -31,7 +31,7 @@ declare(strict_types=1);
namespace OCA\Circles\Db;
use ArtificialOwl\MySmallPhpTools\Exceptions\RowNotFoundException;
use OCA\Circles\Tools\Exceptions\RowNotFoundException;
use OCA\Circles\Exceptions\MemberNotFoundException;
use OCA\Circles\Exceptions\RequestBuilderException;
use OCA\Circles\IFederatedUser;

View file

@ -31,7 +31,7 @@ declare(strict_types=1);
namespace OCA\Circles\Db;
use ArtificialOwl\MySmallPhpTools\Exceptions\RowNotFoundException;
use OCA\Circles\Tools\Exceptions\RowNotFoundException;
use OCA\Circles\Exceptions\MembershipNotFoundException;
use OCA\Circles\Model\Membership;

View file

@ -31,7 +31,7 @@ declare(strict_types=1);
namespace OCA\Circles\Db;
use ArtificialOwl\MySmallPhpTools\Traits\TStringTools;
use OCA\Circles\Tools\Traits\TStringTools;
use OCA\Circles\Exceptions\RequestBuilderException;
use OCA\Circles\IFederatedUser;
use OCA\Circles\Model\Mount;

View file

@ -31,7 +31,7 @@ declare(strict_types=1);
namespace OCA\Circles\Db;
use ArtificialOwl\MySmallPhpTools\Exceptions\RowNotFoundException;
use OCA\Circles\Tools\Exceptions\RowNotFoundException;
use OCA\Circles\Exceptions\MountNotFoundException;
use OCA\Circles\Model\Mount;

View file

@ -95,7 +95,7 @@ class RemoteRequest extends RemoteRequestBuilder {
$qb = $this->getRemoteUpdateSql();
$qb->set('item', $qb->createNamedParameter(json_encode($remote->getOrigData())));
$qb->limitToDBField('uid', $remote->getUid(true), false);
$qb->limit('uid', $remote->getUid(true), '', false);
$qb->execute();
}
@ -111,7 +111,7 @@ class RemoteRequest extends RemoteRequestBuilder {
$qb = $this->getRemoteUpdateSql();
$qb->set('instance', $qb->createNamedParameter($remote->getInstance()));
$qb->limitToDBField('uid', $remote->getUid(true), false);
$qb->limit('uid', $remote->getUid(true), '', false);
$qb->execute();
}
@ -127,7 +127,7 @@ class RemoteRequest extends RemoteRequestBuilder {
$qb = $this->getRemoteUpdateSql();
$qb->set('type', $qb->createNamedParameter($remote->getType()));
$qb->limitToDBField('uid', $remote->getUid(true), false);
$qb->limit('uid', $remote->getUid(true), '', false);
$qb->execute();
}
@ -143,7 +143,7 @@ class RemoteRequest extends RemoteRequestBuilder {
$qb = $this->getRemoteUpdateSql();
$qb->set('href', $qb->createNamedParameter($remote->getId()));
$qb->limitToDBField('uid', $remote->getUid(true), false);
$qb->limit('uid', $remote->getUid(true), '', false);
$qb->execute();
}
@ -163,7 +163,7 @@ class RemoteRequest extends RemoteRequestBuilder {
*/
public function getKnownInstances(): array {
$qb = $this->getRemoteSelectSql();
$qb->filterDBField('type', RemoteInstance::TYPE_UNKNOWN, false);
$qb->filter('type', RemoteInstance::TYPE_UNKNOWN, '', false);
return $this->getItemsFromRequest($qb);
}
@ -186,12 +186,12 @@ class RemoteRequest extends RemoteRequestBuilder {
$expr = $qb->expr();
$orX = $expr->orX();
$orX->add($qb->exprLimitToDBField('type', RemoteInstance::TYPE_GLOBALSCALE, true, false));
$orX->add($qb->exprLimit('type', RemoteInstance::TYPE_GLOBALSCALE, '', false));
if ($circle->isConfig(Circle::CFG_FEDERATED) || $broadcastAsFederated) {
// get all TRUSTED
$orX->add($qb->exprLimitToDBField('type', RemoteInstance::TYPE_TRUSTED, true, false));
$orX->add($qb->exprLimit('type', RemoteInstance::TYPE_TRUSTED, '', false));
// get EXTERNAL with Members
$aliasMember = $qb->generateAlias(CoreQueryBuilder::REMOTE, CoreQueryBuilder::MEMBER);
@ -208,7 +208,7 @@ class RemoteRequest extends RemoteRequestBuilder {
);
$external = $expr->andX();
$external->add($qb->exprLimitToDBField('type', RemoteInstance::TYPE_EXTERNAL, true, false));
$external->add($qb->exprLimit('type', RemoteInstance::TYPE_EXTERNAL, '', false));
$external->add($expr->isNotNull($aliasMember . '.instance'));
$orX->add($external);
}
@ -242,7 +242,7 @@ class RemoteRequest extends RemoteRequestBuilder {
*/
public function getFromHref(string $href): RemoteInstance {
$qb = $this->getRemoteSelectSql();
$qb->limitToDBField('href', $href, false);
$qb->limit('href', $href, '', false);
return $this->getItemFromRequest($qb);
}
@ -267,12 +267,12 @@ class RemoteRequest extends RemoteRequestBuilder {
* @return RemoteInstance
* @throws RemoteNotFoundException
*/
public function searchDuplicate(RemoteInstance $remoteInstance) {
public function searchDuplicate(RemoteInstance $remoteInstance): RemoteInstance {
$qb = $this->getRemoteSelectSql();
$orX = $qb->expr()->orX();
$orX->add($qb->exprLimitToDBField('href', $remoteInstance->getId(), true, false));
$orX->add($qb->exprLimitToDBField('uid', $remoteInstance->getUid(true), true));
$orX->add($qb->exprLimitToDBField('instance', $remoteInstance->getInstance(), true, false));
$orX->add($qb->exprLimit('href', $remoteInstance->getId(), '', false));
$orX->add($qb->exprLimit('uid', $remoteInstance->getUid(true), '', false));
$orX->add($qb->exprLimit('instance', $remoteInstance->getInstance(), '', false));
$qb->andWhere($orX);
return $this->getItemFromRequest($qb);

View file

@ -31,7 +31,7 @@ declare(strict_types=1);
namespace OCA\Circles\Db;
use ArtificialOwl\MySmallPhpTools\Exceptions\RowNotFoundException;
use OCA\Circles\Tools\Exceptions\RowNotFoundException;
use OCA\Circles\Exceptions\RemoteNotFoundException;
use OCA\Circles\Model\Federated\RemoteInstance;

View file

@ -31,7 +31,7 @@ declare(strict_types=1);
namespace OCA\Circles\Db;
use ArtificialOwl\MySmallPhpTools\Exceptions\RowNotFoundException;
use OCA\Circles\Tools\Exceptions\RowNotFoundException;
use OCA\Circles\Exceptions\FederatedShareNotFoundException;
use OCA\Circles\Model\Federated\FederatedShare;

View file

@ -31,7 +31,7 @@ declare(strict_types=1);
namespace OCA\Circles\Db;
use ArtificialOwl\MySmallPhpTools\Exceptions\RowNotFoundException;
use OCA\Circles\Tools\Exceptions\RowNotFoundException;
use OCA\Circles\Exceptions\ShareTokenNotFoundException;
use OCA\Circles\Model\ShareToken;

View file

@ -31,7 +31,7 @@ declare(strict_types=1);
namespace OCA\Circles\Db;
use ArtificialOwl\MySmallPhpTools\Exceptions\RowNotFoundException;
use OCA\Circles\Tools\Exceptions\RowNotFoundException;
use OC\Share20\Share;
use OCA\Circles\Exceptions\ShareWrapperNotFoundException;
use OCA\Circles\Model\ShareWrapper;

View file

@ -28,8 +28,8 @@
namespace OCA\Circles\Db;
use ArtificialOwl\MySmallPhpTools\Traits\TArrayTools;
use OCA\Circles\Model\SharesToken;
use OCA\Circles\Tools\Traits\TArrayTools;
use OCP\DB\QueryBuilder\IQueryBuilder;
/**

View file

@ -31,7 +31,7 @@ declare(strict_types=1);
namespace OCA\Circles\Events;
use ArtificialOwl\MySmallPhpTools\Model\SimpleDataStore;
use OCA\Circles\Tools\Model\SimpleDataStore;
use OCA\Circles\Model\Circle;
use OCA\Circles\Model\Federated\FederatedEvent;
use OCA\Circles\Model\Member;

View file

@ -31,7 +31,7 @@ declare(strict_types=1);
namespace OCA\Circles\Events\Files;
use ArtificialOwl\MySmallPhpTools\Model\SimpleDataStore;
use OCA\Circles\Tools\Model\SimpleDataStore;
use OCA\Circles\Events\CircleResultGenericEvent;
use OCA\Circles\Model\Federated\FederatedEvent;

View file

@ -0,0 +1,34 @@
<?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 2022
* @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\Exceptions;
class JsonNotRequestedException extends FederatedItemNotFoundException {
}

View file

@ -31,7 +31,7 @@ declare(strict_types=1);
namespace OCA\Circles\FederatedItems;
use ArtificialOwl\MySmallPhpTools\Traits\Nextcloud\nc22\TNC22Deserialize;
use OCA\Circles\Tools\Traits\TDeserialize;
use OCA\Circles\Db\CircleRequest;
use OCA\Circles\Exceptions\FederatedItemBadRequestException;
use OCA\Circles\Exceptions\FederatedItemException;
@ -50,7 +50,7 @@ use OCA\Circles\Service\ConfigService;
class CircleConfig implements
IFederatedItem,
IFederatedItemAsyncProcess {
use TNC22Deserialize;
use TDeserialize;
/** @var CircleRequest */

View file

@ -31,7 +31,7 @@ declare(strict_types=1);
namespace OCA\Circles\FederatedItems;
use ArtificialOwl\MySmallPhpTools\Traits\Nextcloud\nc22\TNC22Deserialize;
use OCA\Circles\Tools\Traits\TDeserialize;
use OCA\Circles\Db\CircleRequest;
use OCA\Circles\Db\MemberRequest;
use OCA\Circles\Exceptions\CircleNotFoundException;
@ -58,7 +58,7 @@ class CircleCreate implements
IFederatedItemHighSeverity,
IFederatedItemCircleCheckNotRequired,
IFederatedItemMustBeInitializedLocally {
use TNC22Deserialize;
use TDeserialize;
/** @var CircleRequest */

View file

@ -31,7 +31,7 @@ declare(strict_types=1);
namespace OCA\Circles\FederatedItems;
use ArtificialOwl\MySmallPhpTools\Traits\Nextcloud\nc22\TNC22Deserialize;
use OCA\Circles\Tools\Traits\TDeserialize;
use OCA\Circles\Db\CircleRequest;
use OCA\Circles\Db\MemberRequest;
use OCA\Circles\Exceptions\RequestBuilderException;
@ -54,7 +54,7 @@ class CircleDestroy implements
IFederatedItemHighSeverity,
IFederatedItemAsyncProcess,
IFederatedItemMemberEmpty {
use TNC22Deserialize;
use TDeserialize;
/** @var CircleRequest */

View file

@ -31,7 +31,7 @@ declare(strict_types=1);
namespace OCA\Circles\FederatedItems;
use ArtificialOwl\MySmallPhpTools\Traits\Nextcloud\nc22\TNC22Deserialize;
use OCA\Circles\Tools\Traits\TDeserialize;
use OCA\Circles\Db\CircleRequest;
use OCA\Circles\Exceptions\CircleNameTooShortException;
use OCA\Circles\Exceptions\RequestBuilderException;
@ -47,7 +47,7 @@ use OCA\Circles\Service\EventService;
* @package OCA\Circles\FederatedItems
*/
class CircleEdit implements IFederatedItem {
use TNC22Deserialize;
use TDeserialize;
/** @var CircleRequest */

View file

@ -31,9 +31,9 @@ declare(strict_types=1);
namespace OCA\Circles\FederatedItems;
use ArtificialOwl\MySmallPhpTools\Traits\Nextcloud\nc22\TNC22Deserialize;
use ArtificialOwl\MySmallPhpTools\Traits\Nextcloud\nc22\TNC22Logger;
use ArtificialOwl\MySmallPhpTools\Traits\TStringTools;
use OCA\Circles\Tools\Traits\TDeserialize;
use OCA\Circles\Tools\Traits\TNCLogger;
use OCA\Circles\Tools\Traits\TStringTools;
use Exception;
use OCA\Circles\Db\MemberRequest;
use OCA\Circles\Exceptions\FederatedItemBadRequestException;
@ -77,8 +77,8 @@ class CircleJoin implements
IFederatedItemMemberCheckNotRequired,
IFederatedItemMemberOptional {
use TStringTools;
use TNC22Logger;
use TNC22Deserialize;
use TNCLogger;
use TDeserialize;
/** @var IUserManager */

View file

@ -31,8 +31,8 @@ declare(strict_types=1);
namespace OCA\Circles\FederatedItems;
use ArtificialOwl\MySmallPhpTools\Traits\Nextcloud\nc22\TNC22Deserialize;
use ArtificialOwl\MySmallPhpTools\Traits\Nextcloud\nc22\TNC22Logger;
use OCA\Circles\Tools\Traits\TDeserialize;
use OCA\Circles\Tools\Traits\TNCLogger;
use OCA\Circles\AppInfo\Application;
use OCA\Circles\Db\CircleRequest;
use OCA\Circles\Db\MemberRequest;
@ -67,8 +67,8 @@ class CircleLeave implements
IFederatedItemAsyncProcess,
IFederatedItemInitiatorMembershipNotRequired,
IFederatedItemMemberOptional {
use TNC22Deserialize;
use TNC22Logger;
use TDeserialize;
use TNCLogger;
/** @var MemberRequest */

View file

@ -31,7 +31,7 @@ declare(strict_types=1);
namespace OCA\Circles\FederatedItems;
use ArtificialOwl\MySmallPhpTools\Traits\Nextcloud\nc22\TNC22Deserialize;
use OCA\Circles\Tools\Traits\TDeserialize;
use OCA\Circles\Db\CircleRequest;
use OCA\Circles\IFederatedItem;
use OCA\Circles\Model\Federated\FederatedEvent;
@ -42,7 +42,7 @@ use OCA\Circles\Model\Federated\FederatedEvent;
* @package OCA\Circles\FederatedItems
*/
class CircleSettings implements IFederatedItem {
use TNC22Deserialize;
use TDeserialize;
/** @var CircleRequest */

View file

@ -31,10 +31,10 @@ declare(strict_types=1);
namespace OCA\Circles\FederatedItems\Files;
use ArtificialOwl\MySmallPhpTools\Exceptions\InvalidItemException;
use ArtificialOwl\MySmallPhpTools\Exceptions\UnknownTypeException;
use ArtificialOwl\MySmallPhpTools\Traits\Nextcloud\nc22\TNC22Logger;
use ArtificialOwl\MySmallPhpTools\Traits\TStringTools;
use OCA\Circles\Tools\Exceptions\InvalidItemException;
use OCA\Circles\Tools\Exceptions\UnknownTypeException;
use OCA\Circles\Tools\Traits\TNCLogger;
use OCA\Circles\Tools\Traits\TStringTools;
use OCA\Circles\Db\MountRequest;
use OCA\Circles\Exceptions\CircleNotFoundException;
use OCA\Circles\IFederatedItem;
@ -58,7 +58,7 @@ class FileShare implements
IFederatedItemAsyncProcess,
IFederatedItemMemberEmpty {
use TStringTools;
use TNC22Logger;
use TNCLogger;
/** @var MountRequest */

View file

@ -31,11 +31,11 @@ declare(strict_types=1);
namespace OCA\Circles\FederatedItems\Files;
use ArtificialOwl\MySmallPhpTools\Exceptions\InvalidItemException;
use ArtificialOwl\MySmallPhpTools\Exceptions\ItemNotFoundException;
use ArtificialOwl\MySmallPhpTools\Exceptions\UnknownTypeException;
use ArtificialOwl\MySmallPhpTools\Traits\Nextcloud\nc22\TNC22Logger;
use ArtificialOwl\MySmallPhpTools\Traits\TStringTools;
use OCA\Circles\Tools\Exceptions\InvalidItemException;
use OCA\Circles\Tools\Exceptions\ItemNotFoundException;
use OCA\Circles\Tools\Exceptions\UnknownTypeException;
use OCA\Circles\Tools\Traits\TNCLogger;
use OCA\Circles\Tools\Traits\TStringTools;
use OCA\Circles\Db\MountRequest;
use OCA\Circles\IFederatedItem;
use OCA\Circles\IFederatedItemAsyncProcess;
@ -57,7 +57,7 @@ class FileUnshare implements
IFederatedItemAsyncProcess,
IFederatedItemMemberEmpty {
use TStringTools;
use TNC22Logger;
use TNCLogger;
/** @var MountRequest */

View file

@ -31,7 +31,7 @@ declare(strict_types=1);
namespace OCA\Circles\FederatedItems;
use ArtificialOwl\MySmallPhpTools\Traits\TStringTools;
use OCA\Circles\Tools\Traits\TStringTools;
use OCA\Circles\Db\ShareLockRequest;
use OCA\Circles\Exceptions\FederatedShareNotFoundException;
use OCA\Circles\Exceptions\InvalidIdException;

View file

@ -31,7 +31,7 @@ declare(strict_types=1);
namespace OCA\Circles\FederatedItems;
use ArtificialOwl\MySmallPhpTools\Model\SimpleDataStore;
use OCA\Circles\Tools\Model\SimpleDataStore;
use OCA\Circles\IFederatedItem;
use OCA\Circles\IFederatedItemAsyncProcess;
use OCA\Circles\IFederatedItemLoopbackTest;

View file

@ -31,8 +31,8 @@ declare(strict_types=1);
namespace OCA\Circles\FederatedItems;
use ArtificialOwl\MySmallPhpTools\Traits\Nextcloud\nc22\TNC22Logger;
use ArtificialOwl\MySmallPhpTools\Traits\TStringTools;
use OCA\Circles\Tools\Traits\TNCLogger;
use OCA\Circles\Tools\Traits\TStringTools;
use Exception;
use OCA\Circles\IFederatedItem;
use OCA\Circles\IFederatedItemAsyncProcess;
@ -54,7 +54,7 @@ class MassiveMemberAdd extends SingleMemberAdd implements
IFederatedItemHighSeverity,
IFederatedItemMemberEmpty {
use TStringTools;
use TNC22Logger;
use TNCLogger;
/**

View file

@ -31,7 +31,6 @@ declare(strict_types=1);
namespace OCA\Circles\FederatedItems;
use ArtificialOwl\MySmallPhpTools\Traits\Nextcloud\nc22\TNC22Deserialize;
use OCA\Circles\Db\MemberRequest;
use OCA\Circles\Exceptions\FederatedItemBadRequestException;
use OCA\Circles\Exceptions\FederatedItemException;
@ -44,6 +43,7 @@ use OCA\Circles\Service\ConfigService;
use OCA\Circles\Service\EventService;
use OCA\Circles\Service\MembershipService;
use OCA\Circles\StatusCode;
use OCA\Circles\Tools\Traits\TDeserialize;
/**
* Class MemberDisplayName
@ -54,7 +54,7 @@ class MemberDisplayName implements
IFederatedItem,
IFederatedItemHighSeverity,
IFederatedItemMemberEmpty {
use TNC22Deserialize;
use TDeserialize;
/** @var MemberRequest */
@ -99,7 +99,8 @@ class MemberDisplayName implements
* @throws MemberLevelException
*/
public function verify(FederatedEvent $event): void {
$member = $event->getCircle()->getInitiator();
$member = $event->getCircle()
->getInitiator();
$displayName = $event->getParams()->g('displayName');

View file

@ -31,7 +31,7 @@ declare(strict_types=1);
namespace OCA\Circles\FederatedItems;
use ArtificialOwl\MySmallPhpTools\Traits\Nextcloud\nc22\TNC22Deserialize;
use OCA\Circles\Tools\Traits\TDeserialize;
use OCA\Circles\Db\MemberRequest;
use OCA\Circles\Exceptions\FederatedItemBadRequestException;
use OCA\Circles\Exceptions\FederatedItemException;
@ -57,7 +57,7 @@ class MemberLevel implements
IFederatedItem,
IFederatedItemHighSeverity,
IFederatedItemMemberRequired {
use TNC22Deserialize;
use TDeserialize;
/** @var MemberRequest */

View file

@ -31,7 +31,7 @@ declare(strict_types=1);
namespace OCA\Circles\FederatedItems;
use ArtificialOwl\MySmallPhpTools\Model\SimpleDataStore;
use OCA\Circles\Tools\Model\SimpleDataStore;
use OCA\Circles\IFederatedItem;
use OCA\Circles\IFederatedItemLimitedToInstanceWithMembership;
use OCA\Circles\Model\Federated\FederatedEvent;

View file

@ -31,9 +31,9 @@ declare(strict_types=1);
namespace OCA\Circles\FederatedItems;
use ArtificialOwl\MySmallPhpTools\Traits\Nextcloud\nc22\TNC22Deserialize;
use ArtificialOwl\MySmallPhpTools\Traits\Nextcloud\nc22\TNC22Logger;
use ArtificialOwl\MySmallPhpTools\Traits\TStringTools;
use OCA\Circles\Tools\Traits\TDeserialize;
use OCA\Circles\Tools\Traits\TNCLogger;
use OCA\Circles\Tools\Traits\TStringTools;
use OCA\Circles\Db\MemberRequest;
use OCA\Circles\Exceptions\CircleNotFoundException;
use OCA\Circles\Exceptions\FederatedItemBadRequestException;
@ -86,11 +86,11 @@ class SingleMemberAdd implements
IFederatedItemHighSeverity,
IFederatedItemMemberRequired,
IFederatedItemMemberCheckNotRequired {
use TNC22Deserialize;
use TDeserialize;
use TStringTools;
use TNC22Logger;
use TNCLogger;
/** @var IUserManager */

View file

@ -31,8 +31,8 @@ declare(strict_types=1);
namespace OCA\Circles\GlobalScale;
use ArtificialOwl\MySmallPhpTools\Model\SimpleDataStore;
use ArtificialOwl\MySmallPhpTools\Traits\TArrayTools;
use OCA\Circles\Tools\Model\SimpleDataStore;
use OCA\Circles\Tools\Traits\TArrayTools;
use Exception;
use OC;
use OC\Share20\Share;

View file

@ -31,7 +31,7 @@ declare(strict_types=1);
namespace OCA\Circles\GlobalScale\GSMount;
use ArtificialOwl\MySmallPhpTools\Traits\TArrayTools;
use OCA\Circles\Tools\Traits\TArrayTools;
use Exception;
use OC\Files\Mount\MountPoint;
use OC\Files\Mount\MoveableMount;

View file

@ -31,7 +31,7 @@ declare(strict_types=1);
namespace OCA\Circles\GlobalScale\GSMount;
use ArtificialOwl\MySmallPhpTools\Traits\TArrayTools;
use OCA\Circles\Tools\Traits\TArrayTools;
use Exception;
use OC;
use OCA\Circles\Db\GSSharesRequest;

View file

@ -31,7 +31,7 @@ declare(strict_types=1);
namespace OCA\Circles\GlobalScale;
use ArtificialOwl\MySmallPhpTools\Model\SimpleDataStore;
use OCA\Circles\Tools\Model\SimpleDataStore;
use Exception;
use OC\User\NoUserException;
use OCA\Circles\Exceptions\CircleDoesNotExistException;

View file

@ -31,7 +31,7 @@ declare(strict_types=1);
namespace OCA\Circles\GlobalScale;
use ArtificialOwl\MySmallPhpTools\Model\SimpleDataStore;
use OCA\Circles\Tools\Model\SimpleDataStore;
use OCA\Circles\Model\GlobalScale\GSEvent;
/**

View file

@ -31,8 +31,8 @@ declare(strict_types=1);
namespace OCA\Circles\Handlers;
use ArtificialOwl\MySmallPhpTools\Exceptions\SignatoryException;
use ArtificialOwl\MySmallPhpTools\Traits\TArrayTools;
use OCA\Circles\Tools\Exceptions\SignatoryException;
use OCA\Circles\Tools\Traits\TArrayTools;
use OC\URLGenerator;
use OCA\Circles\AppInfo\Application;
use OCA\Circles\Exceptions\UnknownInterfaceException;

View file

@ -31,7 +31,7 @@ declare(strict_types=1);
namespace OCA\Circles;
use ArtificialOwl\MySmallPhpTools\Model\SimpleDataStore;
use OCA\Circles\Tools\Model\SimpleDataStore;
/**
* Interface IFederatedSync

View file

@ -31,7 +31,7 @@ declare(strict_types=1);
namespace OCA\Circles\Listeners\Examples;
use ArtificialOwl\MySmallPhpTools\Traits\Nextcloud\nc22\TNC22Logger;
use OCA\Circles\Tools\Traits\TNCLogger;
use OCA\Circles\AppInfo\Application;
use OCA\Circles\Events\AddingCircleMemberEvent;
use OCA\Circles\Events\CircleGenericEvent;
@ -47,7 +47,7 @@ use OCP\EventDispatcher\IEventListener;
* @package OCA\Circles\Listeners\Files
*/
class ExampleAddingCircleMember implements IEventListener {
use TNC22Logger;
use TNCLogger;
/** @var ConfigService */

View file

@ -31,8 +31,8 @@ declare(strict_types=1);
namespace OCA\Circles\Listeners\Examples;
use ArtificialOwl\MySmallPhpTools\Traits\Nextcloud\nc22\TNC22Logger;
use ArtificialOwl\MySmallPhpTools\Traits\TStringTools;
use OCA\Circles\Tools\Traits\TNCLogger;
use OCA\Circles\Tools\Traits\TStringTools;
use Exception;
use OCA\Circles\AppInfo\Application;
use OCA\Circles\CirclesManager;
@ -50,7 +50,7 @@ use OCP\EventDispatcher\IEventListener;
*/
class ExampleMembershipsCreated implements IEventListener {
use TStringTools;
use TNC22Logger;
use TNCLogger;
/** @var CirclesManager */

View file

@ -31,8 +31,8 @@ declare(strict_types=1);
namespace OCA\Circles\Listeners\Examples;
use ArtificialOwl\MySmallPhpTools\Traits\Nextcloud\nc22\TNC22Logger;
use ArtificialOwl\MySmallPhpTools\Traits\TStringTools;
use OCA\Circles\Tools\Traits\TNCLogger;
use OCA\Circles\Tools\Traits\TStringTools;
use Exception;
use OCA\Circles\AppInfo\Application;
use OCA\Circles\CirclesManager;
@ -50,7 +50,7 @@ use OCP\EventDispatcher\IEventListener;
*/
class ExampleMembershipsRemoved implements IEventListener {
use TStringTools;
use TNC22Logger;
use TNCLogger;
/** @var CirclesManager */

View file

@ -31,7 +31,7 @@ declare(strict_types=1);
namespace OCA\Circles\Listeners\Examples;
use ArtificialOwl\MySmallPhpTools\Traits\Nextcloud\nc22\TNC22Logger;
use OCA\Circles\Tools\Traits\TNCLogger;
use OCA\Circles\AppInfo\Application;
use OCA\Circles\Events\CircleGenericEvent;
use OCA\Circles\Events\RequestingCircleMemberEvent;
@ -46,7 +46,7 @@ use OCP\EventDispatcher\IEventListener;
* @package OCA\Circles\Listeners\Examples
*/
class ExampleRequestingCircleMember implements IEventListener {
use TNC22Logger;
use TNCLogger;
/** @var ConfigService */

View file

@ -31,8 +31,8 @@ declare(strict_types=1);
namespace OCA\Circles\Listeners\Files;
use ArtificialOwl\MySmallPhpTools\Traits\Nextcloud\nc22\TNC22Logger;
use ArtificialOwl\MySmallPhpTools\Traits\TStringTools;
use OCA\Circles\Tools\Traits\TNCLogger;
use OCA\Circles\Tools\Traits\TStringTools;
use Exception;
use OCA\Circles\AppInfo\Application;
use OCA\Circles\Events\AddingCircleMemberEvent;
@ -52,7 +52,7 @@ use OCP\EventDispatcher\IEventListener;
*/
class AddingMemberSendMail implements IEventListener {
use TStringTools;
use TNC22Logger;
use TNCLogger;
/** @var ShareWrapperService */

View file

@ -31,8 +31,8 @@ declare(strict_types=1);
namespace OCA\Circles\Listeners\Files;
use ArtificialOwl\MySmallPhpTools\Traits\Nextcloud\nc22\TNC22Logger;
use ArtificialOwl\MySmallPhpTools\Traits\TStringTools;
use OCA\Circles\Tools\Traits\TNCLogger;
use OCA\Circles\Tools\Traits\TStringTools;
use Exception;
use OCA\Circles\AppInfo\Application;
use OCA\Circles\Events\Files\CreatingFileShareEvent;
@ -59,7 +59,7 @@ use OCP\EventDispatcher\IEventListener;
*/
class CreatingShareSendMail implements IEventListener {
use TStringTools;
use TNC22Logger;
use TNCLogger;
/** @var ShareWrapperService */

View file

@ -31,8 +31,8 @@ declare(strict_types=1);
namespace OCA\Circles\Listeners\Files;
use ArtificialOwl\MySmallPhpTools\Traits\Nextcloud\nc22\TNC22Logger;
use ArtificialOwl\MySmallPhpTools\Traits\TStringTools;
use OCA\Circles\Tools\Traits\TNCLogger;
use OCA\Circles\Tools\Traits\TStringTools;
use OCA\Circles\AppInfo\Application;
use OCA\Circles\Events\DestroyingCircleEvent;
use OCA\Circles\Exceptions\RequestBuilderException;
@ -47,7 +47,7 @@ use OCP\EventDispatcher\IEventListener;
*/
class DestroyingCircle implements IEventListener {
use TStringTools;
use TNC22Logger;
use TNCLogger;
/** @var ShareWrapperService */

View file

@ -31,9 +31,9 @@ declare(strict_types=1);
namespace OCA\Circles\Listeners\Files;
use ArtificialOwl\MySmallPhpTools\Model\SimpleDataStore;
use ArtificialOwl\MySmallPhpTools\Traits\Nextcloud\nc22\TNC22Logger;
use ArtificialOwl\MySmallPhpTools\Traits\TStringTools;
use OCA\Circles\Tools\Model\SimpleDataStore;
use OCA\Circles\Tools\Traits\TNCLogger;
use OCA\Circles\Tools\Traits\TStringTools;
use OCA\Circles\AppInfo\Application;
use OCA\Circles\Events\CircleMemberAddedEvent;
use OCA\Circles\Model\Member;
@ -50,7 +50,7 @@ use OCP\EventDispatcher\IEventListener;
*/
class MemberAddedSendMail implements IEventListener {
use TStringTools;
use TNC22Logger;
use TNCLogger;
/** @var ShareWrapperService */

View file

@ -31,7 +31,7 @@ declare(strict_types=1);
namespace OCA\Circles\Listeners\Files;
use ArtificialOwl\MySmallPhpTools\Traits\TStringTools;
use OCA\Circles\Tools\Traits\TStringTools;
use OCA\Circles\CirclesManager;
use OCA\Circles\Db\ShareWrapperRequest;
use OCA\Circles\Events\MembershipsRemovedEvent;

View file

@ -31,8 +31,8 @@ declare(strict_types=1);
namespace OCA\Circles\Listeners\Files;
use ArtificialOwl\MySmallPhpTools\Traits\Nextcloud\nc22\TNC22Logger;
use ArtificialOwl\MySmallPhpTools\Traits\TStringTools;
use OCA\Circles\Tools\Traits\TNCLogger;
use OCA\Circles\Tools\Traits\TStringTools;
use OCA\Circles\AppInfo\Application;
use OCA\Circles\Events\PreparingCircleMemberEvent;
use OCA\Circles\Exceptions\FederatedItemException;
@ -57,7 +57,7 @@ use OCP\EventDispatcher\IEventListener;
*/
class PreparingMemberSendMail implements IEventListener {
use TStringTools;
use TNC22Logger;
use TNCLogger;
/** @var ShareWrapperService */

View file

@ -31,8 +31,8 @@ declare(strict_types=1);
namespace OCA\Circles\Listeners\Files;
use ArtificialOwl\MySmallPhpTools\Traits\Nextcloud\nc22\TNC22Logger;
use ArtificialOwl\MySmallPhpTools\Traits\TStringTools;
use OCA\Circles\Tools\Traits\TNCLogger;
use OCA\Circles\Tools\Traits\TStringTools;
use OCA\Circles\AppInfo\Application;
use OCA\Circles\Events\Files\PreparingFileShareEvent;
use OCA\Circles\Exceptions\FederatedItemException;
@ -58,7 +58,7 @@ use OCP\Security\IHasher;
*/
class PreparingShareSendMail implements IEventListener {
use TStringTools;
use TNC22Logger;
use TNCLogger;
/** @var IHasher */

View file

@ -31,8 +31,8 @@ declare(strict_types=1);
namespace OCA\Circles\Listeners\Files;
use ArtificialOwl\MySmallPhpTools\Traits\Nextcloud\nc22\TNC22Logger;
use ArtificialOwl\MySmallPhpTools\Traits\TStringTools;
use OCA\Circles\Tools\Traits\TNCLogger;
use OCA\Circles\Tools\Traits\TStringTools;
use OCA\Circles\AppInfo\Application;
use OCA\Circles\Events\RemovingCircleMemberEvent;
use OCA\Circles\Exceptions\MembershipNotFoundException;
@ -50,7 +50,7 @@ use OCP\EventDispatcher\IEventListener;
*/
class RemovingMember implements IEventListener {
use TStringTools;
use TNC22Logger;
use TNCLogger;
/** @var MemberService */

View file

@ -31,8 +31,8 @@ declare(strict_types=1);
namespace OCA\Circles\Listeners\Files;
use ArtificialOwl\MySmallPhpTools\Traits\Nextcloud\nc22\TNC22Logger;
use ArtificialOwl\MySmallPhpTools\Traits\TStringTools;
use OCA\Circles\Tools\Traits\TNCLogger;
use OCA\Circles\Tools\Traits\TStringTools;
use Exception;
use OCA\Circles\AppInfo\Application;
use OCA\Circles\Events\Files\FileShareCreatedEvent;
@ -60,7 +60,7 @@ use OCP\EventDispatcher\IEventListener;
*/
class ShareCreatedSendMail implements IEventListener {
use TStringTools;
use TNC22Logger;
use TNCLogger;
/** @var ShareWrapperService */

View file

@ -31,7 +31,7 @@ declare(strict_types=1);
namespace OCA\Circles\Listeners\Notifications;
use ArtificialOwl\MySmallPhpTools\Traits\Nextcloud\nc22\TNC22Logger;
use OCA\Circles\Tools\Traits\TNCLogger;
use OCA\Circles\AppInfo\Application;
use OCA\Circles\Events\CircleGenericEvent;
use OCA\Circles\Events\RequestingCircleMemberEvent;
@ -46,7 +46,7 @@ use OCP\EventDispatcher\IEventListener;
* @package OCA\Circles\Listeners\Notifications
*/
class RequestingMember implements IEventListener {
use TNC22Logger;
use TNCLogger;
/** @var NotificationService */

View file

@ -31,7 +31,7 @@ declare(strict_types=1);
namespace OCA\Circles\Migration;
use ArtificialOwl\MySmallPhpTools\Traits\Nextcloud\nc22\TNC22Logger;
use OCA\Circles\Tools\Traits\TNCLogger;
use Exception;
use OCA\Circles\Service\ConfigService;
use OCA\Circles\Service\MigrationService;
@ -45,7 +45,7 @@ use OCP\Migration\IRepairStep;
* @package OCA\Circles\Migration
*/
class Migration implements IRepairStep {
use TNC22Logger;
use TNCLogger;
/** @var MigrationService */

View file

@ -31,11 +31,11 @@ declare(strict_types=1);
namespace OCA\Circles\Model;
use ArtificialOwl\MySmallPhpTools\Db\Nextcloud\nc22\INC22QueryRow;
use ArtificialOwl\MySmallPhpTools\Exceptions\InvalidItemException;
use ArtificialOwl\MySmallPhpTools\IDeserializable;
use ArtificialOwl\MySmallPhpTools\Traits\Nextcloud\nc22\TNC22Deserialize;
use ArtificialOwl\MySmallPhpTools\Traits\TArrayTools;
use OCA\Circles\Tools\Db\IQueryRow;
use OCA\Circles\Tools\Exceptions\InvalidItemException;
use OCA\Circles\Tools\IDeserializable;
use OCA\Circles\Tools\Traits\TDeserialize;
use OCA\Circles\Tools\Traits\TArrayTools;
use DateTime;
use JsonSerializable;
use OCA\Circles\Db\CircleRequest;
@ -82,9 +82,9 @@ use OCP\Security\IHasher;
*
* @package OCA\Circles\Model
*/
class Circle extends ManagedModel implements IEntity, IDeserializable, INC22QueryRow, JsonSerializable {
class Circle extends ManagedModel implements IEntity, IDeserializable, IQueryRow, JsonSerializable {
use TArrayTools;
use TNC22Deserialize;
use TDeserialize;
public const FLAGS_SHORT = 1;
@ -219,6 +219,9 @@ class Circle extends ManagedModel implements IEntity, IDeserializable, INC22Quer
/** @var int */
private $population = 0;
/** @var int */
private $populationInherited = 0;
// /** @var bool */
// private $hidden = false;
@ -663,6 +666,25 @@ class Circle extends ManagedModel implements IEntity, IDeserializable, INC22Quer
}
/**
* @param int $population
*
* @return Circle
*/
public function setPopulationInherited(int $population): self {
$this->populationInherited = $population;
return $this;
}
/**
* @return int
*/
public function getPopulationInherited(): int {
return $this->populationInherited;
}
/**
* @param array $settings
*
@ -866,10 +888,10 @@ class Circle extends ManagedModel implements IEntity, IDeserializable, INC22Quer
* @param array $data
* @param string $prefix
*
* @return INC22QueryRow
* @return IQueryRow
* @throws CircleNotFoundException
*/
public function importFromDatabase(array $data, string $prefix = ''): INC22QueryRow {
public function importFromDatabase(array $data, string $prefix = ''): IQueryRow {
if ($this->get($prefix . 'unique_id', $data) === '') {
throw new CircleNotFoundException();
}
@ -881,7 +903,6 @@ class Circle extends ManagedModel implements IEntity, IDeserializable, INC22Quer
->setConfig($this->getInt($prefix . 'config', $data))
->setSource($this->getInt($prefix . 'source', $data))
->setInstance($this->get($prefix . 'instance', $data))
->setPopulation($this->getInt($prefix . 'population', $data))
->setSettings($this->getArray($prefix . 'settings', $data))
->setContactAddressBook($this->getInt($prefix . 'contact_addressbook', $data))
->setContactGroupName($this->get($prefix . 'contact_groupname', $data))
@ -890,6 +911,9 @@ class Circle extends ManagedModel implements IEntity, IDeserializable, INC22Quer
$creation = $this->get($prefix . 'creation', $data);
$this->setCreation(DateTime::createFromFormat('Y-m-d H:i:s', $creation)->getTimestamp());
$this->setPopulation($this->getInt('population', $this->getSettings()));
$this->setPopulationInherited($this->getInt('populationInherited', $this->getSettings()));
$this->getManager()->manageImportFromDatabase($this, $data, $prefix);

View file

@ -29,7 +29,7 @@
namespace OCA\Circles\Model;
use ArtificialOwl\MySmallPhpTools\Traits\TArrayTools;
use OCA\Circles\Tools\Traits\TArrayTools;
use JsonSerializable;
/**

View file

@ -26,7 +26,7 @@
namespace OCA\Circles\Model;
use ArtificialOwl\MySmallPhpTools\Traits\TArrayTools;
use OCA\Circles\Tools\Traits\TArrayTools;
use JsonSerializable;
use OCA\Circles\Exceptions\CircleTypeNotValidException;
use OCA\Circles\Exceptions\FederatedCircleNotAllowedException;

View file

@ -31,10 +31,10 @@ declare(strict_types=1);
namespace OCA\Circles\Model\Federated;
use ArtificialOwl\MySmallPhpTools\Db\Nextcloud\nc22\INC22QueryRow;
use ArtificialOwl\MySmallPhpTools\Exceptions\InvalidItemException;
use ArtificialOwl\MySmallPhpTools\Model\SimpleDataStore;
use ArtificialOwl\MySmallPhpTools\Traits\TArrayTools;
use OCA\Circles\Tools\Db\IQueryRow;
use OCA\Circles\Tools\Exceptions\InvalidItemException;
use OCA\Circles\Tools\Model\SimpleDataStore;
use OCA\Circles\Tools\Traits\TArrayTools;
use JsonSerializable;
/**
@ -42,7 +42,7 @@ use JsonSerializable;
*
* @package OCA\Circles\Model\Remote
*/
class EventWrapper implements INC22QueryRow, JsonSerializable {
class EventWrapper implements IQueryRow, JsonSerializable {
use TArrayTools;
@ -306,10 +306,10 @@ class EventWrapper implements INC22QueryRow, JsonSerializable {
/**
* @param array $data
*
* @return INC22QueryRow
* @return IQueryRow
* @throws InvalidItemException
*/
public function importFromDatabase(array $data): INC22QueryRow {
public function importFromDatabase(array $data): IQueryRow {
$this->setToken($this->get('token', $data));
$this->setInstance($this->get('instance', $data));
$this->setInterface($this->getInt('interface', $data));

View file

@ -31,9 +31,9 @@ declare(strict_types=1);
namespace OCA\Circles\Model\Federated;
use ArtificialOwl\MySmallPhpTools\Exceptions\InvalidItemException;
use ArtificialOwl\MySmallPhpTools\Model\SimpleDataStore;
use ArtificialOwl\MySmallPhpTools\Traits\TArrayTools;
use OCA\Circles\Tools\Exceptions\InvalidItemException;
use OCA\Circles\Tools\Model\SimpleDataStore;
use OCA\Circles\Tools\Traits\TArrayTools;
use JsonSerializable;
use OCA\Circles\Model\Circle;
use OCA\Circles\Model\Member;

View file

@ -31,10 +31,10 @@ declare(strict_types=1);
namespace OCA\Circles\Model\Federated;
use ArtificialOwl\MySmallPhpTools\Db\Nextcloud\nc22\INC22QueryRow;
use ArtificialOwl\MySmallPhpTools\IDeserializable;
use ArtificialOwl\MySmallPhpTools\Model\SimpleDataStore;
use ArtificialOwl\MySmallPhpTools\Traits\TArrayTools;
use OCA\Circles\Tools\Db\IQueryRow;
use OCA\Circles\Tools\IDeserializable;
use OCA\Circles\Tools\Model\SimpleDataStore;
use OCA\Circles\Tools\Traits\TArrayTools;
use JsonSerializable;
use OCA\Circles\IFederatedModel;
use OCA\Circles\Model\ManagedModel;
@ -44,7 +44,7 @@ use OCA\Circles\Model\ManagedModel;
*
* @package OCA\Circles\Model\Federated
*/
class FederatedShare extends ManagedModel implements IFederatedModel, JsonSerializable, INC22QueryRow, IDeserializable {
class FederatedShare extends ManagedModel implements IFederatedModel, JsonSerializable, IQueryRow, IDeserializable {
use TArrayTools;
@ -195,9 +195,9 @@ class FederatedShare extends ManagedModel implements IFederatedModel, JsonSerial
/**
* @param array $data
*
* @return INC22QueryRow
* @return IQueryRow
*/
public function importFromDatabase(array $data): INC22QueryRow {
public function importFromDatabase(array $data): IQueryRow {
$this->setId($this->getInt('id', $data));
$this->setItemId($this->get('item_id', $data));
$this->setCircleId($this->get('circle_id', $data));

View file

@ -31,9 +31,9 @@ declare(strict_types=1);
namespace OCA\Circles\Model\Federated;
use ArtificialOwl\MySmallPhpTools\Db\Nextcloud\nc22\INC22QueryRow;
use ArtificialOwl\MySmallPhpTools\Model\Nextcloud\nc22\NC22Signatory;
use ArtificialOwl\MySmallPhpTools\Traits\TArrayTools;
use OCA\Circles\Tools\Db\IQueryRow;
use OCA\Circles\Tools\Model\NCSignatory;
use OCA\Circles\Tools\Traits\TArrayTools;
use JsonSerializable;
use OCA\Circles\Exceptions\RemoteNotFoundException;
use OCA\Circles\Exceptions\RemoteUidException;
@ -43,7 +43,7 @@ use OCA\Circles\Exceptions\RemoteUidException;
*
* @package OCA\Circles\Model
*/
class RemoteInstance extends NC22Signatory implements INC22QueryRow, JsonSerializable {
class RemoteInstance extends NCSignatory implements IQueryRow, JsonSerializable {
use TArrayTools;
public const TYPE_UNKNOWN = 'Unknown'; // not trusted
@ -476,9 +476,9 @@ class RemoteInstance extends NC22Signatory implements INC22QueryRow, JsonSeriali
/**
* @param array $data
*
* @return NC22Signatory
* @return NCSignatory
*/
public function import(array $data): NC22Signatory {
public function import(array $data): NCSignatory {
parent::import($data);
$this->setTest($this->get(self::TEST, $data))
@ -544,7 +544,7 @@ class RemoteInstance extends NC22Signatory implements INC22QueryRow, JsonSeriali
* @return self
* @throws RemoteNotFoundException
*/
public function importFromDatabase(array $data, string $prefix = ''): INC22QueryRow {
public function importFromDatabase(array $data, string $prefix = ''): IQueryRow {
if ($this->getInt($prefix . 'id', $data) === 0) {
throw new RemoteNotFoundException();
}

View file

@ -31,11 +31,11 @@ declare(strict_types=1);
namespace OCA\Circles\Model;
use ArtificialOwl\MySmallPhpTools\Db\Nextcloud\nc22\INC22QueryRow;
use ArtificialOwl\MySmallPhpTools\Exceptions\InvalidItemException;
use ArtificialOwl\MySmallPhpTools\IDeserializable;
use ArtificialOwl\MySmallPhpTools\Traits\Nextcloud\nc22\TNC22Deserialize;
use ArtificialOwl\MySmallPhpTools\Traits\TArrayTools;
use OCA\Circles\Tools\Db\IQueryRow;
use OCA\Circles\Tools\Exceptions\InvalidItemException;
use OCA\Circles\Tools\IDeserializable;
use OCA\Circles\Tools\Traits\TDeserialize;
use OCA\Circles\Tools\Traits\TArrayTools;
use JsonSerializable;
use OCA\Circles\Exceptions\FederatedUserNotFoundException;
use OCA\Circles\Exceptions\MembershipNotFoundException;
@ -54,10 +54,10 @@ class FederatedUser extends ManagedModel implements
IFederatedUser,
IEntity,
IDeserializable,
INC22QueryRow,
IQueryRow,
JsonSerializable {
use TArrayTools;
use TNC22Deserialize;
use TDeserialize;
/** @var string */
@ -414,10 +414,10 @@ class FederatedUser extends ManagedModel implements
* @param array $data
* @param string $prefix
*
* @return INC22QueryRow
* @return IQueryRow
* @throws FederatedUserNotFoundException
*/
public function importFromDatabase(array $data, string $prefix = ''): INC22QueryRow {
public function importFromDatabase(array $data, string $prefix = ''): IQueryRow {
if ($this->get($prefix . 'single_id', $data) === '') {
throw new FederatedUserNotFoundException();
}

View file

@ -31,10 +31,10 @@ declare(strict_types=1);
namespace OCA\Circles\Model;
use ArtificialOwl\MySmallPhpTools\Db\Nextcloud\nc22\INC22QueryRow;
use ArtificialOwl\MySmallPhpTools\Exceptions\InvalidItemException;
use ArtificialOwl\MySmallPhpTools\IDeserializable;
use ArtificialOwl\MySmallPhpTools\Traits\TArrayTools;
use OCA\Circles\Tools\Db\IQueryRow;
use OCA\Circles\Tools\Exceptions\InvalidItemException;
use OCA\Circles\Tools\IDeserializable;
use OCA\Circles\Tools\Traits\TArrayTools;
use JsonSerializable;
use OCA\Circles\Db\CoreQueryBuilder;
use OCA\Circles\Exceptions\FileCacheNotFoundException;
@ -44,7 +44,7 @@ use OCA\Circles\Exceptions\FileCacheNotFoundException;
*
* @package OCA\Circles\Model
*/
class FileCacheWrapper extends ManagedModel implements INC22QueryRow, IDeserializable, JsonSerializable {
class FileCacheWrapper extends ManagedModel implements IQueryRow, IDeserializable, JsonSerializable {
use TArrayTools;
@ -497,10 +497,10 @@ class FileCacheWrapper extends ManagedModel implements INC22QueryRow, IDeseriali
* @param array $data
* @param string $prefix
*
* @return INC22QueryRow
* @return IQueryRow
* @throws FileCacheNotFoundException
*/
public function importFromDatabase(array $data, string $prefix = ''): INC22QueryRow {
public function importFromDatabase(array $data, string $prefix = ''): IQueryRow {
if ($this->getInt($prefix . 'fileid', $data) === 0) {
throw new FileCacheNotFoundException();
}

View file

@ -31,8 +31,8 @@ declare(strict_types=1);
namespace OCA\Circles\Model\GlobalScale;
use ArtificialOwl\MySmallPhpTools\Model\SimpleDataStore;
use ArtificialOwl\MySmallPhpTools\Traits\TArrayTools;
use OCA\Circles\Tools\Model\SimpleDataStore;
use OCA\Circles\Tools\Traits\TArrayTools;
use JsonSerializable;
use OCA\Circles\Exceptions\JsonException;
use OCA\Circles\Exceptions\ModelException;

View file

@ -31,7 +31,7 @@ declare(strict_types=1);
namespace OCA\Circles\Model\GlobalScale;
use ArtificialOwl\MySmallPhpTools\Traits\TArrayTools;
use OCA\Circles\Tools\Traits\TArrayTools;
use JsonSerializable;
/**

View file

@ -31,7 +31,7 @@ declare(strict_types=1);
namespace OCA\Circles\Model\GlobalScale;
use ArtificialOwl\MySmallPhpTools\Traits\TArrayTools;
use OCA\Circles\Tools\Traits\TArrayTools;
use JsonSerializable;
/**

View file

@ -31,7 +31,7 @@ declare(strict_types=1);
namespace OCA\Circles\Model\GlobalScale;
use ArtificialOwl\MySmallPhpTools\Traits\TArrayTools;
use OCA\Circles\Tools\Traits\TArrayTools;
use JsonSerializable;
use OCA\Circles\Exceptions\JsonException;
use OCA\Circles\Exceptions\ModelException;

View file

@ -31,7 +31,7 @@ declare(strict_types=1);
namespace OCA\Circles\Model\Helpers;
use ArtificialOwl\MySmallPhpTools\Traits\TArrayTools;
use OCA\Circles\Tools\Traits\TArrayTools;
use OCA\Circles\Exceptions\MemberHelperException;
use OCA\Circles\Exceptions\MemberLevelException;
use OCA\Circles\Exceptions\ParseMemberLevelException;

View file

@ -31,11 +31,6 @@ declare(strict_types=1);
namespace OCA\Circles\Model;
use ArtificialOwl\MySmallPhpTools\Db\Nextcloud\nc22\INC22QueryRow;
use ArtificialOwl\MySmallPhpTools\Exceptions\InvalidItemException;
use ArtificialOwl\MySmallPhpTools\IDeserializable;
use ArtificialOwl\MySmallPhpTools\Traits\Nextcloud\nc22\TNC22Deserialize;
use ArtificialOwl\MySmallPhpTools\Traits\TArrayTools;
use DateTime;
use JsonSerializable;
use OCA\Circles\AppInfo\Capabilities;
@ -45,9 +40,14 @@ use OCA\Circles\Exceptions\ParseMemberLevelException;
use OCA\Circles\Exceptions\RequestBuilderException;
use OCA\Circles\Exceptions\UnknownInterfaceException;
use OCA\Circles\Exceptions\UserTypeNotFoundException;
use OCA\Circles\IFederatedUser;
use OCA\Circles\IEntity;
use OCA\Circles\IFederatedUser;
use OCA\Circles\Model\Federated\RemoteInstance;
use OCA\Circles\Tools\Db\IQueryRow;
use OCA\Circles\Tools\Exceptions\InvalidItemException;
use OCA\Circles\Tools\IDeserializable;
use OCA\Circles\Tools\Traits\TArrayTools;
use OCA\Circles\Tools\Traits\TDeserialize;
/**
* Class Member
@ -58,10 +58,10 @@ class Member extends ManagedModel implements
IEntity,
IFederatedUser,
IDeserializable,
INC22QueryRow,
IQueryRow,
JsonSerializable {
use TArrayTools;
use TNC22Deserialize;
use TDeserialize;
public const LEVEL_NONE = 0;
@ -844,10 +844,10 @@ class Member extends ManagedModel implements
* @param array $data
* @param string $prefix
*
* @return INC22QueryRow
* @return IQueryRow
* @throws MemberNotFoundException
*/
public function importFromDatabase(array $data, string $prefix = ''): INC22QueryRow {
public function importFromDatabase(array $data, string $prefix = ''): IQueryRow {
if ($this->get($prefix . 'single_id', $data) === '') {
throw new MemberNotFoundException();
}

View file

@ -31,19 +31,19 @@ declare(strict_types=1);
namespace OCA\Circles\Model;
use ArtificialOwl\MySmallPhpTools\Db\Nextcloud\nc22\INC22QueryRow;
use ArtificialOwl\MySmallPhpTools\Exceptions\InvalidItemException;
use ArtificialOwl\MySmallPhpTools\IDeserializable;
use ArtificialOwl\MySmallPhpTools\Traits\TArrayTools;
use JsonSerializable;
use OCA\Circles\Exceptions\MembershipNotFoundException;
use OCA\Circles\Tools\Db\IQueryRow;
use OCA\Circles\Tools\Exceptions\InvalidItemException;
use OCA\Circles\Tools\IDeserializable;
use OCA\Circles\Tools\Traits\TArrayTools;
/**
* Class Membership
*
* @package OCA\Circles\Model
*/
class Membership extends ManagedModel implements IDeserializable, INC22QueryRow, JsonSerializable {
class Membership extends ManagedModel implements IDeserializable, IQueryRow, JsonSerializable {
use TArrayTools;
@ -298,10 +298,10 @@ class Membership extends ManagedModel implements IDeserializable, INC22QueryRow,
* @param array $data
* @param string $prefix
*
* @return INC22QueryRow
* @return IQueryRow
* @throws MembershipNotFoundException
*/
public function importFromDatabase(array $data, string $prefix = ''): INC22QueryRow {
public function importFromDatabase(array $data, string $prefix = ''): IQueryRow {
if ($this->get($prefix . 'single_id', $data) === '') {
throw new MembershipNotFoundException();
}

View file

@ -31,7 +31,7 @@ declare(strict_types=1);
namespace OCA\Circles\Model;
use ArtificialOwl\MySmallPhpTools\Traits\Nextcloud\nc22\TNC22Logger;
use OCA\Circles\Tools\Traits\TNCLogger;
use OCA\Circles\AppInfo\Application;
use OCA\Circles\Db\CircleRequest;
use OCA\Circles\Db\CoreQueryBuilder;
@ -65,7 +65,7 @@ use OCP\IURLGenerator;
* @package OCA\Circles\Model
*/
class ModelManager {
use TNC22Logger;
use TNCLogger;
/** @var IURLGenerator */
@ -554,9 +554,7 @@ class ModelManager {
*/
public function generateLinkToCircle(string $singleId): string {
return $this->urlGenerator->linkToRoute(
$this->configService->getAppValue(
ConfigService::ROUTE_TO_CIRCLE
),
$this->configService->getAppValue(ConfigService::ROUTE_TO_CIRCLE),
['singleId' => $singleId]
);
}

View file

@ -31,9 +31,9 @@ declare(strict_types=1);
namespace OCA\Circles\Model;
use ArtificialOwl\MySmallPhpTools\Db\Nextcloud\nc22\INC22QueryRow;
use ArtificialOwl\MySmallPhpTools\IDeserializable;
use ArtificialOwl\MySmallPhpTools\Traits\TArrayTools;
use OCA\Circles\Tools\Db\IQueryRow;
use OCA\Circles\Tools\IDeserializable;
use OCA\Circles\Tools\Traits\TArrayTools;
use JsonSerializable;
use OCA\Circles\Exceptions\CircleNotFoundException;
use OCA\Circles\MountManager\CircleMountManager;
@ -45,7 +45,7 @@ use OCP\Http\Client\IClientService;
*
* @package OCA\Circles\Model
*/
class Mount extends ManagedModel implements IDeserializable, INC22QueryRow, JsonSerializable {
class Mount extends ManagedModel implements IDeserializable, IQueryRow, JsonSerializable {
use TArrayTools;
@ -458,7 +458,7 @@ class Mount extends ManagedModel implements IDeserializable, INC22QueryRow, Json
*
* @return Mount
*/
public function importFromDatabase(array $data, string $prefix = ''): INC22QueryRow {
public function importFromDatabase(array $data, string $prefix = ''): IQueryRow {
$this->setId($this->getInt('id', $data));
$this->setCircleId($this->get('circle_id', $data));
$this->setToken($this->get('token', $data));

View file

@ -31,7 +31,7 @@ declare(strict_types=1);
namespace OCA\Circles\Model;
use ArtificialOwl\MySmallPhpTools\Traits\TArrayTools;
use OCA\Circles\Tools\Traits\TArrayTools;
use JsonSerializable;
/**

View file

@ -31,8 +31,8 @@ declare(strict_types=1);
namespace OCA\Circles\Model;
use ArtificialOwl\MySmallPhpTools\IDeserializable;
use ArtificialOwl\MySmallPhpTools\Traits\TArrayTools;
use OCA\Circles\Tools\IDeserializable;
use OCA\Circles\Tools\Traits\TArrayTools;
use JsonSerializable;
/**

View file

@ -31,15 +31,15 @@ declare(strict_types=1);
namespace OCA\Circles\Model;
use ArtificialOwl\MySmallPhpTools\Db\Nextcloud\nc22\INC22QueryRow;
use ArtificialOwl\MySmallPhpTools\Exceptions\InvalidItemException;
use ArtificialOwl\MySmallPhpTools\IDeserializable;
use ArtificialOwl\MySmallPhpTools\Traits\TArrayTools;
use OCA\Circles\Tools\Db\IQueryRow;
use OCA\Circles\Tools\Exceptions\InvalidItemException;
use OCA\Circles\Tools\IDeserializable;
use OCA\Circles\Tools\Traits\TArrayTools;
use JsonSerializable;
use OCA\Circles\Exceptions\ShareTokenNotFoundException;
use OCP\Share\IShare;
class ShareToken implements IDeserializable, INC22QueryRow, JsonSerializable {
class ShareToken implements IDeserializable, IQueryRow, JsonSerializable {
use TArrayTools;
@ -277,10 +277,10 @@ class ShareToken implements IDeserializable, INC22QueryRow, JsonSerializable {
* @param array $data
* @param string $prefix
*
* @return INC22QueryRow
* @return IQueryRow
* @throws ShareTokenNotFoundException
*/
public function importFromDatabase(array $data, string $prefix = ''): INC22QueryRow {
public function importFromDatabase(array $data, string $prefix = ''): IQueryRow {
if ($this->get($prefix . 'token', $data) === '') {
throw new ShareTokenNotFoundException();
}

View file

@ -31,11 +31,11 @@ declare(strict_types=1);
namespace OCA\Circles\Model;
use ArtificialOwl\MySmallPhpTools\Db\Nextcloud\nc22\INC22QueryRow;
use ArtificialOwl\MySmallPhpTools\Exceptions\InvalidItemException;
use ArtificialOwl\MySmallPhpTools\IDeserializable;
use ArtificialOwl\MySmallPhpTools\Traits\Nextcloud\nc22\TNC22Deserialize;
use ArtificialOwl\MySmallPhpTools\Traits\TArrayTools;
use OCA\Circles\Tools\Db\IQueryRow;
use OCA\Circles\Tools\Exceptions\InvalidItemException;
use OCA\Circles\Tools\IDeserializable;
use OCA\Circles\Tools\Traits\TDeserialize;
use OCA\Circles\Tools\Traits\TArrayTools;
use DateTime;
use JsonSerializable;
use OC;
@ -54,9 +54,9 @@ use OCP\Share\IShare;
*
* @package OCA\Circles\Model
*/
class ShareWrapper extends ManagedModel implements IDeserializable, INC22QueryRow, JsonSerializable {
class ShareWrapper extends ManagedModel implements IDeserializable, IQueryRow, JsonSerializable {
use TArrayTools;
use TNC22Deserialize;
use TDeserialize;
/** @var string */
@ -781,9 +781,9 @@ class ShareWrapper extends ManagedModel implements IDeserializable, INC22QueryRo
* @param array $data
* @param string $prefix
*
* @return INC22QueryRow
* @return IQueryRow
*/
public function importFromDatabase(array $data, string $prefix = ''): INC22QueryRow {
public function importFromDatabase(array $data, string $prefix = ''): IQueryRow {
$shareTime = new DateTime();
$shareTime->setTimestamp($this->getInt($prefix . 'stime', $data));

View file

@ -26,7 +26,7 @@
namespace OCA\Circles\Model;
use ArtificialOwl\MySmallPhpTools\Traits\TArrayTools;
use OCA\Circles\Tools\Traits\TArrayTools;
use JsonSerializable;
use OCP\Share\IShare;

Some files were not shown because too many files have changed in this diff Show more