WIP: Check if the share owner is still a valid user
Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
parent
9ac15bc4e9
commit
28313a94bc
|
@ -597,7 +597,11 @@ class DefaultShareProvider implements IShareProvider {
|
|||
$cursor = $qb->execute();
|
||||
$shares = [];
|
||||
while ($data = $cursor->fetch()) {
|
||||
$shares[$data['fileid']][] = $this->createShare($data);
|
||||
try {
|
||||
$shares[$data['fileid']][] = $this->createShare($data);
|
||||
} catch (\InvalidArgumentException $e) {
|
||||
// ignore exception and leave out share
|
||||
}
|
||||
}
|
||||
$cursor->closeCursor();
|
||||
|
||||
|
@ -727,8 +731,11 @@ class DefaultShareProvider implements IShareProvider {
|
|||
|
||||
$shares = [];
|
||||
while($data = $cursor->fetch()) {
|
||||
$shares[] = $this->createShare($data);
|
||||
}
|
||||
try {
|
||||
$shares[] = $this->createShare($data);
|
||||
} catch (\InvalidArgumentException $e) {
|
||||
// ignore exception and leave out share
|
||||
} }
|
||||
$cursor->closeCursor();
|
||||
|
||||
return $shares;
|
||||
|
@ -799,7 +806,11 @@ class DefaultShareProvider implements IShareProvider {
|
|||
|
||||
while($data = $cursor->fetch()) {
|
||||
if ($this->isAccessibleResult($data)) {
|
||||
$shares[] = $this->createShare($data);
|
||||
try {
|
||||
$shares[] = $this->createShare($data);
|
||||
} catch (\InvalidArgumentException $e) {
|
||||
// ignore exception and leave out share
|
||||
}
|
||||
}
|
||||
}
|
||||
$cursor->closeCursor();
|
||||
|
@ -864,7 +875,11 @@ class DefaultShareProvider implements IShareProvider {
|
|||
}
|
||||
|
||||
if ($this->isAccessibleResult($data)) {
|
||||
$shares2[] = $this->createShare($data);
|
||||
try {
|
||||
$shares2[] = $this->createShare($data);
|
||||
} catch (\InvalidArgumentException $e) {
|
||||
// ignore exception and leave out share
|
||||
}
|
||||
}
|
||||
}
|
||||
$cursor->closeCursor();
|
||||
|
|
|
@ -1173,6 +1173,9 @@ class Manager implements IManager {
|
|||
} catch (ShareNotFound $e) {
|
||||
unset($shares[$key]);
|
||||
}
|
||||
if (!$this->userManager->userExists($share->getShareOwner())) {
|
||||
unset($shares[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
return $shares;
|
||||
|
|
|
@ -396,7 +396,9 @@ class Share implements \OCP\Share\IShare {
|
|||
if (!is_string($shareOwner)) {
|
||||
throw new \InvalidArgumentException();
|
||||
}
|
||||
//TODO checks
|
||||
if(!$this->userManager->userExists($this->shareOwner)) {
|
||||
throw new \InvalidArgumentException('Share owner doesn\'t exist');
|
||||
}
|
||||
|
||||
$this->shareOwner = $shareOwner;
|
||||
return $this;
|
||||
|
|
Loading…
Reference in New Issue