Catch any error during circle detail fetching
Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
@@ -25,9 +25,9 @@ namespace OCA\Deck\Db;
|
|||||||
|
|
||||||
use OCP\AppFramework\Db\DoesNotExistException;
|
use OCP\AppFramework\Db\DoesNotExistException;
|
||||||
use OCP\IDBConnection;
|
use OCP\IDBConnection;
|
||||||
use OCP\ILogger;
|
|
||||||
use OCP\IUserManager;
|
use OCP\IUserManager;
|
||||||
use OCP\IGroupManager;
|
use OCP\IGroupManager;
|
||||||
|
use Psr\Log\LoggerInterface;
|
||||||
|
|
||||||
class BoardMapper extends DeckMapper implements IPermissionMapper {
|
class BoardMapper extends DeckMapper implements IPermissionMapper {
|
||||||
private $labelMapper;
|
private $labelMapper;
|
||||||
@@ -35,6 +35,7 @@ class BoardMapper extends DeckMapper implements IPermissionMapper {
|
|||||||
private $stackMapper;
|
private $stackMapper;
|
||||||
private $userManager;
|
private $userManager;
|
||||||
private $groupManager;
|
private $groupManager;
|
||||||
|
private $logger;
|
||||||
|
|
||||||
private $circlesEnabled;
|
private $circlesEnabled;
|
||||||
|
|
||||||
@@ -44,7 +45,8 @@ class BoardMapper extends DeckMapper implements IPermissionMapper {
|
|||||||
AclMapper $aclMapper,
|
AclMapper $aclMapper,
|
||||||
StackMapper $stackMapper,
|
StackMapper $stackMapper,
|
||||||
IUserManager $userManager,
|
IUserManager $userManager,
|
||||||
IGroupManager $groupManager
|
IGroupManager $groupManager,
|
||||||
|
LoggerInterface $logger
|
||||||
) {
|
) {
|
||||||
parent::__construct($db, 'deck_boards', Board::class);
|
parent::__construct($db, 'deck_boards', Board::class);
|
||||||
$this->labelMapper = $labelMapper;
|
$this->labelMapper = $labelMapper;
|
||||||
@@ -52,6 +54,7 @@ class BoardMapper extends DeckMapper implements IPermissionMapper {
|
|||||||
$this->stackMapper = $stackMapper;
|
$this->stackMapper = $stackMapper;
|
||||||
$this->userManager = $userManager;
|
$this->userManager = $userManager;
|
||||||
$this->groupManager = $groupManager;
|
$this->groupManager = $groupManager;
|
||||||
|
$this->logger = $logger;
|
||||||
|
|
||||||
$this->circlesEnabled = \OC::$server->getAppManager()->isEnabledForUser('circles');
|
$this->circlesEnabled = \OC::$server->getAppManager()->isEnabledForUser('circles');
|
||||||
}
|
}
|
||||||
@@ -248,7 +251,7 @@ class BoardMapper extends DeckMapper implements IPermissionMapper {
|
|||||||
if ($user !== null) {
|
if ($user !== null) {
|
||||||
return new User($user);
|
return new User($user);
|
||||||
}
|
}
|
||||||
\OC::$server->getLogger()->debug('User ' . $acl->getId() . ' not found when mapping acl ' . $acl->getParticipant());
|
$this->logger->debug('User ' . $acl->getId() . ' not found when mapping acl ' . $acl->getParticipant());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if ($acl->getType() === Acl::PERMISSION_TYPE_GROUP) {
|
if ($acl->getType() === Acl::PERMISSION_TYPE_GROUP) {
|
||||||
@@ -256,7 +259,7 @@ class BoardMapper extends DeckMapper implements IPermissionMapper {
|
|||||||
if ($group !== null) {
|
if ($group !== null) {
|
||||||
return new Group($group);
|
return new Group($group);
|
||||||
}
|
}
|
||||||
\OC::$server->getLogger()->debug('Group ' . $acl->getId() . ' not found when mapping acl ' . $acl->getParticipant());
|
$this->logger->debug('Group ' . $acl->getId() . ' not found when mapping acl ' . $acl->getParticipant());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if ($acl->getType() === Acl::PERMISSION_TYPE_CIRCLE) {
|
if ($acl->getType() === Acl::PERMISSION_TYPE_CIRCLE) {
|
||||||
@@ -268,11 +271,12 @@ class BoardMapper extends DeckMapper implements IPermissionMapper {
|
|||||||
if ($circle) {
|
if ($circle) {
|
||||||
return new Circle($circle);
|
return new Circle($circle);
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Throwable $e) {
|
||||||
|
$this->logger->error('Failed to get circle details when building ACL', ['exception' => $e]);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
\OC::$server->getLogger()->log(ILogger::WARN, 'Unknown permission type for mapping acl ' . $acl->getId());
|
$this->logger->warning('Unknown permission type for mapping acl ' . $acl->getId());
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -105,7 +105,8 @@
|
|||||||
<ParamNameMismatch occurrences="1">
|
<ParamNameMismatch occurrences="1">
|
||||||
<code>$boardId</code>
|
<code>$boardId</code>
|
||||||
</ParamNameMismatch>
|
</ParamNameMismatch>
|
||||||
<UndefinedClass occurrences="1">
|
<UndefinedClass occurrences="2">
|
||||||
|
<code>\OCA\Circles\Api\v1\Circles</code>
|
||||||
<code>\OCA\Circles\Api\v1\Circles</code>
|
<code>\OCA\Circles\Api\v1\Circles</code>
|
||||||
</UndefinedClass>
|
</UndefinedClass>
|
||||||
</file>
|
</file>
|
||||||
@@ -170,11 +171,6 @@
|
|||||||
<code>$stackId</code>
|
<code>$stackId</code>
|
||||||
</ParamNameMismatch>
|
</ParamNameMismatch>
|
||||||
</file>
|
</file>
|
||||||
<file src="lib/Notification/NotificationHelper.php">
|
|
||||||
<InvalidScalarArgument occurrences="1">
|
|
||||||
<code>$board->getId()</code>
|
|
||||||
</InvalidScalarArgument>
|
|
||||||
</file>
|
|
||||||
<file src="lib/Notification/Notifier.php">
|
<file src="lib/Notification/Notifier.php">
|
||||||
<RedundantCast occurrences="7">
|
<RedundantCast occurrences="7">
|
||||||
<code>(string) $l->t('%s has mentioned you in a comment on "%s".', [$dn, $params[0]])</code>
|
<code>(string) $l->t('%s has mentioned you in a comment on "%s".', [$dn, $params[0]])</code>
|
||||||
@@ -196,12 +192,6 @@
|
|||||||
<code>$cardId</code>
|
<code>$cardId</code>
|
||||||
<code>$cardId</code>
|
<code>$cardId</code>
|
||||||
</InvalidScalarArgument>
|
</InvalidScalarArgument>
|
||||||
<UndefinedThisPropertyAssignment occurrences="1">
|
|
||||||
<code>$this->currentUser</code>
|
|
||||||
</UndefinedThisPropertyAssignment>
|
|
||||||
<UndefinedThisPropertyFetch occurrences="1">
|
|
||||||
<code>$this->currentUser</code>
|
|
||||||
</UndefinedThisPropertyFetch>
|
|
||||||
</file>
|
</file>
|
||||||
<file src="lib/Service/BoardService.php">
|
<file src="lib/Service/BoardService.php">
|
||||||
<TooManyArguments occurrences="2">
|
<TooManyArguments occurrences="2">
|
||||||
@@ -265,7 +255,6 @@
|
|||||||
</RedundantCondition>
|
</RedundantCondition>
|
||||||
</file>
|
</file>
|
||||||
<file src="lib/Service/FilesAppService.php">
|
<file src="lib/Service/FilesAppService.php">
|
||||||
<InvalidCatch occurrences="1"/>
|
|
||||||
<MissingDependency occurrences="4">
|
<MissingDependency occurrences="4">
|
||||||
<code>$this->rootFolder</code>
|
<code>$this->rootFolder</code>
|
||||||
<code>$this->rootFolder</code>
|
<code>$this->rootFolder</code>
|
||||||
@@ -279,13 +268,6 @@
|
|||||||
<code>\OCA\Circles\Api\v1\Circles</code>
|
<code>\OCA\Circles\Api\v1\Circles</code>
|
||||||
</UndefinedClass>
|
</UndefinedClass>
|
||||||
</file>
|
</file>
|
||||||
<file src="lib/Service/SearchService.php">
|
|
||||||
<UndefinedThisPropertyFetch occurrences="3">
|
|
||||||
<code>$this->l10n</code>
|
|
||||||
<code>$this->urlGenerator</code>
|
|
||||||
<code>$this->userManager</code>
|
|
||||||
</UndefinedThisPropertyFetch>
|
|
||||||
</file>
|
|
||||||
<file src="lib/Service/StackService.php">
|
<file src="lib/Service/StackService.php">
|
||||||
<UndefinedClass occurrences="1">
|
<UndefinedClass occurrences="1">
|
||||||
<code>BadRquestException</code>
|
<code>BadRquestException</code>
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ namespace OCA\Deck\Db;
|
|||||||
|
|
||||||
use OCP\IGroupManager;
|
use OCP\IGroupManager;
|
||||||
use OCP\IUserManager;
|
use OCP\IUserManager;
|
||||||
|
use Psr\Log\LoggerInterface;
|
||||||
use Test\AppFramework\Db\MapperTestUtility;
|
use Test\AppFramework\Db\MapperTestUtility;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -54,7 +55,8 @@ class AclMapperTest extends MapperTestUtility {
|
|||||||
$this->aclMapper,
|
$this->aclMapper,
|
||||||
\OC::$server->query(StackMapper::class),
|
\OC::$server->query(StackMapper::class),
|
||||||
$this->userManager,
|
$this->userManager,
|
||||||
$this->groupManager
|
$this->groupManager,
|
||||||
|
$this->createMock(LoggerInterface::class)
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->boards = [
|
$this->boards = [
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ namespace OCA\Deck\Db;
|
|||||||
use OCP\IDBConnection;
|
use OCP\IDBConnection;
|
||||||
use OCP\IGroupManager;
|
use OCP\IGroupManager;
|
||||||
use OCP\IUserManager;
|
use OCP\IUserManager;
|
||||||
|
use Psr\Log\LoggerInterface;
|
||||||
use Test\AppFramework\Db\MapperTestUtility;
|
use Test\AppFramework\Db\MapperTestUtility;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -61,7 +62,8 @@ class BoardMapperTest extends MapperTestUtility {
|
|||||||
\OC::$server->query(AclMapper::class),
|
\OC::$server->query(AclMapper::class),
|
||||||
\OC::$server->query(StackMapper::class),
|
\OC::$server->query(StackMapper::class),
|
||||||
$this->userManager,
|
$this->userManager,
|
||||||
$this->groupManager
|
$this->groupManager,
|
||||||
|
$this->createMock(LoggerInterface::class)
|
||||||
);
|
);
|
||||||
$this->aclMapper = \OC::$server->query(AclMapper::class);
|
$this->aclMapper = \OC::$server->query(AclMapper::class);
|
||||||
$this->labelMapper = \OC::$server->query(LabelMapper::class);
|
$this->labelMapper = \OC::$server->query(LabelMapper::class);
|
||||||
|
|||||||
Reference in New Issue
Block a user