fixing minor issue in usernameExists
Project: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/commit/501460fc Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/501460fc Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/501460fc Branch: refs/heads/develop Commit: 501460fc70689a28650bd4ce355823525c91c642 Parents: f83e0e5 Author: scnakandala <[email protected]> Authored: Fri Mar 24 13:20:27 2017 -0400 Committer: scnakandala <[email protected]> Committed: Fri Mar 24 13:20:27 2017 -0400 ---------------------------------------------------------------------- app/libraries/Keycloak/Keycloak.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/501460fc/app/libraries/Keycloak/Keycloak.php ---------------------------------------------------------------------- diff --git a/app/libraries/Keycloak/Keycloak.php b/app/libraries/Keycloak/Keycloak.php index 819541d..aeac3ad 100644 --- a/app/libraries/Keycloak/Keycloak.php +++ b/app/libraries/Keycloak/Keycloak.php @@ -221,10 +221,10 @@ class Keycloak { /** * Function to get the user profile of a user - * @param $user_id + * @param $username */ - public function getUserProfile($user_id){ - $user = $this->users->getUser($this->realm, $user_id); + public function getUserProfile($username){ + $user = $this->users->getUser($this->realm, $username); $result = []; $result["email"] = $user->email; $result["firstname"] = $user->firstName; @@ -239,8 +239,8 @@ class Keycloak { */ public function usernameExists($user_id){ try{ - $user = $this->users->getUser($this->realm, $user_id); - return $user != null; + $users = $this->users->getUsers($this->realm, $user_id); + return $users != null && len($users) > 0; }catch (Exception $ex){ // Username does not exists return false;
