Skip to content

Commit a3c4a5a

Browse files
Merge pull request #61838 from nextcloud/carl/perf/groupmapper
perf: Don't fetch full group object in AuthorizedGroupMapper
2 parents 521f59c + 636aaf7 commit a3c4a5a

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

lib/private/Settings/AuthorizedGroupMapper.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
use OCP\DB\Exception;
1616
use OCP\DB\QueryBuilder\IQueryBuilder;
1717
use OCP\IDBConnection;
18-
use OCP\IGroup;
1918
use OCP\IGroupManager;
2019
use OCP\IUser;
2120
use OCP\Server;
@@ -36,15 +35,15 @@ public function findAllClassesForUser(IUser $user): array {
3635
$qb = $this->db->getQueryBuilder();
3736

3837
$groupManager = Server::get(IGroupManager::class);
39-
$groups = $groupManager->getUserGroups($user);
40-
if (count($groups) === 0) {
38+
$groupIds = $groupManager->getUserGroupIds($user);
39+
if (count($groupIds) === 0) {
4140
return [];
4241
}
4342

4443
/** @var list<string> $rows */
4544
$rows = $qb->select('class')
4645
->from($this->getTableName(), 'auth')
47-
->where($qb->expr()->in('group_id', array_map(static fn (IGroup $group) => $qb->createNamedParameter($group->getGID()), $groups), IQueryBuilder::PARAM_STR))
46+
->where($qb->expr()->in('group_id', $qb->createNamedParameter($groupIds, IQueryBuilder::PARAM_STR_ARRAY)))
4847
->executeQuery()
4948
->fetchFirstColumn();
5049

0 commit comments

Comments
 (0)