$added = 0;
foreach ($shares as $share) {
try {
- $this->checkExpireDate($share);
+ $this->checkShare($share);
} catch (ShareNotFound $e) {
//Ignore since this basically means the share is deleted
continue;
// remove all shares which are already expired
foreach ($shares as $key => $share) {
try {
- $this->checkExpireDate($share);
+ $this->checkShare($share);
} catch (ShareNotFound $e) {
unset($shares[$key]);
}
$share = $provider->getShareById($id, $recipient);
- $this->checkExpireDate($share);
+ $this->checkShare($share);
return $share;
}
throw new ShareNotFound($this->l->t('The requested share does not exist anymore'));
}
- $this->checkExpireDate($share);
+ $this->checkShare($share);
/*
* Reduce the permissions for link or email shares if public upload is not enabled
return $share;
}
- protected function checkExpireDate($share) {
+ /**
+ * Check expire date and disabled owner
+ *
+ * @throws ShareNotFound
+ */
+ protected function checkShare(IShare $share): void {
if ($share->isExpired()) {
$this->deleteShare($share);
throw new ShareNotFound($this->l->t('The requested share does not exist anymore'));
}
+ if ($this->config->getAppValue('files_sharing', 'hide_disabled_user_shares', 'no') === 'yes') {
+ $uids = array_unique([$share->getShareOwner(),$share->getSharedBy()]);
+ foreach ($uids as $uid) {
+ $user = $this->userManager->get($uid);
+ if (($user !== null) && !$user->isEnabled()) {
+ throw new ShareNotFound($this->l->t('The requested share comes from a disabled user'));
+ }
+ }
+ }
}
/**