Create user profile before creating default project

User won't be defined in the system until user profile is created which
means checking to see if the user already has a project will fail. So
need to make sure to create the user profile first.


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

Branch: refs/heads/dreg-gateway
Commit: 702377a84b79eb742d5476e8a006a0b0b0a45b7b
Parents: 9b65e71
Author: Marcus Christie <machr...@iu.edu>
Authored: Wed Jul 5 10:38:30 2017 -0400
Committer: Marcus Christie <machr...@iu.edu>
Committed: Wed Jul 5 10:38:30 2017 -0400

----------------------------------------------------------------------
 app/controllers/AccountController.php | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/702377a8/app/controllers/AccountController.php
----------------------------------------------------------------------
diff --git a/app/controllers/AccountController.php 
b/app/controllers/AccountController.php
index 3a77746..f9ea073 100644
--- a/app/controllers/AccountController.php
+++ b/app/controllers/AccountController.php
@@ -273,6 +273,13 @@ 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);
+
         //creating a default project for user
         $projects = 
ProjectUtilities::get_all_user_projects(Config::get('pga_config.airavata')['gateway-id'],
 $username);
         if($projects == null || count($projects) == 0){
@@ -287,13 +294,6 @@ class AccountController extends BaseController
             umask($old_umask);
         }
 
-        // 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);
-
         if(Session::has("admin") || Session::has("admin-read-only") || 
Session::has("gateway-provider")){
             return Redirect::to("admin/dashboard". 
"?status=ok&code=".$accessToken . "&username=".$username
                 . "&refresh_code=" . $refreshToken . "&valid_time=" . 
$validTime);

Reply via email to