5353use OCP \Mail \IMailer ;
5454use OCP \Share \Exceptions \ShareNotFound ;
5555use OCP \Share \IAttributes ;
56- use OCP \Share \IManager ;
5756use OCP \Share \IShare ;
5857use OCP \Share \IShareProvider ;
5958use function str_starts_with ;
@@ -103,7 +102,6 @@ public function __construct(
103102 IFactory $ l10nFactory ,
104103 IURLGenerator $ urlGenerator ,
105104 ITimeFactory $ timeFactory ,
106- private IManager $ shareManager ,
107105 ) {
108106 $ this ->dbConn = $ connection ;
109107 $ this ->userManager = $ userManager ;
@@ -1306,7 +1304,6 @@ public function groupDeleted($gid) {
13061304 *
13071305 * @param string $uid
13081306 * @param string $gid
1309- * @return void
13101307 */
13111308 public function userDeletedFromGroup ($ uid , $ gid ) {
13121309 /*
@@ -1318,7 +1315,7 @@ public function userDeletedFromGroup($uid, $gid) {
13181315 ->where ($ qb ->expr ()->eq ('share_type ' , $ qb ->createNamedParameter (IShare::TYPE_GROUP )))
13191316 ->andWhere ($ qb ->expr ()->eq ('share_with ' , $ qb ->createNamedParameter ($ gid )));
13201317
1321- $ cursor = $ qb ->executeQuery ();
1318+ $ cursor = $ qb ->execute ();
13221319 $ ids = [];
13231320 while ($ row = $ cursor ->fetch ()) {
13241321 $ ids [] = (int )$ row ['id ' ];
@@ -1335,45 +1332,7 @@ public function userDeletedFromGroup($uid, $gid) {
13351332 ->where ($ qb ->expr ()->eq ('share_type ' , $ qb ->createNamedParameter (IShare::TYPE_USERGROUP )))
13361333 ->andWhere ($ qb ->expr ()->eq ('share_with ' , $ qb ->createNamedParameter ($ uid )))
13371334 ->andWhere ($ qb ->expr ()->in ('parent ' , $ qb ->createNamedParameter ($ chunk , IQueryBuilder::PARAM_INT_ARRAY )));
1338- $ qb ->executeStatement ();
1339- }
1340- }
1341-
1342- if ($ this ->shareManager ->shareWithGroupMembersOnly ()) {
1343- $ user = $ this ->userManager ->get ($ uid );
1344- if ($ user === null ) {
1345- return ;
1346- }
1347- $ userGroups = $ this ->groupManager ->getUserGroupIds ($ user );
1348-
1349- // Delete user shares received by the user from users in the group.
1350- $ userReceivedShares = $ this ->shareManager ->getSharedWith ($ uid , IShare::TYPE_USER , null , -1 );
1351- foreach ($ userReceivedShares as $ share ) {
1352- $ owner = $ this ->userManager ->get ($ share ->getSharedBy ());
1353- if ($ owner === null ) {
1354- continue ;
1355- }
1356- $ ownerGroups = $ this ->groupManager ->getUserGroupIds ($ owner );
1357- $ mutualGroups = array_intersect ($ userGroups , $ ownerGroups );
1358-
1359- if (count ($ mutualGroups ) === 0 ) {
1360- $ this ->shareManager ->deleteShare ($ share );
1361- }
1362- }
1363-
1364- // Delete user shares from the user to users in the group.
1365- $ userEmittedShares = $ this ->shareManager ->getSharesBy ($ uid , IShare::TYPE_USER , null , true , -1 );
1366- foreach ($ userEmittedShares as $ share ) {
1367- $ recipient = $ this ->userManager ->get ($ share ->getSharedWith ());
1368- if ($ recipient === null ) {
1369- continue ;
1370- }
1371- $ recipientGroups = $ this ->groupManager ->getUserGroupIds ($ recipient );
1372- $ mutualGroups = array_intersect ($ userGroups , $ recipientGroups );
1373-
1374- if (count ($ mutualGroups ) === 0 ) {
1375- $ this ->shareManager ->deleteShare ($ share );
1376- }
1335+ $ qb ->execute ();
13771336 }
13781337 }
13791338 }
0 commit comments