-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updated setupSSOByName to create new account if one does not already …
…exist
- Loading branch information
Showing
2 changed files
with
12 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
* Zookeeper Online | ||
* | ||
* @author Jim Mason <[email protected]> | ||
* @copyright Copyright (C) 1997-2023 Jim Mason <[email protected]> | ||
* @copyright Copyright (C) 1997-2024 Jim Mason <[email protected]> | ||
* @link https://zookeeper.ibinx.com/ | ||
* @license GPL-3.0 | ||
* | ||
|
@@ -141,14 +141,15 @@ public static function setupSSOByAccount($account) { | |
} | ||
return $retval; | ||
} | ||
|
||
public static function setupSSOByName($account, $name) { | ||
$retval = false; | ||
$row = Engine::api(IUser::class)->getUserByFullname($name); | ||
if($row) { | ||
Engine::api(IUser::class)->assignAccount($row["name"], $account); | ||
$retval = self::setupSSOByAccount($account); | ||
} | ||
return $retval; | ||
$api = Engine::api(IUser::class); | ||
$row = $api->getUserByFullname($name); | ||
if($row) | ||
$api->assignAccount($row["name"], $account); | ||
else | ||
$api->createNewAccount($name, $account); | ||
|
||
return self::setupSSOByAccount($account); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
* Zookeeper Online | ||
* | ||
* @author Jim Mason <[email protected]> | ||
* @copyright Copyright (C) 1997-2022 Jim Mason <[email protected]> | ||
* @copyright Copyright (C) 1997-2024 Jim Mason <[email protected]> | ||
* @link https://zookeeper.ibinx.com/ | ||
* @license GPL-3.0 | ||
* | ||
|
@@ -50,7 +50,7 @@ public function getUserByAccount($account) { | |
} | ||
|
||
public function getUserByFullname($fullname) { | ||
$query = "SELECT * FROM users WHERE realname = ?"; | ||
$query = "SELECT * FROM users WHERE realname = ? AND ssoaccount IS NULL"; | ||
$stmt = $this->prepare($query); | ||
$stmt->bindValue(1, $fullname); | ||
return $stmt->executeAndFetch(); | ||
|