No not fail on nonexisting acl users/groups
Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
@@ -130,6 +130,11 @@ class BoardMapper extends DeckMapper implements IPermissionMapper {
|
||||
return $entries;
|
||||
}
|
||||
|
||||
public function findAll() {
|
||||
$sql = 'SELECT id from *PREFIX*deck_boards;';
|
||||
return $this->findEntities($sql, []);
|
||||
}
|
||||
|
||||
public function delete(/** @noinspection PhpUnnecessaryFullyQualifiedNameInspection */
|
||||
\OCP\AppFramework\Db\Entity $entity) {
|
||||
// delete acl
|
||||
@@ -166,10 +171,22 @@ class BoardMapper extends DeckMapper implements IPermissionMapper {
|
||||
$groupManager = $this->groupManager;
|
||||
$acl->resolveRelation('participant', function($participant) use (&$acl, &$userManager, &$groupManager) {
|
||||
if($acl->getType() === Acl::PERMISSION_TYPE_USER) {
|
||||
return new User($userManager->get($acl->getParticipant($participant)));
|
||||
$user = $userManager->get($participant);
|
||||
if($user !== null) {
|
||||
return new User($user);
|
||||
} else {
|
||||
\OC::$server->getLogger()->debug('User ' . $acl->getId() . ' not found when mapping acl ' . $acl->getParticipant());
|
||||
return $participant;
|
||||
}
|
||||
}
|
||||
if($acl->getType() === Acl::PERMISSION_TYPE_GROUP) {
|
||||
return new Group($groupManager->get($acl->getParticipant($participant)));
|
||||
$group = $groupManager->get($participant);
|
||||
if($group !== null) {
|
||||
return new Group($group);
|
||||
} else {
|
||||
\OC::$server->getLogger()->debug('Group ' . $acl->getId() . ' not found when mapping acl ' . $acl->getParticipant());
|
||||
return $participant;
|
||||
}
|
||||
}
|
||||
throw new \Exception('Unknown permission type for mapping Acl');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user