diff options
author | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2024-08-19 15:27:34 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-19 15:27:34 +0200 |
commit | f2559e44808fc785fa7ef148d4e15713b411e605 (patch) | |
tree | c1f84db761af3ded968d1d2396baf7fb7c447279 /lib/private | |
parent | 617e856f8e1b9b6c1b5503fc975704a4cc44cee1 (diff) | |
download | nextcloud-server-f2559e44808fc785fa7ef148d4e15713b411e605.tar.gz nextcloud-server-f2559e44808fc785fa7ef148d4e15713b411e605.zip |
Revert "[stable28] Apply group limit on remove from group"
Diffstat (limited to 'lib/private')
-rw-r--r-- | lib/private/Share20/DefaultShareProvider.php | 45 | ||||
-rw-r--r-- | lib/private/Share20/ProviderFactory.php | 1 |
2 files changed, 2 insertions, 44 deletions
diff --git a/lib/private/Share20/DefaultShareProvider.php b/lib/private/Share20/DefaultShareProvider.php index 75e853164b2..fd22095b420 100644 --- a/lib/private/Share20/DefaultShareProvider.php +++ b/lib/private/Share20/DefaultShareProvider.php @@ -53,7 +53,6 @@ use OCP\L10N\IFactory; use OCP\Mail\IMailer; use OCP\Share\Exceptions\ShareNotFound; use OCP\Share\IAttributes; -use OCP\Share\IManager; use OCP\Share\IShare; use OCP\Share\IShareProvider; use function str_starts_with; @@ -103,7 +102,6 @@ class DefaultShareProvider implements IShareProvider { IFactory $l10nFactory, IURLGenerator $urlGenerator, ITimeFactory $timeFactory, - private IManager $shareManager, ) { $this->dbConn = $connection; $this->userManager = $userManager; @@ -1306,7 +1304,6 @@ class DefaultShareProvider implements IShareProvider { * * @param string $uid * @param string $gid - * @return void */ public function userDeletedFromGroup($uid, $gid) { /* @@ -1318,7 +1315,7 @@ class DefaultShareProvider implements IShareProvider { ->where($qb->expr()->eq('share_type', $qb->createNamedParameter(IShare::TYPE_GROUP))) ->andWhere($qb->expr()->eq('share_with', $qb->createNamedParameter($gid))); - $cursor = $qb->executeQuery(); + $cursor = $qb->execute(); $ids = []; while ($row = $cursor->fetch()) { $ids[] = (int)$row['id']; @@ -1335,45 +1332,7 @@ class DefaultShareProvider implements IShareProvider { ->where($qb->expr()->eq('share_type', $qb->createNamedParameter(IShare::TYPE_USERGROUP))) ->andWhere($qb->expr()->eq('share_with', $qb->createNamedParameter($uid))) ->andWhere($qb->expr()->in('parent', $qb->createNamedParameter($chunk, IQueryBuilder::PARAM_INT_ARRAY))); - $qb->executeStatement(); - } - } - - if ($this->shareManager->shareWithGroupMembersOnly()) { - $user = $this->userManager->get($uid); - if ($user === null) { - return; - } - $userGroups = $this->groupManager->getUserGroupIds($user); - - // Delete user shares received by the user from users in the group. - $userReceivedShares = $this->shareManager->getSharedWith($uid, IShare::TYPE_USER, null, -1); - foreach ($userReceivedShares as $share) { - $owner = $this->userManager->get($share->getSharedBy()); - if ($owner === null) { - continue; - } - $ownerGroups = $this->groupManager->getUserGroupIds($owner); - $mutualGroups = array_intersect($userGroups, $ownerGroups); - - if (count($mutualGroups) === 0) { - $this->shareManager->deleteShare($share); - } - } - - // Delete user shares from the user to users in the group. - $userEmittedShares = $this->shareManager->getSharesBy($uid, IShare::TYPE_USER, null, true, -1); - foreach ($userEmittedShares as $share) { - $recipient = $this->userManager->get($share->getSharedWith()); - if ($recipient === null) { - continue; - } - $recipientGroups = $this->groupManager->getUserGroupIds($recipient); - $mutualGroups = array_intersect($userGroups, $recipientGroups); - - if (count($mutualGroups) === 0) { - $this->shareManager->deleteShare($share); - } + $qb->execute(); } } } diff --git a/lib/private/Share20/ProviderFactory.php b/lib/private/Share20/ProviderFactory.php index 63c161d5bee..dbf1b21dabe 100644 --- a/lib/private/Share20/ProviderFactory.php +++ b/lib/private/Share20/ProviderFactory.php @@ -106,7 +106,6 @@ class ProviderFactory implements IProviderFactory { $this->serverContainer->getL10NFactory(), $this->serverContainer->getURLGenerator(), $this->serverContainer->query(ITimeFactory::class), - $this->serverContainer->get(IManager::class), ); } |