You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ma...@apache.org on 2019/10/29 19:42:05 UTC

[airavata-php-gateway] branch staging updated: AIRAVATA-3249 Always initialize user profile on login

This is an automated email from the ASF dual-hosted git repository.

machristie pushed a commit to branch staging
in repository https://gitbox.apache.org/repos/asf/airavata-php-gateway.git


The following commit(s) were added to refs/heads/staging by this push:
     new 8e432ab  AIRAVATA-3249 Always initialize user profile on login
8e432ab is described below

commit 8e432abfd3dc0e10052efd40045bc63766b7b5aa
Author: Marcus Christie <ma...@iu.edu>
AuthorDate: Tue Oct 29 15:41:12 2019 -0400

    AIRAVATA-3249 Always initialize user profile on login
---
 app/controllers/AccountController.php  | 6 ++----
 app/libraries/UserProfileUtilities.php | 4 ++++
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/app/controllers/AccountController.php b/app/controllers/AccountController.php
index 5d020a8..c95e285 100644
--- a/app/controllers/AccountController.php
+++ b/app/controllers/AccountController.php
@@ -187,6 +187,7 @@ class AccountController extends BaseController
             CommonUtilities::store_id_in_session($username);
             Session::put("gateway_id", Config::get('pga_config.airavata')['gateway-id']);
 
+            UserProfileUtilities::initialize_user_profile();
             if(Session::has("admin") || Session::has("admin-read-only") || Session::has("authorized-user") || Session::has("gateway-provider")){
                 return $this->initializeWithAiravata($username, $userEmail, $firstName, $lastName, $accessToken,
                     $refreshToken, $expirationTime);
@@ -285,6 +286,7 @@ class AccountController extends BaseController
         CommonUtilities::store_id_in_session($username);
         Session::put("gateway_id", Config::get('pga_config.airavata')['gateway-id']);
 
+        UserProfileUtilities::initialize_user_profile();
         if(Session::has("admin") || Session::has("admin-read-only") || Session::has("authorized-user") || Session::has("gateway-provider")){
             return $this->initializeWithAiravata($username, $userEmail, $firstName, $lastName, $accessToken, $refreshToken, $expirationTime);
         }
@@ -312,10 +314,6 @@ class AccountController extends BaseController
             return Redirect::to("home")->with("airavata-down", true);
         }
 
-        // Create basic user profile if it doesn't exist
-        if (!UserProfileUtilities::does_user_profile_exist($username)) {
-            UserProfileUtilities::create_basic_user_profile($username, $userEmail, $firstName, $lastName);
-        }
         $userProfile = UserProfileUtilities::get_user_profile($username);
         Session::put('user-profile', $userProfile);
 
diff --git a/app/libraries/UserProfileUtilities.php b/app/libraries/UserProfileUtilities.php
index 6717546..efe5711 100644
--- a/app/libraries/UserProfileUtilities.php
+++ b/app/libraries/UserProfileUtilities.php
@@ -25,6 +25,10 @@ class UserProfileUtilities
         return UserProfileUtilities::add_user_profile($userProfileData);
     }
 
+    public static function initialize_user_profile() {
+        return UserProfileService::initializeUserProfile(Session::get('authz-token'));
+    }
+
     public static function add_user_profile($userProfileData) {
 
         $userProfile = new UserProfile($userProfileData);