Skip to content

Commit

Permalink
Merge pull request #180 from humhub/enh/endpoint-get-user-by-source
Browse files Browse the repository at this point in the history
Improved `user/get-by-authclient` endpoint to support additional authentication clients
  • Loading branch information
luke- authored Sep 26, 2024
2 parents 3aa4498 + a791754 commit f4f1b1e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
7 changes: 6 additions & 1 deletion controllers/user/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,12 @@ public function actionGetByEmail($email)
*/
public function actionGetByAuthclient($name, $id)
{
$user = User::findOne(['auth_mode' => $name, 'authclient_id' => $id]);
$user = User::find()
->alias('u')
->joinWith('auths a', false)
->where(['u.auth_mode' => $name, 'u.authclient_id' => $id])
->orWhere(['a.source' => $name, 'a.source_id' => $id])
->one();

if ($user === null) {
return $this->returnError(404, 'User not found!');
Expand Down
5 changes: 3 additions & 2 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
Changelog
=========

0.10.4 (Unreleased)
---------------------------
0.10.4 (September 9, 2024)
--------------------------
- Enh #180: Improved `user/get-by-authclient` endpoint to support additional authentication clients.
- Enh #181: Added user profile `image_url` and `banner_url`
- Enh #179: Added new `resend` and `cancel` endpoints for user invite

Expand Down

0 comments on commit f4f1b1e

Please sign in to comment.