Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not show shares of disabled users #23695

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 22 additions & 10 deletions apps/files_sharing/lib/MountProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,34 +35,33 @@
use OCP\IConfig;
use OCP\ILogger;
use OCP\IUser;
use OCP\IUserManager;
use OCP\Share\IManager;
use OCP\Share\IShare;

class MountProvider implements IMountProvider {
/**
* @var \OCP\IConfig
*/
/** @var \OCP\IConfig */
protected $config;

/**
* @var IManager
*/
/** @var IManager */
protected $shareManager;

/**
* @var ILogger
*/
/** @var ILogger */
protected $logger;

/** @var IUserManager */
private $userManager;

/**
* @param \OCP\IConfig $config
* @param IManager $shareManager
* @param ILogger $logger
*/
public function __construct(IConfig $config, IManager $shareManager, ILogger $logger) {
public function __construct(IConfig $config, IManager $shareManager, ILogger $logger, IUserManager $userManager) {
$this->config = $config;
$this->shareManager = $shareManager;
$this->logger = $logger;
$this->userManager = $userManager;
}


Expand All @@ -86,6 +85,19 @@ public function getMountsForUser(IUser $user, IStorageFactory $loader) {

$superShares = $this->buildSuperShares($shares, $user);

$superShares = array_filter($superShares, function (array $share) {
$user = $this->userManager->get($share[0]->getShareOwner());
if ($user === null) {
return false;
}

if ($user->isEnabled() === false) {
return false;
}

return true;
});

$mounts = [];
$view = new View('/' . $user->getUID() . '/files');
$ownerViews = [];
Expand Down