Do not show shares of disabled users
If a user is disabled their shares should be disabled as well. This makes sure that if the owner of a share is disabled nobody receives those shares anymore. The sharer can be disabled as it is not their data that is shared. Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
This commit is contained in:
parent
9976e47035
commit
0639f09175
|
@ -35,34 +35,33 @@ use OCP\Files\Storage\IStorageFactory;
|
|||
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;
|
||||
}
|
||||
|
||||
|
||||
|
@ -86,6 +85,19 @@ class MountProvider implements IMountProvider {
|
|||
|
||||
$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 = [];
|
||||
|
|
Loading…
Reference in New Issue