Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions lib/Db/UserMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,4 +169,22 @@ public function getOrCreate(int $providerId, string $sub, bool $id4me = false):
$user->setUserId($userId);
return $this->insert($user);
}

/**
* Count the total number of users provisioned by the OIDC backend.
*
* @return int the number of rows in the user_oidc table
*/
public function countUsers(): int {
$qb = $this->db->getQueryBuilder();

$qb->selectAlias($qb->func()->count('*'), 'user_count')
->from($this->getTableName());

$result = $qb->executeQuery();
$count = $result->fetchOne();
$result->closeCursor();

return (int)$count;
}
}
Loading
Loading