Repository: airavata-php-gateway
Updated Branches:
  refs/heads/0.15-release-branch 81bff876c -> 8437d438b


creating default project upon user creation


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

Branch: refs/heads/0.15-release-branch
Commit: c97b28fcc1ee5394d4dffdcf98c765a95a3fad5e
Parents: 81bff87
Author: Supun Nakandala <[email protected]>
Authored: Thu Jul 16 18:29:22 2015 +0530
Committer: Supun Nakandala <[email protected]>
Committed: Thu Jul 16 18:29:22 2015 +0530

----------------------------------------------------------------------
 app/controllers/AccountController.php |  4 +++-
 app/libraries/ProjectUtilities.php    | 32 ++++++++++++++++++++++++++++++
 2 files changed, 35 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/c97b28fc/app/controllers/AccountController.php
----------------------------------------------------------------------
diff --git a/app/controllers/AccountController.php 
b/app/controllers/AccountController.php
index 6cb1976..368e5b5 100755
--- a/app/controllers/AccountController.php
+++ b/app/controllers/AccountController.php
@@ -47,8 +47,10 @@ class AccountController extends BaseController
         } else {
             WSIS::addUser($username, $password, $first_name, $last_name, 
$email, $organization,
                 $address, $country, $telephone, $mobile, $im, $url);
-            CommonUtilities::print_success_message('New user created!');
 
+            //creating a default project for user
+            ProjectUtilities::create_default_project($username);
+            CommonUtilities::print_success_message('New user created!');
             return View::make('account/login');
         }
     }

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/c97b28fc/app/libraries/ProjectUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/ProjectUtilities.php 
b/app/libraries/ProjectUtilities.php
index 7f00a8f..280b116 100644
--- a/app/libraries/ProjectUtilities.php
+++ b/app/libraries/ProjectUtilities.php
@@ -130,6 +130,38 @@ class ProjectUtilities
         return $projectId;
     }
 
+    public static function create_default_project($username)
+    {
+        $project = new Project();
+        $project->owner = $username;
+        $project->name = "Default Project";
+        $project->description = "This is the default project for user " + 
$project->owner;
+
+
+        $projectId = null;
+
+        try {
+            $projectId = 
Airavata::createProject(Config::get('pga_config.airavata')['gateway-id'], 
$project);
+
+            if ($projectId) {
+                CommonUtilities::print_success_message("<p>Project 
{$_POST['project-name']} created!</p>" .
+                    '<p>You will be redirected to the summary page shortly, or 
you can
+                    <a href="project/summary?projId=' . $projectId . '">go 
directly</a> to the project summary page.</p>');
+            } else {
+                CommonUtilities::print_error_message("Error creating project 
{$_POST['project-name']}!");
+            }
+        } catch (InvalidRequestException $ire) {
+            
CommonUtilities::print_error_message('InvalidRequestException!<br><br>' . 
$ire->getMessage());
+        } catch (AiravataClientException $ace) {
+            
CommonUtilities::print_error_message('AiravataClientException!<br><br>' . 
$ace->getMessage());
+        } catch (AiravataSystemException $ase) {
+            
CommonUtilities::print_error_message('AiravataSystemException!<br><br>' . 
$ase->getMessage());
+        }
+
+        return $projectId;
+    }
+
+
     /**
      * Get experiments in project
      * @param $projectId

Reply via email to