]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix: always add user to group cache 42931/head
authorHugo Renard <hugo.renard@protonmail.com>
Thu, 18 Jan 2024 11:09:38 +0000 (12:09 +0100)
committerBenjamin Gaussorgues <benjamin.gaussorgues@nextcloud.com>
Tue, 26 Mar 2024 10:07:37 +0000 (11:07 +0100)
When there is no user in a group, and we add one, it's not added to the group cache. So consecutive call of addUser() and getUsers() is inconsistent.
Furthermore, the user cache is never null, so this check is unesserary.

Signed-off-by: Hugo Renard <hugo.renard@protonmail.com>
lib/private/Group/Group.php

index d8d1a73762ded38daa1caa907914cb3231bcde7d..57289a4d3acb7a8e6def3dcdebb805a6dc7cc1d7 100644 (file)
@@ -184,9 +184,7 @@ class Group implements IGroup {
                foreach ($this->backends as $backend) {
                        if ($backend->implementsActions(\OC\Group\Backend::ADD_TO_GROUP)) {
                                $backend->addToGroup($user->getUID(), $this->gid);
-                               if ($this->users) {
-                                       $this->users[$user->getUID()] = $user;
-                               }
+                               $this->users[$user->getUID()] = $user;
 
                                $this->dispatcher->dispatchTyped(new UserAddedEvent($this, $user));