airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From scnakand...@apache.org
Subject airavata-php-gateway git commit: updating getUserProfile method in keycloak
Date Fri, 24 Mar 2017 17:24:25 GMT
Repository: airavata-php-gateway
Updated Branches:
  refs/heads/keycloak-integration 9a9e450c0 -> b55a828b8


updating getUserProfile method in keycloak


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/b55a828b
Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/b55a828b
Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/b55a828b

Branch: refs/heads/keycloak-integration
Commit: b55a828b88c9f5f2623771140c81623046eb202b
Parents: 9a9e450
Author: scnakandala <supun.nakandala@gmail.com>
Authored: Fri Mar 24 13:24:22 2017 -0400
Committer: scnakandala <supun.nakandala@gmail.com>
Committed: Fri Mar 24 13:24:22 2017 -0400

----------------------------------------------------------------------
 app/libraries/Keycloak/Keycloak.php | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/b55a828b/app/libraries/Keycloak/Keycloak.php
----------------------------------------------------------------------
diff --git a/app/libraries/Keycloak/Keycloak.php b/app/libraries/Keycloak/Keycloak.php
index 3f12593..fd2e437 100644
--- a/app/libraries/Keycloak/Keycloak.php
+++ b/app/libraries/Keycloak/Keycloak.php
@@ -224,12 +224,18 @@ class Keycloak {
      * @param $username
      */
     public function getUserProfile($username){
-        $user = $this->users->getUser($this->realm, $username);
-        $result = [];
-        $result["email"] = $user->email;
-        $result["firstname"] = $user->firstName;
-        $result["lastname"] = $user->lastName;
-        return $result;
+        $users = $this->users->getUsers($this->realm, $username);
+        if(count($users) > 0){
+            $user = $users[0];
+            $result = [];
+            $result["email"] = $user->email;
+            $result["firstname"] = $user->firstName;
+            $result["lastname"] = $user->lastName;
+            return $result;
+        }else{
+            return [];
+        }
+
     }
 
     /**


Mime
View raw message