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 2017/06/16 20:36:04 UTC

[01/50] [abbrv] airavata-php-gateway git commit: AIRAVATA-2342 Turn off creating account (for now)

Repository: airavata-php-gateway
Updated Branches:
  refs/heads/develop a2366efd2 -> b591279a4


AIRAVATA-2342 Turn off creating account (for now)


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

Branch: refs/heads/develop
Commit: 99ffbef3c52151eec04b267e88982ceb6f4e06be
Parents: aba44b6
Author: Marcus Christie <ma...@iu.edu>
Authored: Tue Mar 21 15:43:45 2017 -0400
Committer: Marcus Christie <ma...@iu.edu>
Committed: Tue Mar 21 15:43:45 2017 -0400

----------------------------------------------------------------------
 app/libraries/CommonUtilities.php | 2 +-
 app/views/account/login.blade.php | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/99ffbef3/app/libraries/CommonUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/CommonUtilities.php b/app/libraries/CommonUtilities.php
index 53f790e..a3259a8 100644
--- a/app/libraries/CommonUtilities.php
+++ b/app/libraries/CommonUtilities.php
@@ -249,7 +249,7 @@ class CommonUtilities
             $navbar .= '</ul></li>';
         } else {
 
-                    $navbar .= '<li><a href="' . URL::to('/') . '/create"><span class="glyphicon glyphicon-user"></span> Create account</a></li>';
+                    // $navbar .= '<li><a href="' . URL::to('/') . '/create"><span class="glyphicon glyphicon-user"></span> Create account</a></li>';
                     $navbar .= '<li><a href="' . URL::to('/') . '/login"><span class="glyphicon glyphicon-log-in"></span> Log in</a></li>';
         }
 

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/99ffbef3/app/views/account/login.blade.php
----------------------------------------------------------------------
diff --git a/app/views/account/login.blade.php b/app/views/account/login.blade.php
index 7ef30cc..9d36753 100755
--- a/app/views/account/login.blade.php
+++ b/app/views/account/login.blade.php
@@ -10,9 +10,9 @@
 
     <h3>
         Login
-        <small>
+        {{-- <small>
             <small> (Not registered? <a href="create">Create account</a>)</small>
-        </small>
+        </small> --}}
     </h3>
 
 


[28/50] [abbrv] airavata-php-gateway git commit: Changing IamAdminServices alias to IamAdminServices

Posted by ma...@apache.org.
Changing IamAdminServices alias to IamAdminServices


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

Branch: refs/heads/develop
Commit: 6d9e2085ca67b9bec19f73d185a6d608a0641710
Parents: b16fae5
Author: Marcus Christie <ma...@iu.edu>
Authored: Thu May 4 12:16:41 2017 -0400
Committer: Marcus Christie <ma...@iu.edu>
Committed: Thu May 4 12:17:24 2017 -0400

----------------------------------------------------------------------
 app/libraries/Airavata/IamAdminServiceProvider.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/6d9e2085/app/libraries/Airavata/IamAdminServiceProvider.php
----------------------------------------------------------------------
diff --git a/app/libraries/Airavata/IamAdminServiceProvider.php b/app/libraries/Airavata/IamAdminServiceProvider.php
index 1f62e32..2506211 100755
--- a/app/libraries/Airavata/IamAdminServiceProvider.php
+++ b/app/libraries/Airavata/IamAdminServiceProvider.php
@@ -65,7 +65,7 @@ class IamAdminServiceProvider extends ServiceProvider {
         $this->app->booting(function()
         {
             $loader = \Illuminate\Foundation\AliasLoader::getInstance();
-            $loader->alias('Airavata', 'Airavata\Facades\IamAdminServices');
+            $loader->alias('IamAdminServices', 'Airavata\Facades\IamAdminServices');
         });
 	}
 


[24/50] [abbrv] airavata-php-gateway git commit: AIRAVATA-2342 Adding "InCommon RSA Server CA" cert

Posted by ma...@apache.org.
AIRAVATA-2342 Adding "InCommon RSA Server CA" cert


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

Branch: refs/heads/develop
Commit: d5b88361c68314dcc08dd4687e3b1e71e97d0944
Parents: ec006aa
Author: Marcus Christie <ma...@iu.edu>
Authored: Fri Apr 28 16:13:10 2017 -0400
Committer: Marcus Christie <ma...@iu.edu>
Committed: Fri Apr 28 16:13:10 2017 -0400

----------------------------------------------------------------------
 .../security/incommon_rsa_server_ca.pem         | 34 ++++++++++++++++++++
 1 file changed, 34 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/d5b88361/app/resources/security/incommon_rsa_server_ca.pem
----------------------------------------------------------------------
diff --git a/app/resources/security/incommon_rsa_server_ca.pem b/app/resources/security/incommon_rsa_server_ca.pem
new file mode 100644
index 0000000..6d09cf3
--- /dev/null
+++ b/app/resources/security/incommon_rsa_server_ca.pem
@@ -0,0 +1,34 @@
+-----BEGIN CERTIFICATE-----
+MIIF+TCCA+GgAwIBAgIQRyDQ+oVGGn4XoWQCkYRjdDANBgkqhkiG9w0BAQwFADCB
+iDELMAkGA1UEBhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0pl
+cnNleSBDaXR5MR4wHAYDVQQKExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNV
+BAMTJVVTRVJUcnVzdCBSU0EgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMTQx
+MDA2MDAwMDAwWhcNMjQxMDA1MjM1OTU5WjB2MQswCQYDVQQGEwJVUzELMAkGA1UE
+CBMCTUkxEjAQBgNVBAcTCUFubiBBcmJvcjESMBAGA1UEChMJSW50ZXJuZXQyMREw
+DwYDVQQLEwhJbkNvbW1vbjEfMB0GA1UEAxMWSW5Db21tb24gUlNBIFNlcnZlciBD
+QTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJwb8bsvf2MYFVFRVA+e
+xU5NEFj6MJsXKZDmMwysE1N8VJG06thum4ltuzM+j9INpun5uukNDBqeso7JcC7v
+HgV9lestjaKpTbOc5/MZNrun8XzmCB5hJ0R6lvSoNNviQsil2zfVtefkQnI/tBPP
+iwckRR6MkYNGuQmm/BijBgLsNI0yZpUn6uGX6Ns1oytW61fo8BBZ321wDGZq0GTl
+qKOYMa0dYtX6kuOaQ80tNfvZnjNbRX3EhigsZhLI2w8ZMA0/6fDqSl5AB8f2IHpT
+eIFken5FahZv9JNYyWL7KSd9oX8hzudPR9aKVuDjZvjs3YncJowZaDuNi+L7RyML
+fzcCAwEAAaOCAW4wggFqMB8GA1UdIwQYMBaAFFN5v1qqK0rPVIDh2JvAnfKyA2bL
+MB0GA1UdDgQWBBQeBaN3j2yW4luHS6a0hqxxAAznODAOBgNVHQ8BAf8EBAMCAYYw
+EgYDVR0TAQH/BAgwBgEB/wIBADAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUH
+AwIwGwYDVR0gBBQwEjAGBgRVHSAAMAgGBmeBDAECAjBQBgNVHR8ESTBHMEWgQ6BB
+hj9odHRwOi8vY3JsLnVzZXJ0cnVzdC5jb20vVVNFUlRydXN0UlNBQ2VydGlmaWNh
+dGlvbkF1dGhvcml0eS5jcmwwdgYIKwYBBQUHAQEEajBoMD8GCCsGAQUFBzAChjNo
+dHRwOi8vY3J0LnVzZXJ0cnVzdC5jb20vVVNFUlRydXN0UlNBQWRkVHJ1c3RDQS5j
+cnQwJQYIKwYBBQUHMAGGGWh0dHA6Ly9vY3NwLnVzZXJ0cnVzdC5jb20wDQYJKoZI
+hvcNAQEMBQADggIBAC0RBjjW29dYaK+qOGcXjeIT16MUJNkGE+vrkS/fT2ctyNMU
+11ZlUp5uH5gIjppIG8GLWZqjV5vbhvhZQPwZsHURKsISNrqOcooGTie3jVgU0W+0
++Wj8mN2knCVANt69F2YrA394gbGAdJ5fOrQmL2pIhDY0jqco74fzYefbZ/VS29fR
+5jBxu4uj1P+5ZImem4Gbj1e4ZEzVBhmO55GFfBjRidj26h1oFBHZ7heDH1Bjzw72
+hipu47Gkyfr2NEx3KoCGMLCj3Btx7ASn5Ji8FoU+hCazwOU1VX55mKPU1I2250Lo
+RCASN18JyfsD5PVldJbtyrmz9gn/TKbRXTr80U2q5JhyvjhLf4lOJo/UzL5WCXED
+Smyj4jWG3R7Z8TED9xNNCxGBMXnMete+3PvzdhssvbORDwBZByogQ9xL2LUZFI/i
+eoQp0UM/L8zfP527vWjEzuDN5xwxMnhi+vCToh7J159o5ah29mP+aJnvujbXEnGa
+nrNxHzu+AGOePV8hwrGGG7hOIcPDQwkuYwzN/xT29iLp/cqf9ZhEtkGcQcIImH3b
+oJ8ifsCnSbu0GB9L06Yqh7lcyvKDTEADslIaeSEINxhO2Y1fmcYFX/Fqrrp1WnhH
+OjplXuXE0OPa0utaKC25Aplgom88L2Z8mEWcyfoB7zKOfD759AN7JKZWCYwk
+-----END CERTIFICATE-----


[49/50] [abbrv] airavata-php-gateway git commit: AIRAVATA-2408 Fixing method name

Posted by ma...@apache.org.
AIRAVATA-2408 Fixing method name


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

Branch: refs/heads/develop
Commit: d980e75a185dbf69baec25f7e32f9baa999140d3
Parents: 135077c
Author: Marcus Christie <ma...@iu.edu>
Authored: Tue Jun 13 14:28:37 2017 -0400
Committer: Marcus Christie <ma...@iu.edu>
Committed: Tue Jun 13 14:28:37 2017 -0400

----------------------------------------------------------------------
 app/libraries/UserProfileUtilities.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/d980e75a/app/libraries/UserProfileUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/UserProfileUtilities.php b/app/libraries/UserProfileUtilities.php
index 8d9c99d..31a586c 100644
--- a/app/libraries/UserProfileUtilities.php
+++ b/app/libraries/UserProfileUtilities.php
@@ -8,7 +8,7 @@ class UserProfileUtilities
 
     public static function does_user_profile_exist($userId) {
         $gatewayId = Session::get('gateway_id');
-        return UserProfileService::doesUserProfileExist(Session::get('authz-token'), $userId, $gatewayId);
+        return UserProfileService::doesUserExist(Session::get('authz-token'), $userId, $gatewayId);
     }
 
     public static function create_basic_user_profile($username, $userEmail) {


[50/50] [abbrv] airavata-php-gateway git commit: Merge branch 'keycloak-integration' into develop

Posted by ma...@apache.org.
Merge branch 'keycloak-integration' into develop


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

Branch: refs/heads/develop
Commit: b591279a47b3af3f9be38e5175a48730721e5551
Parents: a2366ef d980e75
Author: Marcus Christie <ma...@iu.edu>
Authored: Fri Jun 16 16:35:51 2017 -0400
Committer: Marcus Christie <ma...@iu.edu>
Committed: Fri Jun 16 16:35:51 2017 -0400

----------------------------------------------------------------------
 app/config/app.php                              |    7 +-
 app/config/email_templates.json                 |   59 +
 app/config/email_templates.json.template        |   41 +
 app/config/pga_config.php.template              |   23 +-
 app/controllers/AccountController.php           |  239 +-
 app/controllers/AdminController.php             |   46 +-
 app/controllers/UserSettingsController.php      |   90 +
 app/filters.php                                 |    4 +-
 app/libraries/AdminUtilities.php                |    3 +-
 .../Airavata/Facades/IamAdminServices.php       |   16 +
 .../Airavata/Facades/UserProfileServices.php    |   16 +
 .../Airavata/IamAdminServiceProvider.php        |   84 +
 .../Airavata/Model/Workspace/Types.php          |  133 +-
 .../Iam/Admin/Services/CPI/Error/Types.php      |   95 +
 .../Iam/Admin/Services/CPI/IamAdminServices.php | 2341 +++++++++++++++++
 .../Service/Iam/Admin/Services/CPI/Types.php    |   33 +
 .../Service/Profile/Tenant/CPI/Error/Types.php  |   95 +
 .../Profile/Tenant/CPI/TenantProfileService.php | 2435 ++++++++++++++++++
 .../Service/Profile/Tenant/CPI/Types.php        |   33 +
 .../Airavata/Service/Profile/Types.php          |   20 +
 .../Service/Profile/User/CPI/Error/Types.php    |   95 +
 .../Airavata/Service/Profile/User/CPI/Types.php |   33 +
 .../Profile/User/CPI/UserProfileService.php     | 2025 +++++++++++++++
 .../Airavata/UserProfileServiceProvider.php     |   83 +
 app/libraries/EmailUtilities.php                |  124 +
 app/libraries/GrouperUtilities.php              |   37 +-
 .../Keycloak/API/BaseKeycloakAPIEndpoint.php    |   29 +
 app/libraries/Keycloak/API/RoleMapper.php       |  113 +
 app/libraries/Keycloak/API/Roles.php            |   37 +
 app/libraries/Keycloak/API/Users.php            |  102 +
 app/libraries/Keycloak/Facades/Keycloak.php     |   16 +
 app/libraries/Keycloak/Keycloak.php             |  446 ++++
 .../Keycloak/KeycloakServiceProvider.php        |   71 +
 app/libraries/Keycloak/KeycloakUtil.php         |   38 +
 app/libraries/SharingUtilities.php              |    8 +-
 app/libraries/UserProfileUtilities.php          |   48 +
 .../security/incommon_rsa_server_ca.pem         |   34 +
 app/routes.php                                  |    6 +
 app/views/account/create.blade.php              |   42 -
 app/views/account/forgot-password.blade.php     |   15 +
 app/views/account/login.blade.php               |   13 +-
 app/views/account/reset-password.blade.php      |   25 +-
 app/views/account/settings.blade.php            |   16 +
 .../account/user-profile-update-email.blade.php |   60 +
 app/views/account/user-profile.blade.php        |   73 +
 app/views/layout/basic.blade.php                |    4 +-
 app/views/layout/fixed-scripts.blade.php        |    8 +-
 public/css/bootstrap.min.css                    |    2 +-
 48 files changed, 9111 insertions(+), 305 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/b591279a/app/config/app.php
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/b591279a/app/controllers/AdminController.php
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/b591279a/app/libraries/SharingUtilities.php
----------------------------------------------------------------------
diff --cc app/libraries/SharingUtilities.php
index f069e55,5822a04..6cf7e7e
--- a/app/libraries/SharingUtilities.php
+++ b/app/libraries/SharingUtilities.php
@@@ -74,10 -64,9 +74,10 @@@ class SharingUtilities 
  
          $read = GrouperUtilities::getAllAccessibleUsers($resourceId, $dataResourceType, ResourcePermissionType::READ);
          $write = GrouperUtilities::getAllAccessibleUsers($resourceId, $dataResourceType, ResourcePermissionType::WRITE);
 +        $owner = GrouperUtilities::getAllAccessibleUsers($resourceId, $dataResourceType, ResourcePermissionType::OWNER);
  
          foreach($read as $uid) {
-             if ($uid !== Session::get('username') && WSIS::usernameExists($uid)) {
+             if ($uid !== Session::get('username') && Keycloak::usernameExists($uid)) {
                  $users[$uid] = array('read' => true, 'write' => false);
              }
          }

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/b591279a/app/routes.php
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/b591279a/app/views/layout/basic.blade.php
----------------------------------------------------------------------


[27/50] [abbrv] airavata-php-gateway git commit: adding IamAdminServices client to pga

Posted by ma...@apache.org.
adding IamAdminServices client to pga


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

Branch: refs/heads/develop
Commit: b16fae5b5c84f2ba54b9f9c554bdf96d10f380cc
Parents: 99f04a0
Author: scnakandala <su...@gmail.com>
Authored: Tue May 2 16:46:16 2017 -0400
Committer: scnakandala <su...@gmail.com>
Committed: Tue May 2 16:46:16 2017 -0400

----------------------------------------------------------------------
 app/config/app.php                              |    3 +-
 app/config/pga_config.php.template              |    5 +
 .../Airavata/Facades/IamAdminServices.php       |   16 +
 .../Airavata/IamAdminServiceProvider.php        |   82 +
 .../Iam/Admin/Services/CPI/Error/Types.php      |   95 +
 .../Iam/Admin/Services/CPI/IamAdminServices.php | 2079 ++++++++++++++++++
 .../Service/Iam/Admin/Services/CPI/Types.php    |   33 +
 7 files changed, 2312 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/b16fae5b/app/config/app.php
----------------------------------------------------------------------
diff --git a/app/config/app.php b/app/config/app.php
index 5032866..9d863ce 100755
--- a/app/config/app.php
+++ b/app/config/app.php
@@ -124,6 +124,7 @@ return array(
         // 'Wsis\WsisServiceProvider',
         'Keycloak\KeycloakServiceProvider',
         'Airavata\AiravataServiceProvider',
+        'Airavata\IamAdminServiceProvider',
         'Teepluss\Theme\ThemeServiceProvider',
         'GrahamCampbell\Markdown\MarkdownServiceProvider',
     ),
@@ -192,8 +193,8 @@ return array(
         'URL' => 'Illuminate\Support\Facades\URL',
         'Validator' => 'Illuminate\Support\Facades\Validator',
         'View' => 'Illuminate\Support\Facades\View',
-        'WSIS' => 'Wsis\Facades\Wsis',
         'Airavata' => 'Airavata\Facades\Airavata',
+        'Airavata.IAM' => 'Airavata\Facades\IamAdminServices',
         'Theme' => 'Teepluss\Theme\Facades\Theme',
         'Markdown' => 'GrahamCampbell\Markdown\Facades\Markdown',
     ),

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/b16fae5b/app/config/pga_config.php.template
----------------------------------------------------------------------
diff --git a/app/config/pga_config.php.template b/app/config/pga_config.php.template
index cd7f1df..b5576f6 100644
--- a/app/config/pga_config.php.template
+++ b/app/config/pga_config.php.template
@@ -107,6 +107,11 @@ return array(
         'airavata-port' => '8930',
 
         /**
+         * Airavata Profile Service port
+         */
+        'airavata-profile-service-port' => '8962',
+
+        /**
          * Airavata API server thrift communication timeout
          */
         'airavata-timeout' => '1000000',

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/b16fae5b/app/libraries/Airavata/Facades/IamAdminServices.php
----------------------------------------------------------------------
diff --git a/app/libraries/Airavata/Facades/IamAdminServices.php b/app/libraries/Airavata/Facades/IamAdminServices.php
new file mode 100755
index 0000000..7972ef9
--- /dev/null
+++ b/app/libraries/Airavata/Facades/IamAdminServices.php
@@ -0,0 +1,16 @@
+<?php
+
+namespace Airavata\Facades;
+
+use Illuminate\Support\Facades\Facade;
+
+class IamAdminServices extends Facade {
+
+    /**
+     * Get the registered name of the component.
+     *
+     * @return string
+     */
+    protected static function getFacadeAccessor() { return 'iam_admin_services'; }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/b16fae5b/app/libraries/Airavata/IamAdminServiceProvider.php
----------------------------------------------------------------------
diff --git a/app/libraries/Airavata/IamAdminServiceProvider.php b/app/libraries/Airavata/IamAdminServiceProvider.php
new file mode 100755
index 0000000..1f62e32
--- /dev/null
+++ b/app/libraries/Airavata/IamAdminServiceProvider.php
@@ -0,0 +1,82 @@
+<?php namespace Airavata;
+
+use Airavata\Service\Iam\Admin\Services\CPI\IamAdminServicesClient;
+use Illuminate\Routing\UrlGenerator;
+use Illuminate\Support\ServiceProvider;
+use Illuminate\Support\Facades\Config;
+use Airavata\API\AiravataClient;
+use Thrift\Transport\TSocket;
+use Thrift\Protocol\TBinaryProtocol;
+use Illuminate\Routing\Redirector;
+
+class IamAdminServiceProvider extends ServiceProvider {
+
+	/**
+	 * Indicates if loading of the provider is deferred.
+	 *
+	 * @var bool
+	 */
+	protected $defer = false;
+
+    /**
+     * Bootstrap the application events.
+     *
+     * @return void
+     */
+    public function boot()
+    {
+        $this->package('airavata/iam_admin_services');
+    }
+
+	/**
+	 * Register the service provider.
+	 *
+	 * @return void
+	 */
+	public function register()
+	{
+        //registering service provider
+        $this->app['iam_admin_services'] = $this->app->share(function($app)
+        {
+            try{
+                $transport = new TSocket(
+                    Config::get('pga_config.airavata')['airavata-server'],
+                    Config::get('pga_config.airavata')['airavata-profile-service-port']
+                );
+                $transport->setRecvTimeout( Config::get('pga_config.airavata')['airavata-timeout']);
+                $transport->setSendTimeout( Config::get('pga_config.airavata')['airavata-timeout']);
+
+                $protocol = new TBinaryProtocol($transport);
+                $transport->open();
+
+                $client = new IamAdminServicesClient($protocol);
+
+            }catch (\Exception $ex){
+                throw new \Exception("Unable to instantiate Airavata IamAdminServices Client", 0,  $ex);
+            }
+
+            if( is_object( $client))
+                return $client;
+            else
+                throw new \Exception("Unable to instantiate Airavata IamAdminServices Client");
+        });
+
+        //registering alis
+        $this->app->booting(function()
+        {
+            $loader = \Illuminate\Foundation\AliasLoader::getInstance();
+            $loader->alias('Airavata', 'Airavata\Facades\IamAdminServices');
+        });
+	}
+
+	/**
+	 * Get the services provided by the provider.
+	 *
+	 * @return array
+	 */
+	public function provides()
+	{
+		return array('iam_admin_services');
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/b16fae5b/app/libraries/Airavata/Service/Iam/Admin/Services/CPI/Error/Types.php
----------------------------------------------------------------------
diff --git a/app/libraries/Airavata/Service/Iam/Admin/Services/CPI/Error/Types.php b/app/libraries/Airavata/Service/Iam/Admin/Services/CPI/Error/Types.php
new file mode 100644
index 0000000..28fa514
--- /dev/null
+++ b/app/libraries/Airavata/Service/Iam/Admin/Services/CPI/Error/Types.php
@@ -0,0 +1,95 @@
+<?php
+namespace Airavata\Service\Iam\Admin\Services\CPI\Error;
+
+/**
+ * Autogenerated by Thrift Compiler (0.9.3)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ *  @generated
+ */
+use Thrift\Base\TBase;
+use Thrift\Type\TType;
+use Thrift\Type\TMessageType;
+use Thrift\Exception\TException;
+use Thrift\Exception\TProtocolException;
+use Thrift\Protocol\TProtocol;
+use Thrift\Protocol\TBinaryProtocolAccelerated;
+use Thrift\Exception\TApplicationException;
+
+
+class IamAdminServicesException extends TException {
+  static $_TSPEC;
+
+  /**
+   * @var string
+   */
+  public $message = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        1 => array(
+          'var' => 'message',
+          'type' => TType::STRING,
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['message'])) {
+        $this->message = $vals['message'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'IamAdminServicesException';
+  }
+
+  public function read($input)
+  {
+    $xfer = 0;
+    $fname = null;
+    $ftype = 0;
+    $fid = 0;
+    $xfer += $input->readStructBegin($fname);
+    while (true)
+    {
+      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
+      if ($ftype == TType::STOP) {
+        break;
+      }
+      switch ($fid)
+      {
+        case 1:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->message);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        default:
+          $xfer += $input->skip($ftype);
+          break;
+      }
+      $xfer += $input->readFieldEnd();
+    }
+    $xfer += $input->readStructEnd();
+    return $xfer;
+  }
+
+  public function write($output) {
+    $xfer = 0;
+    $xfer += $output->writeStructBegin('IamAdminServicesException');
+    if ($this->message !== null) {
+      $xfer += $output->writeFieldBegin('message', TType::STRING, 1);
+      $xfer += $output->writeString($this->message);
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
+

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/b16fae5b/app/libraries/Airavata/Service/Iam/Admin/Services/CPI/IamAdminServices.php
----------------------------------------------------------------------
diff --git a/app/libraries/Airavata/Service/Iam/Admin/Services/CPI/IamAdminServices.php b/app/libraries/Airavata/Service/Iam/Admin/Services/CPI/IamAdminServices.php
new file mode 100644
index 0000000..9bf9a83
--- /dev/null
+++ b/app/libraries/Airavata/Service/Iam/Admin/Services/CPI/IamAdminServices.php
@@ -0,0 +1,2079 @@
+<?php
+namespace Airavata\Service\Iam\Admin\Services\CPI;
+/**
+ * Autogenerated by Thrift Compiler (0.9.3)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ *  @generated
+ */
+use Thrift\Base\TBase;
+use Thrift\Type\TType;
+use Thrift\Type\TMessageType;
+use Thrift\Exception\TException;
+use Thrift\Exception\TProtocolException;
+use Thrift\Protocol\TProtocol;
+use Thrift\Protocol\TBinaryProtocolAccelerated;
+use Thrift\Exception\TApplicationException;
+
+
+interface IamAdminServicesIf {
+  /**
+   * @param \Airavata\Model\Security\AuthzToken $authzToken
+   * @return string
+   * @throws \Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException
+   * @throws \Airavata\API\Error\AuthorizationException
+   */
+  public function getAPIVersion(\Airavata\Model\Security\AuthzToken $authzToken);
+  /**
+   * @param \Airavata\Model\Security\AuthzToken $authzToken
+   * @param \Airavata\Model\Workspace\Gateway $gateway
+   * @param \Airavata\Model\Credential\Store\PasswordCredential $isSuperAdminCredentials
+   * @return \Airavata\Model\Workspace\Gateway
+   * @throws \Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException
+   * @throws \Airavata\API\Error\AuthorizationException
+   */
+  public function setUpGateway(\Airavata\Model\Security\AuthzToken $authzToken, \Airavata\Model\Workspace\Gateway $gateway, \Airavata\Model\Credential\Store\PasswordCredential $isSuperAdminCredentials);
+  /**
+   * @param \Airavata\Model\Security\AuthzToken $authzToken
+   * @param \Airavata\Model\User\UserProfile $userDetails
+   * @param \Airavata\Model\Credential\Store\PasswordCredential $isRealmAdminCredentials
+   * @param string $newPassword
+   * @return bool
+   * @throws \Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException
+   * @throws \Airavata\API\Error\AuthorizationException
+   */
+  public function registerUser(\Airavata\Model\Security\AuthzToken $authzToken, \Airavata\Model\User\UserProfile $userDetails, \Airavata\Model\Credential\Store\PasswordCredential $isRealmAdminCredentials, $newPassword);
+  /**
+   * @param \Airavata\Model\Security\AuthzToken $authzToken
+   * @param \Airavata\Model\User\UserProfile $userDetails
+   * @param \Airavata\Model\Credential\Store\PasswordCredential $isRealmAdminCredentials
+   * @return bool
+   * @throws \Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException
+   * @throws \Airavata\API\Error\AuthorizationException
+   */
+  public function enableUser(\Airavata\Model\Security\AuthzToken $authzToken, \Airavata\Model\User\UserProfile $userDetails, \Airavata\Model\Credential\Store\PasswordCredential $isRealmAdminCredentials);
+  /**
+   * @param \Airavata\Model\Security\AuthzToken $authzToken
+   * @param \Airavata\Model\User\UserProfile $userDetails
+   * @param \Airavata\Model\Credential\Store\PasswordCredential $isRealmAdminCredentials
+   * @param string $newPassword
+   * @return bool
+   * @throws \Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException
+   * @throws \Airavata\API\Error\AuthorizationException
+   */
+  public function resetUserPassword(\Airavata\Model\Security\AuthzToken $authzToken, \Airavata\Model\User\UserProfile $userDetails, \Airavata\Model\Credential\Store\PasswordCredential $isRealmAdminCredentials, $newPassword);
+  /**
+   * @param \Airavata\Model\Security\AuthzToken $authzToken
+   * @param string $gatewayID
+   * @param string $email
+   * @param string $userId
+   * @param \Airavata\Model\Credential\Store\PasswordCredential $isRealmAdminCredentials
+   * @return \Airavata\Model\User\UserProfile[]
+   * @throws \Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException
+   * @throws \Airavata\API\Error\AuthorizationException
+   */
+  public function findUsers(\Airavata\Model\Security\AuthzToken $authzToken, $gatewayID, $email, $userId, \Airavata\Model\Credential\Store\PasswordCredential $isRealmAdminCredentials);
+}
+
+class IamAdminServicesClient implements \Airavata\Service\Iam\Admin\Services\CPI\IamAdminServicesIf {
+  protected $input_ = null;
+  protected $output_ = null;
+
+  protected $seqid_ = 0;
+
+  public function __construct($input, $output=null) {
+    $this->input_ = $input;
+    $this->output_ = $output ? $output : $input;
+  }
+
+  public function getAPIVersion(\Airavata\Model\Security\AuthzToken $authzToken)
+  {
+    $this->send_getAPIVersion($authzToken);
+    return $this->recv_getAPIVersion();
+  }
+
+  public function send_getAPIVersion(\Airavata\Model\Security\AuthzToken $authzToken)
+  {
+    $args = new \Airavata\Service\Iam\Admin\Services\CPI\IamAdminServices_getAPIVersion_args();
+    $args->authzToken = $authzToken;
+    $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');
+    if ($bin_accel)
+    {
+      thrift_protocol_write_binary($this->output_, 'getAPIVersion', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());
+    }
+    else
+    {
+      $this->output_->writeMessageBegin('getAPIVersion', TMessageType::CALL, $this->seqid_);
+      $args->write($this->output_);
+      $this->output_->writeMessageEnd();
+      $this->output_->getTransport()->flush();
+    }
+  }
+
+  public function recv_getAPIVersion()
+  {
+    $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');
+    if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\Airavata\Service\Iam\Admin\Services\CPI\IamAdminServices_getAPIVersion_result', $this->input_->isStrictRead());
+    else
+    {
+      $rseqid = 0;
+      $fname = null;
+      $mtype = 0;
+
+      $this->input_->readMessageBegin($fname, $mtype, $rseqid);
+      if ($mtype == TMessageType::EXCEPTION) {
+        $x = new TApplicationException();
+        $x->read($this->input_);
+        $this->input_->readMessageEnd();
+        throw $x;
+      }
+      $result = new \Airavata\Service\Iam\Admin\Services\CPI\IamAdminServices_getAPIVersion_result();
+      $result->read($this->input_);
+      $this->input_->readMessageEnd();
+    }
+    if ($result->success !== null) {
+      return $result->success;
+    }
+    if ($result->Idse !== null) {
+      throw $result->Idse;
+    }
+    if ($result->ae !== null) {
+      throw $result->ae;
+    }
+    throw new \Exception("getAPIVersion failed: unknown result");
+  }
+
+  public function setUpGateway(\Airavata\Model\Security\AuthzToken $authzToken, \Airavata\Model\Workspace\Gateway $gateway, \Airavata\Model\Credential\Store\PasswordCredential $isSuperAdminCredentials)
+  {
+    $this->send_setUpGateway($authzToken, $gateway, $isSuperAdminCredentials);
+    return $this->recv_setUpGateway();
+  }
+
+  public function send_setUpGateway(\Airavata\Model\Security\AuthzToken $authzToken, \Airavata\Model\Workspace\Gateway $gateway, \Airavata\Model\Credential\Store\PasswordCredential $isSuperAdminCredentials)
+  {
+    $args = new \Airavata\Service\Iam\Admin\Services\CPI\IamAdminServices_setUpGateway_args();
+    $args->authzToken = $authzToken;
+    $args->gateway = $gateway;
+    $args->isSuperAdminCredentials = $isSuperAdminCredentials;
+    $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');
+    if ($bin_accel)
+    {
+      thrift_protocol_write_binary($this->output_, 'setUpGateway', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());
+    }
+    else
+    {
+      $this->output_->writeMessageBegin('setUpGateway', TMessageType::CALL, $this->seqid_);
+      $args->write($this->output_);
+      $this->output_->writeMessageEnd();
+      $this->output_->getTransport()->flush();
+    }
+  }
+
+  public function recv_setUpGateway()
+  {
+    $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');
+    if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\Airavata\Service\Iam\Admin\Services\CPI\IamAdminServices_setUpGateway_result', $this->input_->isStrictRead());
+    else
+    {
+      $rseqid = 0;
+      $fname = null;
+      $mtype = 0;
+
+      $this->input_->readMessageBegin($fname, $mtype, $rseqid);
+      if ($mtype == TMessageType::EXCEPTION) {
+        $x = new TApplicationException();
+        $x->read($this->input_);
+        $this->input_->readMessageEnd();
+        throw $x;
+      }
+      $result = new \Airavata\Service\Iam\Admin\Services\CPI\IamAdminServices_setUpGateway_result();
+      $result->read($this->input_);
+      $this->input_->readMessageEnd();
+    }
+    if ($result->success !== null) {
+      return $result->success;
+    }
+    if ($result->Idse !== null) {
+      throw $result->Idse;
+    }
+    if ($result->ae !== null) {
+      throw $result->ae;
+    }
+    throw new \Exception("setUpGateway failed: unknown result");
+  }
+
+  public function registerUser(\Airavata\Model\Security\AuthzToken $authzToken, \Airavata\Model\User\UserProfile $userDetails, \Airavata\Model\Credential\Store\PasswordCredential $isRealmAdminCredentials, $newPassword)
+  {
+    $this->send_registerUser($authzToken, $userDetails, $isRealmAdminCredentials, $newPassword);
+    return $this->recv_registerUser();
+  }
+
+  public function send_registerUser(\Airavata\Model\Security\AuthzToken $authzToken, \Airavata\Model\User\UserProfile $userDetails, \Airavata\Model\Credential\Store\PasswordCredential $isRealmAdminCredentials, $newPassword)
+  {
+    $args = new \Airavata\Service\Iam\Admin\Services\CPI\IamAdminServices_registerUser_args();
+    $args->authzToken = $authzToken;
+    $args->userDetails = $userDetails;
+    $args->isRealmAdminCredentials = $isRealmAdminCredentials;
+    $args->newPassword = $newPassword;
+    $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');
+    if ($bin_accel)
+    {
+      thrift_protocol_write_binary($this->output_, 'registerUser', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());
+    }
+    else
+    {
+      $this->output_->writeMessageBegin('registerUser', TMessageType::CALL, $this->seqid_);
+      $args->write($this->output_);
+      $this->output_->writeMessageEnd();
+      $this->output_->getTransport()->flush();
+    }
+  }
+
+  public function recv_registerUser()
+  {
+    $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');
+    if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\Airavata\Service\Iam\Admin\Services\CPI\IamAdminServices_registerUser_result', $this->input_->isStrictRead());
+    else
+    {
+      $rseqid = 0;
+      $fname = null;
+      $mtype = 0;
+
+      $this->input_->readMessageBegin($fname, $mtype, $rseqid);
+      if ($mtype == TMessageType::EXCEPTION) {
+        $x = new TApplicationException();
+        $x->read($this->input_);
+        $this->input_->readMessageEnd();
+        throw $x;
+      }
+      $result = new \Airavata\Service\Iam\Admin\Services\CPI\IamAdminServices_registerUser_result();
+      $result->read($this->input_);
+      $this->input_->readMessageEnd();
+    }
+    if ($result->success !== null) {
+      return $result->success;
+    }
+    if ($result->Idse !== null) {
+      throw $result->Idse;
+    }
+    if ($result->ae !== null) {
+      throw $result->ae;
+    }
+    throw new \Exception("registerUser failed: unknown result");
+  }
+
+  public function enableUser(\Airavata\Model\Security\AuthzToken $authzToken, \Airavata\Model\User\UserProfile $userDetails, \Airavata\Model\Credential\Store\PasswordCredential $isRealmAdminCredentials)
+  {
+    $this->send_enableUser($authzToken, $userDetails, $isRealmAdminCredentials);
+    return $this->recv_enableUser();
+  }
+
+  public function send_enableUser(\Airavata\Model\Security\AuthzToken $authzToken, \Airavata\Model\User\UserProfile $userDetails, \Airavata\Model\Credential\Store\PasswordCredential $isRealmAdminCredentials)
+  {
+    $args = new \Airavata\Service\Iam\Admin\Services\CPI\IamAdminServices_enableUser_args();
+    $args->authzToken = $authzToken;
+    $args->userDetails = $userDetails;
+    $args->isRealmAdminCredentials = $isRealmAdminCredentials;
+    $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');
+    if ($bin_accel)
+    {
+      thrift_protocol_write_binary($this->output_, 'enableUser', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());
+    }
+    else
+    {
+      $this->output_->writeMessageBegin('enableUser', TMessageType::CALL, $this->seqid_);
+      $args->write($this->output_);
+      $this->output_->writeMessageEnd();
+      $this->output_->getTransport()->flush();
+    }
+  }
+
+  public function recv_enableUser()
+  {
+    $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');
+    if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\Airavata\Service\Iam\Admin\Services\CPI\IamAdminServices_enableUser_result', $this->input_->isStrictRead());
+    else
+    {
+      $rseqid = 0;
+      $fname = null;
+      $mtype = 0;
+
+      $this->input_->readMessageBegin($fname, $mtype, $rseqid);
+      if ($mtype == TMessageType::EXCEPTION) {
+        $x = new TApplicationException();
+        $x->read($this->input_);
+        $this->input_->readMessageEnd();
+        throw $x;
+      }
+      $result = new \Airavata\Service\Iam\Admin\Services\CPI\IamAdminServices_enableUser_result();
+      $result->read($this->input_);
+      $this->input_->readMessageEnd();
+    }
+    if ($result->success !== null) {
+      return $result->success;
+    }
+    if ($result->Idse !== null) {
+      throw $result->Idse;
+    }
+    if ($result->ae !== null) {
+      throw $result->ae;
+    }
+    throw new \Exception("enableUser failed: unknown result");
+  }
+
+  public function resetUserPassword(\Airavata\Model\Security\AuthzToken $authzToken, \Airavata\Model\User\UserProfile $userDetails, \Airavata\Model\Credential\Store\PasswordCredential $isRealmAdminCredentials, $newPassword)
+  {
+    $this->send_resetUserPassword($authzToken, $userDetails, $isRealmAdminCredentials, $newPassword);
+    return $this->recv_resetUserPassword();
+  }
+
+  public function send_resetUserPassword(\Airavata\Model\Security\AuthzToken $authzToken, \Airavata\Model\User\UserProfile $userDetails, \Airavata\Model\Credential\Store\PasswordCredential $isRealmAdminCredentials, $newPassword)
+  {
+    $args = new \Airavata\Service\Iam\Admin\Services\CPI\IamAdminServices_resetUserPassword_args();
+    $args->authzToken = $authzToken;
+    $args->userDetails = $userDetails;
+    $args->isRealmAdminCredentials = $isRealmAdminCredentials;
+    $args->newPassword = $newPassword;
+    $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');
+    if ($bin_accel)
+    {
+      thrift_protocol_write_binary($this->output_, 'resetUserPassword', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());
+    }
+    else
+    {
+      $this->output_->writeMessageBegin('resetUserPassword', TMessageType::CALL, $this->seqid_);
+      $args->write($this->output_);
+      $this->output_->writeMessageEnd();
+      $this->output_->getTransport()->flush();
+    }
+  }
+
+  public function recv_resetUserPassword()
+  {
+    $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');
+    if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\Airavata\Service\Iam\Admin\Services\CPI\IamAdminServices_resetUserPassword_result', $this->input_->isStrictRead());
+    else
+    {
+      $rseqid = 0;
+      $fname = null;
+      $mtype = 0;
+
+      $this->input_->readMessageBegin($fname, $mtype, $rseqid);
+      if ($mtype == TMessageType::EXCEPTION) {
+        $x = new TApplicationException();
+        $x->read($this->input_);
+        $this->input_->readMessageEnd();
+        throw $x;
+      }
+      $result = new \Airavata\Service\Iam\Admin\Services\CPI\IamAdminServices_resetUserPassword_result();
+      $result->read($this->input_);
+      $this->input_->readMessageEnd();
+    }
+    if ($result->success !== null) {
+      return $result->success;
+    }
+    if ($result->Idse !== null) {
+      throw $result->Idse;
+    }
+    if ($result->ae !== null) {
+      throw $result->ae;
+    }
+    throw new \Exception("resetUserPassword failed: unknown result");
+  }
+
+  public function findUsers(\Airavata\Model\Security\AuthzToken $authzToken, $gatewayID, $email, $userId, \Airavata\Model\Credential\Store\PasswordCredential $isRealmAdminCredentials)
+  {
+    $this->send_findUsers($authzToken, $gatewayID, $email, $userId, $isRealmAdminCredentials);
+    return $this->recv_findUsers();
+  }
+
+  public function send_findUsers(\Airavata\Model\Security\AuthzToken $authzToken, $gatewayID, $email, $userId, \Airavata\Model\Credential\Store\PasswordCredential $isRealmAdminCredentials)
+  {
+    $args = new \Airavata\Service\Iam\Admin\Services\CPI\IamAdminServices_findUsers_args();
+    $args->authzToken = $authzToken;
+    $args->gatewayID = $gatewayID;
+    $args->email = $email;
+    $args->userId = $userId;
+    $args->isRealmAdminCredentials = $isRealmAdminCredentials;
+    $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');
+    if ($bin_accel)
+    {
+      thrift_protocol_write_binary($this->output_, 'findUsers', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());
+    }
+    else
+    {
+      $this->output_->writeMessageBegin('findUsers', TMessageType::CALL, $this->seqid_);
+      $args->write($this->output_);
+      $this->output_->writeMessageEnd();
+      $this->output_->getTransport()->flush();
+    }
+  }
+
+  public function recv_findUsers()
+  {
+    $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');
+    if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\Airavata\Service\Iam\Admin\Services\CPI\IamAdminServices_findUsers_result', $this->input_->isStrictRead());
+    else
+    {
+      $rseqid = 0;
+      $fname = null;
+      $mtype = 0;
+
+      $this->input_->readMessageBegin($fname, $mtype, $rseqid);
+      if ($mtype == TMessageType::EXCEPTION) {
+        $x = new TApplicationException();
+        $x->read($this->input_);
+        $this->input_->readMessageEnd();
+        throw $x;
+      }
+      $result = new \Airavata\Service\Iam\Admin\Services\CPI\IamAdminServices_findUsers_result();
+      $result->read($this->input_);
+      $this->input_->readMessageEnd();
+    }
+    if ($result->success !== null) {
+      return $result->success;
+    }
+    if ($result->Idse !== null) {
+      throw $result->Idse;
+    }
+    if ($result->ae !== null) {
+      throw $result->ae;
+    }
+    throw new \Exception("findUsers failed: unknown result");
+  }
+
+}
+
+// HELPER FUNCTIONS AND STRUCTURES
+
+class IamAdminServices_getAPIVersion_args {
+  static $_TSPEC;
+
+  /**
+   * @var \Airavata\Model\Security\AuthzToken
+   */
+  public $authzToken = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        1 => array(
+          'var' => 'authzToken',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\Model\Security\AuthzToken',
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['authzToken'])) {
+        $this->authzToken = $vals['authzToken'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'IamAdminServices_getAPIVersion_args';
+  }
+
+  public function read($input)
+  {
+    $xfer = 0;
+    $fname = null;
+    $ftype = 0;
+    $fid = 0;
+    $xfer += $input->readStructBegin($fname);
+    while (true)
+    {
+      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
+      if ($ftype == TType::STOP) {
+        break;
+      }
+      switch ($fid)
+      {
+        case 1:
+          if ($ftype == TType::STRUCT) {
+            $this->authzToken = new \Airavata\Model\Security\AuthzToken();
+            $xfer += $this->authzToken->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        default:
+          $xfer += $input->skip($ftype);
+          break;
+      }
+      $xfer += $input->readFieldEnd();
+    }
+    $xfer += $input->readStructEnd();
+    return $xfer;
+  }
+
+  public function write($output) {
+    $xfer = 0;
+    $xfer += $output->writeStructBegin('IamAdminServices_getAPIVersion_args');
+    if ($this->authzToken !== null) {
+      if (!is_object($this->authzToken)) {
+        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
+      }
+      $xfer += $output->writeFieldBegin('authzToken', TType::STRUCT, 1);
+      $xfer += $this->authzToken->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
+class IamAdminServices_getAPIVersion_result {
+  static $_TSPEC;
+
+  /**
+   * @var string
+   */
+  public $success = null;
+  /**
+   * @var \Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException
+   */
+  public $Idse = null;
+  /**
+   * @var \Airavata\API\Error\AuthorizationException
+   */
+  public $ae = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        0 => array(
+          'var' => 'success',
+          'type' => TType::STRING,
+          ),
+        1 => array(
+          'var' => 'Idse',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException',
+          ),
+        2 => array(
+          'var' => 'ae',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\API\Error\AuthorizationException',
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['success'])) {
+        $this->success = $vals['success'];
+      }
+      if (isset($vals['Idse'])) {
+        $this->Idse = $vals['Idse'];
+      }
+      if (isset($vals['ae'])) {
+        $this->ae = $vals['ae'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'IamAdminServices_getAPIVersion_result';
+  }
+
+  public function read($input)
+  {
+    $xfer = 0;
+    $fname = null;
+    $ftype = 0;
+    $fid = 0;
+    $xfer += $input->readStructBegin($fname);
+    while (true)
+    {
+      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
+      if ($ftype == TType::STOP) {
+        break;
+      }
+      switch ($fid)
+      {
+        case 0:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->success);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 1:
+          if ($ftype == TType::STRUCT) {
+            $this->Idse = new \Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException();
+            $xfer += $this->Idse->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 2:
+          if ($ftype == TType::STRUCT) {
+            $this->ae = new \Airavata\API\Error\AuthorizationException();
+            $xfer += $this->ae->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        default:
+          $xfer += $input->skip($ftype);
+          break;
+      }
+      $xfer += $input->readFieldEnd();
+    }
+    $xfer += $input->readStructEnd();
+    return $xfer;
+  }
+
+  public function write($output) {
+    $xfer = 0;
+    $xfer += $output->writeStructBegin('IamAdminServices_getAPIVersion_result');
+    if ($this->success !== null) {
+      $xfer += $output->writeFieldBegin('success', TType::STRING, 0);
+      $xfer += $output->writeString($this->success);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->Idse !== null) {
+      $xfer += $output->writeFieldBegin('Idse', TType::STRUCT, 1);
+      $xfer += $this->Idse->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->ae !== null) {
+      $xfer += $output->writeFieldBegin('ae', TType::STRUCT, 2);
+      $xfer += $this->ae->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
+class IamAdminServices_setUpGateway_args {
+  static $_TSPEC;
+
+  /**
+   * @var \Airavata\Model\Security\AuthzToken
+   */
+  public $authzToken = null;
+  /**
+   * @var \Airavata\Model\Workspace\Gateway
+   */
+  public $gateway = null;
+  /**
+   * @var \Airavata\Model\Credential\Store\PasswordCredential
+   */
+  public $isSuperAdminCredentials = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        1 => array(
+          'var' => 'authzToken',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\Model\Security\AuthzToken',
+          ),
+        2 => array(
+          'var' => 'gateway',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\Model\Workspace\Gateway',
+          ),
+        3 => array(
+          'var' => 'isSuperAdminCredentials',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\Model\Credential\Store\PasswordCredential',
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['authzToken'])) {
+        $this->authzToken = $vals['authzToken'];
+      }
+      if (isset($vals['gateway'])) {
+        $this->gateway = $vals['gateway'];
+      }
+      if (isset($vals['isSuperAdminCredentials'])) {
+        $this->isSuperAdminCredentials = $vals['isSuperAdminCredentials'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'IamAdminServices_setUpGateway_args';
+  }
+
+  public function read($input)
+  {
+    $xfer = 0;
+    $fname = null;
+    $ftype = 0;
+    $fid = 0;
+    $xfer += $input->readStructBegin($fname);
+    while (true)
+    {
+      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
+      if ($ftype == TType::STOP) {
+        break;
+      }
+      switch ($fid)
+      {
+        case 1:
+          if ($ftype == TType::STRUCT) {
+            $this->authzToken = new \Airavata\Model\Security\AuthzToken();
+            $xfer += $this->authzToken->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 2:
+          if ($ftype == TType::STRUCT) {
+            $this->gateway = new \Airavata\Model\Workspace\Gateway();
+            $xfer += $this->gateway->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 3:
+          if ($ftype == TType::STRUCT) {
+            $this->isSuperAdminCredentials = new \Airavata\Model\Credential\Store\PasswordCredential();
+            $xfer += $this->isSuperAdminCredentials->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        default:
+          $xfer += $input->skip($ftype);
+          break;
+      }
+      $xfer += $input->readFieldEnd();
+    }
+    $xfer += $input->readStructEnd();
+    return $xfer;
+  }
+
+  public function write($output) {
+    $xfer = 0;
+    $xfer += $output->writeStructBegin('IamAdminServices_setUpGateway_args');
+    if ($this->authzToken !== null) {
+      if (!is_object($this->authzToken)) {
+        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
+      }
+      $xfer += $output->writeFieldBegin('authzToken', TType::STRUCT, 1);
+      $xfer += $this->authzToken->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->gateway !== null) {
+      if (!is_object($this->gateway)) {
+        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
+      }
+      $xfer += $output->writeFieldBegin('gateway', TType::STRUCT, 2);
+      $xfer += $this->gateway->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->isSuperAdminCredentials !== null) {
+      if (!is_object($this->isSuperAdminCredentials)) {
+        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
+      }
+      $xfer += $output->writeFieldBegin('isSuperAdminCredentials', TType::STRUCT, 3);
+      $xfer += $this->isSuperAdminCredentials->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
+class IamAdminServices_setUpGateway_result {
+  static $_TSPEC;
+
+  /**
+   * @var \Airavata\Model\Workspace\Gateway
+   */
+  public $success = null;
+  /**
+   * @var \Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException
+   */
+  public $Idse = null;
+  /**
+   * @var \Airavata\API\Error\AuthorizationException
+   */
+  public $ae = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        0 => array(
+          'var' => 'success',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\Model\Workspace\Gateway',
+          ),
+        1 => array(
+          'var' => 'Idse',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException',
+          ),
+        2 => array(
+          'var' => 'ae',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\API\Error\AuthorizationException',
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['success'])) {
+        $this->success = $vals['success'];
+      }
+      if (isset($vals['Idse'])) {
+        $this->Idse = $vals['Idse'];
+      }
+      if (isset($vals['ae'])) {
+        $this->ae = $vals['ae'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'IamAdminServices_setUpGateway_result';
+  }
+
+  public function read($input)
+  {
+    $xfer = 0;
+    $fname = null;
+    $ftype = 0;
+    $fid = 0;
+    $xfer += $input->readStructBegin($fname);
+    while (true)
+    {
+      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
+      if ($ftype == TType::STOP) {
+        break;
+      }
+      switch ($fid)
+      {
+        case 0:
+          if ($ftype == TType::STRUCT) {
+            $this->success = new \Airavata\Model\Workspace\Gateway();
+            $xfer += $this->success->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 1:
+          if ($ftype == TType::STRUCT) {
+            $this->Idse = new \Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException();
+            $xfer += $this->Idse->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 2:
+          if ($ftype == TType::STRUCT) {
+            $this->ae = new \Airavata\API\Error\AuthorizationException();
+            $xfer += $this->ae->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        default:
+          $xfer += $input->skip($ftype);
+          break;
+      }
+      $xfer += $input->readFieldEnd();
+    }
+    $xfer += $input->readStructEnd();
+    return $xfer;
+  }
+
+  public function write($output) {
+    $xfer = 0;
+    $xfer += $output->writeStructBegin('IamAdminServices_setUpGateway_result');
+    if ($this->success !== null) {
+      if (!is_object($this->success)) {
+        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
+      }
+      $xfer += $output->writeFieldBegin('success', TType::STRUCT, 0);
+      $xfer += $this->success->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->Idse !== null) {
+      $xfer += $output->writeFieldBegin('Idse', TType::STRUCT, 1);
+      $xfer += $this->Idse->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->ae !== null) {
+      $xfer += $output->writeFieldBegin('ae', TType::STRUCT, 2);
+      $xfer += $this->ae->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
+class IamAdminServices_registerUser_args {
+  static $_TSPEC;
+
+  /**
+   * @var \Airavata\Model\Security\AuthzToken
+   */
+  public $authzToken = null;
+  /**
+   * @var \Airavata\Model\User\UserProfile
+   */
+  public $userDetails = null;
+  /**
+   * @var \Airavata\Model\Credential\Store\PasswordCredential
+   */
+  public $isRealmAdminCredentials = null;
+  /**
+   * @var string
+   */
+  public $newPassword = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        1 => array(
+          'var' => 'authzToken',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\Model\Security\AuthzToken',
+          ),
+        2 => array(
+          'var' => 'userDetails',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\Model\User\UserProfile',
+          ),
+        3 => array(
+          'var' => 'isRealmAdminCredentials',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\Model\Credential\Store\PasswordCredential',
+          ),
+        4 => array(
+          'var' => 'newPassword',
+          'type' => TType::STRING,
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['authzToken'])) {
+        $this->authzToken = $vals['authzToken'];
+      }
+      if (isset($vals['userDetails'])) {
+        $this->userDetails = $vals['userDetails'];
+      }
+      if (isset($vals['isRealmAdminCredentials'])) {
+        $this->isRealmAdminCredentials = $vals['isRealmAdminCredentials'];
+      }
+      if (isset($vals['newPassword'])) {
+        $this->newPassword = $vals['newPassword'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'IamAdminServices_registerUser_args';
+  }
+
+  public function read($input)
+  {
+    $xfer = 0;
+    $fname = null;
+    $ftype = 0;
+    $fid = 0;
+    $xfer += $input->readStructBegin($fname);
+    while (true)
+    {
+      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
+      if ($ftype == TType::STOP) {
+        break;
+      }
+      switch ($fid)
+      {
+        case 1:
+          if ($ftype == TType::STRUCT) {
+            $this->authzToken = new \Airavata\Model\Security\AuthzToken();
+            $xfer += $this->authzToken->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 2:
+          if ($ftype == TType::STRUCT) {
+            $this->userDetails = new \Airavata\Model\User\UserProfile();
+            $xfer += $this->userDetails->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 3:
+          if ($ftype == TType::STRUCT) {
+            $this->isRealmAdminCredentials = new \Airavata\Model\Credential\Store\PasswordCredential();
+            $xfer += $this->isRealmAdminCredentials->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 4:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->newPassword);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        default:
+          $xfer += $input->skip($ftype);
+          break;
+      }
+      $xfer += $input->readFieldEnd();
+    }
+    $xfer += $input->readStructEnd();
+    return $xfer;
+  }
+
+  public function write($output) {
+    $xfer = 0;
+    $xfer += $output->writeStructBegin('IamAdminServices_registerUser_args');
+    if ($this->authzToken !== null) {
+      if (!is_object($this->authzToken)) {
+        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
+      }
+      $xfer += $output->writeFieldBegin('authzToken', TType::STRUCT, 1);
+      $xfer += $this->authzToken->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->userDetails !== null) {
+      if (!is_object($this->userDetails)) {
+        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
+      }
+      $xfer += $output->writeFieldBegin('userDetails', TType::STRUCT, 2);
+      $xfer += $this->userDetails->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->isRealmAdminCredentials !== null) {
+      if (!is_object($this->isRealmAdminCredentials)) {
+        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
+      }
+      $xfer += $output->writeFieldBegin('isRealmAdminCredentials', TType::STRUCT, 3);
+      $xfer += $this->isRealmAdminCredentials->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->newPassword !== null) {
+      $xfer += $output->writeFieldBegin('newPassword', TType::STRING, 4);
+      $xfer += $output->writeString($this->newPassword);
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
+class IamAdminServices_registerUser_result {
+  static $_TSPEC;
+
+  /**
+   * @var bool
+   */
+  public $success = null;
+  /**
+   * @var \Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException
+   */
+  public $Idse = null;
+  /**
+   * @var \Airavata\API\Error\AuthorizationException
+   */
+  public $ae = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        0 => array(
+          'var' => 'success',
+          'type' => TType::BOOL,
+          ),
+        1 => array(
+          'var' => 'Idse',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException',
+          ),
+        2 => array(
+          'var' => 'ae',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\API\Error\AuthorizationException',
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['success'])) {
+        $this->success = $vals['success'];
+      }
+      if (isset($vals['Idse'])) {
+        $this->Idse = $vals['Idse'];
+      }
+      if (isset($vals['ae'])) {
+        $this->ae = $vals['ae'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'IamAdminServices_registerUser_result';
+  }
+
+  public function read($input)
+  {
+    $xfer = 0;
+    $fname = null;
+    $ftype = 0;
+    $fid = 0;
+    $xfer += $input->readStructBegin($fname);
+    while (true)
+    {
+      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
+      if ($ftype == TType::STOP) {
+        break;
+      }
+      switch ($fid)
+      {
+        case 0:
+          if ($ftype == TType::BOOL) {
+            $xfer += $input->readBool($this->success);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 1:
+          if ($ftype == TType::STRUCT) {
+            $this->Idse = new \Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException();
+            $xfer += $this->Idse->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 2:
+          if ($ftype == TType::STRUCT) {
+            $this->ae = new \Airavata\API\Error\AuthorizationException();
+            $xfer += $this->ae->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        default:
+          $xfer += $input->skip($ftype);
+          break;
+      }
+      $xfer += $input->readFieldEnd();
+    }
+    $xfer += $input->readStructEnd();
+    return $xfer;
+  }
+
+  public function write($output) {
+    $xfer = 0;
+    $xfer += $output->writeStructBegin('IamAdminServices_registerUser_result');
+    if ($this->success !== null) {
+      $xfer += $output->writeFieldBegin('success', TType::BOOL, 0);
+      $xfer += $output->writeBool($this->success);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->Idse !== null) {
+      $xfer += $output->writeFieldBegin('Idse', TType::STRUCT, 1);
+      $xfer += $this->Idse->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->ae !== null) {
+      $xfer += $output->writeFieldBegin('ae', TType::STRUCT, 2);
+      $xfer += $this->ae->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
+class IamAdminServices_enableUser_args {
+  static $_TSPEC;
+
+  /**
+   * @var \Airavata\Model\Security\AuthzToken
+   */
+  public $authzToken = null;
+  /**
+   * @var \Airavata\Model\User\UserProfile
+   */
+  public $userDetails = null;
+  /**
+   * @var \Airavata\Model\Credential\Store\PasswordCredential
+   */
+  public $isRealmAdminCredentials = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        1 => array(
+          'var' => 'authzToken',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\Model\Security\AuthzToken',
+          ),
+        2 => array(
+          'var' => 'userDetails',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\Model\User\UserProfile',
+          ),
+        3 => array(
+          'var' => 'isRealmAdminCredentials',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\Model\Credential\Store\PasswordCredential',
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['authzToken'])) {
+        $this->authzToken = $vals['authzToken'];
+      }
+      if (isset($vals['userDetails'])) {
+        $this->userDetails = $vals['userDetails'];
+      }
+      if (isset($vals['isRealmAdminCredentials'])) {
+        $this->isRealmAdminCredentials = $vals['isRealmAdminCredentials'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'IamAdminServices_enableUser_args';
+  }
+
+  public function read($input)
+  {
+    $xfer = 0;
+    $fname = null;
+    $ftype = 0;
+    $fid = 0;
+    $xfer += $input->readStructBegin($fname);
+    while (true)
+    {
+      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
+      if ($ftype == TType::STOP) {
+        break;
+      }
+      switch ($fid)
+      {
+        case 1:
+          if ($ftype == TType::STRUCT) {
+            $this->authzToken = new \Airavata\Model\Security\AuthzToken();
+            $xfer += $this->authzToken->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 2:
+          if ($ftype == TType::STRUCT) {
+            $this->userDetails = new \Airavata\Model\User\UserProfile();
+            $xfer += $this->userDetails->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 3:
+          if ($ftype == TType::STRUCT) {
+            $this->isRealmAdminCredentials = new \Airavata\Model\Credential\Store\PasswordCredential();
+            $xfer += $this->isRealmAdminCredentials->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        default:
+          $xfer += $input->skip($ftype);
+          break;
+      }
+      $xfer += $input->readFieldEnd();
+    }
+    $xfer += $input->readStructEnd();
+    return $xfer;
+  }
+
+  public function write($output) {
+    $xfer = 0;
+    $xfer += $output->writeStructBegin('IamAdminServices_enableUser_args');
+    if ($this->authzToken !== null) {
+      if (!is_object($this->authzToken)) {
+        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
+      }
+      $xfer += $output->writeFieldBegin('authzToken', TType::STRUCT, 1);
+      $xfer += $this->authzToken->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->userDetails !== null) {
+      if (!is_object($this->userDetails)) {
+        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
+      }
+      $xfer += $output->writeFieldBegin('userDetails', TType::STRUCT, 2);
+      $xfer += $this->userDetails->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->isRealmAdminCredentials !== null) {
+      if (!is_object($this->isRealmAdminCredentials)) {
+        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
+      }
+      $xfer += $output->writeFieldBegin('isRealmAdminCredentials', TType::STRUCT, 3);
+      $xfer += $this->isRealmAdminCredentials->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
+class IamAdminServices_enableUser_result {
+  static $_TSPEC;
+
+  /**
+   * @var bool
+   */
+  public $success = null;
+  /**
+   * @var \Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException
+   */
+  public $Idse = null;
+  /**
+   * @var \Airavata\API\Error\AuthorizationException
+   */
+  public $ae = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        0 => array(
+          'var' => 'success',
+          'type' => TType::BOOL,
+          ),
+        1 => array(
+          'var' => 'Idse',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException',
+          ),
+        2 => array(
+          'var' => 'ae',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\API\Error\AuthorizationException',
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['success'])) {
+        $this->success = $vals['success'];
+      }
+      if (isset($vals['Idse'])) {
+        $this->Idse = $vals['Idse'];
+      }
+      if (isset($vals['ae'])) {
+        $this->ae = $vals['ae'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'IamAdminServices_enableUser_result';
+  }
+
+  public function read($input)
+  {
+    $xfer = 0;
+    $fname = null;
+    $ftype = 0;
+    $fid = 0;
+    $xfer += $input->readStructBegin($fname);
+    while (true)
+    {
+      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
+      if ($ftype == TType::STOP) {
+        break;
+      }
+      switch ($fid)
+      {
+        case 0:
+          if ($ftype == TType::BOOL) {
+            $xfer += $input->readBool($this->success);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 1:
+          if ($ftype == TType::STRUCT) {
+            $this->Idse = new \Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException();
+            $xfer += $this->Idse->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 2:
+          if ($ftype == TType::STRUCT) {
+            $this->ae = new \Airavata\API\Error\AuthorizationException();
+            $xfer += $this->ae->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        default:
+          $xfer += $input->skip($ftype);
+          break;
+      }
+      $xfer += $input->readFieldEnd();
+    }
+    $xfer += $input->readStructEnd();
+    return $xfer;
+  }
+
+  public function write($output) {
+    $xfer = 0;
+    $xfer += $output->writeStructBegin('IamAdminServices_enableUser_result');
+    if ($this->success !== null) {
+      $xfer += $output->writeFieldBegin('success', TType::BOOL, 0);
+      $xfer += $output->writeBool($this->success);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->Idse !== null) {
+      $xfer += $output->writeFieldBegin('Idse', TType::STRUCT, 1);
+      $xfer += $this->Idse->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->ae !== null) {
+      $xfer += $output->writeFieldBegin('ae', TType::STRUCT, 2);
+      $xfer += $this->ae->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
+class IamAdminServices_resetUserPassword_args {
+  static $_TSPEC;
+
+  /**
+   * @var \Airavata\Model\Security\AuthzToken
+   */
+  public $authzToken = null;
+  /**
+   * @var \Airavata\Model\User\UserProfile
+   */
+  public $userDetails = null;
+  /**
+   * @var \Airavata\Model\Credential\Store\PasswordCredential
+   */
+  public $isRealmAdminCredentials = null;
+  /**
+   * @var string
+   */
+  public $newPassword = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        1 => array(
+          'var' => 'authzToken',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\Model\Security\AuthzToken',
+          ),
+        2 => array(
+          'var' => 'userDetails',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\Model\User\UserProfile',
+          ),
+        3 => array(
+          'var' => 'isRealmAdminCredentials',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\Model\Credential\Store\PasswordCredential',
+          ),
+        4 => array(
+          'var' => 'newPassword',
+          'type' => TType::STRING,
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['authzToken'])) {
+        $this->authzToken = $vals['authzToken'];
+      }
+      if (isset($vals['userDetails'])) {
+        $this->userDetails = $vals['userDetails'];
+      }
+      if (isset($vals['isRealmAdminCredentials'])) {
+        $this->isRealmAdminCredentials = $vals['isRealmAdminCredentials'];
+      }
+      if (isset($vals['newPassword'])) {
+        $this->newPassword = $vals['newPassword'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'IamAdminServices_resetUserPassword_args';
+  }
+
+  public function read($input)
+  {
+    $xfer = 0;
+    $fname = null;
+    $ftype = 0;
+    $fid = 0;
+    $xfer += $input->readStructBegin($fname);
+    while (true)
+    {
+      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
+      if ($ftype == TType::STOP) {
+        break;
+      }
+      switch ($fid)
+      {
+        case 1:
+          if ($ftype == TType::STRUCT) {
+            $this->authzToken = new \Airavata\Model\Security\AuthzToken();
+            $xfer += $this->authzToken->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 2:
+          if ($ftype == TType::STRUCT) {
+            $this->userDetails = new \Airavata\Model\User\UserProfile();
+            $xfer += $this->userDetails->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 3:
+          if ($ftype == TType::STRUCT) {
+            $this->isRealmAdminCredentials = new \Airavata\Model\Credential\Store\PasswordCredential();
+            $xfer += $this->isRealmAdminCredentials->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 4:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->newPassword);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        default:
+          $xfer += $input->skip($ftype);
+          break;
+      }
+      $xfer += $input->readFieldEnd();
+    }
+    $xfer += $input->readStructEnd();
+    return $xfer;
+  }
+
+  public function write($output) {
+    $xfer = 0;
+    $xfer += $output->writeStructBegin('IamAdminServices_resetUserPassword_args');
+    if ($this->authzToken !== null) {
+      if (!is_object($this->authzToken)) {
+        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
+      }
+      $xfer += $output->writeFieldBegin('authzToken', TType::STRUCT, 1);
+      $xfer += $this->authzToken->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->userDetails !== null) {
+      if (!is_object($this->userDetails)) {
+        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
+      }
+      $xfer += $output->writeFieldBegin('userDetails', TType::STRUCT, 2);
+      $xfer += $this->userDetails->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->isRealmAdminCredentials !== null) {
+      if (!is_object($this->isRealmAdminCredentials)) {
+        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
+      }
+      $xfer += $output->writeFieldBegin('isRealmAdminCredentials', TType::STRUCT, 3);
+      $xfer += $this->isRealmAdminCredentials->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->newPassword !== null) {
+      $xfer += $output->writeFieldBegin('newPassword', TType::STRING, 4);
+      $xfer += $output->writeString($this->newPassword);
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
+class IamAdminServices_resetUserPassword_result {
+  static $_TSPEC;
+
+  /**
+   * @var bool
+   */
+  public $success = null;
+  /**
+   * @var \Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException
+   */
+  public $Idse = null;
+  /**
+   * @var \Airavata\API\Error\AuthorizationException
+   */
+  public $ae = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        0 => array(
+          'var' => 'success',
+          'type' => TType::BOOL,
+          ),
+        1 => array(
+          'var' => 'Idse',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException',
+          ),
+        2 => array(
+          'var' => 'ae',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\API\Error\AuthorizationException',
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['success'])) {
+        $this->success = $vals['success'];
+      }
+      if (isset($vals['Idse'])) {
+        $this->Idse = $vals['Idse'];
+      }
+      if (isset($vals['ae'])) {
+        $this->ae = $vals['ae'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'IamAdminServices_resetUserPassword_result';
+  }
+
+  public function read($input)
+  {
+    $xfer = 0;
+    $fname = null;
+    $ftype = 0;
+    $fid = 0;
+    $xfer += $input->readStructBegin($fname);
+    while (true)
+    {
+      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
+      if ($ftype == TType::STOP) {
+        break;
+      }
+      switch ($fid)
+      {
+        case 0:
+          if ($ftype == TType::BOOL) {
+            $xfer += $input->readBool($this->success);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 1:
+          if ($ftype == TType::STRUCT) {
+            $this->Idse = new \Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException();
+            $xfer += $this->Idse->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 2:
+          if ($ftype == TType::STRUCT) {
+            $this->ae = new \Airavata\API\Error\AuthorizationException();
+            $xfer += $this->ae->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        default:
+          $xfer += $input->skip($ftype);
+          break;
+      }
+      $xfer += $input->readFieldEnd();
+    }
+    $xfer += $input->readStructEnd();
+    return $xfer;
+  }
+
+  public function write($output) {
+    $xfer = 0;
+    $xfer += $output->writeStructBegin('IamAdminServices_resetUserPassword_result');
+    if ($this->success !== null) {
+      $xfer += $output->writeFieldBegin('success', TType::BOOL, 0);
+      $xfer += $output->writeBool($this->success);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->Idse !== null) {
+      $xfer += $output->writeFieldBegin('Idse', TType::STRUCT, 1);
+      $xfer += $this->Idse->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->ae !== null) {
+      $xfer += $output->writeFieldBegin('ae', TType::STRUCT, 2);
+      $xfer += $this->ae->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
+class IamAdminServices_findUsers_args {
+  static $_TSPEC;
+
+  /**
+   * @var \Airavata\Model\Security\AuthzToken
+   */
+  public $authzToken = null;
+  /**
+   * @var string
+   */
+  public $gatewayID = null;
+  /**
+   * @var string
+   */
+  public $email = null;
+  /**
+   * @var string
+   */
+  public $userId = null;
+  /**
+   * @var \Airavata\Model\Credential\Store\PasswordCredential
+   */
+  public $isRealmAdminCredentials = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        1 => array(
+          'var' => 'authzToken',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\Model\Security\AuthzToken',
+          ),
+        2 => array(
+          'var' => 'gatewayID',
+          'type' => TType::STRING,
+          ),
+        3 => array(
+          'var' => 'email',
+          'type' => TType::STRING,
+          ),
+        4 => array(
+          'var' => 'userId',
+          'type' => TType::STRING,
+          ),
+        5 => array(
+          'var' => 'isRealmAdminCredentials',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\Model\Credential\Store\PasswordCredential',
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['authzToken'])) {
+        $this->authzToken = $vals['authzToken'];
+      }
+      if (isset($vals['gatewayID'])) {
+        $this->gatewayID = $vals['gatewayID'];
+      }
+      if (isset($vals['email'])) {
+        $this->email = $vals['email'];
+      }
+      if (isset($vals['userId'])) {
+        $this->userId = $vals['userId'];
+      }
+      if (isset($vals['isRealmAdminCredentials'])) {
+        $this->isRealmAdminCredentials = $vals['isRealmAdminCredentials'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'IamAdminServices_findUsers_args';
+  }
+
+  public function read($input)
+  {
+    $xfer = 0;
+    $fname = null;
+    $ftype = 0;
+    $fid = 0;
+    $xfer += $input->readStructBegin($fname);
+    while (true)
+    {
+      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
+      if ($ftype == TType::STOP) {
+        break;
+      }
+      switch ($fid)
+      {
+        case 1:
+          if ($ftype == TType::STRUCT) {
+            $this->authzToken = new \Airavata\Model\Security\AuthzToken();
+            $xfer += $this->authzToken->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 2:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->gatewayID);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 3:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->email);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 4:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->userId);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 5:
+          if ($ftype == TType::STRUCT) {
+            $this->isRealmAdminCredentials = new \Airavata\Model\Credential\Store\PasswordCredential();
+            $xfer += $this->isRealmAdminCredentials->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        default:
+          $xfer += $input->skip($ftype);
+          break;
+      }
+      $xfer += $input->readFieldEnd();
+    }
+    $xfer += $input->readStructEnd();
+    return $xfer;
+  }
+
+  public function write($output) {
+    $xfer = 0;
+    $xfer += $output->writeStructBegin('IamAdminServices_findUsers_args');
+    if ($this->authzToken !== null) {
+      if (!is_object($this->authzToken)) {
+        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
+      }
+      $xfer += $output->writeFieldBegin('authzToken', TType::STRUCT, 1);
+      $xfer += $this->authzToken->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->gatewayID !== null) {
+      $xfer += $output->writeFieldBegin('gatewayID', TType::STRING, 2);
+      $xfer += $output->writeString($this->gatewayID);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->email !== null) {
+      $xfer += $output->writeFieldBegin('email', TType::STRING, 3);
+      $xfer += $output->writeString($this->email);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->userId !== null) {
+      $xfer += $output->writeFieldBegin('userId', TType::STRING, 4);
+      $xfer += $output->writeString($this->userId);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->isRealmAdminCredentials !== null) {
+      if (!is_object($this->isRealmAdminCredentials)) {
+        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
+      }
+      $xfer += $output->writeFieldBegin('isRealmAdminCredentials', TType::STRUCT, 5);
+      $xfer += $this->isRealmAdminCredentials->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
+class IamAdminServices_findUsers_result {
+  static $_TSPEC;
+
+  /**
+   * @var \Airavata\Model\User\UserProfile[]
+   */
+  public $success = null;
+  /**
+   * @var \Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException
+   */
+  public $Idse = null;
+  /**
+   * @var \Airavata\API\Error\AuthorizationException
+   */
+  public $ae = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        0 => array(
+          'var' => 'success',
+          'type' => TType::LST,
+          'etype' => TType::STRUCT,
+          'elem' => array(
+            'type' => TType::STRUCT,
+            'class' => '\Airavata\Model\User\UserProfile',
+            ),
+          ),
+        1 => array(
+          'var' => 'Idse',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException',
+          ),
+        2 => array(
+          'var' => 'ae',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\API\Error\AuthorizationException',
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['success'])) {
+        $this->success = $vals['success'];
+      }
+      if (isset($vals['Idse'])) {
+        $this->Idse = $vals['Idse'];
+      }
+      if (isset($vals['ae'])) {
+        $this->ae = $vals['ae'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'IamAdminServices_findUsers_result';
+  }
+
+  public function read($input)
+  {
+    $xfer = 0;
+    $fname = null;
+    $ftype = 0;
+    $fid = 0;
+    $xfer += $input->readStructBegin($fname);
+    while (true)
+    {
+      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
+      if ($ftype == TType::STOP) {
+        break;
+      }
+      switch ($fid)
+      {
+        case 0:
+          if ($ftype == TType::LST) {
+            $this->success = array();
+            $_size0 = 0;
+            $_etype3 = 0;
+            $xfer += $input->readListBegin($_etype3, $_size0);
+            for ($_i4 = 0; $_i4 < $_size0; ++$_i4)
+            {
+              $elem5 = null;
+              $elem5 = new \Airavata\Model\User\UserProfile();
+              $xfer += $elem5->read($input);
+              $this->success []= $elem5;
+            }
+            $xfer += $input->readListEnd();
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 1:
+          if ($ftype == TType::STRUCT) {
+            $this->Idse = new \Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException();
+            $xfer += $this->Idse->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 2:
+          if ($ftype == TType::STRUCT) {
+            $this->ae = new \Airavata\API\Error\AuthorizationException();
+            $xfer += $this->ae->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        default:
+          $xfer += $input->skip($ftype);
+          break;
+      }
+      $xfer += $input->readFieldEnd();
+    }
+    $xfer += $input->readStructEnd();
+    return $xfer;
+  }
+
+  public function write($output) {
+    $xfer = 0;
+    $xfer += $output->writeStructBegin('IamAdminServices_findUsers_result');
+    if ($this->success !== null) {
+      if (!is_array($this->success)) {
+        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
+      }
+      $xfer += $output->writeFieldBegin('success', TType::LST, 0);
+      {
+        $output->writeListBegin(TType::STRUCT, count($this->success));
+        {
+          foreach ($this->success as $iter6)
+          {
+            $xfer += $iter6->write($output);
+          }
+        }
+        $output->writeListEnd();
+      }
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->Idse !== null) {
+      $xfer += $output->writeFieldBegin('Idse', TType::STRUCT, 1);
+      $xfer += $this->Idse->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->ae !== null) {
+      $xfer += $output->writeFieldBegin('ae', TType::STRUCT, 2);
+      $xfer += $this->ae->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
+

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/b16fae5b/app/libraries/Airavata/Service/Iam/Admin/Services/CPI/Types.php
----------------------------------------------------------------------
diff --git a/app/libraries/Airavata/Service/Iam/Admin/Services/CPI/Types.php b/app/libraries/Airavata/Service/Iam/Admin/Services/CPI/Types.php
new file mode 100644
index 0000000..fb21133
--- /dev/null
+++ b/app/libraries/Airavata/Service/Iam/Admin/Services/CPI/Types.php
@@ -0,0 +1,33 @@
+<?php
+namespace Airavata\Service\Iam\Admin\Services\CPI;
+
+/**
+ * Autogenerated by Thrift Compiler (0.9.3)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ *  @generated
+ */
+use Thrift\Base\TBase;
+use Thrift\Type\TType;
+use Thrift\Type\TMessageType;
+use Thrift\Exception\TException;
+use Thrift\Exception\TProtocolException;
+use Thrift\Protocol\TProtocol;
+use Thrift\Protocol\TBinaryProtocolAccelerated;
+use Thrift\Exception\TApplicationException;
+
+
+final class Constant extends \Thrift\Type\TConstant {
+  static protected $IAM_ADMIN_SERVICES_CPI_VERSION;
+  static protected $IAM_ADMIN_SERVICES_CPI_NAME;
+
+  static protected function init_IAM_ADMIN_SERVICES_CPI_VERSION() {
+    return "0.17";
+  }
+
+  static protected function init_IAM_ADMIN_SERVICES_CPI_NAME() {
+    return "IamAdminServices";
+  }
+}
+
+


[35/50] [abbrv] airavata-php-gateway git commit: AIRAVATA-2342 Detecting UPDATE_PASSWORD required action when login fails

Posted by ma...@apache.org.
AIRAVATA-2342 Detecting UPDATE_PASSWORD required action when login fails


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

Branch: refs/heads/develop
Commit: 1a3956711af99fd9ad8d8c9e9496e7c7b1ca3c91
Parents: 8154eac
Author: Marcus Christie <ma...@iu.edu>
Authored: Thu May 11 10:49:21 2017 -0400
Committer: Marcus Christie <ma...@iu.edu>
Committed: Thu May 11 10:49:21 2017 -0400

----------------------------------------------------------------------
 app/controllers/AccountController.php |  6 +++++-
 app/libraries/Keycloak/Keycloak.php   | 16 ++++++++++++++++
 app/views/account/login.blade.php     |  8 +++++---
 3 files changed, 26 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/1a395671/app/controllers/AccountController.php
----------------------------------------------------------------------
diff --git a/app/controllers/AccountController.php b/app/controllers/AccountController.php
index 4b7f7da..8e54d42 100644
--- a/app/controllers/AccountController.php
+++ b/app/controllers/AccountController.php
@@ -112,7 +112,11 @@ class AccountController extends BaseController
             $password = $_POST['password'];
             $response = Keycloak::authenticate($username, $password);
             if(!isset($response->access_token)){
-                return Redirect::to("login")->with("invalid-credentials", true);
+                if (Keycloak::isUpdatePasswordRequired($username)) {
+                    return Redirect::to("login")->with("update-password-required", true);
+                } else {
+                    return Redirect::to("login")->with("invalid-credentials", true);
+                }
             }
 
             $accessToken = $response->access_token;

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/1a395671/app/libraries/Keycloak/Keycloak.php
----------------------------------------------------------------------
diff --git a/app/libraries/Keycloak/Keycloak.php b/app/libraries/Keycloak/Keycloak.php
index d6846a7..dfa8f0c 100644
--- a/app/libraries/Keycloak/Keycloak.php
+++ b/app/libraries/Keycloak/Keycloak.php
@@ -381,6 +381,22 @@ class Keycloak {
         }
     }
 
+    // TODO: move this to IamAdminServices
+    public function isUpdatePasswordRequired($username) {
+
+        try{
+            $users = $this->users->getUsers($this->realm, $username);
+            if ($users != null && count($users) == 1) {
+                return in_array("UPDATE_PASSWORD", $users[0]->requiredActions);
+            } else {
+                return false;
+            }
+        }catch (Exception $ex){
+            // Username does not exists
+            return false;
+        }
+    }
+
     public function getAdminAuthzToken() {
 
         $access_token = KeycloakUtil::getAPIAccessToken($this->base_endpoint_url, $this->realm, $this->admin_username, $this->admin_password, $this->verify_peer);

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/1a395671/app/views/account/login.blade.php
----------------------------------------------------------------------
diff --git a/app/views/account/login.blade.php b/app/views/account/login.blade.php
index 7ef30cc..bfbb152 100755
--- a/app/views/account/login.blade.php
+++ b/app/views/account/login.blade.php
@@ -20,9 +20,11 @@
         @if( Session::has("invalid-credentials") )
         {{ CommonUtilities::print_error_message('Invalid username or password. Please try again.') }}
         @endif
-        <?php
-        Session::forget("invalid-credentials");
-        ?>
+        @if( Session::has("update-password-required") )
+        <div class="alert alert-danger">
+            Your password has expired. Please <a href="{{URL::to('/') }}/forgot-password">reset your password</a>.
+        </div>
+        @endif
 
         <div class="form-group">
             <label class="sr-only" for="username">Username</label>


[34/50] [abbrv] airavata-php-gateway git commit: Re-enabled create user and WIP integration with IamAdminServices

Posted by ma...@apache.org.
Re-enabled create user and WIP integration with IamAdminServices


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

Branch: refs/heads/develop
Commit: 8154eac10cd5eef813ae7c6e1ba354dc5e817c79
Parents: 45bf626
Author: Marcus Christie <ma...@iu.edu>
Authored: Thu May 4 16:57:24 2017 -0400
Committer: Marcus Christie <ma...@iu.edu>
Committed: Thu May 4 16:57:24 2017 -0400

----------------------------------------------------------------------
 app/controllers/AccountController.php           | 64 +++++++++++---------
 app/libraries/CommonUtilities.php               |  2 +-
 .../Keycloak/API/BaseKeycloakAPIEndpoint.php    | 28 +--------
 app/libraries/Keycloak/Keycloak.php             | 17 ++++++
 app/libraries/Keycloak/KeycloakUtil.php         | 37 +++++++++++
 app/views/account/create.blade.php              | 42 -------------
 app/views/account/login.blade.php               |  4 +-
 7 files changed, 96 insertions(+), 98 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/8154eac1/app/controllers/AccountController.php
----------------------------------------------------------------------
diff --git a/app/controllers/AccountController.php b/app/controllers/AccountController.php
index 303c3b4..4b7f7da 100644
--- a/app/controllers/AccountController.php
+++ b/app/controllers/AccountController.php
@@ -39,43 +39,51 @@ class AccountController extends BaseController
         $password = $_POST['password'];
         $email = $_POST['email'];
 
-        $organization = isset($_POST['organization']) ? $_POST['organization'] : null;
-        $address = isset($_POST['address']) ? $_POST['address'] : null;
-        $country = isset($_POST['country']) ? $_POST['country'] : null;
-        $telephone = isset($_POST['telephone']) ? $_POST['telephone'] : null;
-        $mobile = isset($_POST['mobile']) ? $_POST['mobile'] : null;
-        $im = isset($_POST['im']) ? $_POST['im'] : null;
-        $url = isset($_POST['url']) ? $_POST['url'] : null;
-
         if (Keycloak::usernameExists($username)) {
             return Redirect::to("create")
                 ->withInput(Input::except('password', 'password_confirm'))
                 ->with("username_exists", true);
         } else {
 
-            WSIS::registerUserAccount($username, $password, $email, $first_name, $last_name, $organization, $address, $country, $telephone, $mobile, $im, $url,
-                Config::get('pga_config.wsis')['tenant-domain']);
+            $admin_authz_token = Keycloak::getAdminAuthzToken();
+
+            $gatewayId = Config::get('pga_config.airavata')['gateway-id'];
+            $user_details = new Airavata\Model\User\UserProfile();
+            $user_details->userId = $username;
+            $user_details->emails = array($email);
+            $user_details->firstName = $first_name;
+            $user_details->lastName = $last_name;
+            $user_details->gatewayId = $gatewayId;
+            $user_details->creationTime = 0;
+            $user_details->lastAccessTime = 0;
+            $user_details->validUntil = 0;
+            $user_details->State = Airavata\Model\User\Status::PENDING;
+
+            // TODO: do we need to pass this if we are passing an access token?
+            // Couldn't the backend just use the access token?
+            $realm_admin_credentials = new Airavata\Model\Credential\Store\PasswordCredential();
+            $realm_admin_credentials->gatewayId = $gatewayId;
+            $realm_admin_credentials->portalUserName = Config::get('pga_config.wsis')['admin-username'];
+            $realm_admin_credentials->loginUserName = Config::get('pga_config.wsis')['admin-username'];
+            $realm_admin_credentials->password = Config::get('pga_config.wsis')['admin-password'];
+
+            IamAdminServices::registerUser($admin_authz_token, $user_details, $realm_admin_credentials, $password);
 
             /*add user to the initial role */
 
-            $initialRoleName = CommonUtilities::getInitialRoleName();
-            $allRoles = Keycloak::getAllRoles();
-            if(! in_array( $initialRoleName, $allRoles)){
-                WSIS::addRole( $initialRoleName);
-            }
-
-            $userRoles["new"] = $initialRoleName;
-
-            if(  Config::get('pga_config.portal')['super-admin-portal'] == true ){
-
-                if(! in_array( "gateway-provider", $allRoles)){
-                    WSIS::addRole( "gateway-provider");
-                }
-                $userRoles["new"] = array("gateway-provider", "admin");
-            }
-            $userRoles["deleted"] = array();
-            // FIXME: this requires the $user_id, not the $username
-            Keycloak::updateUserRoles( $username, $userRoles);
+            // TODO: add user to initial role, etc.
+            // $initialRoleName = CommonUtilities::getInitialRoleName();
+            // $allRoles = Keycloak::getAllRoles();
+            // 
+            // $userRoles["new"] = $initialRoleName;
+            // 
+            // if(  Config::get('pga_config.portal')['super-admin-portal'] == true ){
+            // 
+            //     $userRoles["new"] = array("gateway-provider", "admin");
+            // }
+            // $userRoles["deleted"] = array();
+            // // FIXME: this requires the $user_id, not the $username
+            // Keycloak::updateUserRoles( $username, $userRoles);
 
             CommonUtilities::print_success_message('Account confirmation request was sent to your email account');
             return View::make('home');

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/8154eac1/app/libraries/CommonUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/CommonUtilities.php b/app/libraries/CommonUtilities.php
index a3259a8..53f790e 100644
--- a/app/libraries/CommonUtilities.php
+++ b/app/libraries/CommonUtilities.php
@@ -249,7 +249,7 @@ class CommonUtilities
             $navbar .= '</ul></li>';
         } else {
 
-                    // $navbar .= '<li><a href="' . URL::to('/') . '/create"><span class="glyphicon glyphicon-user"></span> Create account</a></li>';
+                    $navbar .= '<li><a href="' . URL::to('/') . '/create"><span class="glyphicon glyphicon-user"></span> Create account</a></li>';
                     $navbar .= '<li><a href="' . URL::to('/') . '/login"><span class="glyphicon glyphicon-log-in"></span> Log in</a></li>';
         }
 

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/8154eac1/app/libraries/Keycloak/API/BaseKeycloakAPIEndpoint.php
----------------------------------------------------------------------
diff --git a/app/libraries/Keycloak/API/BaseKeycloakAPIEndpoint.php b/app/libraries/Keycloak/API/BaseKeycloakAPIEndpoint.php
index c440179..9f9740f 100644
--- a/app/libraries/Keycloak/API/BaseKeycloakAPIEndpoint.php
+++ b/app/libraries/Keycloak/API/BaseKeycloakAPIEndpoint.php
@@ -1,6 +1,8 @@
 <?php
 namespace Keycloak\API;
 
+use Keycloak\KeycloakUtil;
+
 use Exception;
 use Log;
 
@@ -20,30 +22,6 @@ class BaseKeycloakAPIEndpoint {
 
     protected function getAPIAccessToken($realm) {
 
-        // http://www.keycloak.org/docs/2.5/server_development/topics/admin-rest-api.html
-        // curl -d client_id=admin-cli -d username=username \
-        //   -d "password=password" -d grant_type=password https://149.165.156.62:8443/auth/realms/master/protocol/openid-connect/token
-
-        $r = curl_init($this->base_endpoint_url . '/realms/' . rawurlencode($realm) . '/protocol/openid-connect/token');
-        curl_setopt($r, CURLOPT_RETURNTRANSFER, 1);
-        curl_setopt($r, CURLOPT_ENCODING, 1);
-        curl_setopt($r, CURLOPT_SSL_VERIFYPEER, $this->verify_peer);
-
-        // Assemble POST parameters for the request.
-        $post_fields = "client_id=admin-cli&username=" . urlencode($this->admin_username) . "&password=" . urlencode($this->admin_password) . "&grant_type=password";
-
-        // Obtain and return the access token from the response.
-        curl_setopt($r, CURLOPT_POST, true);
-        curl_setopt($r, CURLOPT_POSTFIELDS, $post_fields);
-
-        $response = curl_exec($r);
-        if ($response == false) {
-            Log::error("Failed to retrieve API Access Token");
-            die("curl_exec() failed. Error: " . curl_error($r));
-        }
-
-        $result = json_decode($response);
-        // Log::debug("API Access Token result", array($result));
-        return $result->access_token;
+        return KeycloakUtil::getAPIAccessToken($this->base_endpoint_url, $realm, $this->admin_username, $this->admin_password, $this->verify_peer);
     }
 }

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/8154eac1/app/libraries/Keycloak/Keycloak.php
----------------------------------------------------------------------
diff --git a/app/libraries/Keycloak/Keycloak.php b/app/libraries/Keycloak/Keycloak.php
index a33b245..d6846a7 100644
--- a/app/libraries/Keycloak/Keycloak.php
+++ b/app/libraries/Keycloak/Keycloak.php
@@ -5,6 +5,7 @@ namespace Keycloak;
 use Keycloak\API\RoleMapper;
 use Keycloak\API\Roles;
 use Keycloak\API\Users;
+use Keycloak\KeycloakUtil;
 
 use Exception;
 use Log;
@@ -20,6 +21,9 @@ class Keycloak {
     private $callback_url;
     private $cafile_path;
     private $verify_peer;
+    private $base_endpoint_url;
+    private $admin_username;
+    private $admin_password;
 
     // API clients
     private $role_mapper;
@@ -39,6 +43,9 @@ class Keycloak {
         $this->callback_url = $callback_url;
         $this->cafile_path = $cafile_path;
         $this->verify_peer = $verify_peer;
+        $this->base_endpoint_url = $base_endpoint_url;
+        $this->admin_username = $admin_username;
+        $this->admin_password = $admin_password;
 
         $this->role_mapper = new RoleMapper($base_endpoint_url, $admin_username, $admin_password, $verify_peer);
         $this->roles = new Roles($base_endpoint_url, $admin_username, $admin_password, $verify_peer);
@@ -374,6 +381,16 @@ class Keycloak {
         }
     }
 
+    public function getAdminAuthzToken() {
+
+        $access_token = KeycloakUtil::getAPIAccessToken($this->base_endpoint_url, $this->realm, $this->admin_username, $this->admin_password, $this->verify_peer);
+        $authzToken = new \Airavata\Model\Security\AuthzToken();
+        $authzToken->accessToken = $access_token;
+        $authzToken->claimsMap['gatewayID'] = $this->realm;
+        $authzToken->claimsMap['userName'] = $this->admin_username;
+        return $authzToken;
+    }
+
     /**
      * Get the user's Keycloak user_id from their username
      */

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/8154eac1/app/libraries/Keycloak/KeycloakUtil.php
----------------------------------------------------------------------
diff --git a/app/libraries/Keycloak/KeycloakUtil.php b/app/libraries/Keycloak/KeycloakUtil.php
new file mode 100644
index 0000000..ce5e779
--- /dev/null
+++ b/app/libraries/Keycloak/KeycloakUtil.php
@@ -0,0 +1,37 @@
+<?php
+namespace Keycloak;
+
+use Exception;
+use Log;
+
+class KeycloakUtil {
+
+    public static function getAPIAccessToken($base_endpoint_url, $realm, $admin_username, $admin_password, $verify_peer) {
+
+        // http://www.keycloak.org/docs/2.5/server_development/topics/admin-rest-api.html
+        // curl -d client_id=admin-cli -d username=username \
+        //   -d "password=password" -d grant_type=password https://149.165.156.62:8443/auth/realms/master/protocol/openid-connect/token
+
+        $r = curl_init($base_endpoint_url . '/realms/' . rawurlencode($realm) . '/protocol/openid-connect/token');
+        curl_setopt($r, CURLOPT_RETURNTRANSFER, 1);
+        curl_setopt($r, CURLOPT_ENCODING, 1);
+        curl_setopt($r, CURLOPT_SSL_VERIFYPEER, $verify_peer);
+
+        // Assemble POST parameters for the request.
+        $post_fields = "client_id=admin-cli&username=" . urlencode($admin_username) . "&password=" . urlencode($admin_password) . "&grant_type=password";
+
+        // Obtain and return the access token from the response.
+        curl_setopt($r, CURLOPT_POST, true);
+        curl_setopt($r, CURLOPT_POSTFIELDS, $post_fields);
+
+        $response = curl_exec($r);
+        if ($response == false) {
+            Log::error("Failed to retrieve API Access Token");
+            die("curl_exec() failed. Error: " . curl_error($r));
+        }
+
+        $result = json_decode($response);
+        // Log::debug("API Access Token result", array($result));
+        return $result->access_token;
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/8154eac1/app/views/account/create.blade.php
----------------------------------------------------------------------
diff --git a/app/views/account/create.blade.php b/app/views/account/create.blade.php
index 1eafc70..d6d0748 100644
--- a/app/views/account/create.blade.php
+++ b/app/views/account/create.blade.php
@@ -66,48 +66,6 @@
                         placeholder="Last Name" required="required" title="" type="text"
                         value="{{Input::old('last_name') }}"/></div>
         </div>
-        <div class="form-group"><label class="control-label">Organization</label>
-
-            <div><input class="form-control" id="organization" name="organization"
-                        placeholder="Organization" title="" type="text" value="{{Input::old('organization') }}"/>
-            </div>
-        </div>
-        <div class="form-group"><label class="control-label">Address</label>
-
-            <div><input class="form-control" id="address" name="address"
-                        placeholder="Address" title="" type="text" value="{{Input::old('address') }}"/>
-            </div>
-        </div>
-        <div class="form-group"><label class="control-label">Country</label>
-
-            <div><input class="form-control" id="country" name="country"
-                        placeholder="Country" title="" type="text" value="{{Input::old('country') }}"/>
-            </div>
-        </div>
-        <div class="form-group"><label class="control-label">Telephone</label>
-
-            <div><input class="form-control" id="telephone" name="telephone"
-                        placeholder="Telephone" title="" type="tel" value="{{Input::old('telephone') }}"/>
-            </div>
-        </div>
-        <div class="form-group"><label class="control-label">Mobile</label>
-
-            <div><input class="form-control" id="mobile" name="mobile"
-                        placeholder="Mobile" title="" type="tel" value="{{Input::old('mobile') }}"/>
-            </div>
-        </div>
-        <div class="form-group"><label class="control-label">IM</label>
-
-            <div><input class="form-control" id="im" name="im"
-                        placeholder="IM" title="" type="text" value="{{Input::old('im') }}"/>
-            </div>
-        </div>
-        <div class="form-group"><label class="control-label">URL</label>
-
-            <div><input class="form-control" id="url" name="url"
-                        placeholder="URL" title="" type="text" value="{{Input::old('url') }}"/>
-            </div>
-        </div>
         <br/>
         <input name="Submit" type="submit" class="btn btn-primary btn-block" value="Create">
     </form>

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/8154eac1/app/views/account/login.blade.php
----------------------------------------------------------------------
diff --git a/app/views/account/login.blade.php b/app/views/account/login.blade.php
index 9d36753..7ef30cc 100755
--- a/app/views/account/login.blade.php
+++ b/app/views/account/login.blade.php
@@ -10,9 +10,9 @@
 
     <h3>
         Login
-        {{-- <small>
+        <small>
             <small> (Not registered? <a href="create">Create account</a>)</small>
-        </small> --}}
+        </small>
     </h3>
 
 


[08/50] [abbrv] airavata-php-gateway git commit: AIRAVATA-2342 Add retrieval of Keycloak user profile

Posted by ma...@apache.org.
AIRAVATA-2342 Add retrieval of Keycloak user profile


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

Branch: refs/heads/develop
Commit: dd00dd4a7496b1eb776a7addb25b32b7a3180f69
Parents: 68cfa16
Author: Marcus Christie <ma...@iu.edu>
Authored: Thu Mar 23 15:57:20 2017 -0400
Committer: Marcus Christie <ma...@iu.edu>
Committed: Thu Mar 23 15:57:20 2017 -0400

----------------------------------------------------------------------
 app/controllers/AccountController.php |  9 +++++----
 app/controllers/AdminController.php   |  7 ++++---
 app/libraries/Keycloak/API/Users.php  | 30 +++++++++++++++++++++++++++++-
 app/libraries/Keycloak/Keycloak.php   | 13 +++++++++++++
 app/libraries/SharingUtilities.php    |  2 +-
 5 files changed, 52 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/dd00dd4a/app/controllers/AccountController.php
----------------------------------------------------------------------
diff --git a/app/controllers/AccountController.php b/app/controllers/AccountController.php
index 1f69fcf..86f3259 100644
--- a/app/controllers/AccountController.php
+++ b/app/controllers/AccountController.php
@@ -59,7 +59,7 @@ class AccountController extends BaseController
             /*add user to the initial role */
 
             $initialRoleName = CommonUtilities::getInitialRoleName();
-            $allRoles = WSIS::getAllRoles();
+            $allRoles = Keycloak::getAllRoles();
             if(! in_array( $initialRoleName, $allRoles)){
                 WSIS::addRole( $initialRoleName);
             }
@@ -74,7 +74,8 @@ class AccountController extends BaseController
                 $userRoles["new"] = array("gateway-provider", "admin");
             }
             $userRoles["deleted"] = array();
-            WSIS::updateUserRoles( $username, $userRoles);
+            // FIXME: this requires the $user_id, not the $username
+            Keycloak::updateUserRoles( $username, $userRoles);
 
             CommonUtilities::print_success_message('Account confirmation request was sent to your email account');
             return View::make('home');
@@ -113,7 +114,7 @@ class AccountController extends BaseController
             $refreshToken = $response->refresh_token;
             $expirationTime = time() + $response->expires_in - 5; //5 seconds safe margin
 
-            $userProfile = WSIS::getUserProfileFromOAuthToken($accessToken);
+            $userProfile = Keycloak::getUserProfileFromOAuthToken($accessToken);
             $username = $userProfile['username'];
             $userRoles = $userProfile['roles'];
 
@@ -412,7 +413,7 @@ class AccountController extends BaseController
         $mail->isHTML(true);
 
         $mail->Subject = "New User Account Was Created Successfully";
-        $userProfile = WSIS::getUserProfile($username);
+        $userProfile = Keycloak::getUserProfile($username);
         $wsisConfig = Config::get('pga_config.wsis');
         if( $wsisConfig['tenant-domain'] == "")
             $username = $username;

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/dd00dd4a/app/controllers/AdminController.php
----------------------------------------------------------------------
diff --git a/app/controllers/AdminController.php b/app/controllers/AdminController.php
index b2f95d7..e1a4ea5 100644
--- a/app/controllers/AdminController.php
+++ b/app/controllers/AdminController.php
@@ -152,7 +152,8 @@ class AdminController extends BaseController {
 		//check if username exists
 		if(WSIS::usernameExists( Input::get("username")) )
 		{
-            WSIS::updateUserRoles(Input::get("username"), array( "new"=>array( Config::get('wsis::admin-role-name')), "deleted"=>array() ) );
+			// FIXME: this requires the user id not the username
+            Keycloak::updateUserRoles(Input::get("username"), array( "new"=>array( Config::get('wsis::admin-role-name')), "deleted"=>array() ) );
 			return Redirect::to("admin/dashboard/users?role=" . Config::get('wsis::admin-role-name'))->with("Gateway Admin has been added.");
 		}
 		else
@@ -234,7 +235,7 @@ class AdminController extends BaseController {
                 || in_array(Config::get("pga_config.wsis")["user-role-name"], $newCurrentRoles)){
             $userProfile = Keycloak::getUserProfile($userId);
             $recipients = array($userProfile["email"]);
-            $this->sendAccessGrantedEmailToTheUser(Input::get("username"), $recipients);
+            $this->sendAccessGrantedEmailToTheUser(Input::get("username"), $userId, $recipients);
 
             // remove the initial role when the initial role isn't a privileged
             // role and the admin has now assigned the user to a privileged
@@ -326,7 +327,7 @@ class AdminController extends BaseController {
 		$mail->isHTML(true);
 
 		$mail->Subject = "Your user account (".$username.") privileges changed!";
-		$userProfile = WSIS::getUserProfile($userId);
+		$userProfile = Keycloak::getUserProfile($userId);
 		$wsisConfig = Config::get('pga_config.wsis');
 		if( $wsisConfig['tenant-domain'] == "")
 			$username = $username;

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/dd00dd4a/app/libraries/Keycloak/API/Users.php
----------------------------------------------------------------------
diff --git a/app/libraries/Keycloak/API/Users.php b/app/libraries/Keycloak/API/Users.php
index ac99995..c1c8aca 100644
--- a/app/libraries/Keycloak/API/Users.php
+++ b/app/libraries/Keycloak/API/Users.php
@@ -37,7 +37,35 @@ class Users {
             $url = $url . '?username=' . rawurlencode($username);
         }
         // Log::debug("getUsers url", array($url));
-        $r = curl_init($this->base_endpoint_url . '/admin/realms/' . rawurlencode($realm) . '/users');
+        $r = curl_init($url);
+        curl_setopt($r, CURLOPT_RETURNTRANSFER, 1);
+        curl_setopt($r, CURLOPT_ENCODING, 1);
+        curl_setopt($r, CURLOPT_SSL_VERIFYPEER, $this->verify_peer);
+        curl_setopt($r, CURLOPT_HTTPHEADER, array(
+            "Authorization: Bearer " . $access_token
+        ));
+
+        $response = curl_exec($r);
+        if ($response == false) {
+            die("curl_exec() failed. Error: " . curl_error($r));
+        }
+        $result = json_decode($response);
+        // Log::debug("getUsers result", array($result));
+        return $result;
+    }
+
+    /**
+     * Get representation of a user
+     * GET /admin/realms/{realm}/users/{id}
+     * Returns a UserRepresentation
+     */
+    public function getUser($realm, $user_id) {
+
+        // get access token for admin API
+        $access_token = $this->getAPIAccessToken();
+        $url = $this->base_endpoint_url . '/admin/realms/' . rawurlencode($realm) . '/users/' . rawurlencode($user_id);
+        // Log::debug("getUser url", array($url));
+        $r = curl_init($url);
         curl_setopt($r, CURLOPT_RETURNTRANSFER, 1);
         curl_setopt($r, CURLOPT_ENCODING, 1);
         curl_setopt($r, CURLOPT_SSL_VERIFYPEER, $this->verify_peer);

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/dd00dd4a/app/libraries/Keycloak/Keycloak.php
----------------------------------------------------------------------
diff --git a/app/libraries/Keycloak/Keycloak.php b/app/libraries/Keycloak/Keycloak.php
index a6d618b..56e2680 100644
--- a/app/libraries/Keycloak/Keycloak.php
+++ b/app/libraries/Keycloak/Keycloak.php
@@ -219,6 +219,19 @@ class Keycloak {
         }
     }
 
+    /**
+     * Function to get the user profile of a user
+     * @param $user_id
+     */
+    public function getUserProfile($user_id){
+        $user = $this->users->getUser($this->realm, $user_id);
+        $result = [];
+        $result["email"] = $user->email;
+        $result["firstname"] = $user->firstName;
+        $result["lastname"] = $user->lastName;
+        return $result;
+    }
+
     private function getOpenIDConnectDiscoveryConfiguration() {
 
         // TODO: cache the result of the request

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/dd00dd4a/app/libraries/SharingUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/SharingUtilities.php b/app/libraries/SharingUtilities.php
index b689b24..aea9675 100755
--- a/app/libraries/SharingUtilities.php
+++ b/app/libraries/SharingUtilities.php
@@ -92,7 +92,7 @@ class SharingUtilities {
         });
         $profiles = array();
         foreach ($uids as $uid) {
-            $profiles[$uid] = WSIS::getUserProfile($uid);
+            $profiles[$uid] = Keycloak::getUserProfile($uid);
         }
         return $profiles;
     }


[41/50] [abbrv] airavata-php-gateway git commit: Merge branch 'AIRAVATA-2316-user-profile-service' into keycloak-integration

Posted by ma...@apache.org.
Merge branch 'AIRAVATA-2316-user-profile-service' into keycloak-integration


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

Branch: refs/heads/develop
Commit: 31b1ca844402ffbeaee3bd6c4e1a77c7684d9c2f
Parents: d021668 05250ee
Author: Marcus Christie <ma...@iu.edu>
Authored: Fri Jun 9 17:00:40 2017 -0400
Committer: Marcus Christie <ma...@iu.edu>
Committed: Fri Jun 9 17:00:40 2017 -0400

----------------------------------------------------------------------
 app/controllers/AccountController.php           |  27 +-
 app/controllers/AdminController.php             |  12 +-
 app/controllers/UserSettingsController.php      |  39 ++
 app/libraries/AdminUtilities.php                |   3 +-
 app/libraries/Airavata/API/Airavata.php         | 466 ++++++++++++++++++-
 app/libraries/UserProfileUtilities.php          |  48 ++
 app/routes.php                                  |   3 +
 app/views/account/settings.blade.php            |  16 +
 app/views/account/user-profile.blade.php        |  94 ++++
 app/views/layout/basic.blade.php                |   4 +-
 app/views/layout/fixed-scripts.blade.php        |   8 +-
 .../user-profile-phone-template.blade.php       |   9 +
 public/css/bootstrap.min.css                    |   2 +-
 13 files changed, 686 insertions(+), 45 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/31b1ca84/app/controllers/AccountController.php
----------------------------------------------------------------------
diff --cc app/controllers/AccountController.php
index d8d4a4e,3e70133..99709df
--- a/app/controllers/AccountController.php
+++ b/app/controllers/AccountController.php
@@@ -123,12 -110,20 +123,13 @@@ class AccountController extends BaseCon
  
              $accessToken = $response->access_token;
              $refreshToken = $response->refresh_token;
 -            $expirationTime = time() + $response->expires_in - 5; //5 seconds safe margin
 +            $expirationTime = time() + $response->expires_in - 300; // 5 minutes safe margin
  
 -            $userProfile = WSIS::getUserProfileFromOAuthToken($accessToken);
 +            $userProfile = Keycloak::getUserProfileFromOAuthToken($accessToken);
              $username = $userProfile['username'];
              $userRoles = $userProfile['roles'];
+             $userEmail = $userProfile["email"];
  
 -            //FIXME There is a bug in WSO2 IS which doest not return the admin role for the default admin user.
 -            //FIXME Hence as a workaround we manually add it here.
 -            if ($username == Config::get('pga_config.wsis')['admin-username']
 -                || $username == Config::get('pga_config.wsis')['admin-username'] . '@' . Config::get('pga_config.wsis')['tenant-domain']){
 -                $userRoles[] = Config::get('pga_config.wsis')['admin-role-name'];
 -            }
 -
              $authzToken = new Airavata\Model\Security\AuthzToken();
              $authzToken->accessToken = $accessToken;
              $authzToken->claimsMap['gatewayID'] = Config::get('pga_config.airavata')['gateway-id'];
@@@ -189,13 -183,12 +189,13 @@@
  
          $accessToken = $response->access_token;
          $refreshToken = $response->refresh_token;
 -        $expirationTime = time() + $response->expires_in - 5; //5 seconds safe margin
 +        $expirationTime = time() + $response->expires_in - 300; //5 minutes safe margin
  
 -        $userProfile = WSIS::getUserProfileFromOAuthToken($accessToken);
 +        $userProfile = Keycloak::getUserProfileFromOAuthToken($accessToken);
 +        Log::debug("userProfile", array($userProfile));
          $username = $userProfile['username'];
- 
          $userRoles = $userProfile['roles'];
+         $userEmail = $userProfile['email'];
  
          //FIXME There is a bug in WSO2 IS which doest not return the admin role for the default admin user.
          //FIXME Hence as a workaround we manually add it here.

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/31b1ca84/app/controllers/AdminController.php
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/31b1ca84/app/views/layout/basic.blade.php
----------------------------------------------------------------------


[37/50] [abbrv] airavata-php-gateway git commit: AIRAVATA-2342 implement reset password

Posted by ma...@apache.org.
AIRAVATA-2342 implement reset password


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

Branch: refs/heads/develop
Commit: c62cb173c00e6c5cec1a4fad75f3fc13478e1f03
Parents: 5e50b51
Author: Marcus Christie <ma...@iu.edu>
Authored: Mon May 22 16:31:49 2017 -0400
Committer: Marcus Christie <ma...@iu.edu>
Committed: Mon May 22 16:31:49 2017 -0400

----------------------------------------------------------------------
 app/controllers/AccountController.php           | 86 +++++++++-----------
 app/libraries/EmailUtilities.php                | 12 ++-
 app/libraries/Keycloak/Keycloak.php             |  6 +-
 .../Keycloak/KeycloakServiceProvider.php        |  4 +-
 app/views/account/reset-password.blade.php      |  2 +-
 5 files changed, 53 insertions(+), 57 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/c62cb173/app/controllers/AccountController.php
----------------------------------------------------------------------
diff --git a/app/controllers/AccountController.php b/app/controllers/AccountController.php
index 8e54d42..7698ad3 100644
--- a/app/controllers/AccountController.php
+++ b/app/controllers/AccountController.php
@@ -2,6 +2,8 @@
 
 class AccountController extends BaseController
 {
+    const PASSWORD_VALIDATION = "required|min:6|max:48|regex:/^.*(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[@!$#*]).*$/";
+    const PASSWORD_VALIDATION_MESSAGE = "Password needs to contain at least (a) One lower case letter (b) One Upper case letter and (c) One number (d) One of the following special characters - !@#$&*";
 
     public function __construct()
     {
@@ -17,13 +19,13 @@ class AccountController extends BaseController
     {
         $rules = array(
             "username" => "required|min:6",
-            "password" => "required|min:6|max:48|regex:/^.*(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[@!$#*]).*$/",
+            "password" => self::PASSWORD_VALIDATION,
             "confirm_password" => "required|same:password",
             "email" => "required|email",
         );
 
         $messages = array(
-            'password.regex' => 'Password needs to contain at least (a) One lower case letter (b) One Upper case letter and (c) One number (d) One of the following special characters - !@#$&*',
+            'password.regex' => self::PASSWORD_VALIDATION_MESSAGE,
         );
 
         $validator = Validator::make(Input::all(), $rules, $messages);
@@ -273,27 +275,13 @@ class AccountController extends BaseController
             CommonUtilities::print_error_message("Please provide a valid username");
             return View::make("account/forgot-password");
         }else{
-            $wsisConfig = Config::get('pga_config.wsis');
-            if( $wsisConfig['tenant-domain'] == "")
-                $username = $username;
-            else
-                $username = $username . "@" . $wsisConfig['tenant-domain'];
             try{
-                $key = WSIS::validateUser(Input::get("userAnswer"),Input::get("imagePath"),Input::get("secretKey"), $username);
-                if(!empty($key)){
-                    $result = WSIS::sendPasswordResetNotification($username, $key);
-                    if($result===true){
-                        CommonUtilities::print_success_message("Password reset notification was sent to your email account");
-                        return View::make("home");
-                    }else{
-                        CommonUtilities::print_error_message("Failed to send password reset notification email");
-                        return View::make("home");
-                    }
-                }else{
-                    CommonUtilities::print_error_message("Failed to validate the given username");
-                    return View::make("account/forgot-password");
-                }
+                $user_profile = Keycloak::getUserProfile($username);
+                EmailUtilities::sendPasswordResetEmail($username, $user_profile["firstname"], $user_profile["lastname"], $user_profile["email"]);
+                CommonUtilities::print_success_message("Password reset notification was sent to your email account");
+                return View::make("home");
             }catch (Exception $ex){
+                Log::error($ex);
                 CommonUtilities::print_error_message("Password reset operation failed");
                 return View::make("home");
             }
@@ -328,28 +316,13 @@ class AccountController extends BaseController
 
     public function resetPassword()
     {
-        $confirmation = Input::get("confirmation");
-        $username = Input::get("username");
-        if(empty($username) || empty($confirmation)){
+        $code = Input::get("code", Input::old("code"));
+        $username = Input::get("username", Input::old("username"));
+        if(empty($username) || empty($code)){
             return View::make("home");
         }else{
-            $wsisConfig = Config::get('pga_config.wsis');
-            if( $wsisConfig['tenant-domain'] == "")
-                $username = $username;
-            else
-                $username = $username . "@" . $wsisConfig['tenant-domain'];
-            try{
-                $key = WSIS::validateConfirmationCode($username, $confirmation);
-                if(!empty($key)){
-                    return View::make("account/reset-password", array("key" => $key, "username"=>$username));
-                }else{
-                    return View::make("home");
-                }
-            }catch (Exception $e){
-                return View::make("home");
-            }
+            return View::make("account/reset-password", array("code" => $code, "username"=>$username));
         }
-
     }
 
     public function confirmAccountCreation()
@@ -393,7 +366,9 @@ class AccountController extends BaseController
         $mail = new PHPMailer;
 
         $mail->isSMTP();
-        $mail->SMTPDebug = 3;
+        // Note: setting SMTPDebug will cause output to be dumped into the
+        // response, so only enable for testing purposes
+        // $mail->SMTPDebug = 3;
         $mail->Host = Config::get('pga_config.portal')['portal-smtp-server-host'];
 
         $mail->SMTPAuth = true;
@@ -434,33 +409,46 @@ class AccountController extends BaseController
     public function resetPasswordSubmit()
     {
         $rules = array(
-            "new_password" => "required|min:6",
+            "new_password" => self::PASSWORD_VALIDATION,
             "confirm_new_password" => "required|same:new_password",
         );
+        $messages = array(
+            'password.regex' => self::PASSWORD_VALIDATION_MESSAGE,
+        );
 
-        $validator = Validator::make(Input::all(), $rules);
+        $validator = Validator::make(Input::all(), $rules, $messages);
         if ($validator->fails()) {
+            Log::debug("validation failed", array($validator->messages()));
             return Redirect::to("reset-password")
-                ->withInput(Input::except('new_password', 'confirm)new_password'))
+                ->withInput(Input::except('new_password', 'confirm_new_password'))
                 ->withErrors($validator);
         }
 
-        $key =  $_POST['key'];
+        $code =  $_POST['code'];
         $username =  $_POST['username'];
         $new_password =  $_POST['new_password'];
 
         try{
-            $result = WSIS::resetPassword($username, $new_password, $key);
+            $verified = EmailUtilities::verifyPasswordResetCode($username, $code);
+            if (!$verified){
+                CommonUtilities::print_error_message("Resetting user password operation failed. Please request to reset user password again.");
+                return View::make("home");
+            }
+
+            $admin_authz_token = Keycloak::getAdminAuthzToken();
+            $tenant_id = Config::get('pga_config.wsis')['tenant-domain'];
+
+            $result = IamAdminServices::resetUserPassword($admin_authz_token, $tenant_id, $username, $new_password);
             if($result){
                 CommonUtilities::print_success_message("User password was reset successfully");
-                return View::make("account/login");
+                return View::make("login");
             }else{
                 CommonUtilities::print_error_message("Resetting user password operation failed");
-                return View::make("account/home");
+                return View::make("home");
             }
         }catch (Exception $e){
             CommonUtilities::print_error_message("Resetting user password operation failed");
-            return View::make("account/home");
+            return View::make("home");
         }
     }
 

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/c62cb173/app/libraries/EmailUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/EmailUtilities.php b/app/libraries/EmailUtilities.php
index c2d6741..541d9f2 100644
--- a/app/libraries/EmailUtilities.php
+++ b/app/libraries/EmailUtilities.php
@@ -5,7 +5,8 @@ class EmailUtilities
 {
 
     public static function sendVerifyEmailAccount($username, $firstName, $lastName, $email){
-        $validTime = Config::get('pga_config.portal')['mail-verify-code-valid-time'];
+        $portalConfig = Config::get('pga_config.portal');
+        $validTime = isset($portalConfig['mail-verify-code-valid-time']) ? $portalConfig['mail-verify-code-valid-time'] : 30;
         $code = uniqid();
         Cache::put('PGA-VERIFY-EMAIL-' . $username, $code, $validTime);
 
@@ -32,7 +33,8 @@ class EmailUtilities
     }
 
     public static function sendPasswordResetEmail($username, $firstName, $lastName, $email){
-        $validTime = Config::get('pga_config.portal')['mail-verify-code-valid-time'];
+        $portalConfig = Config::get('pga_config.portal');
+        $validTime = isset($portalConfig['mail-verify-code-valid-time']) ? $portalConfig['mail-verify-code-valid-time'] : 30;
         $code = uniqid();
         Cache::put('PGA-RESET-PASSWORD-' . $username, $code, $validTime);
 
@@ -40,7 +42,7 @@ class EmailUtilities
         $subject = $emailTemplates->password_reset->subject;
         $body = trim(implode($emailTemplates->password_reset->body));
 
-        $body = str_replace("\$url", URL::to('/'). '/resetPassword?username=' . $username . '&code='.$code, $body);
+        $body = str_replace("\$url", URL::to('/'). '/reset-password?username=' . urlencode($username) . '&code='.urlencode($code), $body);
         $body = str_replace("\$firstName", $firstName, $body);
         $body = str_replace("\$lastName", $lastName, $body);
         $body = str_replace("\$validTime", $validTime, $body);
@@ -63,7 +65,9 @@ class EmailUtilities
         $mail = new PHPMailer();
 
         $mail->isSMTP();
-        $mail->SMTPDebug = 3;
+        // Note: setting SMTPDebug will cause output to be dumped into the
+        // response, so only enable for testing purposes
+        // $mail->SMTPDebug = 3;
         $mail->Host = Config::get('pga_config.portal')['portal-smtp-server-host'];
 
         $mail->SMTPAuth = true;

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/c62cb173/app/libraries/Keycloak/Keycloak.php
----------------------------------------------------------------------
diff --git a/app/libraries/Keycloak/Keycloak.php b/app/libraries/Keycloak/Keycloak.php
index dfa8f0c..6a7ecad 100644
--- a/app/libraries/Keycloak/Keycloak.php
+++ b/app/libraries/Keycloak/Keycloak.php
@@ -24,6 +24,7 @@ class Keycloak {
     private $base_endpoint_url;
     private $admin_username;
     private $admin_password;
+    private $gateway_id;
 
     // API clients
     private $role_mapper;
@@ -34,7 +35,7 @@ class Keycloak {
      * Constructor
      *
      */
-    public function __construct($realm, $openid_connect_discovery_url, $client_id, $client_secret, $callback_url, $cafile_path, $verify_peer, $base_endpoint_url, $admin_username, $admin_password) {
+    public function __construct($realm, $openid_connect_discovery_url, $client_id, $client_secret, $callback_url, $cafile_path, $verify_peer, $base_endpoint_url, $admin_username, $admin_password, $gateway_id) {
 
         $this->realm = $realm;
         $this->openid_connect_discovery_url = $openid_connect_discovery_url;
@@ -46,6 +47,7 @@ class Keycloak {
         $this->base_endpoint_url = $base_endpoint_url;
         $this->admin_username = $admin_username;
         $this->admin_password = $admin_password;
+        $this->gateway_id = $gateway_id;
 
         $this->role_mapper = new RoleMapper($base_endpoint_url, $admin_username, $admin_password, $verify_peer);
         $this->roles = new Roles($base_endpoint_url, $admin_username, $admin_password, $verify_peer);
@@ -402,7 +404,7 @@ class Keycloak {
         $access_token = KeycloakUtil::getAPIAccessToken($this->base_endpoint_url, $this->realm, $this->admin_username, $this->admin_password, $this->verify_peer);
         $authzToken = new \Airavata\Model\Security\AuthzToken();
         $authzToken->accessToken = $access_token;
-        $authzToken->claimsMap['gatewayID'] = $this->realm;
+        $authzToken->claimsMap['gatewayID'] = $this->gateway_id;
         $authzToken->claimsMap['userName'] = $this->admin_username;
         return $authzToken;
     }

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/c62cb173/app/libraries/Keycloak/KeycloakServiceProvider.php
----------------------------------------------------------------------
diff --git a/app/libraries/Keycloak/KeycloakServiceProvider.php b/app/libraries/Keycloak/KeycloakServiceProvider.php
index 530d446..14971fd 100644
--- a/app/libraries/Keycloak/KeycloakServiceProvider.php
+++ b/app/libraries/Keycloak/KeycloakServiceProvider.php
@@ -33,6 +33,7 @@ class KeycloakServiceProvider extends ServiceProvider {
         $this->app['keycloak'] = $this->app->share(function($app)
         {
             $identityServerConfig = Config::get('pga_config.wsis');
+            $airavataConfig = Config::get('pga_config.airavata');
             return new Keycloak(
                 $identityServerConfig['tenant-domain'],
                 // TODO: we can derive this from tenant-domain and service-url
@@ -44,7 +45,8 @@ class KeycloakServiceProvider extends ServiceProvider {
                 $identityServerConfig['verify-peer'],
                 $identityServerConfig['service-url'],
                 $identityServerConfig['admin-username'],
-                $identityServerConfig['admin-password']
+                $identityServerConfig['admin-password'],
+                $airavataConfig['gateway-id']
             );
         });
 

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/c62cb173/app/views/account/reset-password.blade.php
----------------------------------------------------------------------
diff --git a/app/views/account/reset-password.blade.php b/app/views/account/reset-password.blade.php
index c830f06..7bc07e0 100644
--- a/app/views/account/reset-password.blade.php
+++ b/app/views/account/reset-password.blade.php
@@ -17,7 +17,7 @@
     <form role="form" method="POST" action="{{ URL::to('/') }}/reset-password">
         <div class="form-group form-horizontal">
             <input name="username" type="hidden" value="{{$username}}" class="form-control"/>
-            <input name="key" type="hidden" value="{{$key}}" class="form-control"/>
+            <input name="code" type="hidden" value="{{{$code}}}" class="form-control"/>
             <div class="form-group required"><label class="control-label">Password</label>
 
                 <div><input class="form-control" id="new_password" minlength="6" name="new_password" placeholder="New Password"


[13/50] [abbrv] airavata-php-gateway git commit: fixing minor issue in usernameExists

Posted by ma...@apache.org.
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 <su...@gmail.com>
Authored: Fri Mar 24 13:20:27 2017 -0400
Committer: scnakandala <su...@gmail.com>
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;


[19/50] [abbrv] airavata-php-gateway git commit: AIRAVATA-2342 Support Keycloak OIDC logout

Posted by ma...@apache.org.
AIRAVATA-2342 Support Keycloak OIDC logout


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

Branch: refs/heads/develop
Commit: 64362fe8d56e2cc6396f84bf6de422a06fbe1c21
Parents: a37c5aa
Author: Marcus Christie <ma...@iu.edu>
Authored: Tue Mar 28 17:06:41 2017 -0400
Committer: Marcus Christie <ma...@iu.edu>
Committed: Tue Mar 28 17:06:41 2017 -0400

----------------------------------------------------------------------
 app/controllers/AccountController.php | 13 +++++--------
 app/libraries/Keycloak/Keycloak.php   |  9 +++++++++
 2 files changed, 14 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/64362fe8/app/controllers/AccountController.php
----------------------------------------------------------------------
diff --git a/app/controllers/AccountController.php b/app/controllers/AccountController.php
index 77b1feb..7900c7c 100644
--- a/app/controllers/AccountController.php
+++ b/app/controllers/AccountController.php
@@ -465,14 +465,11 @@ class AccountController extends BaseController
 
     public function logout()
     {
-//        Session::flush();
-//        if(Config::get('pga_config.wsis')['auth-mode'] == "oauth"){
-//            return Redirect::away(WSIS::getOAuthLogoutUrl());
-//        }
-//        return Redirect::to('home');
-
-        Session::flush();
-        return Redirect::to('home');
+       Session::flush();
+       if(Config::get('pga_config.wsis')['oauth-grant-type'] == "authorization_code"){
+           return Redirect::away(Keycloak::getOAuthLogoutUrl(URL::to("/")));
+       }
+       return Redirect::to('home');
     }
 
     public function allocationRequestView(){

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/64362fe8/app/libraries/Keycloak/Keycloak.php
----------------------------------------------------------------------
diff --git a/app/libraries/Keycloak/Keycloak.php b/app/libraries/Keycloak/Keycloak.php
index 0bfec52..8c9c1a1 100644
--- a/app/libraries/Keycloak/Keycloak.php
+++ b/app/libraries/Keycloak/Keycloak.php
@@ -168,6 +168,15 @@ class Keycloak {
     }
 
     /**
+     * Function to get the OAuth logout url
+     */
+    public function getOAuthLogoutUrl($redirect_uri) {
+        $config = $this->getOpenIDConnectDiscoveryConfiguration();
+        $logout_endpoint = $config->end_session_endpoint;
+        return $logout_endpoint . '?redirect_uri=' . rawurlencode($redirect_uri);
+    }
+
+    /**
      * Function to list users
      *
      * @return Array of usernames


[45/50] [abbrv] airavata-php-gateway git commit: AIRAVATA-2408 Switching User Profile calls to Profile Service

Posted by ma...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/3c17052f/app/libraries/Airavata/Service/Profile/Tenant/CPI/TenantProfileService.php
----------------------------------------------------------------------
diff --git a/app/libraries/Airavata/Service/Profile/Tenant/CPI/TenantProfileService.php b/app/libraries/Airavata/Service/Profile/Tenant/CPI/TenantProfileService.php
new file mode 100644
index 0000000..c367cad
--- /dev/null
+++ b/app/libraries/Airavata/Service/Profile/Tenant/CPI/TenantProfileService.php
@@ -0,0 +1,2435 @@
+<?php
+namespace Airavata\Service\Profile\Tenant\CPI;
+/**
+ * Autogenerated by Thrift Compiler (0.9.3)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ *  @generated
+ */
+use Thrift\Base\TBase;
+use Thrift\Type\TType;
+use Thrift\Type\TMessageType;
+use Thrift\Exception\TException;
+use Thrift\Exception\TProtocolException;
+use Thrift\Protocol\TProtocol;
+use Thrift\Protocol\TBinaryProtocolAccelerated;
+use Thrift\Exception\TApplicationException;
+
+
+interface TenantProfileServiceIf {
+  /**
+   * @param \Airavata\Model\Security\AuthzToken $authzToken
+   * @return string
+   * @throws \Airavata\Service\Profile\Tenant\CPI\Error\TenantProfileServiceException
+   * @throws \Airavata\API\Error\AuthorizationException
+   */
+  public function getAPIVersion(\Airavata\Model\Security\AuthzToken $authzToken);
+  /**
+   * @param \Airavata\Model\Security\AuthzToken $authzToken
+   * @param \Airavata\Model\Workspace\Gateway $gateway
+   * @return string
+   * @throws \Airavata\Service\Profile\Tenant\CPI\Error\TenantProfileServiceException
+   * @throws \Airavata\API\Error\AuthorizationException
+   */
+  public function addGateway(\Airavata\Model\Security\AuthzToken $authzToken, \Airavata\Model\Workspace\Gateway $gateway);
+  /**
+   * @param \Airavata\Model\Security\AuthzToken $authzToken
+   * @param \Airavata\Model\Workspace\Gateway $updatedGateway
+   * @return bool
+   * @throws \Airavata\Service\Profile\Tenant\CPI\Error\TenantProfileServiceException
+   * @throws \Airavata\API\Error\AuthorizationException
+   */
+  public function updateGateway(\Airavata\Model\Security\AuthzToken $authzToken, \Airavata\Model\Workspace\Gateway $updatedGateway);
+  /**
+   * @param \Airavata\Model\Security\AuthzToken $authzToken
+   * @param string $gatewayId
+   * @return \Airavata\Model\Workspace\Gateway
+   * @throws \Airavata\Service\Profile\Tenant\CPI\Error\TenantProfileServiceException
+   * @throws \Airavata\API\Error\AuthorizationException
+   */
+  public function getGateway(\Airavata\Model\Security\AuthzToken $authzToken, $gatewayId);
+  /**
+   * @param \Airavata\Model\Security\AuthzToken $authzToken
+   * @param string $airavataInternalGatewayId
+   * @param string $gatewayId
+   * @return bool
+   * @throws \Airavata\Service\Profile\Tenant\CPI\Error\TenantProfileServiceException
+   * @throws \Airavata\API\Error\AuthorizationException
+   */
+  public function deleteGateway(\Airavata\Model\Security\AuthzToken $authzToken, $airavataInternalGatewayId, $gatewayId);
+  /**
+   * @param \Airavata\Model\Security\AuthzToken $authzToken
+   * @return \Airavata\Model\Workspace\Gateway[]
+   * @throws \Airavata\Service\Profile\Tenant\CPI\Error\TenantProfileServiceException
+   * @throws \Airavata\API\Error\AuthorizationException
+   */
+  public function getAllGateways(\Airavata\Model\Security\AuthzToken $authzToken);
+  /**
+   * @param \Airavata\Model\Security\AuthzToken $authzToken
+   * @param string $gatewayId
+   * @return bool
+   * @throws \Airavata\Service\Profile\Tenant\CPI\Error\TenantProfileServiceException
+   * @throws \Airavata\API\Error\AuthorizationException
+   */
+  public function isGatewayExist(\Airavata\Model\Security\AuthzToken $authzToken, $gatewayId);
+  /**
+   * @param \Airavata\Model\Security\AuthzToken $authzToken
+   * @param string $requesterUsername
+   * @return \Airavata\Model\Workspace\Gateway[]
+   * @throws \Airavata\Service\Profile\Tenant\CPI\Error\TenantProfileServiceException
+   * @throws \Airavata\API\Error\AuthorizationException
+   */
+  public function getAllGatewaysForUser(\Airavata\Model\Security\AuthzToken $authzToken, $requesterUsername);
+}
+
+class TenantProfileServiceClient implements \Airavata\Service\Profile\Tenant\CPI\TenantProfileServiceIf {
+  protected $input_ = null;
+  protected $output_ = null;
+
+  protected $seqid_ = 0;
+
+  public function __construct($input, $output=null) {
+    $this->input_ = $input;
+    $this->output_ = $output ? $output : $input;
+  }
+
+  public function getAPIVersion(\Airavata\Model\Security\AuthzToken $authzToken)
+  {
+    $this->send_getAPIVersion($authzToken);
+    return $this->recv_getAPIVersion();
+  }
+
+  public function send_getAPIVersion(\Airavata\Model\Security\AuthzToken $authzToken)
+  {
+    $args = new \Airavata\Service\Profile\Tenant\CPI\TenantProfileService_getAPIVersion_args();
+    $args->authzToken = $authzToken;
+    $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');
+    if ($bin_accel)
+    {
+      thrift_protocol_write_binary($this->output_, 'getAPIVersion', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());
+    }
+    else
+    {
+      $this->output_->writeMessageBegin('getAPIVersion', TMessageType::CALL, $this->seqid_);
+      $args->write($this->output_);
+      $this->output_->writeMessageEnd();
+      $this->output_->getTransport()->flush();
+    }
+  }
+
+  public function recv_getAPIVersion()
+  {
+    $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');
+    if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\Airavata\Service\Profile\Tenant\CPI\TenantProfileService_getAPIVersion_result', $this->input_->isStrictRead());
+    else
+    {
+      $rseqid = 0;
+      $fname = null;
+      $mtype = 0;
+
+      $this->input_->readMessageBegin($fname, $mtype, $rseqid);
+      if ($mtype == TMessageType::EXCEPTION) {
+        $x = new TApplicationException();
+        $x->read($this->input_);
+        $this->input_->readMessageEnd();
+        throw $x;
+      }
+      $result = new \Airavata\Service\Profile\Tenant\CPI\TenantProfileService_getAPIVersion_result();
+      $result->read($this->input_);
+      $this->input_->readMessageEnd();
+    }
+    if ($result->success !== null) {
+      return $result->success;
+    }
+    if ($result->tpe !== null) {
+      throw $result->tpe;
+    }
+    if ($result->ae !== null) {
+      throw $result->ae;
+    }
+    throw new \Exception("getAPIVersion failed: unknown result");
+  }
+
+  public function addGateway(\Airavata\Model\Security\AuthzToken $authzToken, \Airavata\Model\Workspace\Gateway $gateway)
+  {
+    $this->send_addGateway($authzToken, $gateway);
+    return $this->recv_addGateway();
+  }
+
+  public function send_addGateway(\Airavata\Model\Security\AuthzToken $authzToken, \Airavata\Model\Workspace\Gateway $gateway)
+  {
+    $args = new \Airavata\Service\Profile\Tenant\CPI\TenantProfileService_addGateway_args();
+    $args->authzToken = $authzToken;
+    $args->gateway = $gateway;
+    $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');
+    if ($bin_accel)
+    {
+      thrift_protocol_write_binary($this->output_, 'addGateway', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());
+    }
+    else
+    {
+      $this->output_->writeMessageBegin('addGateway', TMessageType::CALL, $this->seqid_);
+      $args->write($this->output_);
+      $this->output_->writeMessageEnd();
+      $this->output_->getTransport()->flush();
+    }
+  }
+
+  public function recv_addGateway()
+  {
+    $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');
+    if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\Airavata\Service\Profile\Tenant\CPI\TenantProfileService_addGateway_result', $this->input_->isStrictRead());
+    else
+    {
+      $rseqid = 0;
+      $fname = null;
+      $mtype = 0;
+
+      $this->input_->readMessageBegin($fname, $mtype, $rseqid);
+      if ($mtype == TMessageType::EXCEPTION) {
+        $x = new TApplicationException();
+        $x->read($this->input_);
+        $this->input_->readMessageEnd();
+        throw $x;
+      }
+      $result = new \Airavata\Service\Profile\Tenant\CPI\TenantProfileService_addGateway_result();
+      $result->read($this->input_);
+      $this->input_->readMessageEnd();
+    }
+    if ($result->success !== null) {
+      return $result->success;
+    }
+    if ($result->tpe !== null) {
+      throw $result->tpe;
+    }
+    if ($result->ae !== null) {
+      throw $result->ae;
+    }
+    throw new \Exception("addGateway failed: unknown result");
+  }
+
+  public function updateGateway(\Airavata\Model\Security\AuthzToken $authzToken, \Airavata\Model\Workspace\Gateway $updatedGateway)
+  {
+    $this->send_updateGateway($authzToken, $updatedGateway);
+    return $this->recv_updateGateway();
+  }
+
+  public function send_updateGateway(\Airavata\Model\Security\AuthzToken $authzToken, \Airavata\Model\Workspace\Gateway $updatedGateway)
+  {
+    $args = new \Airavata\Service\Profile\Tenant\CPI\TenantProfileService_updateGateway_args();
+    $args->authzToken = $authzToken;
+    $args->updatedGateway = $updatedGateway;
+    $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');
+    if ($bin_accel)
+    {
+      thrift_protocol_write_binary($this->output_, 'updateGateway', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());
+    }
+    else
+    {
+      $this->output_->writeMessageBegin('updateGateway', TMessageType::CALL, $this->seqid_);
+      $args->write($this->output_);
+      $this->output_->writeMessageEnd();
+      $this->output_->getTransport()->flush();
+    }
+  }
+
+  public function recv_updateGateway()
+  {
+    $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');
+    if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\Airavata\Service\Profile\Tenant\CPI\TenantProfileService_updateGateway_result', $this->input_->isStrictRead());
+    else
+    {
+      $rseqid = 0;
+      $fname = null;
+      $mtype = 0;
+
+      $this->input_->readMessageBegin($fname, $mtype, $rseqid);
+      if ($mtype == TMessageType::EXCEPTION) {
+        $x = new TApplicationException();
+        $x->read($this->input_);
+        $this->input_->readMessageEnd();
+        throw $x;
+      }
+      $result = new \Airavata\Service\Profile\Tenant\CPI\TenantProfileService_updateGateway_result();
+      $result->read($this->input_);
+      $this->input_->readMessageEnd();
+    }
+    if ($result->success !== null) {
+      return $result->success;
+    }
+    if ($result->tpe !== null) {
+      throw $result->tpe;
+    }
+    if ($result->ae !== null) {
+      throw $result->ae;
+    }
+    throw new \Exception("updateGateway failed: unknown result");
+  }
+
+  public function getGateway(\Airavata\Model\Security\AuthzToken $authzToken, $gatewayId)
+  {
+    $this->send_getGateway($authzToken, $gatewayId);
+    return $this->recv_getGateway();
+  }
+
+  public function send_getGateway(\Airavata\Model\Security\AuthzToken $authzToken, $gatewayId)
+  {
+    $args = new \Airavata\Service\Profile\Tenant\CPI\TenantProfileService_getGateway_args();
+    $args->authzToken = $authzToken;
+    $args->gatewayId = $gatewayId;
+    $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');
+    if ($bin_accel)
+    {
+      thrift_protocol_write_binary($this->output_, 'getGateway', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());
+    }
+    else
+    {
+      $this->output_->writeMessageBegin('getGateway', TMessageType::CALL, $this->seqid_);
+      $args->write($this->output_);
+      $this->output_->writeMessageEnd();
+      $this->output_->getTransport()->flush();
+    }
+  }
+
+  public function recv_getGateway()
+  {
+    $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');
+    if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\Airavata\Service\Profile\Tenant\CPI\TenantProfileService_getGateway_result', $this->input_->isStrictRead());
+    else
+    {
+      $rseqid = 0;
+      $fname = null;
+      $mtype = 0;
+
+      $this->input_->readMessageBegin($fname, $mtype, $rseqid);
+      if ($mtype == TMessageType::EXCEPTION) {
+        $x = new TApplicationException();
+        $x->read($this->input_);
+        $this->input_->readMessageEnd();
+        throw $x;
+      }
+      $result = new \Airavata\Service\Profile\Tenant\CPI\TenantProfileService_getGateway_result();
+      $result->read($this->input_);
+      $this->input_->readMessageEnd();
+    }
+    if ($result->success !== null) {
+      return $result->success;
+    }
+    if ($result->tpe !== null) {
+      throw $result->tpe;
+    }
+    if ($result->ae !== null) {
+      throw $result->ae;
+    }
+    throw new \Exception("getGateway failed: unknown result");
+  }
+
+  public function deleteGateway(\Airavata\Model\Security\AuthzToken $authzToken, $airavataInternalGatewayId, $gatewayId)
+  {
+    $this->send_deleteGateway($authzToken, $airavataInternalGatewayId, $gatewayId);
+    return $this->recv_deleteGateway();
+  }
+
+  public function send_deleteGateway(\Airavata\Model\Security\AuthzToken $authzToken, $airavataInternalGatewayId, $gatewayId)
+  {
+    $args = new \Airavata\Service\Profile\Tenant\CPI\TenantProfileService_deleteGateway_args();
+    $args->authzToken = $authzToken;
+    $args->airavataInternalGatewayId = $airavataInternalGatewayId;
+    $args->gatewayId = $gatewayId;
+    $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');
+    if ($bin_accel)
+    {
+      thrift_protocol_write_binary($this->output_, 'deleteGateway', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());
+    }
+    else
+    {
+      $this->output_->writeMessageBegin('deleteGateway', TMessageType::CALL, $this->seqid_);
+      $args->write($this->output_);
+      $this->output_->writeMessageEnd();
+      $this->output_->getTransport()->flush();
+    }
+  }
+
+  public function recv_deleteGateway()
+  {
+    $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');
+    if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\Airavata\Service\Profile\Tenant\CPI\TenantProfileService_deleteGateway_result', $this->input_->isStrictRead());
+    else
+    {
+      $rseqid = 0;
+      $fname = null;
+      $mtype = 0;
+
+      $this->input_->readMessageBegin($fname, $mtype, $rseqid);
+      if ($mtype == TMessageType::EXCEPTION) {
+        $x = new TApplicationException();
+        $x->read($this->input_);
+        $this->input_->readMessageEnd();
+        throw $x;
+      }
+      $result = new \Airavata\Service\Profile\Tenant\CPI\TenantProfileService_deleteGateway_result();
+      $result->read($this->input_);
+      $this->input_->readMessageEnd();
+    }
+    if ($result->success !== null) {
+      return $result->success;
+    }
+    if ($result->tpe !== null) {
+      throw $result->tpe;
+    }
+    if ($result->ae !== null) {
+      throw $result->ae;
+    }
+    throw new \Exception("deleteGateway failed: unknown result");
+  }
+
+  public function getAllGateways(\Airavata\Model\Security\AuthzToken $authzToken)
+  {
+    $this->send_getAllGateways($authzToken);
+    return $this->recv_getAllGateways();
+  }
+
+  public function send_getAllGateways(\Airavata\Model\Security\AuthzToken $authzToken)
+  {
+    $args = new \Airavata\Service\Profile\Tenant\CPI\TenantProfileService_getAllGateways_args();
+    $args->authzToken = $authzToken;
+    $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');
+    if ($bin_accel)
+    {
+      thrift_protocol_write_binary($this->output_, 'getAllGateways', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());
+    }
+    else
+    {
+      $this->output_->writeMessageBegin('getAllGateways', TMessageType::CALL, $this->seqid_);
+      $args->write($this->output_);
+      $this->output_->writeMessageEnd();
+      $this->output_->getTransport()->flush();
+    }
+  }
+
+  public function recv_getAllGateways()
+  {
+    $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');
+    if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\Airavata\Service\Profile\Tenant\CPI\TenantProfileService_getAllGateways_result', $this->input_->isStrictRead());
+    else
+    {
+      $rseqid = 0;
+      $fname = null;
+      $mtype = 0;
+
+      $this->input_->readMessageBegin($fname, $mtype, $rseqid);
+      if ($mtype == TMessageType::EXCEPTION) {
+        $x = new TApplicationException();
+        $x->read($this->input_);
+        $this->input_->readMessageEnd();
+        throw $x;
+      }
+      $result = new \Airavata\Service\Profile\Tenant\CPI\TenantProfileService_getAllGateways_result();
+      $result->read($this->input_);
+      $this->input_->readMessageEnd();
+    }
+    if ($result->success !== null) {
+      return $result->success;
+    }
+    if ($result->tpe !== null) {
+      throw $result->tpe;
+    }
+    if ($result->ae !== null) {
+      throw $result->ae;
+    }
+    throw new \Exception("getAllGateways failed: unknown result");
+  }
+
+  public function isGatewayExist(\Airavata\Model\Security\AuthzToken $authzToken, $gatewayId)
+  {
+    $this->send_isGatewayExist($authzToken, $gatewayId);
+    return $this->recv_isGatewayExist();
+  }
+
+  public function send_isGatewayExist(\Airavata\Model\Security\AuthzToken $authzToken, $gatewayId)
+  {
+    $args = new \Airavata\Service\Profile\Tenant\CPI\TenantProfileService_isGatewayExist_args();
+    $args->authzToken = $authzToken;
+    $args->gatewayId = $gatewayId;
+    $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');
+    if ($bin_accel)
+    {
+      thrift_protocol_write_binary($this->output_, 'isGatewayExist', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());
+    }
+    else
+    {
+      $this->output_->writeMessageBegin('isGatewayExist', TMessageType::CALL, $this->seqid_);
+      $args->write($this->output_);
+      $this->output_->writeMessageEnd();
+      $this->output_->getTransport()->flush();
+    }
+  }
+
+  public function recv_isGatewayExist()
+  {
+    $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');
+    if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\Airavata\Service\Profile\Tenant\CPI\TenantProfileService_isGatewayExist_result', $this->input_->isStrictRead());
+    else
+    {
+      $rseqid = 0;
+      $fname = null;
+      $mtype = 0;
+
+      $this->input_->readMessageBegin($fname, $mtype, $rseqid);
+      if ($mtype == TMessageType::EXCEPTION) {
+        $x = new TApplicationException();
+        $x->read($this->input_);
+        $this->input_->readMessageEnd();
+        throw $x;
+      }
+      $result = new \Airavata\Service\Profile\Tenant\CPI\TenantProfileService_isGatewayExist_result();
+      $result->read($this->input_);
+      $this->input_->readMessageEnd();
+    }
+    if ($result->success !== null) {
+      return $result->success;
+    }
+    if ($result->tpe !== null) {
+      throw $result->tpe;
+    }
+    if ($result->ae !== null) {
+      throw $result->ae;
+    }
+    throw new \Exception("isGatewayExist failed: unknown result");
+  }
+
+  public function getAllGatewaysForUser(\Airavata\Model\Security\AuthzToken $authzToken, $requesterUsername)
+  {
+    $this->send_getAllGatewaysForUser($authzToken, $requesterUsername);
+    return $this->recv_getAllGatewaysForUser();
+  }
+
+  public function send_getAllGatewaysForUser(\Airavata\Model\Security\AuthzToken $authzToken, $requesterUsername)
+  {
+    $args = new \Airavata\Service\Profile\Tenant\CPI\TenantProfileService_getAllGatewaysForUser_args();
+    $args->authzToken = $authzToken;
+    $args->requesterUsername = $requesterUsername;
+    $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');
+    if ($bin_accel)
+    {
+      thrift_protocol_write_binary($this->output_, 'getAllGatewaysForUser', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());
+    }
+    else
+    {
+      $this->output_->writeMessageBegin('getAllGatewaysForUser', TMessageType::CALL, $this->seqid_);
+      $args->write($this->output_);
+      $this->output_->writeMessageEnd();
+      $this->output_->getTransport()->flush();
+    }
+  }
+
+  public function recv_getAllGatewaysForUser()
+  {
+    $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');
+    if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\Airavata\Service\Profile\Tenant\CPI\TenantProfileService_getAllGatewaysForUser_result', $this->input_->isStrictRead());
+    else
+    {
+      $rseqid = 0;
+      $fname = null;
+      $mtype = 0;
+
+      $this->input_->readMessageBegin($fname, $mtype, $rseqid);
+      if ($mtype == TMessageType::EXCEPTION) {
+        $x = new TApplicationException();
+        $x->read($this->input_);
+        $this->input_->readMessageEnd();
+        throw $x;
+      }
+      $result = new \Airavata\Service\Profile\Tenant\CPI\TenantProfileService_getAllGatewaysForUser_result();
+      $result->read($this->input_);
+      $this->input_->readMessageEnd();
+    }
+    if ($result->success !== null) {
+      return $result->success;
+    }
+    if ($result->tpe !== null) {
+      throw $result->tpe;
+    }
+    if ($result->ae !== null) {
+      throw $result->ae;
+    }
+    throw new \Exception("getAllGatewaysForUser failed: unknown result");
+  }
+
+}
+
+// HELPER FUNCTIONS AND STRUCTURES
+
+class TenantProfileService_getAPIVersion_args {
+  static $_TSPEC;
+
+  /**
+   * @var \Airavata\Model\Security\AuthzToken
+   */
+  public $authzToken = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        1 => array(
+          'var' => 'authzToken',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\Model\Security\AuthzToken',
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['authzToken'])) {
+        $this->authzToken = $vals['authzToken'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'TenantProfileService_getAPIVersion_args';
+  }
+
+  public function read($input)
+  {
+    $xfer = 0;
+    $fname = null;
+    $ftype = 0;
+    $fid = 0;
+    $xfer += $input->readStructBegin($fname);
+    while (true)
+    {
+      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
+      if ($ftype == TType::STOP) {
+        break;
+      }
+      switch ($fid)
+      {
+        case 1:
+          if ($ftype == TType::STRUCT) {
+            $this->authzToken = new \Airavata\Model\Security\AuthzToken();
+            $xfer += $this->authzToken->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        default:
+          $xfer += $input->skip($ftype);
+          break;
+      }
+      $xfer += $input->readFieldEnd();
+    }
+    $xfer += $input->readStructEnd();
+    return $xfer;
+  }
+
+  public function write($output) {
+    $xfer = 0;
+    $xfer += $output->writeStructBegin('TenantProfileService_getAPIVersion_args');
+    if ($this->authzToken !== null) {
+      if (!is_object($this->authzToken)) {
+        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
+      }
+      $xfer += $output->writeFieldBegin('authzToken', TType::STRUCT, 1);
+      $xfer += $this->authzToken->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
+class TenantProfileService_getAPIVersion_result {
+  static $_TSPEC;
+
+  /**
+   * @var string
+   */
+  public $success = null;
+  /**
+   * @var \Airavata\Service\Profile\Tenant\CPI\Error\TenantProfileServiceException
+   */
+  public $tpe = null;
+  /**
+   * @var \Airavata\API\Error\AuthorizationException
+   */
+  public $ae = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        0 => array(
+          'var' => 'success',
+          'type' => TType::STRING,
+          ),
+        1 => array(
+          'var' => 'tpe',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\Service\Profile\Tenant\CPI\Error\TenantProfileServiceException',
+          ),
+        2 => array(
+          'var' => 'ae',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\API\Error\AuthorizationException',
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['success'])) {
+        $this->success = $vals['success'];
+      }
+      if (isset($vals['tpe'])) {
+        $this->tpe = $vals['tpe'];
+      }
+      if (isset($vals['ae'])) {
+        $this->ae = $vals['ae'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'TenantProfileService_getAPIVersion_result';
+  }
+
+  public function read($input)
+  {
+    $xfer = 0;
+    $fname = null;
+    $ftype = 0;
+    $fid = 0;
+    $xfer += $input->readStructBegin($fname);
+    while (true)
+    {
+      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
+      if ($ftype == TType::STOP) {
+        break;
+      }
+      switch ($fid)
+      {
+        case 0:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->success);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 1:
+          if ($ftype == TType::STRUCT) {
+            $this->tpe = new \Airavata\Service\Profile\Tenant\CPI\Error\TenantProfileServiceException();
+            $xfer += $this->tpe->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 2:
+          if ($ftype == TType::STRUCT) {
+            $this->ae = new \Airavata\API\Error\AuthorizationException();
+            $xfer += $this->ae->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        default:
+          $xfer += $input->skip($ftype);
+          break;
+      }
+      $xfer += $input->readFieldEnd();
+    }
+    $xfer += $input->readStructEnd();
+    return $xfer;
+  }
+
+  public function write($output) {
+    $xfer = 0;
+    $xfer += $output->writeStructBegin('TenantProfileService_getAPIVersion_result');
+    if ($this->success !== null) {
+      $xfer += $output->writeFieldBegin('success', TType::STRING, 0);
+      $xfer += $output->writeString($this->success);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->tpe !== null) {
+      $xfer += $output->writeFieldBegin('tpe', TType::STRUCT, 1);
+      $xfer += $this->tpe->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->ae !== null) {
+      $xfer += $output->writeFieldBegin('ae', TType::STRUCT, 2);
+      $xfer += $this->ae->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
+class TenantProfileService_addGateway_args {
+  static $_TSPEC;
+
+  /**
+   * @var \Airavata\Model\Security\AuthzToken
+   */
+  public $authzToken = null;
+  /**
+   * @var \Airavata\Model\Workspace\Gateway
+   */
+  public $gateway = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        1 => array(
+          'var' => 'authzToken',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\Model\Security\AuthzToken',
+          ),
+        2 => array(
+          'var' => 'gateway',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\Model\Workspace\Gateway',
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['authzToken'])) {
+        $this->authzToken = $vals['authzToken'];
+      }
+      if (isset($vals['gateway'])) {
+        $this->gateway = $vals['gateway'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'TenantProfileService_addGateway_args';
+  }
+
+  public function read($input)
+  {
+    $xfer = 0;
+    $fname = null;
+    $ftype = 0;
+    $fid = 0;
+    $xfer += $input->readStructBegin($fname);
+    while (true)
+    {
+      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
+      if ($ftype == TType::STOP) {
+        break;
+      }
+      switch ($fid)
+      {
+        case 1:
+          if ($ftype == TType::STRUCT) {
+            $this->authzToken = new \Airavata\Model\Security\AuthzToken();
+            $xfer += $this->authzToken->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 2:
+          if ($ftype == TType::STRUCT) {
+            $this->gateway = new \Airavata\Model\Workspace\Gateway();
+            $xfer += $this->gateway->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        default:
+          $xfer += $input->skip($ftype);
+          break;
+      }
+      $xfer += $input->readFieldEnd();
+    }
+    $xfer += $input->readStructEnd();
+    return $xfer;
+  }
+
+  public function write($output) {
+    $xfer = 0;
+    $xfer += $output->writeStructBegin('TenantProfileService_addGateway_args');
+    if ($this->authzToken !== null) {
+      if (!is_object($this->authzToken)) {
+        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
+      }
+      $xfer += $output->writeFieldBegin('authzToken', TType::STRUCT, 1);
+      $xfer += $this->authzToken->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->gateway !== null) {
+      if (!is_object($this->gateway)) {
+        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
+      }
+      $xfer += $output->writeFieldBegin('gateway', TType::STRUCT, 2);
+      $xfer += $this->gateway->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
+class TenantProfileService_addGateway_result {
+  static $_TSPEC;
+
+  /**
+   * @var string
+   */
+  public $success = null;
+  /**
+   * @var \Airavata\Service\Profile\Tenant\CPI\Error\TenantProfileServiceException
+   */
+  public $tpe = null;
+  /**
+   * @var \Airavata\API\Error\AuthorizationException
+   */
+  public $ae = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        0 => array(
+          'var' => 'success',
+          'type' => TType::STRING,
+          ),
+        1 => array(
+          'var' => 'tpe',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\Service\Profile\Tenant\CPI\Error\TenantProfileServiceException',
+          ),
+        2 => array(
+          'var' => 'ae',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\API\Error\AuthorizationException',
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['success'])) {
+        $this->success = $vals['success'];
+      }
+      if (isset($vals['tpe'])) {
+        $this->tpe = $vals['tpe'];
+      }
+      if (isset($vals['ae'])) {
+        $this->ae = $vals['ae'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'TenantProfileService_addGateway_result';
+  }
+
+  public function read($input)
+  {
+    $xfer = 0;
+    $fname = null;
+    $ftype = 0;
+    $fid = 0;
+    $xfer += $input->readStructBegin($fname);
+    while (true)
+    {
+      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
+      if ($ftype == TType::STOP) {
+        break;
+      }
+      switch ($fid)
+      {
+        case 0:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->success);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 1:
+          if ($ftype == TType::STRUCT) {
+            $this->tpe = new \Airavata\Service\Profile\Tenant\CPI\Error\TenantProfileServiceException();
+            $xfer += $this->tpe->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 2:
+          if ($ftype == TType::STRUCT) {
+            $this->ae = new \Airavata\API\Error\AuthorizationException();
+            $xfer += $this->ae->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        default:
+          $xfer += $input->skip($ftype);
+          break;
+      }
+      $xfer += $input->readFieldEnd();
+    }
+    $xfer += $input->readStructEnd();
+    return $xfer;
+  }
+
+  public function write($output) {
+    $xfer = 0;
+    $xfer += $output->writeStructBegin('TenantProfileService_addGateway_result');
+    if ($this->success !== null) {
+      $xfer += $output->writeFieldBegin('success', TType::STRING, 0);
+      $xfer += $output->writeString($this->success);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->tpe !== null) {
+      $xfer += $output->writeFieldBegin('tpe', TType::STRUCT, 1);
+      $xfer += $this->tpe->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->ae !== null) {
+      $xfer += $output->writeFieldBegin('ae', TType::STRUCT, 2);
+      $xfer += $this->ae->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
+class TenantProfileService_updateGateway_args {
+  static $_TSPEC;
+
+  /**
+   * @var \Airavata\Model\Security\AuthzToken
+   */
+  public $authzToken = null;
+  /**
+   * @var \Airavata\Model\Workspace\Gateway
+   */
+  public $updatedGateway = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        1 => array(
+          'var' => 'authzToken',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\Model\Security\AuthzToken',
+          ),
+        2 => array(
+          'var' => 'updatedGateway',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\Model\Workspace\Gateway',
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['authzToken'])) {
+        $this->authzToken = $vals['authzToken'];
+      }
+      if (isset($vals['updatedGateway'])) {
+        $this->updatedGateway = $vals['updatedGateway'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'TenantProfileService_updateGateway_args';
+  }
+
+  public function read($input)
+  {
+    $xfer = 0;
+    $fname = null;
+    $ftype = 0;
+    $fid = 0;
+    $xfer += $input->readStructBegin($fname);
+    while (true)
+    {
+      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
+      if ($ftype == TType::STOP) {
+        break;
+      }
+      switch ($fid)
+      {
+        case 1:
+          if ($ftype == TType::STRUCT) {
+            $this->authzToken = new \Airavata\Model\Security\AuthzToken();
+            $xfer += $this->authzToken->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 2:
+          if ($ftype == TType::STRUCT) {
+            $this->updatedGateway = new \Airavata\Model\Workspace\Gateway();
+            $xfer += $this->updatedGateway->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        default:
+          $xfer += $input->skip($ftype);
+          break;
+      }
+      $xfer += $input->readFieldEnd();
+    }
+    $xfer += $input->readStructEnd();
+    return $xfer;
+  }
+
+  public function write($output) {
+    $xfer = 0;
+    $xfer += $output->writeStructBegin('TenantProfileService_updateGateway_args');
+    if ($this->authzToken !== null) {
+      if (!is_object($this->authzToken)) {
+        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
+      }
+      $xfer += $output->writeFieldBegin('authzToken', TType::STRUCT, 1);
+      $xfer += $this->authzToken->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->updatedGateway !== null) {
+      if (!is_object($this->updatedGateway)) {
+        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
+      }
+      $xfer += $output->writeFieldBegin('updatedGateway', TType::STRUCT, 2);
+      $xfer += $this->updatedGateway->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
+class TenantProfileService_updateGateway_result {
+  static $_TSPEC;
+
+  /**
+   * @var bool
+   */
+  public $success = null;
+  /**
+   * @var \Airavata\Service\Profile\Tenant\CPI\Error\TenantProfileServiceException
+   */
+  public $tpe = null;
+  /**
+   * @var \Airavata\API\Error\AuthorizationException
+   */
+  public $ae = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        0 => array(
+          'var' => 'success',
+          'type' => TType::BOOL,
+          ),
+        1 => array(
+          'var' => 'tpe',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\Service\Profile\Tenant\CPI\Error\TenantProfileServiceException',
+          ),
+        2 => array(
+          'var' => 'ae',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\API\Error\AuthorizationException',
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['success'])) {
+        $this->success = $vals['success'];
+      }
+      if (isset($vals['tpe'])) {
+        $this->tpe = $vals['tpe'];
+      }
+      if (isset($vals['ae'])) {
+        $this->ae = $vals['ae'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'TenantProfileService_updateGateway_result';
+  }
+
+  public function read($input)
+  {
+    $xfer = 0;
+    $fname = null;
+    $ftype = 0;
+    $fid = 0;
+    $xfer += $input->readStructBegin($fname);
+    while (true)
+    {
+      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
+      if ($ftype == TType::STOP) {
+        break;
+      }
+      switch ($fid)
+      {
+        case 0:
+          if ($ftype == TType::BOOL) {
+            $xfer += $input->readBool($this->success);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 1:
+          if ($ftype == TType::STRUCT) {
+            $this->tpe = new \Airavata\Service\Profile\Tenant\CPI\Error\TenantProfileServiceException();
+            $xfer += $this->tpe->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 2:
+          if ($ftype == TType::STRUCT) {
+            $this->ae = new \Airavata\API\Error\AuthorizationException();
+            $xfer += $this->ae->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        default:
+          $xfer += $input->skip($ftype);
+          break;
+      }
+      $xfer += $input->readFieldEnd();
+    }
+    $xfer += $input->readStructEnd();
+    return $xfer;
+  }
+
+  public function write($output) {
+    $xfer = 0;
+    $xfer += $output->writeStructBegin('TenantProfileService_updateGateway_result');
+    if ($this->success !== null) {
+      $xfer += $output->writeFieldBegin('success', TType::BOOL, 0);
+      $xfer += $output->writeBool($this->success);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->tpe !== null) {
+      $xfer += $output->writeFieldBegin('tpe', TType::STRUCT, 1);
+      $xfer += $this->tpe->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->ae !== null) {
+      $xfer += $output->writeFieldBegin('ae', TType::STRUCT, 2);
+      $xfer += $this->ae->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
+class TenantProfileService_getGateway_args {
+  static $_TSPEC;
+
+  /**
+   * @var \Airavata\Model\Security\AuthzToken
+   */
+  public $authzToken = null;
+  /**
+   * @var string
+   */
+  public $gatewayId = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        1 => array(
+          'var' => 'authzToken',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\Model\Security\AuthzToken',
+          ),
+        2 => array(
+          'var' => 'gatewayId',
+          'type' => TType::STRING,
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['authzToken'])) {
+        $this->authzToken = $vals['authzToken'];
+      }
+      if (isset($vals['gatewayId'])) {
+        $this->gatewayId = $vals['gatewayId'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'TenantProfileService_getGateway_args';
+  }
+
+  public function read($input)
+  {
+    $xfer = 0;
+    $fname = null;
+    $ftype = 0;
+    $fid = 0;
+    $xfer += $input->readStructBegin($fname);
+    while (true)
+    {
+      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
+      if ($ftype == TType::STOP) {
+        break;
+      }
+      switch ($fid)
+      {
+        case 1:
+          if ($ftype == TType::STRUCT) {
+            $this->authzToken = new \Airavata\Model\Security\AuthzToken();
+            $xfer += $this->authzToken->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 2:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->gatewayId);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        default:
+          $xfer += $input->skip($ftype);
+          break;
+      }
+      $xfer += $input->readFieldEnd();
+    }
+    $xfer += $input->readStructEnd();
+    return $xfer;
+  }
+
+  public function write($output) {
+    $xfer = 0;
+    $xfer += $output->writeStructBegin('TenantProfileService_getGateway_args');
+    if ($this->authzToken !== null) {
+      if (!is_object($this->authzToken)) {
+        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
+      }
+      $xfer += $output->writeFieldBegin('authzToken', TType::STRUCT, 1);
+      $xfer += $this->authzToken->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->gatewayId !== null) {
+      $xfer += $output->writeFieldBegin('gatewayId', TType::STRING, 2);
+      $xfer += $output->writeString($this->gatewayId);
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
+class TenantProfileService_getGateway_result {
+  static $_TSPEC;
+
+  /**
+   * @var \Airavata\Model\Workspace\Gateway
+   */
+  public $success = null;
+  /**
+   * @var \Airavata\Service\Profile\Tenant\CPI\Error\TenantProfileServiceException
+   */
+  public $tpe = null;
+  /**
+   * @var \Airavata\API\Error\AuthorizationException
+   */
+  public $ae = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        0 => array(
+          'var' => 'success',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\Model\Workspace\Gateway',
+          ),
+        1 => array(
+          'var' => 'tpe',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\Service\Profile\Tenant\CPI\Error\TenantProfileServiceException',
+          ),
+        2 => array(
+          'var' => 'ae',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\API\Error\AuthorizationException',
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['success'])) {
+        $this->success = $vals['success'];
+      }
+      if (isset($vals['tpe'])) {
+        $this->tpe = $vals['tpe'];
+      }
+      if (isset($vals['ae'])) {
+        $this->ae = $vals['ae'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'TenantProfileService_getGateway_result';
+  }
+
+  public function read($input)
+  {
+    $xfer = 0;
+    $fname = null;
+    $ftype = 0;
+    $fid = 0;
+    $xfer += $input->readStructBegin($fname);
+    while (true)
+    {
+      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
+      if ($ftype == TType::STOP) {
+        break;
+      }
+      switch ($fid)
+      {
+        case 0:
+          if ($ftype == TType::STRUCT) {
+            $this->success = new \Airavata\Model\Workspace\Gateway();
+            $xfer += $this->success->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 1:
+          if ($ftype == TType::STRUCT) {
+            $this->tpe = new \Airavata\Service\Profile\Tenant\CPI\Error\TenantProfileServiceException();
+            $xfer += $this->tpe->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 2:
+          if ($ftype == TType::STRUCT) {
+            $this->ae = new \Airavata\API\Error\AuthorizationException();
+            $xfer += $this->ae->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        default:
+          $xfer += $input->skip($ftype);
+          break;
+      }
+      $xfer += $input->readFieldEnd();
+    }
+    $xfer += $input->readStructEnd();
+    return $xfer;
+  }
+
+  public function write($output) {
+    $xfer = 0;
+    $xfer += $output->writeStructBegin('TenantProfileService_getGateway_result');
+    if ($this->success !== null) {
+      if (!is_object($this->success)) {
+        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
+      }
+      $xfer += $output->writeFieldBegin('success', TType::STRUCT, 0);
+      $xfer += $this->success->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->tpe !== null) {
+      $xfer += $output->writeFieldBegin('tpe', TType::STRUCT, 1);
+      $xfer += $this->tpe->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->ae !== null) {
+      $xfer += $output->writeFieldBegin('ae', TType::STRUCT, 2);
+      $xfer += $this->ae->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
+class TenantProfileService_deleteGateway_args {
+  static $_TSPEC;
+
+  /**
+   * @var \Airavata\Model\Security\AuthzToken
+   */
+  public $authzToken = null;
+  /**
+   * @var string
+   */
+  public $airavataInternalGatewayId = null;
+  /**
+   * @var string
+   */
+  public $gatewayId = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        1 => array(
+          'var' => 'authzToken',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\Model\Security\AuthzToken',
+          ),
+        2 => array(
+          'var' => 'airavataInternalGatewayId',
+          'type' => TType::STRING,
+          ),
+        3 => array(
+          'var' => 'gatewayId',
+          'type' => TType::STRING,
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['authzToken'])) {
+        $this->authzToken = $vals['authzToken'];
+      }
+      if (isset($vals['airavataInternalGatewayId'])) {
+        $this->airavataInternalGatewayId = $vals['airavataInternalGatewayId'];
+      }
+      if (isset($vals['gatewayId'])) {
+        $this->gatewayId = $vals['gatewayId'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'TenantProfileService_deleteGateway_args';
+  }
+
+  public function read($input)
+  {
+    $xfer = 0;
+    $fname = null;
+    $ftype = 0;
+    $fid = 0;
+    $xfer += $input->readStructBegin($fname);
+    while (true)
+    {
+      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
+      if ($ftype == TType::STOP) {
+        break;
+      }
+      switch ($fid)
+      {
+        case 1:
+          if ($ftype == TType::STRUCT) {
+            $this->authzToken = new \Airavata\Model\Security\AuthzToken();
+            $xfer += $this->authzToken->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 2:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->airavataInternalGatewayId);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 3:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->gatewayId);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        default:
+          $xfer += $input->skip($ftype);
+          break;
+      }
+      $xfer += $input->readFieldEnd();
+    }
+    $xfer += $input->readStructEnd();
+    return $xfer;
+  }
+
+  public function write($output) {
+    $xfer = 0;
+    $xfer += $output->writeStructBegin('TenantProfileService_deleteGateway_args');
+    if ($this->authzToken !== null) {
+      if (!is_object($this->authzToken)) {
+        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
+      }
+      $xfer += $output->writeFieldBegin('authzToken', TType::STRUCT, 1);
+      $xfer += $this->authzToken->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->airavataInternalGatewayId !== null) {
+      $xfer += $output->writeFieldBegin('airavataInternalGatewayId', TType::STRING, 2);
+      $xfer += $output->writeString($this->airavataInternalGatewayId);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->gatewayId !== null) {
+      $xfer += $output->writeFieldBegin('gatewayId', TType::STRING, 3);
+      $xfer += $output->writeString($this->gatewayId);
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
+class TenantProfileService_deleteGateway_result {
+  static $_TSPEC;
+
+  /**
+   * @var bool
+   */
+  public $success = null;
+  /**
+   * @var \Airavata\Service\Profile\Tenant\CPI\Error\TenantProfileServiceException
+   */
+  public $tpe = null;
+  /**
+   * @var \Airavata\API\Error\AuthorizationException
+   */
+  public $ae = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        0 => array(
+          'var' => 'success',
+          'type' => TType::BOOL,
+          ),
+        1 => array(
+          'var' => 'tpe',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\Service\Profile\Tenant\CPI\Error\TenantProfileServiceException',
+          ),
+        2 => array(
+          'var' => 'ae',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\API\Error\AuthorizationException',
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['success'])) {
+        $this->success = $vals['success'];
+      }
+      if (isset($vals['tpe'])) {
+        $this->tpe = $vals['tpe'];
+      }
+      if (isset($vals['ae'])) {
+        $this->ae = $vals['ae'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'TenantProfileService_deleteGateway_result';
+  }
+
+  public function read($input)
+  {
+    $xfer = 0;
+    $fname = null;
+    $ftype = 0;
+    $fid = 0;
+    $xfer += $input->readStructBegin($fname);
+    while (true)
+    {
+      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
+      if ($ftype == TType::STOP) {
+        break;
+      }
+      switch ($fid)
+      {
+        case 0:
+          if ($ftype == TType::BOOL) {
+            $xfer += $input->readBool($this->success);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 1:
+          if ($ftype == TType::STRUCT) {
+            $this->tpe = new \Airavata\Service\Profile\Tenant\CPI\Error\TenantProfileServiceException();
+            $xfer += $this->tpe->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 2:
+          if ($ftype == TType::STRUCT) {
+            $this->ae = new \Airavata\API\Error\AuthorizationException();
+            $xfer += $this->ae->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        default:
+          $xfer += $input->skip($ftype);
+          break;
+      }
+      $xfer += $input->readFieldEnd();
+    }
+    $xfer += $input->readStructEnd();
+    return $xfer;
+  }
+
+  public function write($output) {
+    $xfer = 0;
+    $xfer += $output->writeStructBegin('TenantProfileService_deleteGateway_result');
+    if ($this->success !== null) {
+      $xfer += $output->writeFieldBegin('success', TType::BOOL, 0);
+      $xfer += $output->writeBool($this->success);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->tpe !== null) {
+      $xfer += $output->writeFieldBegin('tpe', TType::STRUCT, 1);
+      $xfer += $this->tpe->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->ae !== null) {
+      $xfer += $output->writeFieldBegin('ae', TType::STRUCT, 2);
+      $xfer += $this->ae->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
+class TenantProfileService_getAllGateways_args {
+  static $_TSPEC;
+
+  /**
+   * @var \Airavata\Model\Security\AuthzToken
+   */
+  public $authzToken = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        1 => array(
+          'var' => 'authzToken',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\Model\Security\AuthzToken',
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['authzToken'])) {
+        $this->authzToken = $vals['authzToken'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'TenantProfileService_getAllGateways_args';
+  }
+
+  public function read($input)
+  {
+    $xfer = 0;
+    $fname = null;
+    $ftype = 0;
+    $fid = 0;
+    $xfer += $input->readStructBegin($fname);
+    while (true)
+    {
+      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
+      if ($ftype == TType::STOP) {
+        break;
+      }
+      switch ($fid)
+      {
+        case 1:
+          if ($ftype == TType::STRUCT) {
+            $this->authzToken = new \Airavata\Model\Security\AuthzToken();
+            $xfer += $this->authzToken->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        default:
+          $xfer += $input->skip($ftype);
+          break;
+      }
+      $xfer += $input->readFieldEnd();
+    }
+    $xfer += $input->readStructEnd();
+    return $xfer;
+  }
+
+  public function write($output) {
+    $xfer = 0;
+    $xfer += $output->writeStructBegin('TenantProfileService_getAllGateways_args');
+    if ($this->authzToken !== null) {
+      if (!is_object($this->authzToken)) {
+        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
+      }
+      $xfer += $output->writeFieldBegin('authzToken', TType::STRUCT, 1);
+      $xfer += $this->authzToken->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
+class TenantProfileService_getAllGateways_result {
+  static $_TSPEC;
+
+  /**
+   * @var \Airavata\Model\Workspace\Gateway[]
+   */
+  public $success = null;
+  /**
+   * @var \Airavata\Service\Profile\Tenant\CPI\Error\TenantProfileServiceException
+   */
+  public $tpe = null;
+  /**
+   * @var \Airavata\API\Error\AuthorizationException
+   */
+  public $ae = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        0 => array(
+          'var' => 'success',
+          'type' => TType::LST,
+          'etype' => TType::STRUCT,
+          'elem' => array(
+            'type' => TType::STRUCT,
+            'class' => '\Airavata\Model\Workspace\Gateway',
+            ),
+          ),
+        1 => array(
+          'var' => 'tpe',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\Service\Profile\Tenant\CPI\Error\TenantProfileServiceException',
+          ),
+        2 => array(
+          'var' => 'ae',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\API\Error\AuthorizationException',
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['success'])) {
+        $this->success = $vals['success'];
+      }
+      if (isset($vals['tpe'])) {
+        $this->tpe = $vals['tpe'];
+      }
+      if (isset($vals['ae'])) {
+        $this->ae = $vals['ae'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'TenantProfileService_getAllGateways_result';
+  }
+
+  public function read($input)
+  {
+    $xfer = 0;
+    $fname = null;
+    $ftype = 0;
+    $fid = 0;
+    $xfer += $input->readStructBegin($fname);
+    while (true)
+    {
+      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
+      if ($ftype == TType::STOP) {
+        break;
+      }
+      switch ($fid)
+      {
+        case 0:
+          if ($ftype == TType::LST) {
+            $this->success = array();
+            $_size0 = 0;
+            $_etype3 = 0;
+            $xfer += $input->readListBegin($_etype3, $_size0);
+            for ($_i4 = 0; $_i4 < $_size0; ++$_i4)
+            {
+              $elem5 = null;
+              $elem5 = new \Airavata\Model\Workspace\Gateway();
+              $xfer += $elem5->read($input);
+              $this->success []= $elem5;
+            }
+            $xfer += $input->readListEnd();
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 1:
+          if ($ftype == TType::STRUCT) {
+            $this->tpe = new \Airavata\Service\Profile\Tenant\CPI\Error\TenantProfileServiceException();
+            $xfer += $this->tpe->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 2:
+          if ($ftype == TType::STRUCT) {
+            $this->ae = new \Airavata\API\Error\AuthorizationException();
+            $xfer += $this->ae->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        default:
+          $xfer += $input->skip($ftype);
+          break;
+      }
+      $xfer += $input->readFieldEnd();
+    }
+    $xfer += $input->readStructEnd();
+    return $xfer;
+  }
+
+  public function write($output) {
+    $xfer = 0;
+    $xfer += $output->writeStructBegin('TenantProfileService_getAllGateways_result');
+    if ($this->success !== null) {
+      if (!is_array($this->success)) {
+        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
+      }
+      $xfer += $output->writeFieldBegin('success', TType::LST, 0);
+      {
+        $output->writeListBegin(TType::STRUCT, count($this->success));
+        {
+          foreach ($this->success as $iter6)
+          {
+            $xfer += $iter6->write($output);
+          }
+        }
+        $output->writeListEnd();
+      }
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->tpe !== null) {
+      $xfer += $output->writeFieldBegin('tpe', TType::STRUCT, 1);
+      $xfer += $this->tpe->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->ae !== null) {
+      $xfer += $output->writeFieldBegin('ae', TType::STRUCT, 2);
+      $xfer += $this->ae->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
+class TenantProfileService_isGatewayExist_args {
+  static $_TSPEC;
+
+  /**
+   * @var \Airavata\Model\Security\AuthzToken
+   */
+  public $authzToken = null;
+  /**
+   * @var string
+   */
+  public $gatewayId = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        1 => array(
+          'var' => 'authzToken',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\Model\Security\AuthzToken',
+          ),
+        2 => array(
+          'var' => 'gatewayId',
+          'type' => TType::STRING,
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['authzToken'])) {
+        $this->authzToken = $vals['authzToken'];
+      }
+      if (isset($vals['gatewayId'])) {
+        $this->gatewayId = $vals['gatewayId'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'TenantProfileService_isGatewayExist_args';
+  }
+
+  public function read($input)
+  {
+    $xfer = 0;
+    $fname = null;
+    $ftype = 0;
+    $fid = 0;
+    $xfer += $input->readStructBegin($fname);
+    while (true)
+    {
+      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
+      if ($ftype == TType::STOP) {
+        break;
+      }
+      switch ($fid)
+      {
+        case 1:
+          if ($ftype == TType::STRUCT) {
+            $this->authzToken = new \Airavata\Model\Security\AuthzToken();
+            $xfer += $this->authzToken->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 2:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->gatewayId);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        default:
+          $xfer += $input->skip($ftype);
+          break;
+      }
+      $xfer += $input->readFieldEnd();
+    }
+    $xfer += $input->readStructEnd();
+    return $xfer;
+  }
+
+  public function write($output) {
+    $xfer = 0;
+    $xfer += $output->writeStructBegin('TenantProfileService_isGatewayExist_args');
+    if ($this->authzToken !== null) {
+      if (!is_object($this->authzToken)) {
+        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
+      }
+      $xfer += $output->writeFieldBegin('authzToken', TType::STRUCT, 1);
+      $xfer += $this->authzToken->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->gatewayId !== null) {
+      $xfer += $output->writeFieldBegin('gatewayId', TType::STRING, 2);
+      $xfer += $output->writeString($this->gatewayId);
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
+class TenantProfileService_isGatewayExist_result {
+  static $_TSPEC;
+
+  /**
+   * @var bool
+   */
+  public $success = null;
+  /**
+   * @var \Airavata\Service\Profile\Tenant\CPI\Error\TenantProfileServiceException
+   */
+  public $tpe = null;
+  /**
+   * @var \Airavata\API\Error\AuthorizationException
+   */
+  public $ae = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        0 => array(
+          'var' => 'success',
+          'type' => TType::BOOL,
+          ),
+        1 => array(
+          'var' => 'tpe',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\Service\Profile\Tenant\CPI\Error\TenantProfileServiceException',
+          ),
+        2 => array(
+          'var' => 'ae',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\API\Error\AuthorizationException',
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['success'])) {
+        $this->success = $vals['success'];
+      }
+      if (isset($vals['tpe'])) {
+        $this->tpe = $vals['tpe'];
+      }
+      if (isset($vals['ae'])) {
+        $this->ae = $vals['ae'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'TenantProfileService_isGatewayExist_result';
+  }
+
+  public function read($input)
+  {
+    $xfer = 0;
+    $fname = null;
+    $ftype = 0;
+    $fid = 0;
+    $xfer += $input->readStructBegin($fname);
+    while (true)
+    {
+      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
+      if ($ftype == TType::STOP) {
+        break;
+      }
+      switch ($fid)
+      {
+        case 0:
+          if ($ftype == TType::BOOL) {
+            $xfer += $input->readBool($this->success);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 1:
+          if ($ftype == TType::STRUCT) {
+            $this->tpe = new \Airavata\Service\Profile\Tenant\CPI\Error\TenantProfileServiceException();
+            $xfer += $this->tpe->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 2:
+          if ($ftype == TType::STRUCT) {
+            $this->ae = new \Airavata\API\Error\AuthorizationException();
+            $xfer += $this->ae->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        default:
+          $xfer += $input->skip($ftype);
+          break;
+      }
+      $xfer += $input->readFieldEnd();
+    }
+    $xfer += $input->readStructEnd();
+    return $xfer;
+  }
+
+  public function write($output) {
+    $xfer = 0;
+    $xfer += $output->writeStructBegin('TenantProfileService_isGatewayExist_result');
+    if ($this->success !== null) {
+      $xfer += $output->writeFieldBegin('success', TType::BOOL, 0);
+      $xfer += $output->writeBool($this->success);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->tpe !== null) {
+      $xfer += $output->writeFieldBegin('tpe', TType::STRUCT, 1);
+      $xfer += $this->tpe->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->ae !== null) {
+      $xfer += $output->writeFieldBegin('ae', TType::STRUCT, 2);
+      $xfer += $this->ae->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
+class TenantProfileService_getAllGatewaysForUser_args {
+  static $_TSPEC;
+
+  /**
+   * @var \Airavata\Model\Security\AuthzToken
+   */
+  public $authzToken = null;
+  /**
+   * @var string
+   */
+  public $requesterUsername = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        1 => array(
+          'var' => 'authzToken',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\Model\Security\AuthzToken',
+          ),
+        2 => array(
+          'var' => 'requesterUsername',
+          'type' => TType::STRING,
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['authzToken'])) {
+        $this->authzToken = $vals['authzToken'];
+      }
+      if (isset($vals['requesterUsername'])) {
+        $this->requesterUsername = $vals['requesterUsername'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'TenantProfileService_getAllGatewaysForUser_args';
+  }
+
+  public function read($input)
+  {
+    $xfer = 0;
+    $fname = null;
+    $ftype = 0;
+    $fid = 0;
+    $xfer += $input->readStructBegin($fname);
+    while (true)
+    {
+      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
+      if ($ftype == TType::STOP) {
+        break;
+      }
+      switch ($fid)
+      {
+        case 1:
+          if ($ftype == TType::STRUCT) {
+            $this->authzToken = new \Airavata\Model\Security\AuthzToken();
+            $xfer += $this->authzToken->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 2:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->requesterUsername);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        default:
+          $xfer += $input->skip($ftype);
+          break;
+      }
+      $xfer += $input->readFieldEnd();
+    }
+    $xfer += $input->readStructEnd();
+    return $xfer;
+  }
+
+  public function write($output) {
+    $xfer = 0;
+    $xfer += $output->writeStructBegin('TenantProfileService_getAllGatewaysForUser_args');
+    if ($this->authzToken !== null) {
+      if (!is_object($this->authzToken)) {
+        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
+      }
+      $xfer += $output->writeFieldBegin('authzToken', TType::STRUCT, 1);
+      $xfer += $this->authzToken->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->requesterUsername !== null) {
+      $xfer += $output->writeFieldBegin('requesterUsername', TType::STRING, 2);
+      $xfer += $output->writeString($this->requesterUsername);
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
+class TenantProfileService_getAllGatewaysForUser_result {
+  static $_TSPEC;
+
+  /**
+   * @var \Airavata\Model\Workspace\Gateway[]
+   */
+  public $success = null;
+  /**
+   * @var \Airavata\Service\Profile\Tenant\CPI\Error\TenantProfileServiceException
+   */
+  public $tpe = null;
+  /**
+   * @var \Airavata\API\Error\AuthorizationException
+   */
+  public $ae = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        0 => array(
+          'var' => 'success',
+          'type' => TType::LST,
+          'etype' => TType::STRUCT,
+          'elem' => array(
+            'type' => TType::STRUCT,
+            'class' => '\Airavata\Model\Workspace\Gateway',
+            ),
+          ),
+        1 => array(
+          'var' => 'tpe',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\Service\Profile\Tenant\CPI\Error\TenantProfileServiceException',
+          ),
+        2 => array(
+          'var' => 'ae',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\API\Error\AuthorizationException',
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['success'])) {
+        $this->success = $vals['success'];
+      }
+      if (isset($vals['tpe'])) {
+        $this->tpe = $vals['tpe'];
+      }
+      if (isset($vals['ae'])) {
+        $this->ae = $vals['ae'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'TenantProfileService_getAllGatewaysForUser_result';
+  }
+
+  public function read($input)
+  {
+    $xfer = 0;
+    $fname = null;
+    $ftype = 0;
+    $fid = 0;
+    $xfer += $input->readStructBegin($fname);
+    while (true)
+    {
+      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
+      if ($ftype == TType::STOP) {
+        break;
+      }
+      switch ($fid)
+      {
+        case 0:
+          if ($ftype == TType::LST) {
+            $this->success = array();
+            $_size7 = 0;
+            $_etype10 = 0;
+            $xfer += $input->readListBegin($_etype10, $_size7);
+            for ($_i11 = 0; $_i11 < $_size7; ++$_i11)
+            {
+              $elem12 = null;
+              $elem12 = new \Airavata\Model\Workspace\Gateway();
+              $xfer += $elem12->read($input);
+              $this->success []= $elem12;
+            }
+            $xfer += $input->readListEnd();
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 1:
+          if ($ftype == TType::STRUCT) {
+            $this->tpe = new \Airavata\Service\Profile\Tenant\CPI\Error\TenantProfileServiceException();
+            $xfer += $this->tpe->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 2:
+          if ($ftype == TType::STRUCT) {
+            $this->ae = new \Airavata\API\Error\AuthorizationException();
+            $xfer += $this->ae->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        default:
+          $xfer += $input->skip($ftype);
+          break;
+      }
+      $xfer += $input->readFieldEnd();
+    }
+    $xfer += $input->readStructEnd();
+    return $xfer;
+  }
+
+  public function write($output) {
+    $xfer = 0;
+    $xfer += $output->writeStructBegin('TenantProfileService_getAllGatewaysForUser_result');
+    if ($this->success !== null) {
+      if (!is_array($this->success)) {
+        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
+      }
+      $xfer += $output->writeFieldBegin('success', TType::LST, 0);
+      {
+        $output->writeListBegin(TType::STRUCT, count($this->success));
+        {
+          foreach ($this->success as $iter13)
+          {
+            $xfer += $iter13->write($output);
+          }
+        }
+        $output->writeListEnd();
+      }
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->tpe !== null) {
+      $xfer += $output->writeFieldBegin('tpe', TType::STRUCT, 1);
+      $xfer += $this->tpe->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->ae !== null) {
+      $xfer += $output->writeFieldBegin('ae', TType::STRUCT, 2);
+      $xfer += $this->ae->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
+

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/3c17052f/app/libraries/Airavata/Service/Profile/Tenant/CPI/Types.php
----------------------------------------------------------------------
diff --git a/app/libraries/Airavata/Service/Profile/Tenant/CPI/Types.php b/app/libraries/Airavata/Service/Profile/Tenant/CPI/Types.php
new file mode 100644
index 0000000..92038a2
--- /dev/null
+++ b/app/libraries/Airavata/Service/Profile/Tenant/CPI/Types.php
@@ -0,0 +1,33 @@
+<?php
+namespace Airavata\Service\Profile\Tenant\CPI;
+
+/**
+ * Autogenerated by Thrift Compiler (0.9.3)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ *  @generated
+ */
+use Thrift\Base\TBase;
+use Thrift\Type\TType;
+use Thrift\Type\TMessageType;
+use Thrift\Exception\TException;
+use Thrift\Exception\TProtocolException;
+use Thrift\Protocol\TProtocol;
+use Thrift\Protocol\TBinaryProtocolAccelerated;
+use Thrift\Exception\TApplicationException;
+
+
+final class Constant extends \Thrift\Type\TConstant {
+  static protected $TENANT_PROFILE_CPI_VERSION;
+  static protected $TENANT_PROFILE_CPI_NAME;
+
+  static protected function init_TENANT_PROFILE_CPI_VERSION() {
+    return "0.17";
+  }
+
+  static protected function init_TENANT_PROFILE_CPI_NAME() {
+    return "TenantProfileService";
+  }
+}
+
+

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/3c17052f/app/libraries/Airavata/Service/Profile/Types.php
----------------------------------------------------------------------
diff --git a/app/libraries/Airavata/Service/Profile/Types.php b/app/libraries/Airavata/Service/Profile/Types.php
new file mode 100644
index 0000000..f6eafb7
--- /dev/null
+++ b/app/libraries/Airavata/Service/Profile/Types.php
@@ -0,0 +1,20 @@
+<?php
+namespace Airavata\Service\Profile;
+
+/**
+ * Autogenerated by Thrift Compiler (0.9.3)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ *  @generated
+ */
+use Thrift\Base\TBase;
+use Thrift\Type\TType;
+use Thrift\Type\TMessageType;
+use Thrift\Exception\TException;
+use Thrift\Exception\TProtocolException;
+use Thrift\Protocol\TProtocol;
+use Thrift\Protocol\TBinaryProtocolAccelerated;
+use Thrift\Exception\TApplicationException;
+
+
+

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/3c17052f/app/libraries/Airavata/Service/Profile/User/CPI/Error/Types.php
----------------------------------------------------------------------
diff --git a/app/libraries/Airavata/Service/Profile/User/CPI/Error/Types.php b/app/libraries/Airavata/Service/Profile/User/CPI/Error/Types.php
new file mode 100644
index 0000000..b633c38
--- /dev/null
+++ b/app/libraries/Airavata/Service/Profile/User/CPI/Error/Types.php
@@ -0,0 +1,95 @@
+<?php
+namespace Airavata\Service\Profile\User\CPI\Error;
+
+/**
+ * Autogenerated by Thrift Compiler (0.9.3)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ *  @generated
+ */
+use Thrift\Base\TBase;
+use Thrift\Type\TType;
+use Thrift\Type\TMessageType;
+use Thrift\Exception\TException;
+use Thrift\Exception\TProtocolException;
+use Thrift\Protocol\TProtocol;
+use Thrift\Protocol\TBinaryProtocolAccelerated;
+use Thrift\Exception\TApplicationException;
+
+
+class UserProfileServiceException extends TException {
+  static $_TSPEC;
+
+  /**
+   * @var string
+   */
+  public $message = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        1 => array(
+          'var' => 'message',
+          'type' => TType::STRING,
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['message'])) {
+        $this->message = $vals['message'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'UserProfileServiceException';
+  }
+
+  public function read($input)
+  {
+    $xfer = 0;
+    $fname = null;
+    $ftype = 0;
+    $fid = 0;
+    $xfer += $input->readStructBegin($fname);
+    while (true)
+    {
+      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
+      if ($ftype == TType::STOP) {
+        break;
+      }
+      switch ($fid)
+      {
+        case 1:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->message);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        default:
+          $xfer += $input->skip($ftype);
+          break;
+      }
+      $xfer += $input->readFieldEnd();
+    }
+    $xfer += $input->readStructEnd();
+    return $xfer;
+  }
+
+  public function write($output) {
+    $xfer = 0;
+    $xfer += $output->writeStructBegin('UserProfileServiceException');
+    if ($this->message !== null) {
+      $xfer += $output->writeFieldBegin('message', TType::STRING, 1);
+      $xfer += $output->writeString($this->message);
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
+

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/3c17052f/app/libraries/Airavata/Service/Profile/User/CPI/Types.php
----------------------------------------------------------------------
diff --git a/app/libraries/Airavata/Service/Profile/User/CPI/Types.php b/app/libraries/Airavata/Service/Profile/User/CPI/Types.php
new file mode 100644
index 0000000..c5c6626
--- /dev/null
+++ b/app/libraries/Airavata/Service/Profile/User/CPI/Types.php
@@ -0,0 +1,33 @@
+<?php
+namespace Airavata\Service\Profile\User\CPI;
+
+/**
+ * Autogenerated by Thrift Compiler (0.9.3)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ *  @generated
+ */
+use Thrift\Base\TBase;
+use Thrift\Type\TType;
+use Thrift\Type\TMessageType;
+use Thrift\Exception\TException;
+use Thrift\Exception\TProtocolException;
+use Thrift\Protocol\TProtocol;
+use Thrift\Protocol\TBinaryProtocolAccelerated;
+use Thrift\Exception\TApplicationException;
+
+
+final class Constant extends \Thrift\Type\TConstant {
+  static protected $USER_PROFILE_CPI_VERSION;
+  static protected $USER_PROFILE_CPI_NAME;
+
+  static protected function init_USER_PROFILE_CPI_VERSION() {
+    return "0.17";
+  }
+
+  static protected function init_USER_PROFILE_CPI_NAME() {
+    return "UserProfileService";
+  }
+}
+
+


[39/50] [abbrv] airavata-php-gateway git commit: AIRAVATA-2342 Setting cafile_path for all Keycloak API calls

Posted by ma...@apache.org.
AIRAVATA-2342 Setting cafile_path for all Keycloak API calls


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

Branch: refs/heads/develop
Commit: 12bcfca3e7c820188dc2c12a709b874c39995730
Parents: 9f754b2
Author: Marcus Christie <ma...@iu.edu>
Authored: Wed May 24 17:32:34 2017 -0400
Committer: Marcus Christie <ma...@iu.edu>
Committed: Wed May 24 17:32:34 2017 -0400

----------------------------------------------------------------------
 app/libraries/Keycloak/API/BaseKeycloakAPIEndpoint.php | 6 ++++--
 app/libraries/Keycloak/Keycloak.php                    | 8 ++++----
 app/libraries/Keycloak/KeycloakUtil.php                | 3 ++-
 3 files changed, 10 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/12bcfca3/app/libraries/Keycloak/API/BaseKeycloakAPIEndpoint.php
----------------------------------------------------------------------
diff --git a/app/libraries/Keycloak/API/BaseKeycloakAPIEndpoint.php b/app/libraries/Keycloak/API/BaseKeycloakAPIEndpoint.php
index 9f9740f..93e7f7d 100644
--- a/app/libraries/Keycloak/API/BaseKeycloakAPIEndpoint.php
+++ b/app/libraries/Keycloak/API/BaseKeycloakAPIEndpoint.php
@@ -12,16 +12,18 @@ class BaseKeycloakAPIEndpoint {
     protected $admin_username;
     protected $admin_password;
     protected $verify_peer;
+    protected $cafile_path;
 
-    function __construct($base_endpoint_url, $admin_username, $admin_password, $verify_peer) {
+    function __construct($base_endpoint_url, $admin_username, $admin_password, $verify_peer, $cafile_path) {
         $this->base_endpoint_url = $base_endpoint_url;
         $this->admin_username = $admin_username;
         $this->admin_password = $admin_password;
         $this->verify_peer = $verify_peer;
+        $this->cafile_path = $cafile_path;
     }
 
     protected function getAPIAccessToken($realm) {
 
-        return KeycloakUtil::getAPIAccessToken($this->base_endpoint_url, $realm, $this->admin_username, $this->admin_password, $this->verify_peer);
+        return KeycloakUtil::getAPIAccessToken($this->base_endpoint_url, $realm, $this->admin_username, $this->admin_password, $this->verify_peer, $this->cafile_path);
     }
 }

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/12bcfca3/app/libraries/Keycloak/Keycloak.php
----------------------------------------------------------------------
diff --git a/app/libraries/Keycloak/Keycloak.php b/app/libraries/Keycloak/Keycloak.php
index 6a7ecad..7f0d511 100644
--- a/app/libraries/Keycloak/Keycloak.php
+++ b/app/libraries/Keycloak/Keycloak.php
@@ -49,9 +49,9 @@ class Keycloak {
         $this->admin_password = $admin_password;
         $this->gateway_id = $gateway_id;
 
-        $this->role_mapper = new RoleMapper($base_endpoint_url, $admin_username, $admin_password, $verify_peer);
-        $this->roles = new Roles($base_endpoint_url, $admin_username, $admin_password, $verify_peer);
-        $this->users = new Users($base_endpoint_url, $admin_username, $admin_password, $verify_peer);
+        $this->role_mapper = new RoleMapper($base_endpoint_url, $admin_username, $admin_password, $verify_peer, $this->cafile_path);
+        $this->roles = new Roles($base_endpoint_url, $admin_username, $admin_password, $verify_peer, $this->cafile_path);
+        $this->users = new Users($base_endpoint_url, $admin_username, $admin_password, $verify_peer, $this->cafile_path);
     }
 
     /**
@@ -401,7 +401,7 @@ class Keycloak {
 
     public function getAdminAuthzToken() {
 
-        $access_token = KeycloakUtil::getAPIAccessToken($this->base_endpoint_url, $this->realm, $this->admin_username, $this->admin_password, $this->verify_peer);
+        $access_token = KeycloakUtil::getAPIAccessToken($this->base_endpoint_url, $this->realm, $this->admin_username, $this->admin_password, $this->verify_peer, $this->cafile_path);
         $authzToken = new \Airavata\Model\Security\AuthzToken();
         $authzToken->accessToken = $access_token;
         $authzToken->claimsMap['gatewayID'] = $this->gateway_id;

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/12bcfca3/app/libraries/Keycloak/KeycloakUtil.php
----------------------------------------------------------------------
diff --git a/app/libraries/Keycloak/KeycloakUtil.php b/app/libraries/Keycloak/KeycloakUtil.php
index ce5e779..6628052 100644
--- a/app/libraries/Keycloak/KeycloakUtil.php
+++ b/app/libraries/Keycloak/KeycloakUtil.php
@@ -6,7 +6,7 @@ use Log;
 
 class KeycloakUtil {
 
-    public static function getAPIAccessToken($base_endpoint_url, $realm, $admin_username, $admin_password, $verify_peer) {
+    public static function getAPIAccessToken($base_endpoint_url, $realm, $admin_username, $admin_password, $verify_peer, $cafile_path) {
 
         // http://www.keycloak.org/docs/2.5/server_development/topics/admin-rest-api.html
         // curl -d client_id=admin-cli -d username=username \
@@ -16,6 +16,7 @@ class KeycloakUtil {
         curl_setopt($r, CURLOPT_RETURNTRANSFER, 1);
         curl_setopt($r, CURLOPT_ENCODING, 1);
         curl_setopt($r, CURLOPT_SSL_VERIFYPEER, $verify_peer);
+        curl_setopt($r, CURLOPT_CAINFO, $cafile_path);
 
         // Assemble POST parameters for the request.
         $post_fields = "client_id=admin-cli&username=" . urlencode($admin_username) . "&password=" . urlencode($admin_password) . "&grant_type=password";


[29/50] [abbrv] airavata-php-gateway git commit: Regenerated Thrift stub code and models

Posted by ma...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/d656b4ec/app/libraries/Airavata/Model/User/Types.php
----------------------------------------------------------------------
diff --git a/app/libraries/Airavata/Model/User/Types.php b/app/libraries/Airavata/Model/User/Types.php
index c9aa616..1ebd5db 100644
--- a/app/libraries/Airavata/Model/User/Types.php
+++ b/app/libraries/Airavata/Model/User/Types.php
@@ -133,6 +133,10 @@ class NSFDemographics {
   /**
    * @var string
    */
+  public $airavataInternalUserId = "DO_NOT_SET_AT_CLIENTS";
+  /**
+   * @var string
+   */
   public $gender = null;
   /**
    * @var int
@@ -155,14 +159,18 @@ class NSFDemographics {
     if (!isset(self::$_TSPEC)) {
       self::$_TSPEC = array(
         1 => array(
-          'var' => 'gender',
+          'var' => 'airavataInternalUserId',
           'type' => TType::STRING,
           ),
         2 => array(
+          'var' => 'gender',
+          'type' => TType::STRING,
+          ),
+        3 => array(
           'var' => 'usCitizenship',
           'type' => TType::I32,
           ),
-        3 => array(
+        4 => array(
           'var' => 'ethnicities',
           'type' => TType::LST,
           'etype' => TType::I32,
@@ -170,7 +178,7 @@ class NSFDemographics {
             'type' => TType::I32,
             ),
           ),
-        4 => array(
+        5 => array(
           'var' => 'races',
           'type' => TType::LST,
           'etype' => TType::I32,
@@ -178,7 +186,7 @@ class NSFDemographics {
             'type' => TType::I32,
             ),
           ),
-        5 => array(
+        6 => array(
           'var' => 'disabilities',
           'type' => TType::LST,
           'etype' => TType::I32,
@@ -189,6 +197,9 @@ class NSFDemographics {
         );
     }
     if (is_array($vals)) {
+      if (isset($vals['airavataInternalUserId'])) {
+        $this->airavataInternalUserId = $vals['airavataInternalUserId'];
+      }
       if (isset($vals['gender'])) {
         $this->gender = $vals['gender'];
       }
@@ -228,19 +239,26 @@ class NSFDemographics {
       {
         case 1:
           if ($ftype == TType::STRING) {
-            $xfer += $input->readString($this->gender);
+            $xfer += $input->readString($this->airavataInternalUserId);
           } else {
             $xfer += $input->skip($ftype);
           }
           break;
         case 2:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->gender);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 3:
           if ($ftype == TType::I32) {
             $xfer += $input->readI32($this->usCitizenship);
           } else {
             $xfer += $input->skip($ftype);
           }
           break;
-        case 3:
+        case 4:
           if ($ftype == TType::LST) {
             $this->ethnicities = array();
             $_size0 = 0;
@@ -257,7 +275,7 @@ class NSFDemographics {
             $xfer += $input->skip($ftype);
           }
           break;
-        case 4:
+        case 5:
           if ($ftype == TType::LST) {
             $this->races = array();
             $_size6 = 0;
@@ -274,7 +292,7 @@ class NSFDemographics {
             $xfer += $input->skip($ftype);
           }
           break;
-        case 5:
+        case 6:
           if ($ftype == TType::LST) {
             $this->disabilities = array();
             $_size12 = 0;
@@ -304,13 +322,18 @@ class NSFDemographics {
   public function write($output) {
     $xfer = 0;
     $xfer += $output->writeStructBegin('NSFDemographics');
+    if ($this->airavataInternalUserId !== null) {
+      $xfer += $output->writeFieldBegin('airavataInternalUserId', TType::STRING, 1);
+      $xfer += $output->writeString($this->airavataInternalUserId);
+      $xfer += $output->writeFieldEnd();
+    }
     if ($this->gender !== null) {
-      $xfer += $output->writeFieldBegin('gender', TType::STRING, 1);
+      $xfer += $output->writeFieldBegin('gender', TType::STRING, 2);
       $xfer += $output->writeString($this->gender);
       $xfer += $output->writeFieldEnd();
     }
     if ($this->usCitizenship !== null) {
-      $xfer += $output->writeFieldBegin('usCitizenship', TType::I32, 2);
+      $xfer += $output->writeFieldBegin('usCitizenship', TType::I32, 3);
       $xfer += $output->writeI32($this->usCitizenship);
       $xfer += $output->writeFieldEnd();
     }
@@ -318,7 +341,7 @@ class NSFDemographics {
       if (!is_array($this->ethnicities)) {
         throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
       }
-      $xfer += $output->writeFieldBegin('ethnicities', TType::LST, 3);
+      $xfer += $output->writeFieldBegin('ethnicities', TType::LST, 4);
       {
         $output->writeListBegin(TType::I32, count($this->ethnicities));
         {
@@ -335,7 +358,7 @@ class NSFDemographics {
       if (!is_array($this->races)) {
         throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
       }
-      $xfer += $output->writeFieldBegin('races', TType::LST, 4);
+      $xfer += $output->writeFieldBegin('races', TType::LST, 5);
       {
         $output->writeListBegin(TType::I32, count($this->races));
         {
@@ -352,7 +375,7 @@ class NSFDemographics {
       if (!is_array($this->disabilities)) {
         throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
       }
-      $xfer += $output->writeFieldBegin('disabilities', TType::LST, 5);
+      $xfer += $output->writeFieldBegin('disabilities', TType::LST, 6);
       {
         $output->writeListBegin(TType::I32, count($this->disabilities));
         {
@@ -393,6 +416,12 @@ class NSFDemographics {
  * *  Externally assertable unique identifier. SAML (primarly in higher education, academic) tends to keep
  * *   user name less opaque. OpenID Connect maintains them to be opaque.
  * *
+ * * firstName, middleName, lastName:
+ * *  First and Last names as assertede by the user
+ * *
+ * * namePrefix, nameSuffix:
+ * *  prefix and suffix to the users name as asserted by the user
+ * *
  * * emails:
  * *   Email identifier are Verified, REQUIRED and MULTIVALUED
  * *
@@ -450,6 +479,26 @@ class UserProfile {
   /**
    * @var string
    */
+  public $firstName = null;
+  /**
+   * @var string
+   */
+  public $lastName = null;
+  /**
+   * @var string
+   */
+  public $middleName = null;
+  /**
+   * @var string
+   */
+  public $namePrefix = null;
+  /**
+   * @var string
+   */
+  public $nameSuffix = null;
+  /**
+   * @var string
+   */
   public $userName = null;
   /**
    * @var string
@@ -476,15 +525,15 @@ class UserProfile {
    */
   public $orginationAffiliation = null;
   /**
-   * @var string
+   * @var int
    */
   public $creationTime = null;
   /**
-   * @var string
+   * @var int
    */
   public $lastAccessTime = null;
   /**
-   * @var string
+   * @var int
    */
   public $validUntil = null;
   /**
@@ -540,14 +589,34 @@ class UserProfile {
             ),
           ),
         6 => array(
-          'var' => 'userName',
+          'var' => 'firstName',
           'type' => TType::STRING,
           ),
         7 => array(
-          'var' => 'orcidId',
+          'var' => 'lastName',
           'type' => TType::STRING,
           ),
         8 => array(
+          'var' => 'middleName',
+          'type' => TType::STRING,
+          ),
+        9 => array(
+          'var' => 'namePrefix',
+          'type' => TType::STRING,
+          ),
+        10 => array(
+          'var' => 'nameSuffix',
+          'type' => TType::STRING,
+          ),
+        11 => array(
+          'var' => 'userName',
+          'type' => TType::STRING,
+          ),
+        12 => array(
+          'var' => 'orcidId',
+          'type' => TType::STRING,
+          ),
+        13 => array(
           'var' => 'phones',
           'type' => TType::LST,
           'etype' => TType::STRING,
@@ -555,11 +624,11 @@ class UserProfile {
             'type' => TType::STRING,
             ),
           ),
-        9 => array(
+        14 => array(
           'var' => 'country',
           'type' => TType::STRING,
           ),
-        10 => array(
+        15 => array(
           'var' => 'nationality',
           'type' => TType::LST,
           'etype' => TType::STRING,
@@ -567,35 +636,35 @@ class UserProfile {
             'type' => TType::STRING,
             ),
           ),
-        11 => array(
+        16 => array(
           'var' => 'homeOrganization',
           'type' => TType::STRING,
           ),
-        12 => array(
+        17 => array(
           'var' => 'orginationAffiliation',
           'type' => TType::STRING,
           ),
-        13 => array(
+        18 => array(
           'var' => 'creationTime',
-          'type' => TType::STRING,
+          'type' => TType::I64,
           ),
-        14 => array(
+        19 => array(
           'var' => 'lastAccessTime',
-          'type' => TType::STRING,
+          'type' => TType::I64,
           ),
-        15 => array(
+        20 => array(
           'var' => 'validUntil',
-          'type' => TType::STRING,
+          'type' => TType::I64,
           ),
-        16 => array(
+        21 => array(
           'var' => 'State',
           'type' => TType::I32,
           ),
-        17 => array(
+        22 => array(
           'var' => 'comments',
           'type' => TType::STRING,
           ),
-        18 => array(
+        23 => array(
           'var' => 'labeledURI',
           'type' => TType::LST,
           'etype' => TType::STRING,
@@ -603,15 +672,15 @@ class UserProfile {
             'type' => TType::STRING,
             ),
           ),
-        19 => array(
+        24 => array(
           'var' => 'gpgKey',
           'type' => TType::STRING,
           ),
-        20 => array(
+        25 => array(
           'var' => 'timeZone',
           'type' => TType::STRING,
           ),
-        21 => array(
+        26 => array(
           'var' => 'nsfDemographics',
           'type' => TType::STRUCT,
           'class' => '\Airavata\Model\User\NSFDemographics',
@@ -634,6 +703,21 @@ class UserProfile {
       if (isset($vals['emails'])) {
         $this->emails = $vals['emails'];
       }
+      if (isset($vals['firstName'])) {
+        $this->firstName = $vals['firstName'];
+      }
+      if (isset($vals['lastName'])) {
+        $this->lastName = $vals['lastName'];
+      }
+      if (isset($vals['middleName'])) {
+        $this->middleName = $vals['middleName'];
+      }
+      if (isset($vals['namePrefix'])) {
+        $this->namePrefix = $vals['namePrefix'];
+      }
+      if (isset($vals['nameSuffix'])) {
+        $this->nameSuffix = $vals['nameSuffix'];
+      }
       if (isset($vals['userName'])) {
         $this->userName = $vals['userName'];
       }
@@ -751,19 +835,54 @@ class UserProfile {
           break;
         case 6:
           if ($ftype == TType::STRING) {
-            $xfer += $input->readString($this->userName);
+            $xfer += $input->readString($this->firstName);
           } else {
             $xfer += $input->skip($ftype);
           }
           break;
         case 7:
           if ($ftype == TType::STRING) {
-            $xfer += $input->readString($this->orcidId);
+            $xfer += $input->readString($this->lastName);
           } else {
             $xfer += $input->skip($ftype);
           }
           break;
         case 8:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->middleName);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 9:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->namePrefix);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 10:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->nameSuffix);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 11:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->userName);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 12:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->orcidId);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 13:
           if ($ftype == TType::LST) {
             $this->phones = array();
             $_size27 = 0;
@@ -780,14 +899,14 @@ class UserProfile {
             $xfer += $input->skip($ftype);
           }
           break;
-        case 9:
+        case 14:
           if ($ftype == TType::STRING) {
             $xfer += $input->readString($this->country);
           } else {
             $xfer += $input->skip($ftype);
           }
           break;
-        case 10:
+        case 15:
           if ($ftype == TType::LST) {
             $this->nationality = array();
             $_size33 = 0;
@@ -804,56 +923,56 @@ class UserProfile {
             $xfer += $input->skip($ftype);
           }
           break;
-        case 11:
+        case 16:
           if ($ftype == TType::STRING) {
             $xfer += $input->readString($this->homeOrganization);
           } else {
             $xfer += $input->skip($ftype);
           }
           break;
-        case 12:
+        case 17:
           if ($ftype == TType::STRING) {
             $xfer += $input->readString($this->orginationAffiliation);
           } else {
             $xfer += $input->skip($ftype);
           }
           break;
-        case 13:
-          if ($ftype == TType::STRING) {
-            $xfer += $input->readString($this->creationTime);
+        case 18:
+          if ($ftype == TType::I64) {
+            $xfer += $input->readI64($this->creationTime);
           } else {
             $xfer += $input->skip($ftype);
           }
           break;
-        case 14:
-          if ($ftype == TType::STRING) {
-            $xfer += $input->readString($this->lastAccessTime);
+        case 19:
+          if ($ftype == TType::I64) {
+            $xfer += $input->readI64($this->lastAccessTime);
           } else {
             $xfer += $input->skip($ftype);
           }
           break;
-        case 15:
-          if ($ftype == TType::STRING) {
-            $xfer += $input->readString($this->validUntil);
+        case 20:
+          if ($ftype == TType::I64) {
+            $xfer += $input->readI64($this->validUntil);
           } else {
             $xfer += $input->skip($ftype);
           }
           break;
-        case 16:
+        case 21:
           if ($ftype == TType::I32) {
             $xfer += $input->readI32($this->State);
           } else {
             $xfer += $input->skip($ftype);
           }
           break;
-        case 17:
+        case 22:
           if ($ftype == TType::STRING) {
             $xfer += $input->readString($this->comments);
           } else {
             $xfer += $input->skip($ftype);
           }
           break;
-        case 18:
+        case 23:
           if ($ftype == TType::LST) {
             $this->labeledURI = array();
             $_size39 = 0;
@@ -870,21 +989,21 @@ class UserProfile {
             $xfer += $input->skip($ftype);
           }
           break;
-        case 19:
+        case 24:
           if ($ftype == TType::STRING) {
             $xfer += $input->readString($this->gpgKey);
           } else {
             $xfer += $input->skip($ftype);
           }
           break;
-        case 20:
+        case 25:
           if ($ftype == TType::STRING) {
             $xfer += $input->readString($this->timeZone);
           } else {
             $xfer += $input->skip($ftype);
           }
           break;
-        case 21:
+        case 26:
           if ($ftype == TType::STRUCT) {
             $this->nsfDemographics = new \Airavata\Model\User\NSFDemographics();
             $xfer += $this->nsfDemographics->read($input);
@@ -942,13 +1061,38 @@ class UserProfile {
       }
       $xfer += $output->writeFieldEnd();
     }
+    if ($this->firstName !== null) {
+      $xfer += $output->writeFieldBegin('firstName', TType::STRING, 6);
+      $xfer += $output->writeString($this->firstName);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->lastName !== null) {
+      $xfer += $output->writeFieldBegin('lastName', TType::STRING, 7);
+      $xfer += $output->writeString($this->lastName);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->middleName !== null) {
+      $xfer += $output->writeFieldBegin('middleName', TType::STRING, 8);
+      $xfer += $output->writeString($this->middleName);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->namePrefix !== null) {
+      $xfer += $output->writeFieldBegin('namePrefix', TType::STRING, 9);
+      $xfer += $output->writeString($this->namePrefix);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->nameSuffix !== null) {
+      $xfer += $output->writeFieldBegin('nameSuffix', TType::STRING, 10);
+      $xfer += $output->writeString($this->nameSuffix);
+      $xfer += $output->writeFieldEnd();
+    }
     if ($this->userName !== null) {
-      $xfer += $output->writeFieldBegin('userName', TType::STRING, 6);
+      $xfer += $output->writeFieldBegin('userName', TType::STRING, 11);
       $xfer += $output->writeString($this->userName);
       $xfer += $output->writeFieldEnd();
     }
     if ($this->orcidId !== null) {
-      $xfer += $output->writeFieldBegin('orcidId', TType::STRING, 7);
+      $xfer += $output->writeFieldBegin('orcidId', TType::STRING, 12);
       $xfer += $output->writeString($this->orcidId);
       $xfer += $output->writeFieldEnd();
     }
@@ -956,7 +1100,7 @@ class UserProfile {
       if (!is_array($this->phones)) {
         throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
       }
-      $xfer += $output->writeFieldBegin('phones', TType::LST, 8);
+      $xfer += $output->writeFieldBegin('phones', TType::LST, 13);
       {
         $output->writeListBegin(TType::STRING, count($this->phones));
         {
@@ -970,7 +1114,7 @@ class UserProfile {
       $xfer += $output->writeFieldEnd();
     }
     if ($this->country !== null) {
-      $xfer += $output->writeFieldBegin('country', TType::STRING, 9);
+      $xfer += $output->writeFieldBegin('country', TType::STRING, 14);
       $xfer += $output->writeString($this->country);
       $xfer += $output->writeFieldEnd();
     }
@@ -978,7 +1122,7 @@ class UserProfile {
       if (!is_array($this->nationality)) {
         throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
       }
-      $xfer += $output->writeFieldBegin('nationality', TType::LST, 10);
+      $xfer += $output->writeFieldBegin('nationality', TType::LST, 15);
       {
         $output->writeListBegin(TType::STRING, count($this->nationality));
         {
@@ -992,37 +1136,37 @@ class UserProfile {
       $xfer += $output->writeFieldEnd();
     }
     if ($this->homeOrganization !== null) {
-      $xfer += $output->writeFieldBegin('homeOrganization', TType::STRING, 11);
+      $xfer += $output->writeFieldBegin('homeOrganization', TType::STRING, 16);
       $xfer += $output->writeString($this->homeOrganization);
       $xfer += $output->writeFieldEnd();
     }
     if ($this->orginationAffiliation !== null) {
-      $xfer += $output->writeFieldBegin('orginationAffiliation', TType::STRING, 12);
+      $xfer += $output->writeFieldBegin('orginationAffiliation', TType::STRING, 17);
       $xfer += $output->writeString($this->orginationAffiliation);
       $xfer += $output->writeFieldEnd();
     }
     if ($this->creationTime !== null) {
-      $xfer += $output->writeFieldBegin('creationTime', TType::STRING, 13);
-      $xfer += $output->writeString($this->creationTime);
+      $xfer += $output->writeFieldBegin('creationTime', TType::I64, 18);
+      $xfer += $output->writeI64($this->creationTime);
       $xfer += $output->writeFieldEnd();
     }
     if ($this->lastAccessTime !== null) {
-      $xfer += $output->writeFieldBegin('lastAccessTime', TType::STRING, 14);
-      $xfer += $output->writeString($this->lastAccessTime);
+      $xfer += $output->writeFieldBegin('lastAccessTime', TType::I64, 19);
+      $xfer += $output->writeI64($this->lastAccessTime);
       $xfer += $output->writeFieldEnd();
     }
     if ($this->validUntil !== null) {
-      $xfer += $output->writeFieldBegin('validUntil', TType::STRING, 15);
-      $xfer += $output->writeString($this->validUntil);
+      $xfer += $output->writeFieldBegin('validUntil', TType::I64, 20);
+      $xfer += $output->writeI64($this->validUntil);
       $xfer += $output->writeFieldEnd();
     }
     if ($this->State !== null) {
-      $xfer += $output->writeFieldBegin('State', TType::I32, 16);
+      $xfer += $output->writeFieldBegin('State', TType::I32, 21);
       $xfer += $output->writeI32($this->State);
       $xfer += $output->writeFieldEnd();
     }
     if ($this->comments !== null) {
-      $xfer += $output->writeFieldBegin('comments', TType::STRING, 17);
+      $xfer += $output->writeFieldBegin('comments', TType::STRING, 22);
       $xfer += $output->writeString($this->comments);
       $xfer += $output->writeFieldEnd();
     }
@@ -1030,7 +1174,7 @@ class UserProfile {
       if (!is_array($this->labeledURI)) {
         throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
       }
-      $xfer += $output->writeFieldBegin('labeledURI', TType::LST, 18);
+      $xfer += $output->writeFieldBegin('labeledURI', TType::LST, 23);
       {
         $output->writeListBegin(TType::STRING, count($this->labeledURI));
         {
@@ -1044,12 +1188,12 @@ class UserProfile {
       $xfer += $output->writeFieldEnd();
     }
     if ($this->gpgKey !== null) {
-      $xfer += $output->writeFieldBegin('gpgKey', TType::STRING, 19);
+      $xfer += $output->writeFieldBegin('gpgKey', TType::STRING, 24);
       $xfer += $output->writeString($this->gpgKey);
       $xfer += $output->writeFieldEnd();
     }
     if ($this->timeZone !== null) {
-      $xfer += $output->writeFieldBegin('timeZone', TType::STRING, 20);
+      $xfer += $output->writeFieldBegin('timeZone', TType::STRING, 25);
       $xfer += $output->writeString($this->timeZone);
       $xfer += $output->writeFieldEnd();
     }
@@ -1057,7 +1201,7 @@ class UserProfile {
       if (!is_object($this->nsfDemographics)) {
         throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
       }
-      $xfer += $output->writeFieldBegin('nsfDemographics', TType::STRUCT, 21);
+      $xfer += $output->writeFieldBegin('nsfDemographics', TType::STRUCT, 26);
       $xfer += $this->nsfDemographics->write($output);
       $xfer += $output->writeFieldEnd();
     }


[16/50] [abbrv] airavata-php-gateway git commit: AIRAVATA-2342 Fixing getting user profile for role management

Posted by ma...@apache.org.
AIRAVATA-2342 Fixing getting user profile for role management


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

Branch: refs/heads/develop
Commit: e4c524e891de891a3dc3625faf9ef5fd1f323e9b
Parents: b55a828
Author: Marcus Christie <ma...@iu.edu>
Authored: Fri Mar 24 15:53:16 2017 -0400
Committer: Marcus Christie <ma...@iu.edu>
Committed: Fri Mar 24 15:53:16 2017 -0400

----------------------------------------------------------------------
 app/controllers/AdminController.php | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/e4c524e8/app/controllers/AdminController.php
----------------------------------------------------------------------
diff --git a/app/controllers/AdminController.php b/app/controllers/AdminController.php
index 94b11b8..46caa9a 100644
--- a/app/controllers/AdminController.php
+++ b/app/controllers/AdminController.php
@@ -233,7 +233,7 @@ class AdminController extends BaseController {
         $newCurrentRoles = Keycloak::getUserRoles($userId);
         if(in_array(Config::get("pga_config.wsis")["admin-role-name"], $newCurrentRoles) || in_array(Config::get("pga_config.wsis")["read-only-admin-role-name"], $newCurrentRoles)
                 || in_array(Config::get("pga_config.wsis")["user-role-name"], $newCurrentRoles)){
-            $userProfile = Keycloak::getUserProfile($userId);
+            $userProfile = Keycloak::getUserProfile(Input::get("username"));
             $recipients = array($userProfile["email"]);
             $this->sendAccessGrantedEmailToTheUser(Input::get("username"), $userId, $recipients);
 
@@ -327,7 +327,7 @@ class AdminController extends BaseController {
 		$mail->isHTML(true);
 
 		$mail->Subject = "Your user account (".$username.") privileges changed!";
-		$userProfile = Keycloak::getUserProfile($userId);
+		$userProfile = Keycloak::getUserProfile($username);
 		$wsisConfig = Config::get('pga_config.wsis');
 		if( $wsisConfig['tenant-domain'] == "")
 			$username = $username;


[09/50] [abbrv] airavata-php-gateway git commit: handling username '@' split differently

Posted by ma...@apache.org.
handling username '@' split differently


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

Branch: refs/heads/develop
Commit: 1c6c44d56c187e30b275e4bf9f91556bb08fedee
Parents: 471b380
Author: scnakandala <su...@gmail.com>
Authored: Fri Mar 24 10:19:36 2017 -0400
Committer: scnakandala <su...@gmail.com>
Committed: Fri Mar 24 10:19:36 2017 -0400

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


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/1c6c44d5/app/libraries/GrouperUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/GrouperUtilities.php b/app/libraries/GrouperUtilities.php
index e73fdc3..62714f4 100644
--- a/app/libraries/GrouperUtilities.php
+++ b/app/libraries/GrouperUtilities.php
@@ -25,7 +25,7 @@ class GrouperUtilities
         foreach($userPermissionMap as $key=> $value){
             if (strpos($key, '@') !== false) {
                 $parts = explode('@', $key);
-                $key = $parts[0] . "@" . Config::get('pga_config.airavata')['gateway-id'];
+                $key = join('@', array_slice($parts, 0, -1)) . "@" . Config::get('pga_config.airavata')['gateway-id'];
             }else{
                 $key = $key . "@" . Config::get('pga_config.airavata')['gateway-id'];
             }
@@ -45,7 +45,7 @@ class GrouperUtilities
         foreach($userPermissionMap as $key=> $value){
             if (strpos($key, '@') !== false) {
                 $parts = explode('@', $key);
-                $key = $parts[0] . "@" . Config::get('pga_config.airavata')['gateway-id'];
+                $key = join('@', array_slice($parts, 0, -1)) . "@" . Config::get('pga_config.airavata')['gateway-id'];
             }else{
                 $key = $key . "@" . Config::get('pga_config.airavata')['gateway-id'];
             }
@@ -67,7 +67,7 @@ class GrouperUtilities
         foreach ($temp as $key => $u) {
             if (strpos($u, '@') !== false) {
                 $parts = explode('@', $u);
-                $u = $parts[0];
+                $u = $key = join('@', array_slice($parts, 0, -1));
             }
             $userList[] = $u;
         }
@@ -81,7 +81,7 @@ class GrouperUtilities
     public static function createGroup($group){
         if (strpos($group->ownerId, '@') !== false) {
             $parts = explode('@', $group->ownerId);
-            $group->ownerId = $parts[0] . "@" . Config::get('pga_config.airavata')['gateway-id'];
+            $group->ownerId = join('@', array_slice($parts, 0, -1)) . "@" . Config::get('pga_config.airavata')['gateway-id'];
         }else{
             $group->ownerId = $group->ownerId . "@" . Config::get('pga_config.airavata')['gateway-id'];
         }
@@ -95,7 +95,7 @@ class GrouperUtilities
     public static function updateGroup($group){
         if (strpos($group->ownerId, '@') !== false) {
             $parts = explode('@', $group->ownerId);
-            $group->ownerId = $parts[0] . "@" . Config::get('pga_config.airavata')['gateway-id'];
+            $group->ownerId = join('@', array_slice($parts, 0, -1)) . "@" . Config::get('pga_config.airavata')['gateway-id'];
         }else{
             $group->ownerId = $group->ownerId . "@" . Config::get('pga_config.airavata')['gateway-id'];
         }
@@ -110,7 +110,7 @@ class GrouperUtilities
     public static function deleteGroup($groupId, $ownerName){
         if (strpos($ownerName, '@') !== false) {
             $parts = explode('@', $ownerName);
-            $ownerName = $parts[0];
+            $ownerName = join('@', array_slice($parts, 0, -1));
         }
 
         Airavata::deleteGroup(Session::get('authz-token'), $groupId, $ownerName, Config::get('pga_config.airavata')['gateway-id']);
@@ -131,7 +131,7 @@ class GrouperUtilities
     public static function getAllGroupsUserBelongs($userName){
         if (strpos($userName, '@') !== false) {
             $parts = explode('@', $userName);
-            $userName = $parts[0];
+            $userName = join('@', array_slice($parts, 0, -1));
         }
 
         return Airavata::getAllGroupsUserBelongs(Session::get('authz-token'), $userName,


[06/50] [abbrv] airavata-php-gateway git commit: AIRAVATA-2342 Fix adding realm role to user

Posted by ma...@apache.org.
AIRAVATA-2342 Fix adding realm role to user


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

Branch: refs/heads/develop
Commit: ee4e98a785eca23674c4ef19b3d022f65410cad2
Parents: 471b380
Author: Marcus Christie <ma...@iu.edu>
Authored: Thu Mar 23 15:21:39 2017 -0400
Committer: Marcus Christie <ma...@iu.edu>
Committed: Thu Mar 23 15:32:21 2017 -0400

----------------------------------------------------------------------
 app/libraries/Keycloak/API/RoleMapper.php | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/ee4e98a7/app/libraries/Keycloak/API/RoleMapper.php
----------------------------------------------------------------------
diff --git a/app/libraries/Keycloak/API/RoleMapper.php b/app/libraries/Keycloak/API/RoleMapper.php
index e79246e..738012b 100644
--- a/app/libraries/Keycloak/API/RoleMapper.php
+++ b/app/libraries/Keycloak/API/RoleMapper.php
@@ -1,6 +1,7 @@
 <?php
 namespace Keycloak\API;
 
+use Exception;
 use Log;
 
 /**
@@ -55,7 +56,6 @@ class RoleMapper {
         return $result;
     }
 
-    // TODO: change this to an Array of role representations
     public function addRealmRoleMappingsToUser($realm, $user_id, $role_representations) {
 
         // get access token for admin API
@@ -66,27 +66,23 @@ class RoleMapper {
         curl_setopt($r, CURLOPT_RETURNTRANSFER, 1);
         curl_setopt($r, CURLOPT_ENCODING, 1);
         curl_setopt($r, CURLOPT_SSL_VERIFYPEER, $this->verify_peer);
-        curl_setopt($r, CURLOPT_HTTPHEADER, array(
-            "Authorization: Bearer " . $access_token
-        ));
 
         curl_setopt($r, CURLOPT_POST, true);
         $data = json_encode($role_representations);
+        // Log::debug("addRealmRoleMappingsToUser data=$data");
         curl_setopt($r, CURLOPT_HTTPHEADER, array(
+            "Authorization: Bearer " . $access_token,
             'Content-Type: application/json',
             'Content-Length: ' . strlen($data))
         );
         curl_setopt($r, CURLOPT_POSTFIELDS, $data);
 
         $response = curl_exec($r);
-        if ($response == false) {
-            Log::error("Failed to add realm role mapping to user");
-            die("curl_exec() failed. Error: " . curl_error($r));
-        }
-        $result = json_decode($response);
         $info = curl_getinfo($r);
-        // Log::debug("addRealmRoleMappingsToUser result", array($result, $info));
-        return $result;
+        if ($info['http_code'] != 200 && $info['http_code'] != 204) {
+            throw new Exception("Failed to add realm role mapping to user");
+        }
+        return;
     }
 
     // TODO: factor this out into base class?


[31/50] [abbrv] airavata-php-gateway git commit: Regenerated Thrift stub code and models

Posted by ma...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/d656b4ec/app/libraries/Airavata/API/Airavata.php
----------------------------------------------------------------------
diff --git a/app/libraries/Airavata/API/Airavata.php b/app/libraries/Airavata/API/Airavata.php
index ae27035..23df7a4 100644
--- a/app/libraries/Airavata/API/Airavata.php
+++ b/app/libraries/Airavata/API/Airavata.php
@@ -4095,6 +4095,193 @@ interface AiravataIf {
    * @throws \Airavata\API\Error\AuthorizationException
    */
   public function getAllGroupsUserBelongs(\Airavata\Model\Security\AuthzToken $authzToken, $userName, $gatewayId);
+  /**
+   * @param \Airavata\Model\Security\AuthzToken $authzToken
+   * @param \Airavata\Model\User\UserProfile $userProfile
+   * @return string
+   * @throws \Airavata\API\Error\InvalidRequestException
+   * @throws \Airavata\API\Error\AiravataClientException
+   * @throws \Airavata\API\Error\AiravataSystemException
+   * @throws \Airavata\API\Error\AuthorizationException
+   */
+  public function addUserProfile(\Airavata\Model\Security\AuthzToken $authzToken, \Airavata\Model\User\UserProfile $userProfile);
+  /**
+   * @param \Airavata\Model\Security\AuthzToken $authzToken
+   * @param \Airavata\Model\User\UserProfile $userProfile
+   * @return bool
+   * @throws \Airavata\API\Error\InvalidRequestException
+   * @throws \Airavata\API\Error\AiravataClientException
+   * @throws \Airavata\API\Error\AiravataSystemException
+   * @throws \Airavata\API\Error\AuthorizationException
+   */
+  public function updateUserProfile(\Airavata\Model\Security\AuthzToken $authzToken, \Airavata\Model\User\UserProfile $userProfile);
+  /**
+   * @param \Airavata\Model\Security\AuthzToken $authzToken
+   * @param string $userId
+   * @param string $gatewayId
+   * @return \Airavata\Model\User\UserProfile * A structure holding the user profile and its child models.
+   * *
+   * * Notes:
+   * *  The model does not include passwords as it is assumed an external identity provider is used to authenticate user.
+   * *  References:
+   * *     NSF Demographic Information - http://www.nsf.gov/pubs/2000/00form1225/00form1225.doc
+   * *     LDAP Schema - https://tools.ietf.org/html/rfc4519
+   * *     SCIM 2.0 - https://tools.ietf.org/html/rfc7643
+   * *
+   * * userModelVersion:
+   * *  Version number of profile
+   * *
+   * * airavataInternalUserId:
+   * *  internal to Airavata, not intended to be used outside of the Airavata platform or possibly by gateways
+   * *  (that is, never shown to users), never reassigned, REQUIRED
+   * *
+   * * userId:
+   * *  Externally assertable unique identifier. SAML (primarly in higher education, academic) tends to keep
+   * *   user name less opaque. OpenID Connect maintains them to be opaque.
+   * *
+   * * firstName, middleName, lastName:
+   * *  First and Last names as assertede by the user
+   * *
+   * * namePrefix, nameSuffix:
+   * *  prefix and suffix to the users name as asserted by the user
+   * *
+   * * emails:
+   * *   Email identifier are Verified, REQUIRED and MULTIVALUED
+   * *
+   * * userName:
+   * *  Name-based identifiers can be multivalues. To keep it simple, Airavata will make it a string.
+   * *   In the future these can be enumerated as:
+   *     *   Official name (as asserted possibly by some external identity provider)
+   *     *   Prefered name (as asserted or suggested by user directly)
+   *     *   Components:
+   *     *      givenName
+   *     *      surname (familyName)
+   *     *      displayName (often asserted by user to handle things like middle names, suffix, prefix, and the like)
+   * *
+   * * orcidId: ORCID ID - http://orcid.org/about/what-is-orcid)
+   * *
+   * * phones: Telephone MULTIVALUED
+   * *
+   * * country: Country of Residance
+   * *
+   * * nationality Countries of citizenship
+   * *
+   * * comments:
+   * *   Free-form information (treated as opaque by Airavata and simply passed to resource).
+   * *
+   * * labeledURI:
+   *   * Google Scholar, Web of Science, ACS, e.t.c
+   * *
+   * * timeZone:
+   * *  User’s preferred timezone - IANA Timezone Databases - http://www.iana.org/time-zones.
+   * *
+   * 
+   * @throws \Airavata\API\Error\InvalidRequestException
+   * @throws \Airavata\API\Error\AiravataClientException
+   * @throws \Airavata\API\Error\AiravataSystemException
+   * @throws \Airavata\API\Error\AuthorizationException
+   */
+  public function getUserProfileById(\Airavata\Model\Security\AuthzToken $authzToken, $userId, $gatewayId);
+  /**
+   * @param \Airavata\Model\Security\AuthzToken $authzToken
+   * @param string $userId
+   * @return bool
+   * @throws \Airavata\API\Error\InvalidRequestException
+   * @throws \Airavata\API\Error\AiravataClientException
+   * @throws \Airavata\API\Error\AiravataSystemException
+   * @throws \Airavata\API\Error\AuthorizationException
+   */
+  public function deleteUserProfile(\Airavata\Model\Security\AuthzToken $authzToken, $userId);
+  /**
+   * @param \Airavata\Model\Security\AuthzToken $authzToken
+   * @param string $gatewayId
+   * @param int $offset
+   * @param int $limit
+   * @return \Airavata\Model\User\UserProfile[]
+   * @throws \Airavata\API\Error\InvalidRequestException
+   * @throws \Airavata\API\Error\AiravataClientException
+   * @throws \Airavata\API\Error\AiravataSystemException
+   * @throws \Airavata\API\Error\AuthorizationException
+   */
+  public function getAllUserProfilesInGateway(\Airavata\Model\Security\AuthzToken $authzToken, $gatewayId, $offset, $limit);
+  /**
+   * @param \Airavata\Model\Security\AuthzToken $authzToken
+   * @param string $userName
+   * @param string $gatewayId
+   * @return \Airavata\Model\User\UserProfile * A structure holding the user profile and its child models.
+   * *
+   * * Notes:
+   * *  The model does not include passwords as it is assumed an external identity provider is used to authenticate user.
+   * *  References:
+   * *     NSF Demographic Information - http://www.nsf.gov/pubs/2000/00form1225/00form1225.doc
+   * *     LDAP Schema - https://tools.ietf.org/html/rfc4519
+   * *     SCIM 2.0 - https://tools.ietf.org/html/rfc7643
+   * *
+   * * userModelVersion:
+   * *  Version number of profile
+   * *
+   * * airavataInternalUserId:
+   * *  internal to Airavata, not intended to be used outside of the Airavata platform or possibly by gateways
+   * *  (that is, never shown to users), never reassigned, REQUIRED
+   * *
+   * * userId:
+   * *  Externally assertable unique identifier. SAML (primarly in higher education, academic) tends to keep
+   * *   user name less opaque. OpenID Connect maintains them to be opaque.
+   * *
+   * * firstName, middleName, lastName:
+   * *  First and Last names as assertede by the user
+   * *
+   * * namePrefix, nameSuffix:
+   * *  prefix and suffix to the users name as asserted by the user
+   * *
+   * * emails:
+   * *   Email identifier are Verified, REQUIRED and MULTIVALUED
+   * *
+   * * userName:
+   * *  Name-based identifiers can be multivalues. To keep it simple, Airavata will make it a string.
+   * *   In the future these can be enumerated as:
+   *     *   Official name (as asserted possibly by some external identity provider)
+   *     *   Prefered name (as asserted or suggested by user directly)
+   *     *   Components:
+   *     *      givenName
+   *     *      surname (familyName)
+   *     *      displayName (often asserted by user to handle things like middle names, suffix, prefix, and the like)
+   * *
+   * * orcidId: ORCID ID - http://orcid.org/about/what-is-orcid)
+   * *
+   * * phones: Telephone MULTIVALUED
+   * *
+   * * country: Country of Residance
+   * *
+   * * nationality Countries of citizenship
+   * *
+   * * comments:
+   * *   Free-form information (treated as opaque by Airavata and simply passed to resource).
+   * *
+   * * labeledURI:
+   *   * Google Scholar, Web of Science, ACS, e.t.c
+   * *
+   * * timeZone:
+   * *  User’s preferred timezone - IANA Timezone Databases - http://www.iana.org/time-zones.
+   * *
+   * 
+   * @throws \Airavata\API\Error\InvalidRequestException
+   * @throws \Airavata\API\Error\AiravataClientException
+   * @throws \Airavata\API\Error\AiravataSystemException
+   * @throws \Airavata\API\Error\AuthorizationException
+   */
+  public function getUserProfileByName(\Airavata\Model\Security\AuthzToken $authzToken, $userName, $gatewayId);
+  /**
+   * @param \Airavata\Model\Security\AuthzToken $authzToken
+   * @param string $userName
+   * @param string $gatewayId
+   * @return bool
+   * @throws \Airavata\API\Error\InvalidRequestException
+   * @throws \Airavata\API\Error\AiravataClientException
+   * @throws \Airavata\API\Error\AiravataSystemException
+   * @throws \Airavata\API\Error\AuthorizationException
+   */
+  public function doesUserProfileExist(\Airavata\Model\Security\AuthzToken $authzToken, $userName, $gatewayId);
 }
 
 class AiravataClient implements \Airavata\API\AiravataIf {
@@ -15055,6 +15242,459 @@ class AiravataClient implements \Airavata\API\AiravataIf {
     throw new \Exception("getAllGroupsUserBelongs failed: unknown result");
   }
 
+  public function addUserProfile(\Airavata\Model\Security\AuthzToken $authzToken, \Airavata\Model\User\UserProfile $userProfile)
+  {
+    $this->send_addUserProfile($authzToken, $userProfile);
+    return $this->recv_addUserProfile();
+  }
+
+  public function send_addUserProfile(\Airavata\Model\Security\AuthzToken $authzToken, \Airavata\Model\User\UserProfile $userProfile)
+  {
+    $args = new \Airavata\API\Airavata_addUserProfile_args();
+    $args->authzToken = $authzToken;
+    $args->userProfile = $userProfile;
+    $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');
+    if ($bin_accel)
+    {
+      thrift_protocol_write_binary($this->output_, 'addUserProfile', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());
+    }
+    else
+    {
+      $this->output_->writeMessageBegin('addUserProfile', TMessageType::CALL, $this->seqid_);
+      $args->write($this->output_);
+      $this->output_->writeMessageEnd();
+      $this->output_->getTransport()->flush();
+    }
+  }
+
+  public function recv_addUserProfile()
+  {
+    $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');
+    if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\Airavata\API\Airavata_addUserProfile_result', $this->input_->isStrictRead());
+    else
+    {
+      $rseqid = 0;
+      $fname = null;
+      $mtype = 0;
+
+      $this->input_->readMessageBegin($fname, $mtype, $rseqid);
+      if ($mtype == TMessageType::EXCEPTION) {
+        $x = new TApplicationException();
+        $x->read($this->input_);
+        $this->input_->readMessageEnd();
+        throw $x;
+      }
+      $result = new \Airavata\API\Airavata_addUserProfile_result();
+      $result->read($this->input_);
+      $this->input_->readMessageEnd();
+    }
+    if ($result->success !== null) {
+      return $result->success;
+    }
+    if ($result->ire !== null) {
+      throw $result->ire;
+    }
+    if ($result->ace !== null) {
+      throw $result->ace;
+    }
+    if ($result->ase !== null) {
+      throw $result->ase;
+    }
+    if ($result->ae !== null) {
+      throw $result->ae;
+    }
+    throw new \Exception("addUserProfile failed: unknown result");
+  }
+
+  public function updateUserProfile(\Airavata\Model\Security\AuthzToken $authzToken, \Airavata\Model\User\UserProfile $userProfile)
+  {
+    $this->send_updateUserProfile($authzToken, $userProfile);
+    return $this->recv_updateUserProfile();
+  }
+
+  public function send_updateUserProfile(\Airavata\Model\Security\AuthzToken $authzToken, \Airavata\Model\User\UserProfile $userProfile)
+  {
+    $args = new \Airavata\API\Airavata_updateUserProfile_args();
+    $args->authzToken = $authzToken;
+    $args->userProfile = $userProfile;
+    $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');
+    if ($bin_accel)
+    {
+      thrift_protocol_write_binary($this->output_, 'updateUserProfile', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());
+    }
+    else
+    {
+      $this->output_->writeMessageBegin('updateUserProfile', TMessageType::CALL, $this->seqid_);
+      $args->write($this->output_);
+      $this->output_->writeMessageEnd();
+      $this->output_->getTransport()->flush();
+    }
+  }
+
+  public function recv_updateUserProfile()
+  {
+    $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');
+    if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\Airavata\API\Airavata_updateUserProfile_result', $this->input_->isStrictRead());
+    else
+    {
+      $rseqid = 0;
+      $fname = null;
+      $mtype = 0;
+
+      $this->input_->readMessageBegin($fname, $mtype, $rseqid);
+      if ($mtype == TMessageType::EXCEPTION) {
+        $x = new TApplicationException();
+        $x->read($this->input_);
+        $this->input_->readMessageEnd();
+        throw $x;
+      }
+      $result = new \Airavata\API\Airavata_updateUserProfile_result();
+      $result->read($this->input_);
+      $this->input_->readMessageEnd();
+    }
+    if ($result->success !== null) {
+      return $result->success;
+    }
+    if ($result->ire !== null) {
+      throw $result->ire;
+    }
+    if ($result->ace !== null) {
+      throw $result->ace;
+    }
+    if ($result->ase !== null) {
+      throw $result->ase;
+    }
+    if ($result->ae !== null) {
+      throw $result->ae;
+    }
+    throw new \Exception("updateUserProfile failed: unknown result");
+  }
+
+  public function getUserProfileById(\Airavata\Model\Security\AuthzToken $authzToken, $userId, $gatewayId)
+  {
+    $this->send_getUserProfileById($authzToken, $userId, $gatewayId);
+    return $this->recv_getUserProfileById();
+  }
+
+  public function send_getUserProfileById(\Airavata\Model\Security\AuthzToken $authzToken, $userId, $gatewayId)
+  {
+    $args = new \Airavata\API\Airavata_getUserProfileById_args();
+    $args->authzToken = $authzToken;
+    $args->userId = $userId;
+    $args->gatewayId = $gatewayId;
+    $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');
+    if ($bin_accel)
+    {
+      thrift_protocol_write_binary($this->output_, 'getUserProfileById', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());
+    }
+    else
+    {
+      $this->output_->writeMessageBegin('getUserProfileById', TMessageType::CALL, $this->seqid_);
+      $args->write($this->output_);
+      $this->output_->writeMessageEnd();
+      $this->output_->getTransport()->flush();
+    }
+  }
+
+  public function recv_getUserProfileById()
+  {
+    $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');
+    if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\Airavata\API\Airavata_getUserProfileById_result', $this->input_->isStrictRead());
+    else
+    {
+      $rseqid = 0;
+      $fname = null;
+      $mtype = 0;
+
+      $this->input_->readMessageBegin($fname, $mtype, $rseqid);
+      if ($mtype == TMessageType::EXCEPTION) {
+        $x = new TApplicationException();
+        $x->read($this->input_);
+        $this->input_->readMessageEnd();
+        throw $x;
+      }
+      $result = new \Airavata\API\Airavata_getUserProfileById_result();
+      $result->read($this->input_);
+      $this->input_->readMessageEnd();
+    }
+    if ($result->success !== null) {
+      return $result->success;
+    }
+    if ($result->ire !== null) {
+      throw $result->ire;
+    }
+    if ($result->ace !== null) {
+      throw $result->ace;
+    }
+    if ($result->ase !== null) {
+      throw $result->ase;
+    }
+    if ($result->ae !== null) {
+      throw $result->ae;
+    }
+    throw new \Exception("getUserProfileById failed: unknown result");
+  }
+
+  public function deleteUserProfile(\Airavata\Model\Security\AuthzToken $authzToken, $userId)
+  {
+    $this->send_deleteUserProfile($authzToken, $userId);
+    return $this->recv_deleteUserProfile();
+  }
+
+  public function send_deleteUserProfile(\Airavata\Model\Security\AuthzToken $authzToken, $userId)
+  {
+    $args = new \Airavata\API\Airavata_deleteUserProfile_args();
+    $args->authzToken = $authzToken;
+    $args->userId = $userId;
+    $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');
+    if ($bin_accel)
+    {
+      thrift_protocol_write_binary($this->output_, 'deleteUserProfile', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());
+    }
+    else
+    {
+      $this->output_->writeMessageBegin('deleteUserProfile', TMessageType::CALL, $this->seqid_);
+      $args->write($this->output_);
+      $this->output_->writeMessageEnd();
+      $this->output_->getTransport()->flush();
+    }
+  }
+
+  public function recv_deleteUserProfile()
+  {
+    $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');
+    if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\Airavata\API\Airavata_deleteUserProfile_result', $this->input_->isStrictRead());
+    else
+    {
+      $rseqid = 0;
+      $fname = null;
+      $mtype = 0;
+
+      $this->input_->readMessageBegin($fname, $mtype, $rseqid);
+      if ($mtype == TMessageType::EXCEPTION) {
+        $x = new TApplicationException();
+        $x->read($this->input_);
+        $this->input_->readMessageEnd();
+        throw $x;
+      }
+      $result = new \Airavata\API\Airavata_deleteUserProfile_result();
+      $result->read($this->input_);
+      $this->input_->readMessageEnd();
+    }
+    if ($result->success !== null) {
+      return $result->success;
+    }
+    if ($result->ire !== null) {
+      throw $result->ire;
+    }
+    if ($result->ace !== null) {
+      throw $result->ace;
+    }
+    if ($result->ase !== null) {
+      throw $result->ase;
+    }
+    if ($result->ae !== null) {
+      throw $result->ae;
+    }
+    throw new \Exception("deleteUserProfile failed: unknown result");
+  }
+
+  public function getAllUserProfilesInGateway(\Airavata\Model\Security\AuthzToken $authzToken, $gatewayId, $offset, $limit)
+  {
+    $this->send_getAllUserProfilesInGateway($authzToken, $gatewayId, $offset, $limit);
+    return $this->recv_getAllUserProfilesInGateway();
+  }
+
+  public function send_getAllUserProfilesInGateway(\Airavata\Model\Security\AuthzToken $authzToken, $gatewayId, $offset, $limit)
+  {
+    $args = new \Airavata\API\Airavata_getAllUserProfilesInGateway_args();
+    $args->authzToken = $authzToken;
+    $args->gatewayId = $gatewayId;
+    $args->offset = $offset;
+    $args->limit = $limit;
+    $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');
+    if ($bin_accel)
+    {
+      thrift_protocol_write_binary($this->output_, 'getAllUserProfilesInGateway', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());
+    }
+    else
+    {
+      $this->output_->writeMessageBegin('getAllUserProfilesInGateway', TMessageType::CALL, $this->seqid_);
+      $args->write($this->output_);
+      $this->output_->writeMessageEnd();
+      $this->output_->getTransport()->flush();
+    }
+  }
+
+  public function recv_getAllUserProfilesInGateway()
+  {
+    $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');
+    if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\Airavata\API\Airavata_getAllUserProfilesInGateway_result', $this->input_->isStrictRead());
+    else
+    {
+      $rseqid = 0;
+      $fname = null;
+      $mtype = 0;
+
+      $this->input_->readMessageBegin($fname, $mtype, $rseqid);
+      if ($mtype == TMessageType::EXCEPTION) {
+        $x = new TApplicationException();
+        $x->read($this->input_);
+        $this->input_->readMessageEnd();
+        throw $x;
+      }
+      $result = new \Airavata\API\Airavata_getAllUserProfilesInGateway_result();
+      $result->read($this->input_);
+      $this->input_->readMessageEnd();
+    }
+    if ($result->success !== null) {
+      return $result->success;
+    }
+    if ($result->ire !== null) {
+      throw $result->ire;
+    }
+    if ($result->ace !== null) {
+      throw $result->ace;
+    }
+    if ($result->ase !== null) {
+      throw $result->ase;
+    }
+    if ($result->ae !== null) {
+      throw $result->ae;
+    }
+    throw new \Exception("getAllUserProfilesInGateway failed: unknown result");
+  }
+
+  public function getUserProfileByName(\Airavata\Model\Security\AuthzToken $authzToken, $userName, $gatewayId)
+  {
+    $this->send_getUserProfileByName($authzToken, $userName, $gatewayId);
+    return $this->recv_getUserProfileByName();
+  }
+
+  public function send_getUserProfileByName(\Airavata\Model\Security\AuthzToken $authzToken, $userName, $gatewayId)
+  {
+    $args = new \Airavata\API\Airavata_getUserProfileByName_args();
+    $args->authzToken = $authzToken;
+    $args->userName = $userName;
+    $args->gatewayId = $gatewayId;
+    $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');
+    if ($bin_accel)
+    {
+      thrift_protocol_write_binary($this->output_, 'getUserProfileByName', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());
+    }
+    else
+    {
+      $this->output_->writeMessageBegin('getUserProfileByName', TMessageType::CALL, $this->seqid_);
+      $args->write($this->output_);
+      $this->output_->writeMessageEnd();
+      $this->output_->getTransport()->flush();
+    }
+  }
+
+  public function recv_getUserProfileByName()
+  {
+    $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');
+    if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\Airavata\API\Airavata_getUserProfileByName_result', $this->input_->isStrictRead());
+    else
+    {
+      $rseqid = 0;
+      $fname = null;
+      $mtype = 0;
+
+      $this->input_->readMessageBegin($fname, $mtype, $rseqid);
+      if ($mtype == TMessageType::EXCEPTION) {
+        $x = new TApplicationException();
+        $x->read($this->input_);
+        $this->input_->readMessageEnd();
+        throw $x;
+      }
+      $result = new \Airavata\API\Airavata_getUserProfileByName_result();
+      $result->read($this->input_);
+      $this->input_->readMessageEnd();
+    }
+    if ($result->success !== null) {
+      return $result->success;
+    }
+    if ($result->ire !== null) {
+      throw $result->ire;
+    }
+    if ($result->ace !== null) {
+      throw $result->ace;
+    }
+    if ($result->ase !== null) {
+      throw $result->ase;
+    }
+    if ($result->ae !== null) {
+      throw $result->ae;
+    }
+    throw new \Exception("getUserProfileByName failed: unknown result");
+  }
+
+  public function doesUserProfileExist(\Airavata\Model\Security\AuthzToken $authzToken, $userName, $gatewayId)
+  {
+    $this->send_doesUserProfileExist($authzToken, $userName, $gatewayId);
+    return $this->recv_doesUserProfileExist();
+  }
+
+  public function send_doesUserProfileExist(\Airavata\Model\Security\AuthzToken $authzToken, $userName, $gatewayId)
+  {
+    $args = new \Airavata\API\Airavata_doesUserProfileExist_args();
+    $args->authzToken = $authzToken;
+    $args->userName = $userName;
+    $args->gatewayId = $gatewayId;
+    $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');
+    if ($bin_accel)
+    {
+      thrift_protocol_write_binary($this->output_, 'doesUserProfileExist', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());
+    }
+    else
+    {
+      $this->output_->writeMessageBegin('doesUserProfileExist', TMessageType::CALL, $this->seqid_);
+      $args->write($this->output_);
+      $this->output_->writeMessageEnd();
+      $this->output_->getTransport()->flush();
+    }
+  }
+
+  public function recv_doesUserProfileExist()
+  {
+    $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');
+    if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\Airavata\API\Airavata_doesUserProfileExist_result', $this->input_->isStrictRead());
+    else
+    {
+      $rseqid = 0;
+      $fname = null;
+      $mtype = 0;
+
+      $this->input_->readMessageBegin($fname, $mtype, $rseqid);
+      if ($mtype == TMessageType::EXCEPTION) {
+        $x = new TApplicationException();
+        $x->read($this->input_);
+        $this->input_->readMessageEnd();
+        throw $x;
+      }
+      $result = new \Airavata\API\Airavata_doesUserProfileExist_result();
+      $result->read($this->input_);
+      $this->input_->readMessageEnd();
+    }
+    if ($result->success !== null) {
+      return $result->success;
+    }
+    if ($result->ire !== null) {
+      throw $result->ire;
+    }
+    if ($result->ace !== null) {
+      throw $result->ace;
+    }
+    if ($result->ase !== null) {
+      throw $result->ase;
+    }
+    if ($result->ae !== null) {
+      throw $result->ae;
+    }
+    throw new \Exception("doesUserProfileExist failed: unknown result");
+  }
+
 }
 
 // HELPER FUNCTIONS AND STRUCTURES
@@ -28034,14 +28674,2349 @@ class Airavata_launchExperiment_args {
           break;
         case 2:
           if ($ftype == TType::STRING) {
-            $xfer += $input->readString($this->airavataExperimentId);
+            $xfer += $input->readString($this->airavataExperimentId);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 3:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->gatewayId);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        default:
+          $xfer += $input->skip($ftype);
+          break;
+      }
+      $xfer += $input->readFieldEnd();
+    }
+    $xfer += $input->readStructEnd();
+    return $xfer;
+  }
+
+  public function write($output) {
+    $xfer = 0;
+    $xfer += $output->writeStructBegin('Airavata_launchExperiment_args');
+    if ($this->authzToken !== null) {
+      if (!is_object($this->authzToken)) {
+        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
+      }
+      $xfer += $output->writeFieldBegin('authzToken', TType::STRUCT, 1);
+      $xfer += $this->authzToken->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->airavataExperimentId !== null) {
+      $xfer += $output->writeFieldBegin('airavataExperimentId', TType::STRING, 2);
+      $xfer += $output->writeString($this->airavataExperimentId);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->gatewayId !== null) {
+      $xfer += $output->writeFieldBegin('gatewayId', TType::STRING, 3);
+      $xfer += $output->writeString($this->gatewayId);
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
+class Airavata_launchExperiment_result {
+  static $_TSPEC;
+
+  /**
+   * @var \Airavata\API\Error\InvalidRequestException
+   */
+  public $ire = null;
+  /**
+   * @var \Airavata\API\Error\ExperimentNotFoundException
+   */
+  public $enf = null;
+  /**
+   * @var \Airavata\API\Error\AiravataClientException
+   */
+  public $ace = null;
+  /**
+   * @var \Airavata\API\Error\AiravataSystemException
+   */
+  public $ase = null;
+  /**
+   * @var \Airavata\API\Error\AuthorizationException
+   */
+  public $ae = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        1 => array(
+          'var' => 'ire',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\API\Error\InvalidRequestException',
+          ),
+        2 => array(
+          'var' => 'enf',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\API\Error\ExperimentNotFoundException',
+          ),
+        3 => array(
+          'var' => 'ace',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\API\Error\AiravataClientException',
+          ),
+        4 => array(
+          'var' => 'ase',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\API\Error\AiravataSystemException',
+          ),
+        5 => array(
+          'var' => 'ae',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\API\Error\AuthorizationException',
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['ire'])) {
+        $this->ire = $vals['ire'];
+      }
+      if (isset($vals['enf'])) {
+        $this->enf = $vals['enf'];
+      }
+      if (isset($vals['ace'])) {
+        $this->ace = $vals['ace'];
+      }
+      if (isset($vals['ase'])) {
+        $this->ase = $vals['ase'];
+      }
+      if (isset($vals['ae'])) {
+        $this->ae = $vals['ae'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'Airavata_launchExperiment_result';
+  }
+
+  public function read($input)
+  {
+    $xfer = 0;
+    $fname = null;
+    $ftype = 0;
+    $fid = 0;
+    $xfer += $input->readStructBegin($fname);
+    while (true)
+    {
+      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
+      if ($ftype == TType::STOP) {
+        break;
+      }
+      switch ($fid)
+      {
+        case 1:
+          if ($ftype == TType::STRUCT) {
+            $this->ire = new \Airavata\API\Error\InvalidRequestException();
+            $xfer += $this->ire->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 2:
+          if ($ftype == TType::STRUCT) {
+            $this->enf = new \Airavata\API\Error\ExperimentNotFoundException();
+            $xfer += $this->enf->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 3:
+          if ($ftype == TType::STRUCT) {
+            $this->ace = new \Airavata\API\Error\AiravataClientException();
+            $xfer += $this->ace->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 4:
+          if ($ftype == TType::STRUCT) {
+            $this->ase = new \Airavata\API\Error\AiravataSystemException();
+            $xfer += $this->ase->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 5:
+          if ($ftype == TType::STRUCT) {
+            $this->ae = new \Airavata\API\Error\AuthorizationException();
+            $xfer += $this->ae->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        default:
+          $xfer += $input->skip($ftype);
+          break;
+      }
+      $xfer += $input->readFieldEnd();
+    }
+    $xfer += $input->readStructEnd();
+    return $xfer;
+  }
+
+  public function write($output) {
+    $xfer = 0;
+    $xfer += $output->writeStructBegin('Airavata_launchExperiment_result');
+    if ($this->ire !== null) {
+      $xfer += $output->writeFieldBegin('ire', TType::STRUCT, 1);
+      $xfer += $this->ire->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->enf !== null) {
+      $xfer += $output->writeFieldBegin('enf', TType::STRUCT, 2);
+      $xfer += $this->enf->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->ace !== null) {
+      $xfer += $output->writeFieldBegin('ace', TType::STRUCT, 3);
+      $xfer += $this->ace->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->ase !== null) {
+      $xfer += $output->writeFieldBegin('ase', TType::STRUCT, 4);
+      $xfer += $this->ase->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->ae !== null) {
+      $xfer += $output->writeFieldBegin('ae', TType::STRUCT, 5);
+      $xfer += $this->ae->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
+class Airavata_getExperimentStatus_args {
+  static $_TSPEC;
+
+  /**
+   * @var \Airavata\Model\Security\AuthzToken
+   */
+  public $authzToken = null;
+  /**
+   * @var string
+   */
+  public $airavataExperimentId = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        1 => array(
+          'var' => 'authzToken',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\Model\Security\AuthzToken',
+          ),
+        2 => array(
+          'var' => 'airavataExperimentId',
+          'type' => TType::STRING,
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['authzToken'])) {
+        $this->authzToken = $vals['authzToken'];
+      }
+      if (isset($vals['airavataExperimentId'])) {
+        $this->airavataExperimentId = $vals['airavataExperimentId'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'Airavata_getExperimentStatus_args';
+  }
+
+  public function read($input)
+  {
+    $xfer = 0;
+    $fname = null;
+    $ftype = 0;
+    $fid = 0;
+    $xfer += $input->readStructBegin($fname);
+    while (true)
+    {
+      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
+      if ($ftype == TType::STOP) {
+        break;
+      }
+      switch ($fid)
+      {
+        case 1:
+          if ($ftype == TType::STRUCT) {
+            $this->authzToken = new \Airavata\Model\Security\AuthzToken();
+            $xfer += $this->authzToken->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 2:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->airavataExperimentId);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        default:
+          $xfer += $input->skip($ftype);
+          break;
+      }
+      $xfer += $input->readFieldEnd();
+    }
+    $xfer += $input->readStructEnd();
+    return $xfer;
+  }
+
+  public function write($output) {
+    $xfer = 0;
+    $xfer += $output->writeStructBegin('Airavata_getExperimentStatus_args');
+    if ($this->authzToken !== null) {
+      if (!is_object($this->authzToken)) {
+        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
+      }
+      $xfer += $output->writeFieldBegin('authzToken', TType::STRUCT, 1);
+      $xfer += $this->authzToken->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->airavataExperimentId !== null) {
+      $xfer += $output->writeFieldBegin('airavataExperimentId', TType::STRING, 2);
+      $xfer += $output->writeString($this->airavataExperimentId);
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
+class Airavata_getExperimentStatus_result {
+  static $_TSPEC;
+
+  /**
+   * @var \Airavata\Model\Status\ExperimentStatus
+   */
+  public $success = null;
+  /**
+   * @var \Airavata\API\Error\InvalidRequestException
+   */
+  public $ire = null;
+  /**
+   * @var \Airavata\API\Error\ExperimentNotFoundException
+   */
+  public $enf = null;
+  /**
+   * @var \Airavata\API\Error\AiravataClientException
+   */
+  public $ace = null;
+  /**
+   * @var \Airavata\API\Error\AiravataSystemException
+   */
+  public $ase = null;
+  /**
+   * @var \Airavata\API\Error\AuthorizationException
+   */
+  public $ae = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        0 => array(
+          'var' => 'success',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\Model\Status\ExperimentStatus',
+          ),
+        1 => array(
+          'var' => 'ire',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\API\Error\InvalidRequestException',
+          ),
+        2 => array(
+          'var' => 'enf',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\API\Error\ExperimentNotFoundException',
+          ),
+        3 => array(
+          'var' => 'ace',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\API\Error\AiravataClientException',
+          ),
+        4 => array(
+          'var' => 'ase',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\API\Error\AiravataSystemException',
+          ),
+        5 => array(
+          'var' => 'ae',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\API\Error\AuthorizationException',
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['success'])) {
+        $this->success = $vals['success'];
+      }
+      if (isset($vals['ire'])) {
+        $this->ire = $vals['ire'];
+      }
+      if (isset($vals['enf'])) {
+        $this->enf = $vals['enf'];
+      }
+      if (isset($vals['ace'])) {
+        $this->ace = $vals['ace'];
+      }
+      if (isset($vals['ase'])) {
+        $this->ase = $vals['ase'];
+      }
+      if (isset($vals['ae'])) {
+        $this->ae = $vals['ae'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'Airavata_getExperimentStatus_result';
+  }
+
+  public function read($input)
+  {
+    $xfer = 0;
+    $fname = null;
+    $ftype = 0;
+    $fid = 0;
+    $xfer += $input->readStructBegin($fname);
+    while (true)
+    {
+      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
+      if ($ftype == TType::STOP) {
+        break;
+      }
+      switch ($fid)
+      {
+        case 0:
+          if ($ftype == TType::STRUCT) {
+            $this->success = new \Airavata\Model\Status\ExperimentStatus();
+            $xfer += $this->success->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 1:
+          if ($ftype == TType::STRUCT) {
+            $this->ire = new \Airavata\API\Error\InvalidRequestException();
+            $xfer += $this->ire->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 2:
+          if ($ftype == TType::STRUCT) {
+            $this->enf = new \Airavata\API\Error\ExperimentNotFoundException();
+            $xfer += $this->enf->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 3:
+          if ($ftype == TType::STRUCT) {
+            $this->ace = new \Airavata\API\Error\AiravataClientException();
+            $xfer += $this->ace->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 4:
+          if ($ftype == TType::STRUCT) {
+            $this->ase = new \Airavata\API\Error\AiravataSystemException();
+            $xfer += $this->ase->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 5:
+          if ($ftype == TType::STRUCT) {
+            $this->ae = new \Airavata\API\Error\AuthorizationException();
+            $xfer += $this->ae->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        default:
+          $xfer += $input->skip($ftype);
+          break;
+      }
+      $xfer += $input->readFieldEnd();
+    }
+    $xfer += $input->readStructEnd();
+    return $xfer;
+  }
+
+  public function write($output) {
+    $xfer = 0;
+    $xfer += $output->writeStructBegin('Airavata_getExperimentStatus_result');
+    if ($this->success !== null) {
+      if (!is_object($this->success)) {
+        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
+      }
+      $xfer += $output->writeFieldBegin('success', TType::STRUCT, 0);
+      $xfer += $this->success->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->ire !== null) {
+      $xfer += $output->writeFieldBegin('ire', TType::STRUCT, 1);
+      $xfer += $this->ire->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->enf !== null) {
+      $xfer += $output->writeFieldBegin('enf', TType::STRUCT, 2);
+      $xfer += $this->enf->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->ace !== null) {
+      $xfer += $output->writeFieldBegin('ace', TType::STRUCT, 3);
+      $xfer += $this->ace->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->ase !== null) {
+      $xfer += $output->writeFieldBegin('ase', TType::STRUCT, 4);
+      $xfer += $this->ase->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->ae !== null) {
+      $xfer += $output->writeFieldBegin('ae', TType::STRUCT, 5);
+      $xfer += $this->ae->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
+class Airavata_getExperimentOutputs_args {
+  static $_TSPEC;
+
+  /**
+   * @var \Airavata\Model\Security\AuthzToken
+   */
+  public $authzToken = null;
+  /**
+   * @var string
+   */
+  public $airavataExperimentId = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        1 => array(
+          'var' => 'authzToken',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\Model\Security\AuthzToken',
+          ),
+        2 => array(
+          'var' => 'airavataExperimentId',
+          'type' => TType::STRING,
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['authzToken'])) {
+        $this->authzToken = $vals['authzToken'];
+      }
+      if (isset($vals['airavataExperimentId'])) {
+        $this->airavataExperimentId = $vals['airavataExperimentId'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'Airavata_getExperimentOutputs_args';
+  }
+
+  public function read($input)
+  {
+    $xfer = 0;
+    $fname = null;
+    $ftype = 0;
+    $fid = 0;
+    $xfer += $input->readStructBegin($fname);
+    while (true)
+    {
+      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
+      if ($ftype == TType::STOP) {
+        break;
+      }
+      switch ($fid)
+      {
+        case 1:
+          if ($ftype == TType::STRUCT) {
+            $this->authzToken = new \Airavata\Model\Security\AuthzToken();
+            $xfer += $this->authzToken->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 2:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->airavataExperimentId);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        default:
+          $xfer += $input->skip($ftype);
+          break;
+      }
+      $xfer += $input->readFieldEnd();
+    }
+    $xfer += $input->readStructEnd();
+    return $xfer;
+  }
+
+  public function write($output) {
+    $xfer = 0;
+    $xfer += $output->writeStructBegin('Airavata_getExperimentOutputs_args');
+    if ($this->authzToken !== null) {
+      if (!is_object($this->authzToken)) {
+        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
+      }
+      $xfer += $output->writeFieldBegin('authzToken', TType::STRUCT, 1);
+      $xfer += $this->authzToken->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->airavataExperimentId !== null) {
+      $xfer += $output->writeFieldBegin('airavataExperimentId', TType::STRING, 2);
+      $xfer += $output->writeString($this->airavataExperimentId);
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
+class Airavata_getExperimentOutputs_result {
+  static $_TSPEC;
+
+  /**
+   * @var \Airavata\Model\Application\Io\OutputDataObjectType[]
+   */
+  public $success = null;
+  /**
+   * @var \Airavata\API\Error\InvalidRequestException
+   */
+  public $ire = null;
+  /**
+   * @var \Airavata\API\Error\ExperimentNotFoundException
+   */
+  public $enf = null;
+  /**
+   * @var \Airavata\API\Error\AiravataClientException
+   */
+  public $ace = null;
+  /**
+   * @var \Airavata\API\Error\AiravataSystemException
+   */
+  public $ase = null;
+  /**
+   * @var \Airavata\API\Error\AuthorizationException
+   */
+  public $ae = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        0 => array(
+          'var' => 'success',
+          'type' => TType::LST,
+          'etype' => TType::STRUCT,
+          'elem' => array(
+            'type' => TType::STRUCT,
+            'class' => '\Airavata\Model\Application\Io\OutputDataObjectType',
+            ),
+          ),
+        1 => array(
+          'var' => 'ire',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\API\Error\InvalidRequestException',
+          ),
+        2 => array(
+          'var' => 'enf',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\API\Error\ExperimentNotFoundException',
+          ),
+        3 => array(
+          'var' => 'ace',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\API\Error\AiravataClientException',
+          ),
+        4 => array(
+          'var' => 'ase',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\API\Error\AiravataSystemException',
+          ),
+        5 => array(
+          'var' => 'ae',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\API\Error\AuthorizationException',
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['success'])) {
+        $this->success = $vals['success'];
+      }
+      if (isset($vals['ire'])) {
+        $this->ire = $vals['ire'];
+      }
+      if (isset($vals['enf'])) {
+        $this->enf = $vals['enf'];
+      }
+      if (isset($vals['ace'])) {
+        $this->ace = $vals['ace'];
+      }
+      if (isset($vals['ase'])) {
+        $this->ase = $vals['ase'];
+      }
+      if (isset($vals['ae'])) {
+        $this->ae = $vals['ae'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'Airavata_getExperimentOutputs_result';
+  }
+
+  public function read($input)
+  {
+    $xfer = 0;
+    $fname = null;
+    $ftype = 0;
+    $fid = 0;
+    $xfer += $input->readStructBegin($fname);
+    while (true)
+    {
+      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
+      if ($ftype == TType::STOP) {
+        break;
+      }
+      switch ($fid)
+      {
+        case 0:
+          if ($ftype == TType::LST) {
+            $this->success = array();
+            $_size106 = 0;
+            $_etype109 = 0;
+            $xfer += $input->readListBegin($_etype109, $_size106);
+            for ($_i110 = 0; $_i110 < $_size106; ++$_i110)
+            {
+              $elem111 = null;
+              $elem111 = new \Airavata\Model\Application\Io\OutputDataObjectType();
+              $xfer += $elem111->read($input);
+              $this->success []= $elem111;
+            }
+            $xfer += $input->readListEnd();
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 1:
+          if ($ftype == TType::STRUCT) {
+            $this->ire = new \Airavata\API\Error\InvalidRequestException();
+            $xfer += $this->ire->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 2:
+          if ($ftype == TType::STRUCT) {
+            $this->enf = new \Airavata\API\Error\ExperimentNotFoundException();
+            $xfer += $this->enf->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 3:
+          if ($ftype == TType::STRUCT) {
+            $this->ace = new \Airavata\API\Error\AiravataClientException();
+            $xfer += $this->ace->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 4:
+          if ($ftype == TType::STRUCT) {
+            $this->ase = new \Airavata\API\Error\AiravataSystemException();
+            $xfer += $this->ase->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 5:
+          if ($ftype == TType::STRUCT) {
+            $this->ae = new \Airavata\API\Error\AuthorizationException();
+            $xfer += $this->ae->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        default:
+          $xfer += $input->skip($ftype);
+          break;
+      }
+      $xfer += $input->readFieldEnd();
+    }
+    $xfer += $input->readStructEnd();
+    return $xfer;
+  }
+
+  public function write($output) {
+    $xfer = 0;
+    $xfer += $output->writeStructBegin('Airavata_getExperimentOutputs_result');
+    if ($this->success !== null) {
+      if (!is_array($this->success)) {
+        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
+      }
+      $xfer += $output->writeFieldBegin('success', TType::LST, 0);
+      {
+        $output->writeListBegin(TType::STRUCT, count($this->success));
+        {
+          foreach ($this->success as $iter112)
+          {
+            $xfer += $iter112->write($output);
+          }
+        }
+        $output->writeListEnd();
+      }
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->ire !== null) {
+      $xfer += $output->writeFieldBegin('ire', TType::STRUCT, 1);
+      $xfer += $this->ire->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->enf !== null) {
+      $xfer += $output->writeFieldBegin('enf', TType::STRUCT, 2);
+      $xfer += $this->enf->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->ace !== null) {
+      $xfer += $output->writeFieldBegin('ace', TType::STRUCT, 3);
+      $xfer += $this->ace->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->ase !== null) {
+      $xfer += $output->writeFieldBegin('ase', TType::STRUCT, 4);
+      $xfer += $this->ase->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->ae !== null) {
+      $xfer += $output->writeFieldBegin('ae', TType::STRUCT, 5);
+      $xfer += $this->ae->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
+class Airavata_getIntermediateOutputs_args {
+  static $_TSPEC;
+
+  /**
+   * @var \Airavata\Model\Security\AuthzToken
+   */
+  public $authzToken = null;
+  /**
+   * @var string
+   */
+  public $airavataExperimentId = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        1 => array(
+          'var' => 'authzToken',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\Model\Security\AuthzToken',
+          ),
+        2 => array(
+          'var' => 'airavataExperimentId',
+          'type' => TType::STRING,
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['authzToken'])) {
+        $this->authzToken = $vals['authzToken'];
+      }
+      if (isset($vals['airavataExperimentId'])) {
+        $this->airavataExperimentId = $vals['airavataExperimentId'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'Airavata_getIntermediateOutputs_args';
+  }
+
+  public function read($input)
+  {
+    $xfer = 0;
+    $fname = null;
+    $ftype = 0;
+    $fid = 0;
+    $xfer += $input->readStructBegin($fname);
+    while (true)
+    {
+      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
+      if ($ftype == TType::STOP) {
+        break;
+      }
+      switch ($fid)
+      {
+        case 1:
+          if ($ftype == TType::STRUCT) {
+            $this->authzToken = new \Airavata\Model\Security\AuthzToken();
+            $xfer += $this->authzToken->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 2:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->airavataExperimentId);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        default:
+          $xfer += $input->skip($ftype);
+          break;
+      }
+      $xfer += $input->readFieldEnd();
+    }
+    $xfer += $input->readStructEnd();
+    return $xfer;
+  }
+
+  public function write($output) {
+    $xfer = 0;
+    $xfer += $output->writeStructBegin('Airavata_getIntermediateOutputs_args');
+    if ($this->authzToken !== null) {
+      if (!is_object($this->authzToken)) {
+        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
+      }
+      $xfer += $output->writeFieldBegin('authzToken', TType::STRUCT, 1);
+      $xfer += $this->authzToken->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->airavataExperimentId !== null) {
+      $xfer += $output->writeFieldBegin('airavataExperimentId', TType::STRING, 2);
+      $xfer += $output->writeString($this->airavataExperimentId);
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
+class Airavata_getIntermediateOutputs_result {
+  static $_TSPEC;
+
+  /**
+   * @var \Airavata\Model\Application\Io\OutputDataObjectType[]
+   */
+  public $success = null;
+  /**
+   * @var \Airavata\API\Error\InvalidRequestException
+   */
+  public $ire = null;
+  /**
+   * @var \Airavata\API\Error\ExperimentNotFoundException
+   */
+  public $enf = null;
+  /**
+   * @var \Airavata\API\Error\AiravataClientException
+   */
+  public $ace = null;
+  /**
+   * @var \Airavata\API\Error\AiravataSystemException
+   */
+  public $ase = null;
+  /**
+   * @var \Airavata\API\Error\AuthorizationException
+   */
+  public $ae = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        0 => array(
+          'var' => 'success',
+          'type' => TType::LST,
+          'etype' => TType::STRUCT,
+          'elem' => array(
+            'type' => TType::STRUCT,
+            'class' => '\Airavata\Model\Application\Io\OutputDataObjectType',
+            ),
+          ),
+        1 => array(
+          'var' => 'ire',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\API\Error\InvalidRequestException',
+          ),
+        2 => array(
+          'var' => 'enf',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\API\Error\ExperimentNotFoundException',
+          ),
+        3 => array(
+          'var' => 'ace',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\API\Error\AiravataClientException',
+          ),
+        4 => array(
+          'var' => 'ase',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\API\Error\AiravataSystemException',
+          ),
+        5 => array(
+          'var' => 'ae',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\API\Error\AuthorizationException',
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['success'])) {
+        $this->success = $vals['success'];
+      }
+      if (isset($vals['ire'])) {
+        $this->ire = $vals['ire'];
+      }
+      if (isset($vals['enf'])) {
+        $this->enf = $vals['enf'];
+      }
+      if (isset($vals['ace'])) {
+        $this->ace = $vals['ace'];
+      }
+      if (isset($vals['ase'])) {
+        $this->ase = $vals['ase'];
+      }
+      if (isset($vals['ae'])) {
+        $this->ae = $vals['ae'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'Airavata_getIntermediateOutputs_result';
+  }
+
+  public function read($input)
+  {
+    $xfer = 0;
+    $fname = null;
+    $ftype = 0;
+    $fid = 0;
+    $xfer += $input->readStructBegin($fname);
+    while (true)
+    {
+      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
+      if ($ftype == TType::STOP) {
+        break;
+      }
+      switch ($fid)
+      {
+        case 0:
+          if ($ftype == TType::LST) {
+            $this->success = array();
+            $_size113 = 0;
+            $_etype116 = 0;
+            $xfer += $input->readListBegin($_etype116, $_size113);
+            for ($_i117 = 0; $_i117 < $_size113; ++$_i117)
+            {
+              $elem118 = null;
+              $elem118 = new \Airavata\Model\Application\Io\OutputDataObjectType();
+              $xfer += $elem118->read($input);
+              $this->success []= $elem118;
+            }
+            $xfer += $input->readListEnd();
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 1:
+          if ($ftype == TType::STRUCT) {
+            $this->ire = new \Airavata\API\Error\InvalidRequestException();
+            $xfer += $this->ire->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 2:
+          if ($ftype == TType::STRUCT) {
+            $this->enf = new \Airavata\API\Error\ExperimentNotFoundException();
+            $xfer += $this->enf->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 3:
+          if ($ftype == TType::STRUCT) {
+            $this->ace = new \Airavata\API\Error\AiravataClientException();
+            $xfer += $this->ace->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 4:
+          if ($ftype == TType::STRUCT) {
+            $this->ase = new \Airavata\API\Error\AiravataSystemException();
+            $xfer += $this->ase->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 5:
+          if ($ftype == TType::STRUCT) {
+            $this->ae = new \Airavata\API\Error\AuthorizationException();
+            $xfer += $this->ae->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        default:
+          $xfer += $input->skip($ftype);
+          break;
+      }
+      $xfer += $input->readFieldEnd();
+    }
+    $xfer += $input->readStructEnd();
+    return $xfer;
+  }
+
+  public function write($output) {
+    $xfer = 0;
+    $xfer += $output->writeStructBegin('Airavata_getIntermediateOutputs_result');
+    if ($this->success !== null) {
+      if (!is_array($this->success)) {
+        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
+      }
+      $xfer += $output->writeFieldBegin('success', TType::LST, 0);
+      {
+        $output->writeListBegin(TType::STRUCT, count($this->success));
+        {
+          foreach ($this->success as $iter119)
+          {
+            $xfer += $iter119->write($output);
+          }
+        }
+        $output->writeListEnd();
+      }
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->ire !== null) {
+      $xfer += $output->writeFieldBegin('ire', TType::STRUCT, 1);
+      $xfer += $this->ire->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->enf !== null) {
+      $xfer += $output->writeFieldBegin('enf', TType::STRUCT, 2);
+      $xfer += $this->enf->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->ace !== null) {
+      $xfer += $output->writeFieldBegin('ace', TType::STRUCT, 3);
+      $xfer += $this->ace->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->ase !== null) {
+      $xfer += $output->writeFieldBegin('ase', TType::STRUCT, 4);
+      $xfer += $this->ase->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->ae !== null) {
+      $xfer += $output->writeFieldBegin('ae', TType::STRUCT, 5);
+      $xfer += $this->ae->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
+class Airavata_getJobStatuses_args {
+  static $_TSPEC;
+
+  /**
+   * @var \Airavata\Model\Security\AuthzToken
+   */
+  public $authzToken = null;
+  /**
+   * @var string
+   */
+  public $airavataExperimentId = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        1 => array(
+          'var' => 'authzToken',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\Model\Security\AuthzToken',
+          ),
+        2 => array(
+          'var' => 'airavataExperimentId',
+          'type' => TType::STRING,
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['authzToken'])) {
+        $this->authzToken = $vals['authzToken'];
+      }
+      if (isset($vals['airavataExperimentId'])) {
+        $this->airavataExperimentId = $vals['airavataExperimentId'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'Airavata_getJobStatuses_args';
+  }
+
+  public function read($input)
+  {
+    $xfer = 0;
+    $fname = null;
+    $ftype = 0;
+    $fid = 0;
+    $xfer += $input->readStructBegin($fname);
+    while (true)
+    {
+      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
+      if ($ftype == TType::STOP) {
+        break;
+      }
+      switch ($fid)
+      {
+        case 1:
+          if ($ftype == TType::STRUCT) {
+            $this->authzToken = new \Airavata\Model\Security\AuthzToken();
+            $xfer += $this->authzToken->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 2:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->airavataExperimentId);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        default:
+          $xfer += $input->skip($ftype);
+          break;
+      }
+      $xfer += $input->readFieldEnd();
+    }
+    $xfer += $input->readStructEnd();
+    return $xfer;
+  }
+
+  public function write($output) {
+    $xfer = 0;
+    $xfer += $output->writeStructBegin('Airavata_getJobStatuses_args');
+    if ($this->authzToken !== null) {
+      if (!is_object($this->authzToken)) {
+        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
+      }
+      $xfer += $output->writeFieldBegin('authzToken', TType::STRUCT, 1);
+      $xfer += $this->authzToken->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->airavataExperimentId !== null) {
+      $xfer += $output->writeFieldBegin('airavataExperimentId', TType::STRING, 2);
+      $xfer += $output->writeString($this->airavataExperimentId);
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
+class Airavata_getJobStatuses_result {
+  static $_TSPEC;
+
+  /**
+   * @var array
+   */
+  public $success = null;
+  /**
+   * @var \Airavata\API\Error\InvalidRequestException
+   */
+  public $ire = null;
+  /**
+   * @var \Airavata\API\Error\ExperimentNotFoundException
+   */
+  public $enf = null;
+  /**
+   * @var \Airavata\API\Error\AiravataClientException
+   */
+  public $ace = null;
+  /**
+   * @var \Airavata\API\Error\AiravataSystemException
+   */
+  public $ase = null;
+  /**
+   * @var \Airavata\API\Error\AuthorizationException
+   */
+  public $ae = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        0 => array(
+          'var' => 'success',
+          'type' => TType::MAP,
+          'ktype' => TType::STRING,
+          'vtype' => TType::STRUCT,
+          'key' => array(
+            'type' => TType::STRING,
+          ),
+          'val' => array(
+            'type' => TType::STRUCT,
+            'class' => '\Airavata\Model\Status\JobStatus',
+            ),
+          ),
+        1 => array(
+          'var' => 'ire',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\API\Error\InvalidRequestException',
+          ),
+        2 => array(
+          'var' => 'enf',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\API\Error\ExperimentNotFoundException',
+          ),
+        3 => array(
+          'var' => 'ace',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\API\Error\AiravataClientException',
+          ),
+        4 => array(
+          'var' => 'ase',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\API\Error\AiravataSystemException',
+          ),
+        5 => array(
+          'var' => 'ae',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\API\Error\AuthorizationException',
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['success'])) {
+        $this->success = $vals['success'];
+      }
+      if (isset($vals['ire'])) {
+        $this->ire = $vals['ire'];
+      }
+      if (isset($vals['enf'])) {
+        $this->enf = $vals['enf'];
+      }
+      if (isset($vals['ace'])) {
+        $this->ace = $vals['ace'];
+      }
+      if (isset($vals['ase'])) {
+        $this->ase = $vals['ase'];
+      }
+      if (isset($vals['ae'])) {
+        $this->ae = $vals['ae'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'Airavata_getJobStatuses_result';
+  }
+
+  public function read($input)
+  {
+    $xfer = 0;
+    $fname = null;
+    $ftype = 0;
+    $fid = 0;
+    $xfer += $input->readStructBegin($fname);
+    while (true)
+    {
+      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
+      if ($ftype == TType::STOP) {
+        break;
+      }
+      switch ($fid)
+      {
+        case 0:
+          if ($ftype == TType::MAP) {
+            $this->success = array();
+            $_size120 = 0;
+            $_ktype121 = 0;
+            $_vtype122 = 0;
+            $xfer += $input->readMapBegin($_ktype121, $_vtype122, $_size120);
+            for ($_i124 = 0; $_i124 < $_size120; ++$_i124)
+            {
+              $key125 = '';
+              $val126 = new \Airavata\Model\Status\JobStatus();
+              $xfer += $input->readString($key125);
+              $val126 = new \Airavata\Model\Status\JobStatus();
+              $xfer += $val126->read($input);
+              $this->success[$key125] = $val126;
+            }
+            $xfer += $input->readMapEnd();
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 1:
+          if ($ftype == TType::STRUCT) {
+            $this->ire = new \Airavata\API\Error\InvalidRequestException();
+            $xfer += $this->ire->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 2:
+          if ($ftype == TType::STRUCT) {
+            $this->enf = new \Airavata\API\Error\ExperimentNotFoundException();
+            $xfer += $this->enf->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 3:
+          if ($ftype == TType::STRUCT) {
+            $this->ace = new \Airavata\API\Error\AiravataClientException();
+            $xfer += $this->ace->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 4:
+          if ($ftype == TType::STRUCT) {
+            $this->ase = new \Airavata\API\Error\AiravataSystemException();
+            $xfer += $this->ase->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 5:
+          if ($ftype == TType::STRUCT) {
+            $this->ae = new \Airavata\API\Error\AuthorizationException();
+            $xfer += $this->ae->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        default:
+          $xfer += $input->skip($ftype);
+          break;
+      }
+      $xfer += $input->readFieldEnd();
+    }
+    $xfer += $input->readStructEnd();
+    return $xfer;
+  }
+
+  public function write($output) {
+    $xfer = 0;
+    $xfer += $output->writeStructBegin('Airavata_getJobStatuses_result');
+    if ($this->success !== null) {
+      if (!is_array($this->success)) {
+        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
+      }
+      $xfer += $output->writeFieldBegin('success', TType::MAP, 0);
+      {
+        $output->writeMapBegin(TType::STRING, TType::STRUCT, count($this->success));
+        {
+          foreach ($this->success as $kiter127 => $viter128)
+          {
+            $xfer += $output->writeString($kiter127);
+            $xfer += $viter128->write($output);
+          }
+        }
+        $output->writeMapEnd();
+      }
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->ire !== null) {
+      $xfer += $output->writeFieldBegin('ire', TType::STRUCT, 1);
+      $xfer += $this->ire->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->enf !== null) {
+      $xfer += $output->writeFieldBegin('enf', TType::STRUCT, 2);
+      $xfer += $this->enf->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->ace !== null) {
+      $xfer += $output->writeFieldBegin('ace', TType::STRUCT, 3);
+      $xfer += $this->ace->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->ase !== null) {
+      $xfer += $output->writeFieldBegin('ase', TType::STRUCT, 4);
+      $xfer += $this->ase->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->ae !== null) {
+      $xfer += $output->writeFieldBegin('ae', TType::STRUCT, 5);
+      $xfer += $this->ae->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
+class Airavata_getJobDetails_args {
+  static $_TSPEC;
+
+  /**
+   * @var \Airavata\Model\Security\AuthzToken
+   */
+  public $authzToken = null;
+  /**
+   * @var string
+   */
+  public $airavataExperimentId = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        1 => array(
+          'var' => 'authzToken',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\Model\Security\AuthzToken',
+          ),
+        2 => array(
+          'var' => 'airavataExperimentId',
+          'type' => TType::STRING,
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['authzToken'])) {
+        $this->authzToken = $vals['authzToken'];
+      }
+      if (isset($vals['airavataExperimentId'])) {
+        $this->airavataExperimentId = $vals['airavataExperimentId'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'Airavata_getJobDetails_args';
+  }
+
+  public function read($input)
+  {
+    $xfer = 0;
+    $fname = null;
+    $ftype = 0;
+    $fid = 0;
+    $xfer += $input->readStructBegin($fname);
+    while (true)
+    {
+      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
+      if ($ftype == TType::STOP) {
+        break;
+      }
+      switch ($fid)
+      {
+        case 1:
+          if ($ftype == TType::STRUCT) {
+            $this->authzToken = new \Airavata\Model\Security\AuthzToken();
+            $xfer += $this->authzToken->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 2:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->airavataExperimentId);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        default:
+          $xfer += $input->skip($ftype);
+          break;
+      }
+      $xfer += $input->readFieldEnd();
+    }
+    $xfer += $input->readStructEnd();
+    return $xfer;
+  }
+
+  public function write($output) {
+    $xfer = 0;
+    $xfer += $output->writeStructBegin('Airavata_getJobDetails_args');
+    if ($this->authzToken !== null) {
+      if (!is_object($this->authzToken)) {
+        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
+      }
+      $xfer += $output->writeFieldBegin('authzToken', TType::STRUCT, 1);
+      $xfer += $this->authzToken->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->airavataExperimentId !== null) {
+      $xfer += $output->writeFieldBegin('airavataExperimentId', TType::STRING, 2);
+      $xfer += $output->writeString($this->airavataExperimentId);
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
+class Airavata_getJobDetails_result {
+  static $_TSPEC;
+
+  /**
+   * @var \Airavata\Model\Job\JobModel[]
+   */
+  public $success = null;
+  /**
+   * @var \Airavata\API\Error\InvalidRequestException
+   */
+  public $ire = null;
+  /**
+   * @var \Airavata\API\Error\ExperimentNotFoundException
+   */
+  public $enf = null;
+  /**
+   * @var \Airavata\API\Error\AiravataClientException
+   */
+  public $ace = null;
+  /**
+   * @var \Airavata\API\Error\AiravataSystemException
+   */
+  public $ase = null;
+  /**
+   * @var \Airavata\API\Error\AuthorizationException
+   */
+  public $ae = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        0 => array(
+          'var' => 'success',
+          'type' => TType::LST,
+          'etype' => TType::STRUCT,
+          'elem' => array(
+            'type' => TType::STRUCT,
+            'class' => '\Airavata\Model\Job\JobModel',
+            ),
+          ),
+        1 => array(
+          'var' => 'ire',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\API\Error\InvalidRequestException',
+          ),
+        2 => array(
+          'var' => 'enf',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\API\Error\ExperimentNotFoundException',
+          ),
+        3 => array(
+          'var' => 'ace',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\API\Error\AiravataClientException',
+          ),
+        4 => array(
+          'var' => 'ase',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\API\Error\AiravataSystemException',
+          ),
+        5 => array(
+          'var' => 'ae',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\API\Error\AuthorizationException',
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['success'])) {
+        $this->success = $vals['success'];
+      }
+      if (isset($vals['ire'])) {
+        $this->ire = $vals['ire'];
+      }
+      if (isset($vals['enf'])) {
+        $this->enf = $vals['enf'];
+      }
+      if (isset($vals['ace'])) {
+        $this->ace = $vals['ace'];
+      }
+      if (isset($vals['ase'])) {
+        $this->ase = $vals['ase'];
+      }
+      if (isset($vals['ae'])) {
+        $this->ae = $vals['ae'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'Airavata_getJobDetails_result';
+  }
+
+  public function read($input)
+  {
+    $xfer = 0;
+    $fname = null;
+    $ftype = 0;
+    $fid = 0;
+    $xfer += $input->readStructBegin($fname);
+    while (true)
+    {
+      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
+      if ($ftype == TType::STOP) {
+        break;
+      }
+      switch ($fid)
+      {
+        case 0:
+          if ($ftype == TType::LST) {
+            $this->success = array();
+            $_size129 = 0;
+            $_etype132 = 0;
+            $xfer += $input->readListBegin($_etype132, $_size129);
+            for ($_i133 = 0; $_i133 < $_size129; ++$_i133)
+            {
+              $elem134 = null;
+              $elem134 = new \Airavata\Model\Job\JobModel();
+              $xfer += $elem134->read($input);
+              $this->success []= $elem134;
+            }
+            $xfer += $input->readListEnd();
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 1:
+          if ($ftype == TType::STRUCT) {
+            $this->ire = new \Airavata\API\Error\InvalidRequestException();
+            $xfer += $this->ire->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 2:
+          if ($ftype == TType::STRUCT) {
+            $this->enf = new \Airavata\API\Error\ExperimentNotFoundException();
+            $xfer += $this->enf->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 3:
+          if ($ftype == TType::STRUCT) {
+            $this->ace = new \Airavata\API\Error\AiravataClientException();
+            $xfer += $this->ace->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 4:
+          if ($ftype == TType::STRUCT) {
+            $this->ase = new \Airavata\API\Error\AiravataSystemException();
+            $xfer += $this->ase->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 5:
+          if ($ftype == TType::STRUCT) {
+            $this->ae = new \Airavata\API\Error\AuthorizationException();
+            $xfer += $this->ae->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        default:
+          $xfer += $input->skip($ftype);
+          break;
+      }
+      $xfer += $input->readFieldEnd();
+    }
+    $xfer += $input->readStructEnd();
+    return $xfer;
+  }
+
+  public function write($output) {
+    $xfer = 0;
+    $xfer += $output->writeStructBegin('Airavata_getJobDetails_result');
+    if ($this->success !== null) {
+      if (!is_array($this->success)) {
+        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
+      }
+      $xfer += $output->writeFieldBegin('success', TType::LST, 0);
+      {
+        $output->writeListBegin(TType::STRUCT, count($this->success));
+        {
+          foreach ($this->success as $iter135)
+          {
+            $xfer += $iter135->write($output);
+          }
+        }
+        $output->writeListEnd();
+      }
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->ire !== null) {
+      $xfer += $output->writeFieldBegin('ire', TType::STRUCT, 1);
+      $xfer += $this->ire->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->enf !== null) {
+      $xfer += $output->writeFieldBegin('enf', TType::STRUCT, 2);
+      $xfer += $this->enf->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->ace !== null) {
+      $xfer += $output->writeFieldBegin('ace', TType::STRUCT, 3);
+      $xfer += $this->ace->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->ase !== null) {
+      $xfer += $output->writeFieldBegin('ase', TType::STRUCT, 4);
+      $xfer += $this->ase->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->ae !== null) {
+      $xfer += $output->writeFieldBegin('ae', TType::STRUCT, 5);
+      $xfer += $this->ae->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
+class Airavata_cloneExperiment_args {
+  static $_TSPEC;
+
+  /**
+   * @var \Airavata\Model\Security\AuthzToken
+   */
+  public $authzToken = null;
+  /**
+   * @var string
+   */
+  public $existingExperimentID = null;
+  /**
+   * @var string
+   */
+  public $newExperimentName = null;
+  /**
+   * @var string
+   */
+  public $newExperimentProjectId = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        1 => array(
+          'var' => 'authzToken',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\Model\Security\AuthzToken',
+          ),
+        2 => array(
+          'var' => 'existingExperimentID',
+          'type' => TType::STRING,
+          ),
+        3 => array(
+          'var' => 'newExperimentName',
+          'type' => TType::STRING,
+          ),
+        4 => array(
+          'var' => 'newExperimentProjectId',
+          'type' => TType::STRING,
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['authzToken'])) {
+        $this->authzToken = $vals['authzToken'];
+      }
+      if (isset($vals['existingExperimentID'])) {
+        $this->existingExperimentID = $vals['existingExperimentID'];
+      }
+      if (isset($vals['newExperimentName'])) {
+        $this->newExperimentName = $vals['newExperimentName'];
+      }
+      if (isset($vals['newExperimentProjectId'])) {
+        $this->newExperimentProjectId = $vals['newExperimentProjectId'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'Airavata_cloneExperiment_args';
+  }
+
+  public function read($input)
+  {
+    $xfer = 0;
+    $fname = null;
+    $ftype = 0;
+    $fid = 0;
+    $xfer += $input->readStructBegin($fname);
+    while (true)
+    {
+      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
+      if ($ftype == TType::STOP) {
+        break;
+      }
+      switch ($fid)
+      {
+        case 1:
+          if ($ftype == TType::STRUCT) {
+            $this->authzToken = new \Airavata\Model\Security\AuthzToken();
+            $xfer += $this->authzToken->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 2:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->existingExperimentID);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 3:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->newExperimentName);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 4:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->newExperimentProjectId);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        default:
+          $xfer += $input->skip($ftype);
+          break;
+      }
+      $xfer += $input->readFieldEnd();
+    }
+    $xfer += $input->readStructEnd();
+    return $xfer;
+  }
+
+  public function write($output) {
+    $xfer = 0;
+    $xfer += $output->writeStructBegin('Airavata_cloneExperiment_args');
+    if ($this->authzToken !== null) {
+      if (!is_object($this->authzToken)) {
+        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
+      }
+      $xfer += $output->writeFieldBegin('authzToken', TType::STRUCT, 1);
+      $xfer += $this->authzToken->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->existingExperimentID !== null) {
+      $xfer += $output->writeFieldBegin('existingExperimentID', TType::STRING, 2);
+      $xfer += $output->writeString($this->existingExperimentID);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->newExperimentName !== null) {
+      $xfer += $output->writeFieldBegin('newExperimentName', TType::STRING, 3);
+      $xfer += $output->writeString($this->newExperimentName);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->newExperimentProjectId !== null) {
+      $xfer += $output->writeFieldBegin('newExperimentProjectId', TType::STRING, 4);
+      $xfer += $output->writeString($this->newExperimentProjectId);
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
+class Airavata_cloneExperiment_result {
+  static $_TSPEC;
+
+  /**
+   * @var string
+   */
+  public $success = null;
+  /**
+   * @var \Airavata\API\Error\InvalidRequestException
+   */
+  public $ire = null;
+  /**
+   * @var \Airavata\API\Error\ExperimentNotFoundException
+   */
+  public $enf = null;
+  /**
+   * @var \Airavata\API\Error\AiravataClientException
+   */
+  public $ace = null;
+  /**
+   * @var \Airavata\API\Error\AiravataSystemException
+   */
+  public $ase = null;
+  /**
+   * @var \Airavata\API\Error\AuthorizationException
+   */
+  public $ae = null;
+  /**
+   * @var \Airavata\API\Error\ProjectNotFoundException
+   */
+  public $pnfe = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        0 => array(
+          'var' => 'success',
+          'type' => TType::STRING,
+          ),
+        1 => array(
+          'var' => 'ire',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\API\Error\InvalidRequestException',
+          ),
+        2 => array(
+          'var' => 'enf',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\API\Error\ExperimentNotFoundException',
+          ),
+        3 => array(
+          'var' => 'ace',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\API\Error\AiravataClientException',
+          ),
+        4 => array(
+          'var' => 'ase',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\API\Error\AiravataSystemException',
+          ),
+        5 => array(
+          'var' => 'ae',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\API\Error\AuthorizationException',
+          ),
+        6 => array(
+          'var' => 'pnfe',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\API\Error\ProjectNotFoundException',
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['success'])) {
+        $this->success = $vals['success'];
+      }
+      if (isset($vals['ire'])) {
+        $this->ire = $vals['ire'];
+      }
+      if (isset($vals['enf'])) {
+        $this->enf = $vals['enf'];
+      }
+      if (isset($vals['ace'])) {
+        $this->ace = $vals['ace'];
+      }
+      if (isset($vals['ase'])) {
+        $this->ase = $vals['ase'];
+      }
+      if (isset($vals['ae'])) {
+        $this->ae = $vals['ae'];
+      }
+      if (isset($vals['pnfe'])) {
+        $this->pnfe = $vals['pnfe'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'Airavata_cloneExperiment_result';
+  }
+
+  public function read($input)
+  {
+    $xfer = 0;
+    $fname = null;
+    $ftype = 0;
+    $fid = 0;
+    $xfer += $input->readStructBegin($fname);
+    while (true)
+    {
+      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
+      if ($ftype == TType::STOP) {
+        break;
+      }
+      switch ($fid)
+      {
+        case 0:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->success);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 1:
+          if ($ftype == TType::STRUCT) {
+            $this->ire = new \Airavata\API\Error\InvalidRequestException();
+            $xfer += $this->ire->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 2:
+          if ($ftype == TType::STRUCT) {
+            $this->enf = new \Airavata\API\Error\ExperimentNotFoundException();
+            $xfer += $this->enf->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 3:
+          if ($ftype == TType::STRUCT) {
+            $this->ace = new \Airavata\API\Error\AiravataClientException();
+            $xfer += $this->ace->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 4:
+          if ($ftype == TType::STRUCT) {
+         

<TRUNCATED>

[48/50] [abbrv] airavata-php-gateway git commit: AIRAVATA-2408 Updating Thrift stubs

Posted by ma...@apache.org.
AIRAVATA-2408 Updating Thrift stubs


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

Branch: refs/heads/develop
Commit: 135077cd6d77fcd56733b8fd149c88e823d4b1d7
Parents: 3c17052
Author: Marcus Christie <ma...@iu.edu>
Authored: Mon Jun 12 16:46:00 2017 -0400
Committer: Marcus Christie <ma...@iu.edu>
Committed: Mon Jun 12 16:46:00 2017 -0400

----------------------------------------------------------------------
 app/libraries/Airavata/API/Airavata.php | 11335 ++++++++++---------------
 1 file changed, 4512 insertions(+), 6823 deletions(-)
----------------------------------------------------------------------



[11/50] [abbrv] airavata-php-gateway git commit: removing IS tenant removal from Group utilities

Posted by ma...@apache.org.
removing IS tenant removal from Group utilities


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

Branch: refs/heads/develop
Commit: 0d34e1740054468f17760dfa81b37971d04ea96b
Parents: f55323c
Author: scnakandala <su...@gmail.com>
Authored: Fri Mar 24 11:26:22 2017 -0400
Committer: scnakandala <su...@gmail.com>
Committed: Fri Mar 24 11:26:22 2017 -0400

----------------------------------------------------------------------
 app/libraries/GrouperUtilities.php | 33 ++++-----------------------------
 1 file changed, 4 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/0d34e174/app/libraries/GrouperUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/GrouperUtilities.php b/app/libraries/GrouperUtilities.php
index 62714f4..3af5cba 100644
--- a/app/libraries/GrouperUtilities.php
+++ b/app/libraries/GrouperUtilities.php
@@ -23,12 +23,7 @@ class GrouperUtilities
     {
         $newUserPermissionsMap = [];
         foreach($userPermissionMap as $key=> $value){
-            if (strpos($key, '@') !== false) {
-                $parts = explode('@', $key);
-                $key = join('@', array_slice($parts, 0, -1)) . "@" . Config::get('pga_config.airavata')['gateway-id'];
-            }else{
-                $key = $key . "@" . Config::get('pga_config.airavata')['gateway-id'];
-            }
+            $key = $key . "@" . Config::get('pga_config.airavata')['gateway-id'];
             $newUserPermissionsMap[$key] = $value;
         }
         Airavata::shareResourceWithUsers(Session::get('authz-token'), $resourceId, $dataResourceType, $newUserPermissionsMap);
@@ -43,12 +38,7 @@ class GrouperUtilities
     {
         $newUserPermissionsMap = [];
         foreach($userPermissionMap as $key=> $value){
-            if (strpos($key, '@') !== false) {
-                $parts = explode('@', $key);
-                $key = join('@', array_slice($parts, 0, -1)) . "@" . Config::get('pga_config.airavata')['gateway-id'];
-            }else{
-                $key = $key . "@" . Config::get('pga_config.airavata')['gateway-id'];
-            }
+            $key = $key . "@" . Config::get('pga_config.airavata')['gateway-id'];
             $newUserPermissionsMap[$key] = $value;
         }
         Airavata::revokeSharingOfResourceFromUsers(Session::get('authz-token'), $resourceId, $dataResourceType, $newUserPermissionsMap);
@@ -79,12 +69,7 @@ class GrouperUtilities
      * @param $group            Airavata/Model/Group/GrouoModel
      */
     public static function createGroup($group){
-        if (strpos($group->ownerId, '@') !== false) {
-            $parts = explode('@', $group->ownerId);
-            $group->ownerId = join('@', array_slice($parts, 0, -1)) . "@" . Config::get('pga_config.airavata')['gateway-id'];
-        }else{
-            $group->ownerId = $group->ownerId . "@" . Config::get('pga_config.airavata')['gateway-id'];
-        }
+        $group->ownerId = $group->ownerId . "@" . Config::get('pga_config.airavata')['gateway-id'];
         Airavata::createGroup(Session::get('authz-token'),$group);
     }
 
@@ -93,12 +78,7 @@ class GrouperUtilities
      * @param $group            Airavata/Model/Group/GrouoModel
      */
     public static function updateGroup($group){
-        if (strpos($group->ownerId, '@') !== false) {
-            $parts = explode('@', $group->ownerId);
-            $group->ownerId = join('@', array_slice($parts, 0, -1)) . "@" . Config::get('pga_config.airavata')['gateway-id'];
-        }else{
-            $group->ownerId = $group->ownerId . "@" . Config::get('pga_config.airavata')['gateway-id'];
-        }
+        $group->ownerId = $group->ownerId . "@" . Config::get('pga_config.airavata')['gateway-id'];
         Airavata::updateGroup(Session::get('authz-token'),$group);
     }
 
@@ -108,11 +88,6 @@ class GrouperUtilities
      * @param $ownerName
      */
     public static function deleteGroup($groupId, $ownerName){
-        if (strpos($ownerName, '@') !== false) {
-            $parts = explode('@', $ownerName);
-            $ownerName = join('@', array_slice($parts, 0, -1));
-        }
-
         Airavata::deleteGroup(Session::get('authz-token'), $groupId, $ownerName, Config::get('pga_config.airavata')['gateway-id']);
     }
 


[30/50] [abbrv] airavata-php-gateway git commit: Regenerated Thrift stub code and models

Posted by ma...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/d656b4ec/app/libraries/Airavata/API/Error/Types.php
----------------------------------------------------------------------
diff --git a/app/libraries/Airavata/API/Error/Types.php b/app/libraries/Airavata/API/Error/Types.php
index edaa6de..0b5258d 100644
--- a/app/libraries/Airavata/API/Error/Types.php
+++ b/app/libraries/Airavata/API/Error/Types.php
@@ -514,6 +514,88 @@ class AuthorizationException extends TException {
 }
 
 /**
+ * This exception is thrown when you try to save a duplicate entity that already exists
+ *   in the database.
+ * 
+ *   message: contains the associated error message
+ * 
+ */
+class DuplicateEntryException extends TException {
+  static $_TSPEC;
+
+  /**
+   * @var string
+   */
+  public $message = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        1 => array(
+          'var' => 'message',
+          'type' => TType::STRING,
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['message'])) {
+        $this->message = $vals['message'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'DuplicateEntryException';
+  }
+
+  public function read($input)
+  {
+    $xfer = 0;
+    $fname = null;
+    $ftype = 0;
+    $fid = 0;
+    $xfer += $input->readStructBegin($fname);
+    while (true)
+    {
+      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
+      if ($ftype == TType::STOP) {
+        break;
+      }
+      switch ($fid)
+      {
+        case 1:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->message);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        default:
+          $xfer += $input->skip($ftype);
+          break;
+      }
+      $xfer += $input->readFieldEnd();
+    }
+    $xfer += $input->readStructEnd();
+    return $xfer;
+  }
+
+  public function write($output) {
+    $xfer = 0;
+    $xfer += $output->writeStructBegin('DuplicateEntryException');
+    if ($this->message !== null) {
+      $xfer += $output->writeFieldBegin('message', TType::STRING, 1);
+      $xfer += $output->writeString($this->message);
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
+/**
  * This exception is thrown by Airavata Services when a call fails as a result of
  * a problem that a client may be able to resolve.  For example, if the user
  * attempts to execute an application on a resource gateway does not have access to.

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/d656b4ec/app/libraries/Airavata/Model/AppCatalog/ComputeResource/Types.php
----------------------------------------------------------------------
diff --git a/app/libraries/Airavata/Model/AppCatalog/ComputeResource/Types.php b/app/libraries/Airavata/Model/AppCatalog/ComputeResource/Types.php
index 696b064..86e6c5d 100644
--- a/app/libraries/Airavata/Model/AppCatalog/ComputeResource/Types.php
+++ b/app/libraries/Airavata/Model/AppCatalog/ComputeResource/Types.php
@@ -43,6 +43,7 @@ final class ResourceJobManagerType {
   const LSF = 3;
   const UGE = 4;
   const CLOUD = 5;
+  const AIRAVATA_CUSTOM = 6;
   static public $__names = array(
     0 => 'FORK',
     1 => 'PBS',
@@ -50,6 +51,7 @@ final class ResourceJobManagerType {
     3 => 'LSF',
     4 => 'UGE',
     5 => 'CLOUD',
+    6 => 'AIRAVATA_CUSTOM',
   );
 }
 

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/d656b4ec/app/libraries/Airavata/Model/Application/Io/Types.php
----------------------------------------------------------------------
diff --git a/app/libraries/Airavata/Model/Application/Io/Types.php b/app/libraries/Airavata/Model/Application/Io/Types.php
index fd97025..b8bdf76 100644
--- a/app/libraries/Airavata/Model/Application/Io/Types.php
+++ b/app/libraries/Airavata/Model/Application/Io/Types.php
@@ -173,9 +173,9 @@ class InputDataObjectType {
           'var' => 'storageResourceId',
           'type' => TType::STRING,
           ),
-          13 => array(
-              'var' => 'isReadOnly',
-              'type' => TType::BOOL,
+        13 => array(
+          'var' => 'isReadOnly',
+          'type' => TType::BOOL,
           ),
         );
     }

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/d656b4ec/app/libraries/Airavata/Model/Data/Replica/Types.php
----------------------------------------------------------------------
diff --git a/app/libraries/Airavata/Model/Data/Replica/Types.php b/app/libraries/Airavata/Model/Data/Replica/Types.php
index 7fba287..d6e208e 100644
--- a/app/libraries/Airavata/Model/Data/Replica/Types.php
+++ b/app/libraries/Airavata/Model/Data/Replica/Types.php
@@ -48,103 +48,107 @@ final class DataProductType {
   );
 }
 
-class DataProductModel {
+class DataReplicaLocationModel {
   static $_TSPEC;
 
   /**
    * @var string
    */
-  public $productUri = null;
+  public $replicaId = null;
   /**
    * @var string
    */
-  public $gatewayId = null;
+  public $productUri = null;
   /**
    * @var string
    */
-  public $parentProductUri = null;
+  public $replicaName = null;
   /**
    * @var string
    */
-  public $productName = null;
+  public $replicaDescription = null;
   /**
-   * @var string
+   * @var int
    */
-  public $productDescription = null;
+  public $creationTime = null;
   /**
-   * @var string
+   * @var int
    */
-  public $ownerName = null;
+  public $lastModifiedTime = null;
   /**
    * @var int
    */
-  public $dataProductType = null;
+  public $validUntilTime = null;
   /**
    * @var int
    */
-  public $productSize = null;
+  public $replicaLocationCategory = null;
   /**
    * @var int
    */
-  public $creationTime = null;
+  public $replicaPersistentType = null;
   /**
-   * @var int
+   * @var string
    */
-  public $lastModifiedTime = null;
+  public $storageResourceId = null;
   /**
-   * @var array
+   * @var string
    */
-  public $productMetadata = null;
+  public $filePath = null;
   /**
-   * @var \Airavata\Model\Data\Replica\DataReplicaLocationModel[]
+   * @var array
    */
-  public $replicaLocations = null;
+  public $replicaMetadata = null;
 
   public function __construct($vals=null) {
     if (!isset(self::$_TSPEC)) {
       self::$_TSPEC = array(
         1 => array(
-          'var' => 'productUri',
+          'var' => 'replicaId',
           'type' => TType::STRING,
           ),
         2 => array(
-          'var' => 'gatewayId',
+          'var' => 'productUri',
           'type' => TType::STRING,
           ),
         3 => array(
-          'var' => 'parentProductUri',
+          'var' => 'replicaName',
           'type' => TType::STRING,
           ),
         4 => array(
-          'var' => 'productName',
+          'var' => 'replicaDescription',
           'type' => TType::STRING,
           ),
         5 => array(
-          'var' => 'productDescription',
-          'type' => TType::STRING,
+          'var' => 'creationTime',
+          'type' => TType::I64,
           ),
         6 => array(
-          'var' => 'ownerName',
-          'type' => TType::STRING,
+          'var' => 'lastModifiedTime',
+          'type' => TType::I64,
           ),
         7 => array(
-          'var' => 'dataProductType',
-          'type' => TType::I32,
+          'var' => 'validUntilTime',
+          'type' => TType::I64,
           ),
         8 => array(
-          'var' => 'productSize',
+          'var' => 'replicaLocationCategory',
           'type' => TType::I32,
           ),
         9 => array(
-          'var' => 'creationTime',
-          'type' => TType::I64,
+          'var' => 'replicaPersistentType',
+          'type' => TType::I32,
           ),
         10 => array(
-          'var' => 'lastModifiedTime',
-          'type' => TType::I64,
+          'var' => 'storageResourceId',
+          'type' => TType::STRING,
           ),
         11 => array(
-          'var' => 'productMetadata',
+          'var' => 'filePath',
+          'type' => TType::STRING,
+          ),
+        12 => array(
+          'var' => 'replicaMetadata',
           'type' => TType::MAP,
           'ktype' => TType::STRING,
           'vtype' => TType::STRING,
@@ -155,41 +159,20 @@ class DataProductModel {
             'type' => TType::STRING,
             ),
           ),
-        12 => array(
-          'var' => 'replicaLocations',
-          'type' => TType::LST,
-          'etype' => TType::STRUCT,
-          'elem' => array(
-            'type' => TType::STRUCT,
-            'class' => '\Airavata\Model\Data\Replica\DataReplicaLocationModel',
-            ),
-          ),
         );
     }
     if (is_array($vals)) {
+      if (isset($vals['replicaId'])) {
+        $this->replicaId = $vals['replicaId'];
+      }
       if (isset($vals['productUri'])) {
         $this->productUri = $vals['productUri'];
       }
-      if (isset($vals['gatewayId'])) {
-        $this->gatewayId = $vals['gatewayId'];
-      }
-      if (isset($vals['parentProductUri'])) {
-        $this->parentProductUri = $vals['parentProductUri'];
-      }
-      if (isset($vals['productName'])) {
-        $this->productName = $vals['productName'];
-      }
-      if (isset($vals['productDescription'])) {
-        $this->productDescription = $vals['productDescription'];
-      }
-      if (isset($vals['ownerName'])) {
-        $this->ownerName = $vals['ownerName'];
-      }
-      if (isset($vals['dataProductType'])) {
-        $this->dataProductType = $vals['dataProductType'];
+      if (isset($vals['replicaName'])) {
+        $this->replicaName = $vals['replicaName'];
       }
-      if (isset($vals['productSize'])) {
-        $this->productSize = $vals['productSize'];
+      if (isset($vals['replicaDescription'])) {
+        $this->replicaDescription = $vals['replicaDescription'];
       }
       if (isset($vals['creationTime'])) {
         $this->creationTime = $vals['creationTime'];
@@ -197,17 +180,29 @@ class DataProductModel {
       if (isset($vals['lastModifiedTime'])) {
         $this->lastModifiedTime = $vals['lastModifiedTime'];
       }
-      if (isset($vals['productMetadata'])) {
-        $this->productMetadata = $vals['productMetadata'];
+      if (isset($vals['validUntilTime'])) {
+        $this->validUntilTime = $vals['validUntilTime'];
       }
-      if (isset($vals['replicaLocations'])) {
-        $this->replicaLocations = $vals['replicaLocations'];
+      if (isset($vals['replicaLocationCategory'])) {
+        $this->replicaLocationCategory = $vals['replicaLocationCategory'];
+      }
+      if (isset($vals['replicaPersistentType'])) {
+        $this->replicaPersistentType = $vals['replicaPersistentType'];
+      }
+      if (isset($vals['storageResourceId'])) {
+        $this->storageResourceId = $vals['storageResourceId'];
+      }
+      if (isset($vals['filePath'])) {
+        $this->filePath = $vals['filePath'];
+      }
+      if (isset($vals['replicaMetadata'])) {
+        $this->replicaMetadata = $vals['replicaMetadata'];
       }
     }
   }
 
   public function getName() {
-    return 'DataProductModel';
+    return 'DataReplicaLocationModel';
   }
 
   public function read($input)
@@ -227,77 +222,84 @@ class DataProductModel {
       {
         case 1:
           if ($ftype == TType::STRING) {
-            $xfer += $input->readString($this->productUri);
+            $xfer += $input->readString($this->replicaId);
           } else {
             $xfer += $input->skip($ftype);
           }
           break;
         case 2:
           if ($ftype == TType::STRING) {
-            $xfer += $input->readString($this->gatewayId);
+            $xfer += $input->readString($this->productUri);
           } else {
             $xfer += $input->skip($ftype);
           }
           break;
         case 3:
           if ($ftype == TType::STRING) {
-            $xfer += $input->readString($this->parentProductUri);
+            $xfer += $input->readString($this->replicaName);
           } else {
             $xfer += $input->skip($ftype);
           }
           break;
         case 4:
           if ($ftype == TType::STRING) {
-            $xfer += $input->readString($this->productName);
+            $xfer += $input->readString($this->replicaDescription);
           } else {
             $xfer += $input->skip($ftype);
           }
           break;
         case 5:
-          if ($ftype == TType::STRING) {
-            $xfer += $input->readString($this->productDescription);
+          if ($ftype == TType::I64) {
+            $xfer += $input->readI64($this->creationTime);
           } else {
             $xfer += $input->skip($ftype);
           }
           break;
         case 6:
-          if ($ftype == TType::STRING) {
-            $xfer += $input->readString($this->ownerName);
+          if ($ftype == TType::I64) {
+            $xfer += $input->readI64($this->lastModifiedTime);
           } else {
             $xfer += $input->skip($ftype);
           }
           break;
         case 7:
-          if ($ftype == TType::I32) {
-            $xfer += $input->readI32($this->dataProductType);
+          if ($ftype == TType::I64) {
+            $xfer += $input->readI64($this->validUntilTime);
           } else {
             $xfer += $input->skip($ftype);
           }
           break;
         case 8:
           if ($ftype == TType::I32) {
-            $xfer += $input->readI32($this->productSize);
+            $xfer += $input->readI32($this->replicaLocationCategory);
           } else {
             $xfer += $input->skip($ftype);
           }
           break;
         case 9:
-          if ($ftype == TType::I64) {
-            $xfer += $input->readI64($this->creationTime);
+          if ($ftype == TType::I32) {
+            $xfer += $input->readI32($this->replicaPersistentType);
           } else {
             $xfer += $input->skip($ftype);
           }
           break;
         case 10:
-          if ($ftype == TType::I64) {
-            $xfer += $input->readI64($this->lastModifiedTime);
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->storageResourceId);
           } else {
             $xfer += $input->skip($ftype);
           }
           break;
         case 11:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->filePath);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 12:
           if ($ftype == TType::MAP) {
-            $this->productMetadata = array();
+            $this->replicaMetadata = array();
             $_size0 = 0;
             $_ktype1 = 0;
             $_vtype2 = 0;
@@ -308,31 +310,13 @@ class DataProductModel {
               $val6 = '';
               $xfer += $input->readString($key5);
               $xfer += $input->readString($val6);
-              $this->productMetadata[$key5] = $val6;
+              $this->replicaMetadata[$key5] = $val6;
             }
             $xfer += $input->readMapEnd();
           } else {
             $xfer += $input->skip($ftype);
           }
           break;
-        case 12:
-          if ($ftype == TType::LST) {
-            $this->replicaLocations = array();
-            $_size7 = 0;
-            $_etype10 = 0;
-            $xfer += $input->readListBegin($_etype10, $_size7);
-            for ($_i11 = 0; $_i11 < $_size7; ++$_i11)
-            {
-              $elem12 = null;
-              $elem12 = new \Airavata\Model\Data\Replica\DataReplicaLocationModel();
-              $xfer += $elem12->read($input);
-              $this->replicaLocations []= $elem12;
-            }
-            $xfer += $input->readListEnd();
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
         default:
           $xfer += $input->skip($ftype);
           break;
@@ -345,92 +329,80 @@ class DataProductModel {
 
   public function write($output) {
     $xfer = 0;
-    $xfer += $output->writeStructBegin('DataProductModel');
+    $xfer += $output->writeStructBegin('DataReplicaLocationModel');
+    if ($this->replicaId !== null) {
+      $xfer += $output->writeFieldBegin('replicaId', TType::STRING, 1);
+      $xfer += $output->writeString($this->replicaId);
+      $xfer += $output->writeFieldEnd();
+    }
     if ($this->productUri !== null) {
-      $xfer += $output->writeFieldBegin('productUri', TType::STRING, 1);
+      $xfer += $output->writeFieldBegin('productUri', TType::STRING, 2);
       $xfer += $output->writeString($this->productUri);
       $xfer += $output->writeFieldEnd();
     }
-    if ($this->gatewayId !== null) {
-      $xfer += $output->writeFieldBegin('gatewayId', TType::STRING, 2);
-      $xfer += $output->writeString($this->gatewayId);
+    if ($this->replicaName !== null) {
+      $xfer += $output->writeFieldBegin('replicaName', TType::STRING, 3);
+      $xfer += $output->writeString($this->replicaName);
       $xfer += $output->writeFieldEnd();
     }
-    if ($this->parentProductUri !== null) {
-      $xfer += $output->writeFieldBegin('parentProductUri', TType::STRING, 3);
-      $xfer += $output->writeString($this->parentProductUri);
+    if ($this->replicaDescription !== null) {
+      $xfer += $output->writeFieldBegin('replicaDescription', TType::STRING, 4);
+      $xfer += $output->writeString($this->replicaDescription);
       $xfer += $output->writeFieldEnd();
     }
-    if ($this->productName !== null) {
-      $xfer += $output->writeFieldBegin('productName', TType::STRING, 4);
-      $xfer += $output->writeString($this->productName);
+    if ($this->creationTime !== null) {
+      $xfer += $output->writeFieldBegin('creationTime', TType::I64, 5);
+      $xfer += $output->writeI64($this->creationTime);
       $xfer += $output->writeFieldEnd();
     }
-    if ($this->productDescription !== null) {
-      $xfer += $output->writeFieldBegin('productDescription', TType::STRING, 5);
-      $xfer += $output->writeString($this->productDescription);
+    if ($this->lastModifiedTime !== null) {
+      $xfer += $output->writeFieldBegin('lastModifiedTime', TType::I64, 6);
+      $xfer += $output->writeI64($this->lastModifiedTime);
       $xfer += $output->writeFieldEnd();
     }
-    if ($this->ownerName !== null) {
-      $xfer += $output->writeFieldBegin('ownerName', TType::STRING, 6);
-      $xfer += $output->writeString($this->ownerName);
+    if ($this->validUntilTime !== null) {
+      $xfer += $output->writeFieldBegin('validUntilTime', TType::I64, 7);
+      $xfer += $output->writeI64($this->validUntilTime);
       $xfer += $output->writeFieldEnd();
     }
-    if ($this->dataProductType !== null) {
-      $xfer += $output->writeFieldBegin('dataProductType', TType::I32, 7);
-      $xfer += $output->writeI32($this->dataProductType);
+    if ($this->replicaLocationCategory !== null) {
+      $xfer += $output->writeFieldBegin('replicaLocationCategory', TType::I32, 8);
+      $xfer += $output->writeI32($this->replicaLocationCategory);
       $xfer += $output->writeFieldEnd();
     }
-    if ($this->productSize !== null) {
-      $xfer += $output->writeFieldBegin('productSize', TType::I32, 8);
-      $xfer += $output->writeI32($this->productSize);
+    if ($this->replicaPersistentType !== null) {
+      $xfer += $output->writeFieldBegin('replicaPersistentType', TType::I32, 9);
+      $xfer += $output->writeI32($this->replicaPersistentType);
       $xfer += $output->writeFieldEnd();
     }
-    if ($this->creationTime !== null) {
-      $xfer += $output->writeFieldBegin('creationTime', TType::I64, 9);
-      $xfer += $output->writeI64($this->creationTime);
+    if ($this->storageResourceId !== null) {
+      $xfer += $output->writeFieldBegin('storageResourceId', TType::STRING, 10);
+      $xfer += $output->writeString($this->storageResourceId);
       $xfer += $output->writeFieldEnd();
     }
-    if ($this->lastModifiedTime !== null) {
-      $xfer += $output->writeFieldBegin('lastModifiedTime', TType::I64, 10);
-      $xfer += $output->writeI64($this->lastModifiedTime);
+    if ($this->filePath !== null) {
+      $xfer += $output->writeFieldBegin('filePath', TType::STRING, 11);
+      $xfer += $output->writeString($this->filePath);
       $xfer += $output->writeFieldEnd();
     }
-    if ($this->productMetadata !== null) {
-      if (!is_array($this->productMetadata)) {
+    if ($this->replicaMetadata !== null) {
+      if (!is_array($this->replicaMetadata)) {
         throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
       }
-      $xfer += $output->writeFieldBegin('productMetadata', TType::MAP, 11);
+      $xfer += $output->writeFieldBegin('replicaMetadata', TType::MAP, 12);
       {
-        $output->writeMapBegin(TType::STRING, TType::STRING, count($this->productMetadata));
+        $output->writeMapBegin(TType::STRING, TType::STRING, count($this->replicaMetadata));
         {
-          foreach ($this->productMetadata as $kiter13 => $viter14)
+          foreach ($this->replicaMetadata as $kiter7 => $viter8)
           {
-            $xfer += $output->writeString($kiter13);
-            $xfer += $output->writeString($viter14);
+            $xfer += $output->writeString($kiter7);
+            $xfer += $output->writeString($viter8);
           }
         }
         $output->writeMapEnd();
       }
       $xfer += $output->writeFieldEnd();
     }
-    if ($this->replicaLocations !== null) {
-      if (!is_array($this->replicaLocations)) {
-        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
-      }
-      $xfer += $output->writeFieldBegin('replicaLocations', TType::LST, 12);
-      {
-        $output->writeListBegin(TType::STRUCT, count($this->replicaLocations));
-        {
-          foreach ($this->replicaLocations as $iter15)
-          {
-            $xfer += $iter15->write($output);
-          }
-        }
-        $output->writeListEnd();
-      }
-      $xfer += $output->writeFieldEnd();
-    }
     $xfer += $output->writeFieldStop();
     $xfer += $output->writeStructEnd();
     return $xfer;
@@ -438,107 +410,103 @@ class DataProductModel {
 
 }
 
-class DataReplicaLocationModel {
+class DataProductModel {
   static $_TSPEC;
 
   /**
    * @var string
    */
-  public $replicaId = null;
+  public $productUri = null;
   /**
    * @var string
    */
-  public $productUri = null;
+  public $gatewayId = null;
   /**
    * @var string
    */
-  public $replicaName = null;
+  public $parentProductUri = null;
   /**
    * @var string
    */
-  public $replicaDescription = null;
+  public $productName = null;
   /**
-   * @var int
+   * @var string
    */
-  public $creationTime = null;
+  public $productDescription = null;
   /**
-   * @var int
+   * @var string
    */
-  public $lastModifiedTime = null;
+  public $ownerName = null;
   /**
    * @var int
    */
-  public $validUntilTime = null;
+  public $dataProductType = null;
   /**
    * @var int
    */
-  public $replicaLocationCategory = null;
+  public $productSize = null;
   /**
    * @var int
    */
-  public $replicaPersistentType = null;
+  public $creationTime = null;
   /**
-   * @var string
+   * @var int
    */
-  public $storageResourceId = null;
+  public $lastModifiedTime = null;
   /**
-   * @var string
+   * @var array
    */
-  public $filePath = null;
+  public $productMetadata = null;
   /**
-   * @var array
+   * @var \Airavata\Model\Data\Replica\DataReplicaLocationModel[]
    */
-  public $replicaMetadata = null;
+  public $replicaLocations = null;
 
   public function __construct($vals=null) {
     if (!isset(self::$_TSPEC)) {
       self::$_TSPEC = array(
         1 => array(
-          'var' => 'replicaId',
+          'var' => 'productUri',
           'type' => TType::STRING,
           ),
         2 => array(
-          'var' => 'productUri',
+          'var' => 'gatewayId',
           'type' => TType::STRING,
           ),
         3 => array(
-          'var' => 'replicaName',
+          'var' => 'parentProductUri',
           'type' => TType::STRING,
           ),
         4 => array(
-          'var' => 'replicaDescription',
+          'var' => 'productName',
           'type' => TType::STRING,
           ),
         5 => array(
-          'var' => 'creationTime',
-          'type' => TType::I64,
+          'var' => 'productDescription',
+          'type' => TType::STRING,
           ),
         6 => array(
-          'var' => 'lastModifiedTime',
-          'type' => TType::I64,
+          'var' => 'ownerName',
+          'type' => TType::STRING,
           ),
         7 => array(
-          'var' => 'validUntilTime',
-          'type' => TType::I64,
+          'var' => 'dataProductType',
+          'type' => TType::I32,
           ),
         8 => array(
-          'var' => 'replicaLocationCategory',
+          'var' => 'productSize',
           'type' => TType::I32,
           ),
         9 => array(
-          'var' => 'replicaPersistentType',
-          'type' => TType::I32,
+          'var' => 'creationTime',
+          'type' => TType::I64,
           ),
         10 => array(
-          'var' => 'storageResourceId',
-          'type' => TType::STRING,
+          'var' => 'lastModifiedTime',
+          'type' => TType::I64,
           ),
         11 => array(
-          'var' => 'filePath',
-          'type' => TType::STRING,
-          ),
-        12 => array(
-          'var' => 'replicaMetadata',
+          'var' => 'productMetadata',
           'type' => TType::MAP,
           'ktype' => TType::STRING,
           'vtype' => TType::STRING,
@@ -549,50 +517,59 @@ class DataReplicaLocationModel {
             'type' => TType::STRING,
             ),
           ),
+        12 => array(
+          'var' => 'replicaLocations',
+          'type' => TType::LST,
+          'etype' => TType::STRUCT,
+          'elem' => array(
+            'type' => TType::STRUCT,
+            'class' => '\Airavata\Model\Data\Replica\DataReplicaLocationModel',
+            ),
+          ),
         );
     }
     if (is_array($vals)) {
-      if (isset($vals['replicaId'])) {
-        $this->replicaId = $vals['replicaId'];
-      }
       if (isset($vals['productUri'])) {
         $this->productUri = $vals['productUri'];
       }
-      if (isset($vals['replicaName'])) {
-        $this->replicaName = $vals['replicaName'];
+      if (isset($vals['gatewayId'])) {
+        $this->gatewayId = $vals['gatewayId'];
       }
-      if (isset($vals['replicaDescription'])) {
-        $this->replicaDescription = $vals['replicaDescription'];
+      if (isset($vals['parentProductUri'])) {
+        $this->parentProductUri = $vals['parentProductUri'];
       }
-      if (isset($vals['creationTime'])) {
-        $this->creationTime = $vals['creationTime'];
+      if (isset($vals['productName'])) {
+        $this->productName = $vals['productName'];
       }
-      if (isset($vals['lastModifiedTime'])) {
-        $this->lastModifiedTime = $vals['lastModifiedTime'];
+      if (isset($vals['productDescription'])) {
+        $this->productDescription = $vals['productDescription'];
       }
-      if (isset($vals['validUntilTime'])) {
-        $this->validUntilTime = $vals['validUntilTime'];
+      if (isset($vals['ownerName'])) {
+        $this->ownerName = $vals['ownerName'];
       }
-      if (isset($vals['replicaLocationCategory'])) {
-        $this->replicaLocationCategory = $vals['replicaLocationCategory'];
+      if (isset($vals['dataProductType'])) {
+        $this->dataProductType = $vals['dataProductType'];
       }
-      if (isset($vals['replicaPersistentType'])) {
-        $this->replicaPersistentType = $vals['replicaPersistentType'];
+      if (isset($vals['productSize'])) {
+        $this->productSize = $vals['productSize'];
       }
-      if (isset($vals['storageResourceId'])) {
-        $this->storageResourceId = $vals['storageResourceId'];
+      if (isset($vals['creationTime'])) {
+        $this->creationTime = $vals['creationTime'];
       }
-      if (isset($vals['filePath'])) {
-        $this->filePath = $vals['filePath'];
+      if (isset($vals['lastModifiedTime'])) {
+        $this->lastModifiedTime = $vals['lastModifiedTime'];
       }
-      if (isset($vals['replicaMetadata'])) {
-        $this->replicaMetadata = $vals['replicaMetadata'];
+      if (isset($vals['productMetadata'])) {
+        $this->productMetadata = $vals['productMetadata'];
+      }
+      if (isset($vals['replicaLocations'])) {
+        $this->replicaLocations = $vals['replicaLocations'];
       }
     }
   }
 
   public function getName() {
-    return 'DataReplicaLocationModel';
+    return 'DataProductModel';
   }
 
   public function read($input)
@@ -612,97 +589,108 @@ class DataReplicaLocationModel {
       {
         case 1:
           if ($ftype == TType::STRING) {
-            $xfer += $input->readString($this->replicaId);
+            $xfer += $input->readString($this->productUri);
           } else {
             $xfer += $input->skip($ftype);
           }
           break;
         case 2:
           if ($ftype == TType::STRING) {
-            $xfer += $input->readString($this->productUri);
+            $xfer += $input->readString($this->gatewayId);
           } else {
             $xfer += $input->skip($ftype);
           }
           break;
         case 3:
           if ($ftype == TType::STRING) {
-            $xfer += $input->readString($this->replicaName);
+            $xfer += $input->readString($this->parentProductUri);
           } else {
             $xfer += $input->skip($ftype);
           }
           break;
         case 4:
           if ($ftype == TType::STRING) {
-            $xfer += $input->readString($this->replicaDescription);
+            $xfer += $input->readString($this->productName);
           } else {
             $xfer += $input->skip($ftype);
           }
           break;
         case 5:
-          if ($ftype == TType::I64) {
-            $xfer += $input->readI64($this->creationTime);
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->productDescription);
           } else {
             $xfer += $input->skip($ftype);
           }
           break;
         case 6:
-          if ($ftype == TType::I64) {
-            $xfer += $input->readI64($this->lastModifiedTime);
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->ownerName);
           } else {
             $xfer += $input->skip($ftype);
           }
           break;
         case 7:
-          if ($ftype == TType::I64) {
-            $xfer += $input->readI64($this->validUntilTime);
+          if ($ftype == TType::I32) {
+            $xfer += $input->readI32($this->dataProductType);
           } else {
             $xfer += $input->skip($ftype);
           }
           break;
         case 8:
           if ($ftype == TType::I32) {
-            $xfer += $input->readI32($this->replicaLocationCategory);
+            $xfer += $input->readI32($this->productSize);
           } else {
             $xfer += $input->skip($ftype);
           }
           break;
         case 9:
-          if ($ftype == TType::I32) {
-            $xfer += $input->readI32($this->replicaPersistentType);
+          if ($ftype == TType::I64) {
+            $xfer += $input->readI64($this->creationTime);
           } else {
             $xfer += $input->skip($ftype);
           }
           break;
         case 10:
-          if ($ftype == TType::STRING) {
-            $xfer += $input->readString($this->storageResourceId);
+          if ($ftype == TType::I64) {
+            $xfer += $input->readI64($this->lastModifiedTime);
           } else {
             $xfer += $input->skip($ftype);
           }
           break;
         case 11:
-          if ($ftype == TType::STRING) {
-            $xfer += $input->readString($this->filePath);
+          if ($ftype == TType::MAP) {
+            $this->productMetadata = array();
+            $_size9 = 0;
+            $_ktype10 = 0;
+            $_vtype11 = 0;
+            $xfer += $input->readMapBegin($_ktype10, $_vtype11, $_size9);
+            for ($_i13 = 0; $_i13 < $_size9; ++$_i13)
+            {
+              $key14 = '';
+              $val15 = '';
+              $xfer += $input->readString($key14);
+              $xfer += $input->readString($val15);
+              $this->productMetadata[$key14] = $val15;
+            }
+            $xfer += $input->readMapEnd();
           } else {
             $xfer += $input->skip($ftype);
           }
           break;
         case 12:
-          if ($ftype == TType::MAP) {
-            $this->replicaMetadata = array();
+          if ($ftype == TType::LST) {
+            $this->replicaLocations = array();
             $_size16 = 0;
-            $_ktype17 = 0;
-            $_vtype18 = 0;
-            $xfer += $input->readMapBegin($_ktype17, $_vtype18, $_size16);
+            $_etype19 = 0;
+            $xfer += $input->readListBegin($_etype19, $_size16);
             for ($_i20 = 0; $_i20 < $_size16; ++$_i20)
             {
-              $key21 = '';
-              $val22 = '';
-              $xfer += $input->readString($key21);
-              $xfer += $input->readString($val22);
-              $this->replicaMetadata[$key21] = $val22;
+              $elem21 = null;
+              $elem21 = new \Airavata\Model\Data\Replica\DataReplicaLocationModel();
+              $xfer += $elem21->read($input);
+              $this->replicaLocations []= $elem21;
             }
-            $xfer += $input->readMapEnd();
+            $xfer += $input->readListEnd();
           } else {
             $xfer += $input->skip($ftype);
           }
@@ -719,80 +707,92 @@ class DataReplicaLocationModel {
 
   public function write($output) {
     $xfer = 0;
-    $xfer += $output->writeStructBegin('DataReplicaLocationModel');
-    if ($this->replicaId !== null) {
-      $xfer += $output->writeFieldBegin('replicaId', TType::STRING, 1);
-      $xfer += $output->writeString($this->replicaId);
-      $xfer += $output->writeFieldEnd();
-    }
+    $xfer += $output->writeStructBegin('DataProductModel');
     if ($this->productUri !== null) {
-      $xfer += $output->writeFieldBegin('productUri', TType::STRING, 2);
+      $xfer += $output->writeFieldBegin('productUri', TType::STRING, 1);
       $xfer += $output->writeString($this->productUri);
       $xfer += $output->writeFieldEnd();
     }
-    if ($this->replicaName !== null) {
-      $xfer += $output->writeFieldBegin('replicaName', TType::STRING, 3);
-      $xfer += $output->writeString($this->replicaName);
+    if ($this->gatewayId !== null) {
+      $xfer += $output->writeFieldBegin('gatewayId', TType::STRING, 2);
+      $xfer += $output->writeString($this->gatewayId);
       $xfer += $output->writeFieldEnd();
     }
-    if ($this->replicaDescription !== null) {
-      $xfer += $output->writeFieldBegin('replicaDescription', TType::STRING, 4);
-      $xfer += $output->writeString($this->replicaDescription);
+    if ($this->parentProductUri !== null) {
+      $xfer += $output->writeFieldBegin('parentProductUri', TType::STRING, 3);
+      $xfer += $output->writeString($this->parentProductUri);
       $xfer += $output->writeFieldEnd();
     }
-    if ($this->creationTime !== null) {
-      $xfer += $output->writeFieldBegin('creationTime', TType::I64, 5);
-      $xfer += $output->writeI64($this->creationTime);
+    if ($this->productName !== null) {
+      $xfer += $output->writeFieldBegin('productName', TType::STRING, 4);
+      $xfer += $output->writeString($this->productName);
       $xfer += $output->writeFieldEnd();
     }
-    if ($this->lastModifiedTime !== null) {
-      $xfer += $output->writeFieldBegin('lastModifiedTime', TType::I64, 6);
-      $xfer += $output->writeI64($this->lastModifiedTime);
+    if ($this->productDescription !== null) {
+      $xfer += $output->writeFieldBegin('productDescription', TType::STRING, 5);
+      $xfer += $output->writeString($this->productDescription);
       $xfer += $output->writeFieldEnd();
     }
-    if ($this->validUntilTime !== null) {
-      $xfer += $output->writeFieldBegin('validUntilTime', TType::I64, 7);
-      $xfer += $output->writeI64($this->validUntilTime);
+    if ($this->ownerName !== null) {
+      $xfer += $output->writeFieldBegin('ownerName', TType::STRING, 6);
+      $xfer += $output->writeString($this->ownerName);
       $xfer += $output->writeFieldEnd();
     }
-    if ($this->replicaLocationCategory !== null) {
-      $xfer += $output->writeFieldBegin('replicaLocationCategory', TType::I32, 8);
-      $xfer += $output->writeI32($this->replicaLocationCategory);
+    if ($this->dataProductType !== null) {
+      $xfer += $output->writeFieldBegin('dataProductType', TType::I32, 7);
+      $xfer += $output->writeI32($this->dataProductType);
       $xfer += $output->writeFieldEnd();
     }
-    if ($this->replicaPersistentType !== null) {
-      $xfer += $output->writeFieldBegin('replicaPersistentType', TType::I32, 9);
-      $xfer += $output->writeI32($this->replicaPersistentType);
+    if ($this->productSize !== null) {
+      $xfer += $output->writeFieldBegin('productSize', TType::I32, 8);
+      $xfer += $output->writeI32($this->productSize);
       $xfer += $output->writeFieldEnd();
     }
-    if ($this->storageResourceId !== null) {
-      $xfer += $output->writeFieldBegin('storageResourceId', TType::STRING, 10);
-      $xfer += $output->writeString($this->storageResourceId);
+    if ($this->creationTime !== null) {
+      $xfer += $output->writeFieldBegin('creationTime', TType::I64, 9);
+      $xfer += $output->writeI64($this->creationTime);
       $xfer += $output->writeFieldEnd();
     }
-    if ($this->filePath !== null) {
-      $xfer += $output->writeFieldBegin('filePath', TType::STRING, 11);
-      $xfer += $output->writeString($this->filePath);
+    if ($this->lastModifiedTime !== null) {
+      $xfer += $output->writeFieldBegin('lastModifiedTime', TType::I64, 10);
+      $xfer += $output->writeI64($this->lastModifiedTime);
       $xfer += $output->writeFieldEnd();
     }
-    if ($this->replicaMetadata !== null) {
-      if (!is_array($this->replicaMetadata)) {
+    if ($this->productMetadata !== null) {
+      if (!is_array($this->productMetadata)) {
         throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
       }
-      $xfer += $output->writeFieldBegin('replicaMetadata', TType::MAP, 12);
+      $xfer += $output->writeFieldBegin('productMetadata', TType::MAP, 11);
       {
-        $output->writeMapBegin(TType::STRING, TType::STRING, count($this->replicaMetadata));
+        $output->writeMapBegin(TType::STRING, TType::STRING, count($this->productMetadata));
         {
-          foreach ($this->replicaMetadata as $kiter23 => $viter24)
+          foreach ($this->productMetadata as $kiter22 => $viter23)
           {
-            $xfer += $output->writeString($kiter23);
-            $xfer += $output->writeString($viter24);
+            $xfer += $output->writeString($kiter22);
+            $xfer += $output->writeString($viter23);
           }
         }
         $output->writeMapEnd();
       }
       $xfer += $output->writeFieldEnd();
     }
+    if ($this->replicaLocations !== null) {
+      if (!is_array($this->replicaLocations)) {
+        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
+      }
+      $xfer += $output->writeFieldBegin('replicaLocations', TType::LST, 12);
+      {
+        $output->writeListBegin(TType::STRUCT, count($this->replicaLocations));
+        {
+          foreach ($this->replicaLocations as $iter24)
+          {
+            $xfer += $iter24->write($output);
+          }
+        }
+        $output->writeListEnd();
+      }
+      $xfer += $output->writeFieldEnd();
+    }
     $xfer += $output->writeFieldStop();
     $xfer += $output->writeStructEnd();
     return $xfer;

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/d656b4ec/app/libraries/Airavata/Model/Dbevent/Types.php
----------------------------------------------------------------------
diff --git a/app/libraries/Airavata/Model/Dbevent/Types.php b/app/libraries/Airavata/Model/Dbevent/Types.php
new file mode 100644
index 0000000..bfbc983
--- /dev/null
+++ b/app/libraries/Airavata/Model/Dbevent/Types.php
@@ -0,0 +1,573 @@
+<?php
+namespace Airavata\Model\Dbevent;
+
+/**
+ * Autogenerated by Thrift Compiler (0.9.3)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ *  @generated
+ */
+use Thrift\Base\TBase;
+use Thrift\Type\TType;
+use Thrift\Type\TMessageType;
+use Thrift\Exception\TException;
+use Thrift\Exception\TProtocolException;
+use Thrift\Protocol\TProtocol;
+use Thrift\Protocol\TBinaryProtocolAccelerated;
+use Thrift\Exception\TApplicationException;
+
+
+final class CrudType {
+  const CREATE = 0;
+  const READ = 1;
+  const UPDATE = 2;
+  const DELETE = 3;
+  static public $__names = array(
+    0 => 'CREATE',
+    1 => 'READ',
+    2 => 'UPDATE',
+    3 => 'DELETE',
+  );
+}
+
+final class EntityType {
+  const USER_PROFILE = 0;
+  const TENANT = 1;
+  const GROUP = 2;
+  const PROJECT = 3;
+  const EXPERIMENT = 4;
+  const APPLICATION = 5;
+  const SHARING = 6;
+  const REGISTRY = 7;
+  static public $__names = array(
+    0 => 'USER_PROFILE',
+    1 => 'TENANT',
+    2 => 'GROUP',
+    3 => 'PROJECT',
+    4 => 'EXPERIMENT',
+    5 => 'APPLICATION',
+    6 => 'SHARING',
+    7 => 'REGISTRY',
+  );
+}
+
+final class DBEventType {
+  const PUBLISHER = 0;
+  const SUBSCRIBER = 1;
+  static public $__names = array(
+    0 => 'PUBLISHER',
+    1 => 'SUBSCRIBER',
+  );
+}
+
+class DBEventPublisherContext {
+  static $_TSPEC;
+
+  /**
+   * @var int
+   */
+  public $crudType = null;
+  /**
+   * @var int
+   */
+  public $entityType = null;
+  /**
+   * @var string
+   */
+  public $entityDataModel = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        1 => array(
+          'var' => 'crudType',
+          'type' => TType::I32,
+          ),
+        2 => array(
+          'var' => 'entityType',
+          'type' => TType::I32,
+          ),
+        3 => array(
+          'var' => 'entityDataModel',
+          'type' => TType::STRING,
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['crudType'])) {
+        $this->crudType = $vals['crudType'];
+      }
+      if (isset($vals['entityType'])) {
+        $this->entityType = $vals['entityType'];
+      }
+      if (isset($vals['entityDataModel'])) {
+        $this->entityDataModel = $vals['entityDataModel'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'DBEventPublisherContext';
+  }
+
+  public function read($input)
+  {
+    $xfer = 0;
+    $fname = null;
+    $ftype = 0;
+    $fid = 0;
+    $xfer += $input->readStructBegin($fname);
+    while (true)
+    {
+      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
+      if ($ftype == TType::STOP) {
+        break;
+      }
+      switch ($fid)
+      {
+        case 1:
+          if ($ftype == TType::I32) {
+            $xfer += $input->readI32($this->crudType);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 2:
+          if ($ftype == TType::I32) {
+            $xfer += $input->readI32($this->entityType);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 3:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->entityDataModel);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        default:
+          $xfer += $input->skip($ftype);
+          break;
+      }
+      $xfer += $input->readFieldEnd();
+    }
+    $xfer += $input->readStructEnd();
+    return $xfer;
+  }
+
+  public function write($output) {
+    $xfer = 0;
+    $xfer += $output->writeStructBegin('DBEventPublisherContext');
+    if ($this->crudType !== null) {
+      $xfer += $output->writeFieldBegin('crudType', TType::I32, 1);
+      $xfer += $output->writeI32($this->crudType);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->entityType !== null) {
+      $xfer += $output->writeFieldBegin('entityType', TType::I32, 2);
+      $xfer += $output->writeI32($this->entityType);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->entityDataModel !== null) {
+      $xfer += $output->writeFieldBegin('entityDataModel', TType::STRING, 3);
+      $xfer += $output->writeString($this->entityDataModel);
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
+class DBEventPublisher {
+  static $_TSPEC;
+
+  /**
+   * @var \Airavata\Model\Dbevent\DBEventPublisherContext
+   */
+  public $publisherContext = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        1 => array(
+          'var' => 'publisherContext',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\Model\Dbevent\DBEventPublisherContext',
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['publisherContext'])) {
+        $this->publisherContext = $vals['publisherContext'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'DBEventPublisher';
+  }
+
+  public function read($input)
+  {
+    $xfer = 0;
+    $fname = null;
+    $ftype = 0;
+    $fid = 0;
+    $xfer += $input->readStructBegin($fname);
+    while (true)
+    {
+      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
+      if ($ftype == TType::STOP) {
+        break;
+      }
+      switch ($fid)
+      {
+        case 1:
+          if ($ftype == TType::STRUCT) {
+            $this->publisherContext = new \Airavata\Model\Dbevent\DBEventPublisherContext();
+            $xfer += $this->publisherContext->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        default:
+          $xfer += $input->skip($ftype);
+          break;
+      }
+      $xfer += $input->readFieldEnd();
+    }
+    $xfer += $input->readStructEnd();
+    return $xfer;
+  }
+
+  public function write($output) {
+    $xfer = 0;
+    $xfer += $output->writeStructBegin('DBEventPublisher');
+    if ($this->publisherContext !== null) {
+      if (!is_object($this->publisherContext)) {
+        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
+      }
+      $xfer += $output->writeFieldBegin('publisherContext', TType::STRUCT, 1);
+      $xfer += $this->publisherContext->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
+class DBEventSubscriber {
+  static $_TSPEC;
+
+  /**
+   * @var string
+   */
+  public $subscriberService = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        1 => array(
+          'var' => 'subscriberService',
+          'type' => TType::STRING,
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['subscriberService'])) {
+        $this->subscriberService = $vals['subscriberService'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'DBEventSubscriber';
+  }
+
+  public function read($input)
+  {
+    $xfer = 0;
+    $fname = null;
+    $ftype = 0;
+    $fid = 0;
+    $xfer += $input->readStructBegin($fname);
+    while (true)
+    {
+      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
+      if ($ftype == TType::STOP) {
+        break;
+      }
+      switch ($fid)
+      {
+        case 1:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->subscriberService);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        default:
+          $xfer += $input->skip($ftype);
+          break;
+      }
+      $xfer += $input->readFieldEnd();
+    }
+    $xfer += $input->readStructEnd();
+    return $xfer;
+  }
+
+  public function write($output) {
+    $xfer = 0;
+    $xfer += $output->writeStructBegin('DBEventSubscriber');
+    if ($this->subscriberService !== null) {
+      $xfer += $output->writeFieldBegin('subscriberService', TType::STRING, 1);
+      $xfer += $output->writeString($this->subscriberService);
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
+class DBEventMessageContext {
+  static $_TSPEC;
+
+  /**
+   * @var \Airavata\Model\Dbevent\DBEventPublisher
+   */
+  public $publisher = null;
+  /**
+   * @var \Airavata\Model\Dbevent\DBEventSubscriber
+   */
+  public $subscriber = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        1 => array(
+          'var' => 'publisher',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\Model\Dbevent\DBEventPublisher',
+          ),
+        2 => array(
+          'var' => 'subscriber',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\Model\Dbevent\DBEventSubscriber',
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['publisher'])) {
+        $this->publisher = $vals['publisher'];
+      }
+      if (isset($vals['subscriber'])) {
+        $this->subscriber = $vals['subscriber'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'DBEventMessageContext';
+  }
+
+  public function read($input)
+  {
+    $xfer = 0;
+    $fname = null;
+    $ftype = 0;
+    $fid = 0;
+    $xfer += $input->readStructBegin($fname);
+    while (true)
+    {
+      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
+      if ($ftype == TType::STOP) {
+        break;
+      }
+      switch ($fid)
+      {
+        case 1:
+          if ($ftype == TType::STRUCT) {
+            $this->publisher = new \Airavata\Model\Dbevent\DBEventPublisher();
+            $xfer += $this->publisher->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 2:
+          if ($ftype == TType::STRUCT) {
+            $this->subscriber = new \Airavata\Model\Dbevent\DBEventSubscriber();
+            $xfer += $this->subscriber->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        default:
+          $xfer += $input->skip($ftype);
+          break;
+      }
+      $xfer += $input->readFieldEnd();
+    }
+    $xfer += $input->readStructEnd();
+    return $xfer;
+  }
+
+  public function write($output) {
+    $xfer = 0;
+    $xfer += $output->writeStructBegin('DBEventMessageContext');
+    if ($this->publisher !== null) {
+      if (!is_object($this->publisher)) {
+        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
+      }
+      $xfer += $output->writeFieldBegin('publisher', TType::STRUCT, 1);
+      $xfer += $this->publisher->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->subscriber !== null) {
+      if (!is_object($this->subscriber)) {
+        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
+      }
+      $xfer += $output->writeFieldBegin('subscriber', TType::STRUCT, 2);
+      $xfer += $this->subscriber->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
+class DBEventMessage {
+  static $_TSPEC;
+
+  /**
+   * @var int
+   */
+  public $dbEventType = null;
+  /**
+   * @var \Airavata\Model\Dbevent\DBEventMessageContext
+   */
+  public $messageContext = null;
+  /**
+   * @var string
+   */
+  public $publisherService = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        1 => array(
+          'var' => 'dbEventType',
+          'type' => TType::I32,
+          ),
+        2 => array(
+          'var' => 'messageContext',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\Model\Dbevent\DBEventMessageContext',
+          ),
+        3 => array(
+          'var' => 'publisherService',
+          'type' => TType::STRING,
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['dbEventType'])) {
+        $this->dbEventType = $vals['dbEventType'];
+      }
+      if (isset($vals['messageContext'])) {
+        $this->messageContext = $vals['messageContext'];
+      }
+      if (isset($vals['publisherService'])) {
+        $this->publisherService = $vals['publisherService'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'DBEventMessage';
+  }
+
+  public function read($input)
+  {
+    $xfer = 0;
+    $fname = null;
+    $ftype = 0;
+    $fid = 0;
+    $xfer += $input->readStructBegin($fname);
+    while (true)
+    {
+      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
+      if ($ftype == TType::STOP) {
+        break;
+      }
+      switch ($fid)
+      {
+        case 1:
+          if ($ftype == TType::I32) {
+            $xfer += $input->readI32($this->dbEventType);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 2:
+          if ($ftype == TType::STRUCT) {
+            $this->messageContext = new \Airavata\Model\Dbevent\DBEventMessageContext();
+            $xfer += $this->messageContext->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 3:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->publisherService);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        default:
+          $xfer += $input->skip($ftype);
+          break;
+      }
+      $xfer += $input->readFieldEnd();
+    }
+    $xfer += $input->readStructEnd();
+    return $xfer;
+  }
+
+  public function write($output) {
+    $xfer = 0;
+    $xfer += $output->writeStructBegin('DBEventMessage');
+    if ($this->dbEventType !== null) {
+      $xfer += $output->writeFieldBegin('dbEventType', TType::I32, 1);
+      $xfer += $output->writeI32($this->dbEventType);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->messageContext !== null) {
+      if (!is_object($this->messageContext)) {
+        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
+      }
+      $xfer += $output->writeFieldBegin('messageContext', TType::STRUCT, 2);
+      $xfer += $this->messageContext->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->publisherService !== null) {
+      $xfer += $output->writeFieldBegin('publisherService', TType::STRING, 3);
+      $xfer += $output->writeString($this->publisherService);
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
+

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/d656b4ec/app/libraries/Airavata/Model/Messaging/Event/Types.php
----------------------------------------------------------------------
diff --git a/app/libraries/Airavata/Model/Messaging/Event/Types.php b/app/libraries/Airavata/Model/Messaging/Event/Types.php
index 96a015e..fed31a4 100644
--- a/app/libraries/Airavata/Model/Messaging/Event/Types.php
+++ b/app/libraries/Airavata/Model/Messaging/Event/Types.php
@@ -39,6 +39,7 @@ final class MessageType {
   const LAUNCHPROCESS = 5;
   const TERMINATEPROCESS = 6;
   const PROCESSOUTPUT = 7;
+  const DB_EVENT = 8;
   static public $__names = array(
     0 => 'EXPERIMENT',
     1 => 'EXPERIMENT_CANCEL',
@@ -48,6 +49,7 @@ final class MessageType {
     5 => 'LAUNCHPROCESS',
     6 => 'TERMINATEPROCESS',
     7 => 'PROCESSOUTPUT',
+    8 => 'DB_EVENT',
   );
 }
 

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/d656b4ec/app/libraries/Airavata/Model/Tenant/Types.php
----------------------------------------------------------------------
diff --git a/app/libraries/Airavata/Model/Tenant/Types.php b/app/libraries/Airavata/Model/Tenant/Types.php
new file mode 100644
index 0000000..74595f8
--- /dev/null
+++ b/app/libraries/Airavata/Model/Tenant/Types.php
@@ -0,0 +1,528 @@
+<?php
+namespace Airavata\Model\Tenant;
+
+/**
+ * Autogenerated by Thrift Compiler (0.9.3)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ *  @generated
+ */
+use Thrift\Base\TBase;
+use Thrift\Type\TType;
+use Thrift\Type\TMessageType;
+use Thrift\Exception\TException;
+use Thrift\Exception\TProtocolException;
+use Thrift\Protocol\TProtocol;
+use Thrift\Protocol\TBinaryProtocolAccelerated;
+use Thrift\Exception\TApplicationException;
+
+
+final class TenantApprovalStatus {
+  const REQUESTED = 0;
+  const APPROVED = 1;
+  const ACTIVE = 2;
+  const DEACTIVATED = 3;
+  const CANCELLED = 4;
+  const DENIED = 5;
+  const CREATED = 6;
+  static public $__names = array(
+    0 => 'REQUESTED',
+    1 => 'APPROVED',
+    2 => 'ACTIVE',
+    3 => 'DEACTIVATED',
+    4 => 'CANCELLED',
+    5 => 'DENIED',
+    6 => 'CREATED',
+  );
+}
+
+class Tenant {
+  static $_TSPEC;
+
+  /**
+   * @var string
+   */
+  public $tenantId = null;
+  /**
+   * @var int
+   */
+  public $tenantApprovalStatus = null;
+  /**
+   * @var string
+   */
+  public $tenantName = null;
+  /**
+   * @var string
+   */
+  public $domain = null;
+  /**
+   * @var string
+   */
+  public $emailAddress = null;
+  /**
+   * @var string
+   */
+  public $tenantAcronym = null;
+  /**
+   * @var string
+   */
+  public $tenantURL = null;
+  /**
+   * @var string
+   */
+  public $tenantPublicAbstract = null;
+  /**
+   * @var string
+   */
+  public $reviewProposalDescription = null;
+  /**
+   * @var string
+   */
+  public $tenantAdminFirstName = null;
+  /**
+   * @var string
+   */
+  public $tenantAdminLastName = null;
+  /**
+   * @var string
+   */
+  public $tenantAdminEmail = null;
+  /**
+   * @var string
+   */
+  public $identityServerUserName = null;
+  /**
+   * @var string
+   */
+  public $identityServerPasswordToken = null;
+  /**
+   * @var string
+   */
+  public $declinedReason = null;
+  /**
+   * @var string
+   */
+  public $oauthClientId = null;
+  /**
+   * @var string
+   */
+  public $oauthClientSecret = null;
+  /**
+   * @var int
+   */
+  public $requestCreationTime = null;
+  /**
+   * @var string
+   */
+  public $requesterUsername = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        1 => array(
+          'var' => 'tenantId',
+          'type' => TType::STRING,
+          ),
+        2 => array(
+          'var' => 'tenantApprovalStatus',
+          'type' => TType::I32,
+          ),
+        3 => array(
+          'var' => 'tenantName',
+          'type' => TType::STRING,
+          ),
+        4 => array(
+          'var' => 'domain',
+          'type' => TType::STRING,
+          ),
+        5 => array(
+          'var' => 'emailAddress',
+          'type' => TType::STRING,
+          ),
+        6 => array(
+          'var' => 'tenantAcronym',
+          'type' => TType::STRING,
+          ),
+        7 => array(
+          'var' => 'tenantURL',
+          'type' => TType::STRING,
+          ),
+        8 => array(
+          'var' => 'tenantPublicAbstract',
+          'type' => TType::STRING,
+          ),
+        9 => array(
+          'var' => 'reviewProposalDescription',
+          'type' => TType::STRING,
+          ),
+        10 => array(
+          'var' => 'tenantAdminFirstName',
+          'type' => TType::STRING,
+          ),
+        11 => array(
+          'var' => 'tenantAdminLastName',
+          'type' => TType::STRING,
+          ),
+        12 => array(
+          'var' => 'tenantAdminEmail',
+          'type' => TType::STRING,
+          ),
+        13 => array(
+          'var' => 'identityServerUserName',
+          'type' => TType::STRING,
+          ),
+        14 => array(
+          'var' => 'identityServerPasswordToken',
+          'type' => TType::STRING,
+          ),
+        15 => array(
+          'var' => 'declinedReason',
+          'type' => TType::STRING,
+          ),
+        16 => array(
+          'var' => 'oauthClientId',
+          'type' => TType::STRING,
+          ),
+        17 => array(
+          'var' => 'oauthClientSecret',
+          'type' => TType::STRING,
+          ),
+        18 => array(
+          'var' => 'requestCreationTime',
+          'type' => TType::I64,
+          ),
+        19 => array(
+          'var' => 'requesterUsername',
+          'type' => TType::STRING,
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['tenantId'])) {
+        $this->tenantId = $vals['tenantId'];
+      }
+      if (isset($vals['tenantApprovalStatus'])) {
+        $this->tenantApprovalStatus = $vals['tenantApprovalStatus'];
+      }
+      if (isset($vals['tenantName'])) {
+        $this->tenantName = $vals['tenantName'];
+      }
+      if (isset($vals['domain'])) {
+        $this->domain = $vals['domain'];
+      }
+      if (isset($vals['emailAddress'])) {
+        $this->emailAddress = $vals['emailAddress'];
+      }
+      if (isset($vals['tenantAcronym'])) {
+        $this->tenantAcronym = $vals['tenantAcronym'];
+      }
+      if (isset($vals['tenantURL'])) {
+        $this->tenantURL = $vals['tenantURL'];
+      }
+      if (isset($vals['tenantPublicAbstract'])) {
+        $this->tenantPublicAbstract = $vals['tenantPublicAbstract'];
+      }
+      if (isset($vals['reviewProposalDescription'])) {
+        $this->reviewProposalDescription = $vals['reviewProposalDescription'];
+      }
+      if (isset($vals['tenantAdminFirstName'])) {
+        $this->tenantAdminFirstName = $vals['tenantAdminFirstName'];
+      }
+      if (isset($vals['tenantAdminLastName'])) {
+        $this->tenantAdminLastName = $vals['tenantAdminLastName'];
+      }
+      if (isset($vals['tenantAdminEmail'])) {
+        $this->tenantAdminEmail = $vals['tenantAdminEmail'];
+      }
+      if (isset($vals['identityServerUserName'])) {
+        $this->identityServerUserName = $vals['identityServerUserName'];
+      }
+      if (isset($vals['identityServerPasswordToken'])) {
+        $this->identityServerPasswordToken = $vals['identityServerPasswordToken'];
+      }
+      if (isset($vals['declinedReason'])) {
+        $this->declinedReason = $vals['declinedReason'];
+      }
+      if (isset($vals['oauthClientId'])) {
+        $this->oauthClientId = $vals['oauthClientId'];
+      }
+      if (isset($vals['oauthClientSecret'])) {
+        $this->oauthClientSecret = $vals['oauthClientSecret'];
+      }
+      if (isset($vals['requestCreationTime'])) {
+        $this->requestCreationTime = $vals['requestCreationTime'];
+      }
+      if (isset($vals['requesterUsername'])) {
+        $this->requesterUsername = $vals['requesterUsername'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'Tenant';
+  }
+
+  public function read($input)
+  {
+    $xfer = 0;
+    $fname = null;
+    $ftype = 0;
+    $fid = 0;
+    $xfer += $input->readStructBegin($fname);
+    while (true)
+    {
+      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
+      if ($ftype == TType::STOP) {
+        break;
+      }
+      switch ($fid)
+      {
+        case 1:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->tenantId);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 2:
+          if ($ftype == TType::I32) {
+            $xfer += $input->readI32($this->tenantApprovalStatus);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 3:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->tenantName);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 4:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->domain);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 5:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->emailAddress);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 6:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->tenantAcronym);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 7:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->tenantURL);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 8:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->tenantPublicAbstract);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 9:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->reviewProposalDescription);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 10:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->tenantAdminFirstName);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 11:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->tenantAdminLastName);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 12:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->tenantAdminEmail);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 13:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->identityServerUserName);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 14:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->identityServerPasswordToken);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 15:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->declinedReason);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 16:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->oauthClientId);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 17:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->oauthClientSecret);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 18:
+          if ($ftype == TType::I64) {
+            $xfer += $input->readI64($this->requestCreationTime);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 19:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->requesterUsername);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        default:
+          $xfer += $input->skip($ftype);
+          break;
+      }
+      $xfer += $input->readFieldEnd();
+    }
+    $xfer += $input->readStructEnd();
+    return $xfer;
+  }
+
+  public function write($output) {
+    $xfer = 0;
+    $xfer += $output->writeStructBegin('Tenant');
+    if ($this->tenantId !== null) {
+      $xfer += $output->writeFieldBegin('tenantId', TType::STRING, 1);
+      $xfer += $output->writeString($this->tenantId);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->tenantApprovalStatus !== null) {
+      $xfer += $output->writeFieldBegin('tenantApprovalStatus', TType::I32, 2);
+      $xfer += $output->writeI32($this->tenantApprovalStatus);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->tenantName !== null) {
+      $xfer += $output->writeFieldBegin('tenantName', TType::STRING, 3);
+      $xfer += $output->writeString($this->tenantName);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->domain !== null) {
+      $xfer += $output->writeFieldBegin('domain', TType::STRING, 4);
+      $xfer += $output->writeString($this->domain);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->emailAddress !== null) {
+      $xfer += $output->writeFieldBegin('emailAddress', TType::STRING, 5);
+      $xfer += $output->writeString($this->emailAddress);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->tenantAcronym !== null) {
+      $xfer += $output->writeFieldBegin('tenantAcronym', TType::STRING, 6);
+      $xfer += $output->writeString($this->tenantAcronym);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->tenantURL !== null) {
+      $xfer += $output->writeFieldBegin('tenantURL', TType::STRING, 7);
+      $xfer += $output->writeString($this->tenantURL);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->tenantPublicAbstract !== null) {
+      $xfer += $output->writeFieldBegin('tenantPublicAbstract', TType::STRING, 8);
+      $xfer += $output->writeString($this->tenantPublicAbstract);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->reviewProposalDescription !== null) {
+      $xfer += $output->writeFieldBegin('reviewProposalDescription', TType::STRING, 9);
+      $xfer += $output->writeString($this->reviewProposalDescription);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->tenantAdminFirstName !== null) {
+      $xfer += $output->writeFieldBegin('tenantAdminFirstName', TType::STRING, 10);
+      $xfer += $output->writeString($this->tenantAdminFirstName);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->tenantAdminLastName !== null) {
+      $xfer += $output->writeFieldBegin('tenantAdminLastName', TType::STRING, 11);
+      $xfer += $output->writeString($this->tenantAdminLastName);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->tenantAdminEmail !== null) {
+      $xfer += $output->writeFieldBegin('tenantAdminEmail', TType::STRING, 12);
+      $xfer += $output->writeString($this->tenantAdminEmail);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->identityServerUserName !== null) {
+      $xfer += $output->writeFieldBegin('identityServerUserName', TType::STRING, 13);
+      $xfer += $output->writeString($this->identityServerUserName);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->identityServerPasswordToken !== null) {
+      $xfer += $output->writeFieldBegin('identityServerPasswordToken', TType::STRING, 14);
+      $xfer += $output->writeString($this->identityServerPasswordToken);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->declinedReason !== null) {
+      $xfer += $output->writeFieldBegin('declinedReason', TType::STRING, 15);
+      $xfer += $output->writeString($this->declinedReason);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->oauthClientId !== null) {
+      $xfer += $output->writeFieldBegin('oauthClientId', TType::STRING, 16);
+      $xfer += $output->writeString($this->oauthClientId);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->oauthClientSecret !== null) {
+      $xfer += $output->writeFieldBegin('oauthClientSecret', TType::STRING, 17);
+      $xfer += $output->writeString($this->oauthClientSecret);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->requestCreationTime !== null) {
+      $xfer += $output->writeFieldBegin('requestCreationTime', TType::I64, 18);
+      $xfer += $output->writeI64($this->requestCreationTime);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->requesterUsername !== null) {
+      $xfer += $output->writeFieldBegin('requesterUsername', TType::STRING, 19);
+      $xfer += $output->writeString($this->requesterUsername);
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
+


[12/50] [abbrv] airavata-php-gateway git commit: adding usernameExists methods to Keycloack class

Posted by ma...@apache.org.
adding usernameExists methods to Keycloack class


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

Branch: refs/heads/develop
Commit: f83e0e51daf8ba6ffd73c1b475940dad2fc9c3a2
Parents: 0d34e17
Author: scnakandala <su...@gmail.com>
Authored: Fri Mar 24 12:25:07 2017 -0400
Committer: scnakandala <su...@gmail.com>
Committed: Fri Mar 24 12:25:07 2017 -0400

----------------------------------------------------------------------
 app/controllers/AccountController.php |  2 +-
 app/controllers/AdminController.php   |  2 +-
 app/libraries/Keycloak/Keycloak.php   | 15 +++++++++++++++
 app/libraries/SharingUtilities.php    |  6 +++---
 4 files changed, 20 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/f83e0e51/app/controllers/AccountController.php
----------------------------------------------------------------------
diff --git a/app/controllers/AccountController.php b/app/controllers/AccountController.php
index 86f3259..0c3a3fc 100644
--- a/app/controllers/AccountController.php
+++ b/app/controllers/AccountController.php
@@ -47,7 +47,7 @@ class AccountController extends BaseController
         $im = isset($_POST['im']) ? $_POST['im'] : null;
         $url = isset($_POST['url']) ? $_POST['url'] : null;
 
-        if (WSIS::usernameExists($username)) {
+        if (Keycloak::usernameExists($username)) {
             return Redirect::to("create")
                 ->withInput(Input::except('password', 'password_confirm'))
                 ->with("username_exists", true);

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/f83e0e51/app/controllers/AdminController.php
----------------------------------------------------------------------
diff --git a/app/controllers/AdminController.php b/app/controllers/AdminController.php
index e1a4ea5..94b11b8 100644
--- a/app/controllers/AdminController.php
+++ b/app/controllers/AdminController.php
@@ -150,7 +150,7 @@ class AdminController extends BaseController {
 
 	public function addGatewayAdminSubmit(){
 		//check if username exists
-		if(WSIS::usernameExists( Input::get("username")) )
+		if(Keycloak::usernameExists( Input::get("username")) )
 		{
 			// FIXME: this requires the user id not the username
             Keycloak::updateUserRoles(Input::get("username"), array( "new"=>array( Config::get('wsis::admin-role-name')), "deleted"=>array() ) );

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/f83e0e51/app/libraries/Keycloak/Keycloak.php
----------------------------------------------------------------------
diff --git a/app/libraries/Keycloak/Keycloak.php b/app/libraries/Keycloak/Keycloak.php
index 56e2680..819541d 100644
--- a/app/libraries/Keycloak/Keycloak.php
+++ b/app/libraries/Keycloak/Keycloak.php
@@ -232,6 +232,21 @@ class Keycloak {
         return $result;
     }
 
+    /**
+     * Function to check whether a user exists with the given userId
+     * @param $user_id
+     * @return bool
+     */
+    public function usernameExists($user_id){
+        try{
+            $user = $this->users->getUser($this->realm, $user_id);
+            return $user != null;
+        }catch (Exception $ex){
+            // Username does not exists
+            return false;
+        }
+    }
+
     private function getOpenIDConnectDiscoveryConfiguration() {
 
         // TODO: cache the result of the request

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/f83e0e51/app/libraries/SharingUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/SharingUtilities.php b/app/libraries/SharingUtilities.php
index aea9675..5822a04 100755
--- a/app/libraries/SharingUtilities.php
+++ b/app/libraries/SharingUtilities.php
@@ -66,13 +66,13 @@ class SharingUtilities {
         $write = GrouperUtilities::getAllAccessibleUsers($resourceId, $dataResourceType, ResourcePermissionType::WRITE);
 
         foreach($read as $uid) {
-            if ($uid !== Session::get('username') && WSIS::usernameExists($uid)) {
+            if ($uid !== Session::get('username') && Keycloak::usernameExists($uid)) {
                 $users[$uid] = array('read' => true, 'write' => false);
             }
         }
 
         foreach($write as $uid) {
-            if ($uid !== Session::get('username') && WSIS::usernameExists($uid)) {
+            if ($uid !== Session::get('username') && Keycloak::usernameExists($uid)) {
                 $users[$uid]['write'] = true;
             }
         }
@@ -88,7 +88,7 @@ class SharingUtilities {
      */
     public static function getUserProfiles($uids) {
         $uids = array_filter($uids, function($uid) {
-            return ($uid !== Session::get('username') && WSIS::usernameExists($uid));
+            return ($uid !== Session::get('username') && Keycloak::usernameExists($uid));
         });
         $profiles = array();
         foreach ($uids as $uid) {


[33/50] [abbrv] airavata-php-gateway git commit: Using TMultiplexedProtocol for IamAdminServices

Posted by ma...@apache.org.
Using TMultiplexedProtocol for IamAdminServices


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

Branch: refs/heads/develop
Commit: 45bf62624403712acbd0a15f9762752710641980
Parents: d656b4e
Author: Marcus Christie <ma...@iu.edu>
Authored: Thu May 4 16:56:23 2017 -0400
Committer: Marcus Christie <ma...@iu.edu>
Committed: Thu May 4 16:56:23 2017 -0400

----------------------------------------------------------------------
 app/libraries/Airavata/IamAdminServiceProvider.php | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/45bf6262/app/libraries/Airavata/IamAdminServiceProvider.php
----------------------------------------------------------------------
diff --git a/app/libraries/Airavata/IamAdminServiceProvider.php b/app/libraries/Airavata/IamAdminServiceProvider.php
index 2506211..bf517ba 100755
--- a/app/libraries/Airavata/IamAdminServiceProvider.php
+++ b/app/libraries/Airavata/IamAdminServiceProvider.php
@@ -7,6 +7,7 @@ use Illuminate\Support\Facades\Config;
 use Airavata\API\AiravataClient;
 use Thrift\Transport\TSocket;
 use Thrift\Protocol\TBinaryProtocol;
+use Thrift\Protocol\TMultiplexedProtocol;
 use Illuminate\Routing\Redirector;
 
 class IamAdminServiceProvider extends ServiceProvider {
@@ -47,6 +48,7 @@ class IamAdminServiceProvider extends ServiceProvider {
                 $transport->setSendTimeout( Config::get('pga_config.airavata')['airavata-timeout']);
 
                 $protocol = new TBinaryProtocol($transport);
+                $protocol = new TMultiplexedProtocol($protocol, "IamAdminServices");
                 $transport->open();
 
                 $client = new IamAdminServicesClient($protocol);


[47/50] [abbrv] airavata-php-gateway git commit: AIRAVATA-2408 Updating Thrift stubs

Posted by ma...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/135077cd/app/libraries/Airavata/API/Airavata.php
----------------------------------------------------------------------
diff --git a/app/libraries/Airavata/API/Airavata.php b/app/libraries/Airavata/API/Airavata.php
index 9c20f39..ae27035 100644
--- a/app/libraries/Airavata/API/Airavata.php
+++ b/app/libraries/Airavata/API/Airavata.php
@@ -4095,126 +4095,6 @@ interface AiravataIf {
    * @throws \Airavata\API\Error\AuthorizationException
    */
   public function getAllGroupsUserBelongs(\Airavata\Model\Security\AuthzToken $authzToken, $userName, $gatewayId);
-  /**
-   * @param \Airavata\Model\Security\AuthzToken $authzToken
-   * @param \Airavata\Model\User\UserProfile $userProfile
-   * @return string
-   * @throws \Airavata\API\Error\InvalidRequestException
-   * @throws \Airavata\API\Error\AiravataClientException
-   * @throws \Airavata\API\Error\AiravataSystemException
-   * @throws \Airavata\API\Error\AuthorizationException
-   */
-  public function addUserProfile(\Airavata\Model\Security\AuthzToken $authzToken, \Airavata\Model\User\UserProfile $userProfile);
-  /**
-   * @param \Airavata\Model\Security\AuthzToken $authzToken
-   * @param \Airavata\Model\User\UserProfile $userProfile
-   * @return bool
-   * @throws \Airavata\API\Error\InvalidRequestException
-   * @throws \Airavata\API\Error\AiravataClientException
-   * @throws \Airavata\API\Error\AiravataSystemException
-   * @throws \Airavata\API\Error\AuthorizationException
-   */
-  public function updateUserProfile(\Airavata\Model\Security\AuthzToken $authzToken, \Airavata\Model\User\UserProfile $userProfile);
-  /**
-   * @param \Airavata\Model\Security\AuthzToken $authzToken
-   * @param string $userId
-   * @param string $gatewayId
-   * @return \Airavata\Model\User\UserProfile * A structure holding the user profile and its child models.
-   * *
-   * * Notes:
-   * *  The model does not include passwords as it is assumed an external identity provider is used to authenticate user.
-   * *  References:
-   * *     NSF Demographic Information - http://www.nsf.gov/pubs/2000/00form1225/00form1225.doc
-   * *     LDAP Schema - https://tools.ietf.org/html/rfc4519
-   * *     SCIM 2.0 - https://tools.ietf.org/html/rfc7643
-   * *
-   * * userModelVersion:
-   * *  Version number of profile
-   * *
-   * * airavataInternalUserId:
-   * *  internal to Airavata, not intended to be used outside of the Airavata platform or possibly by gateways
-   * *  (that is, never shown to users), never reassigned, REQUIRED
-   * *
-   * * userId:
-   * *  Externally assertable unique identifier. SAML (primarly in higher education, academic) tends to keep
-   * *   user name less opaque. OpenID Connect maintains them to be opaque.
-   * *
-   * * firstName, middleName, lastName:
-   * *  First and Last names as assertede by the user
-   * *
-   * * namePrefix, nameSuffix:
-   * *  prefix and suffix to the users name as asserted by the user
-   * *
-   * * emails:
-   * *   Email identifier are Verified, REQUIRED and MULTIVALUED
-   * *
-   * * userName:
-   * *  Name-based identifiers can be multivalues. To keep it simple, Airavata will make it a string.
-   * *   In the future these can be enumerated as:
-   *     *   Official name (as asserted possibly by some external identity provider)
-   *     *   Prefered name (as asserted or suggested by user directly)
-   *     *   Components:
-   *     *      givenName
-   *     *      surname (familyName)
-   *     *      displayName (often asserted by user to handle things like middle names, suffix, prefix, and the like)
-   * *
-   * * orcidId: ORCID ID - http://orcid.org/about/what-is-orcid)
-   * *
-   * * phones: Telephone MULTIVALUED
-   * *
-   * * country: Country of Residance
-   * *
-   * * nationality Countries of citizenship
-   * *
-   * * comments:
-   * *   Free-form information (treated as opaque by Airavata and simply passed to resource).
-   * *
-   * * labeledURI:
-   *   * Google Scholar, Web of Science, ACS, e.t.c
-   * *
-   * * timeZone:
-   * *  User’s preferred timezone - IANA Timezone Databases - http://www.iana.org/time-zones.
-   * *
-   * 
-   * @throws \Airavata\API\Error\InvalidRequestException
-   * @throws \Airavata\API\Error\AiravataClientException
-   * @throws \Airavata\API\Error\AiravataSystemException
-   * @throws \Airavata\API\Error\AuthorizationException
-   */
-  public function getUserProfileById(\Airavata\Model\Security\AuthzToken $authzToken, $userId, $gatewayId);
-  /**
-   * @param \Airavata\Model\Security\AuthzToken $authzToken
-   * @param string $userId
-   * @return bool
-   * @throws \Airavata\API\Error\InvalidRequestException
-   * @throws \Airavata\API\Error\AiravataClientException
-   * @throws \Airavata\API\Error\AiravataSystemException
-   * @throws \Airavata\API\Error\AuthorizationException
-   */
-  public function deleteUserProfile(\Airavata\Model\Security\AuthzToken $authzToken, $userId);
-  /**
-   * @param \Airavata\Model\Security\AuthzToken $authzToken
-   * @param string $gatewayId
-   * @param int $offset
-   * @param int $limit
-   * @return \Airavata\Model\User\UserProfile[]
-   * @throws \Airavata\API\Error\InvalidRequestException
-   * @throws \Airavata\API\Error\AiravataClientException
-   * @throws \Airavata\API\Error\AiravataSystemException
-   * @throws \Airavata\API\Error\AuthorizationException
-   */
-  public function getAllUserProfilesInGateway(\Airavata\Model\Security\AuthzToken $authzToken, $gatewayId, $offset, $limit);
-  /**
-   * @param \Airavata\Model\Security\AuthzToken $authzToken
-   * @param string $userId
-   * @param string $gatewayId
-   * @return bool
-   * @throws \Airavata\API\Error\InvalidRequestException
-   * @throws \Airavata\API\Error\AiravataClientException
-   * @throws \Airavata\API\Error\AiravataSystemException
-   * @throws \Airavata\API\Error\AuthorizationException
-   */
-  public function doesUserProfileExist(\Airavata\Model\Security\AuthzToken $authzToken, $userId, $gatewayId);
 }
 
 class AiravataClient implements \Airavata\API\AiravataIf {
@@ -15175,394 +15055,6 @@ class AiravataClient implements \Airavata\API\AiravataIf {
     throw new \Exception("getAllGroupsUserBelongs failed: unknown result");
   }
 
-  public function addUserProfile(\Airavata\Model\Security\AuthzToken $authzToken, \Airavata\Model\User\UserProfile $userProfile)
-  {
-    $this->send_addUserProfile($authzToken, $userProfile);
-    return $this->recv_addUserProfile();
-  }
-
-  public function send_addUserProfile(\Airavata\Model\Security\AuthzToken $authzToken, \Airavata\Model\User\UserProfile $userProfile)
-  {
-    $args = new \Airavata\API\Airavata_addUserProfile_args();
-    $args->authzToken = $authzToken;
-    $args->userProfile = $userProfile;
-    $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');
-    if ($bin_accel)
-    {
-      thrift_protocol_write_binary($this->output_, 'addUserProfile', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());
-    }
-    else
-    {
-      $this->output_->writeMessageBegin('addUserProfile', TMessageType::CALL, $this->seqid_);
-      $args->write($this->output_);
-      $this->output_->writeMessageEnd();
-      $this->output_->getTransport()->flush();
-    }
-  }
-
-  public function recv_addUserProfile()
-  {
-    $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');
-    if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\Airavata\API\Airavata_addUserProfile_result', $this->input_->isStrictRead());
-    else
-    {
-      $rseqid = 0;
-      $fname = null;
-      $mtype = 0;
-
-      $this->input_->readMessageBegin($fname, $mtype, $rseqid);
-      if ($mtype == TMessageType::EXCEPTION) {
-        $x = new TApplicationException();
-        $x->read($this->input_);
-        $this->input_->readMessageEnd();
-        throw $x;
-      }
-      $result = new \Airavata\API\Airavata_addUserProfile_result();
-      $result->read($this->input_);
-      $this->input_->readMessageEnd();
-    }
-    if ($result->success !== null) {
-      return $result->success;
-    }
-    if ($result->ire !== null) {
-      throw $result->ire;
-    }
-    if ($result->ace !== null) {
-      throw $result->ace;
-    }
-    if ($result->ase !== null) {
-      throw $result->ase;
-    }
-    if ($result->ae !== null) {
-      throw $result->ae;
-    }
-    throw new \Exception("addUserProfile failed: unknown result");
-  }
-
-  public function updateUserProfile(\Airavata\Model\Security\AuthzToken $authzToken, \Airavata\Model\User\UserProfile $userProfile)
-  {
-    $this->send_updateUserProfile($authzToken, $userProfile);
-    return $this->recv_updateUserProfile();
-  }
-
-  public function send_updateUserProfile(\Airavata\Model\Security\AuthzToken $authzToken, \Airavata\Model\User\UserProfile $userProfile)
-  {
-    $args = new \Airavata\API\Airavata_updateUserProfile_args();
-    $args->authzToken = $authzToken;
-    $args->userProfile = $userProfile;
-    $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');
-    if ($bin_accel)
-    {
-      thrift_protocol_write_binary($this->output_, 'updateUserProfile', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());
-    }
-    else
-    {
-      $this->output_->writeMessageBegin('updateUserProfile', TMessageType::CALL, $this->seqid_);
-      $args->write($this->output_);
-      $this->output_->writeMessageEnd();
-      $this->output_->getTransport()->flush();
-    }
-  }
-
-  public function recv_updateUserProfile()
-  {
-    $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');
-    if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\Airavata\API\Airavata_updateUserProfile_result', $this->input_->isStrictRead());
-    else
-    {
-      $rseqid = 0;
-      $fname = null;
-      $mtype = 0;
-
-      $this->input_->readMessageBegin($fname, $mtype, $rseqid);
-      if ($mtype == TMessageType::EXCEPTION) {
-        $x = new TApplicationException();
-        $x->read($this->input_);
-        $this->input_->readMessageEnd();
-        throw $x;
-      }
-      $result = new \Airavata\API\Airavata_updateUserProfile_result();
-      $result->read($this->input_);
-      $this->input_->readMessageEnd();
-    }
-    if ($result->success !== null) {
-      return $result->success;
-    }
-    if ($result->ire !== null) {
-      throw $result->ire;
-    }
-    if ($result->ace !== null) {
-      throw $result->ace;
-    }
-    if ($result->ase !== null) {
-      throw $result->ase;
-    }
-    if ($result->ae !== null) {
-      throw $result->ae;
-    }
-    throw new \Exception("updateUserProfile failed: unknown result");
-  }
-
-  public function getUserProfileById(\Airavata\Model\Security\AuthzToken $authzToken, $userId, $gatewayId)
-  {
-    $this->send_getUserProfileById($authzToken, $userId, $gatewayId);
-    return $this->recv_getUserProfileById();
-  }
-
-  public function send_getUserProfileById(\Airavata\Model\Security\AuthzToken $authzToken, $userId, $gatewayId)
-  {
-    $args = new \Airavata\API\Airavata_getUserProfileById_args();
-    $args->authzToken = $authzToken;
-    $args->userId = $userId;
-    $args->gatewayId = $gatewayId;
-    $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');
-    if ($bin_accel)
-    {
-      thrift_protocol_write_binary($this->output_, 'getUserProfileById', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());
-    }
-    else
-    {
-      $this->output_->writeMessageBegin('getUserProfileById', TMessageType::CALL, $this->seqid_);
-      $args->write($this->output_);
-      $this->output_->writeMessageEnd();
-      $this->output_->getTransport()->flush();
-    }
-  }
-
-  public function recv_getUserProfileById()
-  {
-    $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');
-    if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\Airavata\API\Airavata_getUserProfileById_result', $this->input_->isStrictRead());
-    else
-    {
-      $rseqid = 0;
-      $fname = null;
-      $mtype = 0;
-
-      $this->input_->readMessageBegin($fname, $mtype, $rseqid);
-      if ($mtype == TMessageType::EXCEPTION) {
-        $x = new TApplicationException();
-        $x->read($this->input_);
-        $this->input_->readMessageEnd();
-        throw $x;
-      }
-      $result = new \Airavata\API\Airavata_getUserProfileById_result();
-      $result->read($this->input_);
-      $this->input_->readMessageEnd();
-    }
-    if ($result->success !== null) {
-      return $result->success;
-    }
-    if ($result->ire !== null) {
-      throw $result->ire;
-    }
-    if ($result->ace !== null) {
-      throw $result->ace;
-    }
-    if ($result->ase !== null) {
-      throw $result->ase;
-    }
-    if ($result->ae !== null) {
-      throw $result->ae;
-    }
-    throw new \Exception("getUserProfileById failed: unknown result");
-  }
-
-  public function deleteUserProfile(\Airavata\Model\Security\AuthzToken $authzToken, $userId)
-  {
-    $this->send_deleteUserProfile($authzToken, $userId);
-    return $this->recv_deleteUserProfile();
-  }
-
-  public function send_deleteUserProfile(\Airavata\Model\Security\AuthzToken $authzToken, $userId)
-  {
-    $args = new \Airavata\API\Airavata_deleteUserProfile_args();
-    $args->authzToken = $authzToken;
-    $args->userId = $userId;
-    $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');
-    if ($bin_accel)
-    {
-      thrift_protocol_write_binary($this->output_, 'deleteUserProfile', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());
-    }
-    else
-    {
-      $this->output_->writeMessageBegin('deleteUserProfile', TMessageType::CALL, $this->seqid_);
-      $args->write($this->output_);
-      $this->output_->writeMessageEnd();
-      $this->output_->getTransport()->flush();
-    }
-  }
-
-  public function recv_deleteUserProfile()
-  {
-    $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');
-    if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\Airavata\API\Airavata_deleteUserProfile_result', $this->input_->isStrictRead());
-    else
-    {
-      $rseqid = 0;
-      $fname = null;
-      $mtype = 0;
-
-      $this->input_->readMessageBegin($fname, $mtype, $rseqid);
-      if ($mtype == TMessageType::EXCEPTION) {
-        $x = new TApplicationException();
-        $x->read($this->input_);
-        $this->input_->readMessageEnd();
-        throw $x;
-      }
-      $result = new \Airavata\API\Airavata_deleteUserProfile_result();
-      $result->read($this->input_);
-      $this->input_->readMessageEnd();
-    }
-    if ($result->success !== null) {
-      return $result->success;
-    }
-    if ($result->ire !== null) {
-      throw $result->ire;
-    }
-    if ($result->ace !== null) {
-      throw $result->ace;
-    }
-    if ($result->ase !== null) {
-      throw $result->ase;
-    }
-    if ($result->ae !== null) {
-      throw $result->ae;
-    }
-    throw new \Exception("deleteUserProfile failed: unknown result");
-  }
-
-  public function getAllUserProfilesInGateway(\Airavata\Model\Security\AuthzToken $authzToken, $gatewayId, $offset, $limit)
-  {
-    $this->send_getAllUserProfilesInGateway($authzToken, $gatewayId, $offset, $limit);
-    return $this->recv_getAllUserProfilesInGateway();
-  }
-
-  public function send_getAllUserProfilesInGateway(\Airavata\Model\Security\AuthzToken $authzToken, $gatewayId, $offset, $limit)
-  {
-    $args = new \Airavata\API\Airavata_getAllUserProfilesInGateway_args();
-    $args->authzToken = $authzToken;
-    $args->gatewayId = $gatewayId;
-    $args->offset = $offset;
-    $args->limit = $limit;
-    $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');
-    if ($bin_accel)
-    {
-      thrift_protocol_write_binary($this->output_, 'getAllUserProfilesInGateway', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());
-    }
-    else
-    {
-      $this->output_->writeMessageBegin('getAllUserProfilesInGateway', TMessageType::CALL, $this->seqid_);
-      $args->write($this->output_);
-      $this->output_->writeMessageEnd();
-      $this->output_->getTransport()->flush();
-    }
-  }
-
-  public function recv_getAllUserProfilesInGateway()
-  {
-    $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');
-    if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\Airavata\API\Airavata_getAllUserProfilesInGateway_result', $this->input_->isStrictRead());
-    else
-    {
-      $rseqid = 0;
-      $fname = null;
-      $mtype = 0;
-
-      $this->input_->readMessageBegin($fname, $mtype, $rseqid);
-      if ($mtype == TMessageType::EXCEPTION) {
-        $x = new TApplicationException();
-        $x->read($this->input_);
-        $this->input_->readMessageEnd();
-        throw $x;
-      }
-      $result = new \Airavata\API\Airavata_getAllUserProfilesInGateway_result();
-      $result->read($this->input_);
-      $this->input_->readMessageEnd();
-    }
-    if ($result->success !== null) {
-      return $result->success;
-    }
-    if ($result->ire !== null) {
-      throw $result->ire;
-    }
-    if ($result->ace !== null) {
-      throw $result->ace;
-    }
-    if ($result->ase !== null) {
-      throw $result->ase;
-    }
-    if ($result->ae !== null) {
-      throw $result->ae;
-    }
-    throw new \Exception("getAllUserProfilesInGateway failed: unknown result");
-  }
-
-  public function doesUserProfileExist(\Airavata\Model\Security\AuthzToken $authzToken, $userId, $gatewayId)
-  {
-    $this->send_doesUserProfileExist($authzToken, $userId, $gatewayId);
-    return $this->recv_doesUserProfileExist();
-  }
-
-  public function send_doesUserProfileExist(\Airavata\Model\Security\AuthzToken $authzToken, $userId, $gatewayId)
-  {
-    $args = new \Airavata\API\Airavata_doesUserProfileExist_args();
-    $args->authzToken = $authzToken;
-    $args->userId = $userId;
-    $args->gatewayId = $gatewayId;
-    $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');
-    if ($bin_accel)
-    {
-      thrift_protocol_write_binary($this->output_, 'doesUserProfileExist', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());
-    }
-    else
-    {
-      $this->output_->writeMessageBegin('doesUserProfileExist', TMessageType::CALL, $this->seqid_);
-      $args->write($this->output_);
-      $this->output_->writeMessageEnd();
-      $this->output_->getTransport()->flush();
-    }
-  }
-
-  public function recv_doesUserProfileExist()
-  {
-    $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');
-    if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\Airavata\API\Airavata_doesUserProfileExist_result', $this->input_->isStrictRead());
-    else
-    {
-      $rseqid = 0;
-      $fname = null;
-      $mtype = 0;
-
-      $this->input_->readMessageBegin($fname, $mtype, $rseqid);
-      if ($mtype == TMessageType::EXCEPTION) {
-        $x = new TApplicationException();
-        $x->read($this->input_);
-        $this->input_->readMessageEnd();
-        throw $x;
-      }
-      $result = new \Airavata\API\Airavata_doesUserProfileExist_result();
-      $result->read($this->input_);
-      $this->input_->readMessageEnd();
-    }
-    if ($result->success !== null) {
-      return $result->success;
-    }
-    if ($result->ire !== null) {
-      throw $result->ire;
-    }
-    if ($result->ace !== null) {
-      throw $result->ace;
-    }
-    if ($result->ase !== null) {
-      throw $result->ase;
-    }
-    if ($result->ae !== null) {
-      throw $result->ae;
-    }
-    throw new \Exception("doesUserProfileExist failed: unknown result");
-  }
-
 }
 
 // HELPER FUNCTIONS AND STRUCTURES
@@ -30870,1863 +30362,21 @@ class Airavata_cloneExperimentByAdmin_args {
           break;
         case 2:
           if ($ftype == TType::STRING) {
-            $xfer += $input->readString($this->existingExperimentID);
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
-        case 3:
-          if ($ftype == TType::STRING) {
-            $xfer += $input->readString($this->newExperimentName);
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
-        case 4:
-          if ($ftype == TType::STRING) {
-            $xfer += $input->readString($this->newExperimentProjectId);
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
-        default:
-          $xfer += $input->skip($ftype);
-          break;
-      }
-      $xfer += $input->readFieldEnd();
-    }
-    $xfer += $input->readStructEnd();
-    return $xfer;
-  }
-
-  public function write($output) {
-    $xfer = 0;
-    $xfer += $output->writeStructBegin('Airavata_cloneExperimentByAdmin_args');
-    if ($this->authzToken !== null) {
-      if (!is_object($this->authzToken)) {
-        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
-      }
-      $xfer += $output->writeFieldBegin('authzToken', TType::STRUCT, 1);
-      $xfer += $this->authzToken->write($output);
-      $xfer += $output->writeFieldEnd();
-    }
-    if ($this->existingExperimentID !== null) {
-      $xfer += $output->writeFieldBegin('existingExperimentID', TType::STRING, 2);
-      $xfer += $output->writeString($this->existingExperimentID);
-      $xfer += $output->writeFieldEnd();
-    }
-    if ($this->newExperimentName !== null) {
-      $xfer += $output->writeFieldBegin('newExperimentName', TType::STRING, 3);
-      $xfer += $output->writeString($this->newExperimentName);
-      $xfer += $output->writeFieldEnd();
-    }
-    if ($this->newExperimentProjectId !== null) {
-      $xfer += $output->writeFieldBegin('newExperimentProjectId', TType::STRING, 4);
-      $xfer += $output->writeString($this->newExperimentProjectId);
-      $xfer += $output->writeFieldEnd();
-    }
-    $xfer += $output->writeFieldStop();
-    $xfer += $output->writeStructEnd();
-    return $xfer;
-  }
-
-}
-
-class Airavata_cloneExperimentByAdmin_result {
-  static $_TSPEC;
-
-  /**
-   * @var string
-   */
-  public $success = null;
-  /**
-   * @var \Airavata\API\Error\InvalidRequestException
-   */
-  public $ire = null;
-  /**
-   * @var \Airavata\API\Error\ExperimentNotFoundException
-   */
-  public $enf = null;
-  /**
-   * @var \Airavata\API\Error\AiravataClientException
-   */
-  public $ace = null;
-  /**
-   * @var \Airavata\API\Error\AiravataSystemException
-   */
-  public $ase = null;
-  /**
-   * @var \Airavata\API\Error\AuthorizationException
-   */
-  public $ae = null;
-  /**
-   * @var \Airavata\API\Error\ProjectNotFoundException
-   */
-  public $pnfe = null;
-
-  public function __construct($vals=null) {
-    if (!isset(self::$_TSPEC)) {
-      self::$_TSPEC = array(
-        0 => array(
-          'var' => 'success',
-          'type' => TType::STRING,
-          ),
-        1 => array(
-          'var' => 'ire',
-          'type' => TType::STRUCT,
-          'class' => '\Airavata\API\Error\InvalidRequestException',
-          ),
-        2 => array(
-          'var' => 'enf',
-          'type' => TType::STRUCT,
-          'class' => '\Airavata\API\Error\ExperimentNotFoundException',
-          ),
-        3 => array(
-          'var' => 'ace',
-          'type' => TType::STRUCT,
-          'class' => '\Airavata\API\Error\AiravataClientException',
-          ),
-        4 => array(
-          'var' => 'ase',
-          'type' => TType::STRUCT,
-          'class' => '\Airavata\API\Error\AiravataSystemException',
-          ),
-        5 => array(
-          'var' => 'ae',
-          'type' => TType::STRUCT,
-          'class' => '\Airavata\API\Error\AuthorizationException',
-          ),
-        6 => array(
-          'var' => 'pnfe',
-          'type' => TType::STRUCT,
-          'class' => '\Airavata\API\Error\ProjectNotFoundException',
-          ),
-        );
-    }
-    if (is_array($vals)) {
-      if (isset($vals['success'])) {
-        $this->success = $vals['success'];
-      }
-      if (isset($vals['ire'])) {
-        $this->ire = $vals['ire'];
-      }
-      if (isset($vals['enf'])) {
-        $this->enf = $vals['enf'];
-      }
-      if (isset($vals['ace'])) {
-        $this->ace = $vals['ace'];
-      }
-      if (isset($vals['ase'])) {
-        $this->ase = $vals['ase'];
-      }
-      if (isset($vals['ae'])) {
-        $this->ae = $vals['ae'];
-      }
-      if (isset($vals['pnfe'])) {
-        $this->pnfe = $vals['pnfe'];
-      }
-    }
-  }
-
-  public function getName() {
-    return 'Airavata_cloneExperimentByAdmin_result';
-  }
-
-  public function read($input)
-  {
-    $xfer = 0;
-    $fname = null;
-    $ftype = 0;
-    $fid = 0;
-    $xfer += $input->readStructBegin($fname);
-    while (true)
-    {
-      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
-      if ($ftype == TType::STOP) {
-        break;
-      }
-      switch ($fid)
-      {
-        case 0:
-          if ($ftype == TType::STRING) {
-            $xfer += $input->readString($this->success);
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
-        case 1:
-          if ($ftype == TType::STRUCT) {
-            $this->ire = new \Airavata\API\Error\InvalidRequestException();
-            $xfer += $this->ire->read($input);
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
-        case 2:
-          if ($ftype == TType::STRUCT) {
-            $this->enf = new \Airavata\API\Error\ExperimentNotFoundException();
-            $xfer += $this->enf->read($input);
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
-        case 3:
-          if ($ftype == TType::STRUCT) {
-            $this->ace = new \Airavata\API\Error\AiravataClientException();
-            $xfer += $this->ace->read($input);
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
-        case 4:
-          if ($ftype == TType::STRUCT) {
-            $this->ase = new \Airavata\API\Error\AiravataSystemException();
-            $xfer += $this->ase->read($input);
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
-        case 5:
-          if ($ftype == TType::STRUCT) {
-            $this->ae = new \Airavata\API\Error\AuthorizationException();
-            $xfer += $this->ae->read($input);
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
-        case 6:
-          if ($ftype == TType::STRUCT) {
-            $this->pnfe = new \Airavata\API\Error\ProjectNotFoundException();
-            $xfer += $this->pnfe->read($input);
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
-        default:
-          $xfer += $input->skip($ftype);
-          break;
-      }
-      $xfer += $input->readFieldEnd();
-    }
-    $xfer += $input->readStructEnd();
-    return $xfer;
-  }
-
-  public function write($output) {
-    $xfer = 0;
-    $xfer += $output->writeStructBegin('Airavata_cloneExperimentByAdmin_result');
-    if ($this->success !== null) {
-      $xfer += $output->writeFieldBegin('success', TType::STRING, 0);
-      $xfer += $output->writeString($this->success);
-      $xfer += $output->writeFieldEnd();
-    }
-    if ($this->ire !== null) {
-      $xfer += $output->writeFieldBegin('ire', TType::STRUCT, 1);
-      $xfer += $this->ire->write($output);
-      $xfer += $output->writeFieldEnd();
-    }
-    if ($this->enf !== null) {
-      $xfer += $output->writeFieldBegin('enf', TType::STRUCT, 2);
-      $xfer += $this->enf->write($output);
-      $xfer += $output->writeFieldEnd();
-    }
-    if ($this->ace !== null) {
-      $xfer += $output->writeFieldBegin('ace', TType::STRUCT, 3);
-      $xfer += $this->ace->write($output);
-      $xfer += $output->writeFieldEnd();
-    }
-    if ($this->ase !== null) {
-      $xfer += $output->writeFieldBegin('ase', TType::STRUCT, 4);
-      $xfer += $this->ase->write($output);
-      $xfer += $output->writeFieldEnd();
-    }
-    if ($this->ae !== null) {
-      $xfer += $output->writeFieldBegin('ae', TType::STRUCT, 5);
-      $xfer += $this->ae->write($output);
-      $xfer += $output->writeFieldEnd();
-    }
-    if ($this->pnfe !== null) {
-      $xfer += $output->writeFieldBegin('pnfe', TType::STRUCT, 6);
-      $xfer += $this->pnfe->write($output);
-      $xfer += $output->writeFieldEnd();
-    }
-    $xfer += $output->writeFieldStop();
-    $xfer += $output->writeStructEnd();
-    return $xfer;
-  }
-
-}
-
-class Airavata_terminateExperiment_args {
-  static $_TSPEC;
-
-  /**
-   * @var \Airavata\Model\Security\AuthzToken
-   */
-  public $authzToken = null;
-  /**
-   * @var string
-   */
-  public $airavataExperimentId = null;
-  /**
-   * @var string
-   */
-  public $gatewayId = null;
-
-  public function __construct($vals=null) {
-    if (!isset(self::$_TSPEC)) {
-      self::$_TSPEC = array(
-        1 => array(
-          'var' => 'authzToken',
-          'type' => TType::STRUCT,
-          'class' => '\Airavata\Model\Security\AuthzToken',
-          ),
-        2 => array(
-          'var' => 'airavataExperimentId',
-          'type' => TType::STRING,
-          ),
-        3 => array(
-          'var' => 'gatewayId',
-          'type' => TType::STRING,
-          ),
-        );
-    }
-    if (is_array($vals)) {
-      if (isset($vals['authzToken'])) {
-        $this->authzToken = $vals['authzToken'];
-      }
-      if (isset($vals['airavataExperimentId'])) {
-        $this->airavataExperimentId = $vals['airavataExperimentId'];
-      }
-      if (isset($vals['gatewayId'])) {
-        $this->gatewayId = $vals['gatewayId'];
-      }
-    }
-  }
-
-  public function getName() {
-    return 'Airavata_terminateExperiment_args';
-  }
-
-  public function read($input)
-  {
-    $xfer = 0;
-    $fname = null;
-    $ftype = 0;
-    $fid = 0;
-    $xfer += $input->readStructBegin($fname);
-    while (true)
-    {
-      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
-      if ($ftype == TType::STOP) {
-        break;
-      }
-      switch ($fid)
-      {
-        case 1:
-          if ($ftype == TType::STRUCT) {
-            $this->authzToken = new \Airavata\Model\Security\AuthzToken();
-            $xfer += $this->authzToken->read($input);
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
-        case 2:
-          if ($ftype == TType::STRING) {
-            $xfer += $input->readString($this->airavataExperimentId);
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
-        case 3:
-          if ($ftype == TType::STRING) {
-            $xfer += $input->readString($this->gatewayId);
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
-        default:
-          $xfer += $input->skip($ftype);
-          break;
-      }
-      $xfer += $input->readFieldEnd();
-    }
-    $xfer += $input->readStructEnd();
-    return $xfer;
-  }
-
-  public function write($output) {
-    $xfer = 0;
-    $xfer += $output->writeStructBegin('Airavata_terminateExperiment_args');
-    if ($this->authzToken !== null) {
-      if (!is_object($this->authzToken)) {
-        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
-      }
-      $xfer += $output->writeFieldBegin('authzToken', TType::STRUCT, 1);
-      $xfer += $this->authzToken->write($output);
-      $xfer += $output->writeFieldEnd();
-    }
-    if ($this->airavataExperimentId !== null) {
-      $xfer += $output->writeFieldBegin('airavataExperimentId', TType::STRING, 2);
-      $xfer += $output->writeString($this->airavataExperimentId);
-      $xfer += $output->writeFieldEnd();
-    }
-    if ($this->gatewayId !== null) {
-      $xfer += $output->writeFieldBegin('gatewayId', TType::STRING, 3);
-      $xfer += $output->writeString($this->gatewayId);
-      $xfer += $output->writeFieldEnd();
-    }
-    $xfer += $output->writeFieldStop();
-    $xfer += $output->writeStructEnd();
-    return $xfer;
-  }
-
-}
-
-class Airavata_terminateExperiment_result {
-  static $_TSPEC;
-
-  /**
-   * @var \Airavata\API\Error\InvalidRequestException
-   */
-  public $ire = null;
-  /**
-   * @var \Airavata\API\Error\ExperimentNotFoundException
-   */
-  public $enf = null;
-  /**
-   * @var \Airavata\API\Error\AiravataClientException
-   */
-  public $ace = null;
-  /**
-   * @var \Airavata\API\Error\AiravataSystemException
-   */
-  public $ase = null;
-  /**
-   * @var \Airavata\API\Error\AuthorizationException
-   */
-  public $ae = null;
-
-  public function __construct($vals=null) {
-    if (!isset(self::$_TSPEC)) {
-      self::$_TSPEC = array(
-        1 => array(
-          'var' => 'ire',
-          'type' => TType::STRUCT,
-          'class' => '\Airavata\API\Error\InvalidRequestException',
-          ),
-        2 => array(
-          'var' => 'enf',
-          'type' => TType::STRUCT,
-          'class' => '\Airavata\API\Error\ExperimentNotFoundException',
-          ),
-        3 => array(
-          'var' => 'ace',
-          'type' => TType::STRUCT,
-          'class' => '\Airavata\API\Error\AiravataClientException',
-          ),
-        4 => array(
-          'var' => 'ase',
-          'type' => TType::STRUCT,
-          'class' => '\Airavata\API\Error\AiravataSystemException',
-          ),
-        5 => array(
-          'var' => 'ae',
-          'type' => TType::STRUCT,
-          'class' => '\Airavata\API\Error\AuthorizationException',
-          ),
-        );
-    }
-    if (is_array($vals)) {
-      if (isset($vals['ire'])) {
-        $this->ire = $vals['ire'];
-      }
-      if (isset($vals['enf'])) {
-        $this->enf = $vals['enf'];
-      }
-      if (isset($vals['ace'])) {
-        $this->ace = $vals['ace'];
-      }
-      if (isset($vals['ase'])) {
-        $this->ase = $vals['ase'];
-      }
-      if (isset($vals['ae'])) {
-        $this->ae = $vals['ae'];
-      }
-    }
-  }
-
-  public function getName() {
-    return 'Airavata_terminateExperiment_result';
-  }
-
-  public function read($input)
-  {
-    $xfer = 0;
-    $fname = null;
-    $ftype = 0;
-    $fid = 0;
-    $xfer += $input->readStructBegin($fname);
-    while (true)
-    {
-      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
-      if ($ftype == TType::STOP) {
-        break;
-      }
-      switch ($fid)
-      {
-        case 1:
-          if ($ftype == TType::STRUCT) {
-            $this->ire = new \Airavata\API\Error\InvalidRequestException();
-            $xfer += $this->ire->read($input);
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
-        case 2:
-          if ($ftype == TType::STRUCT) {
-            $this->enf = new \Airavata\API\Error\ExperimentNotFoundException();
-            $xfer += $this->enf->read($input);
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
-        case 3:
-          if ($ftype == TType::STRUCT) {
-            $this->ace = new \Airavata\API\Error\AiravataClientException();
-            $xfer += $this->ace->read($input);
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
-        case 4:
-          if ($ftype == TType::STRUCT) {
-            $this->ase = new \Airavata\API\Error\AiravataSystemException();
-            $xfer += $this->ase->read($input);
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
-        case 5:
-          if ($ftype == TType::STRUCT) {
-            $this->ae = new \Airavata\API\Error\AuthorizationException();
-            $xfer += $this->ae->read($input);
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
-        default:
-          $xfer += $input->skip($ftype);
-          break;
-      }
-      $xfer += $input->readFieldEnd();
-    }
-    $xfer += $input->readStructEnd();
-    return $xfer;
-  }
-
-  public function write($output) {
-    $xfer = 0;
-    $xfer += $output->writeStructBegin('Airavata_terminateExperiment_result');
-    if ($this->ire !== null) {
-      $xfer += $output->writeFieldBegin('ire', TType::STRUCT, 1);
-      $xfer += $this->ire->write($output);
-      $xfer += $output->writeFieldEnd();
-    }
-    if ($this->enf !== null) {
-      $xfer += $output->writeFieldBegin('enf', TType::STRUCT, 2);
-      $xfer += $this->enf->write($output);
-      $xfer += $output->writeFieldEnd();
-    }
-    if ($this->ace !== null) {
-      $xfer += $output->writeFieldBegin('ace', TType::STRUCT, 3);
-      $xfer += $this->ace->write($output);
-      $xfer += $output->writeFieldEnd();
-    }
-    if ($this->ase !== null) {
-      $xfer += $output->writeFieldBegin('ase', TType::STRUCT, 4);
-      $xfer += $this->ase->write($output);
-      $xfer += $output->writeFieldEnd();
-    }
-    if ($this->ae !== null) {
-      $xfer += $output->writeFieldBegin('ae', TType::STRUCT, 5);
-      $xfer += $this->ae->write($output);
-      $xfer += $output->writeFieldEnd();
-    }
-    $xfer += $output->writeFieldStop();
-    $xfer += $output->writeStructEnd();
-    return $xfer;
-  }
-
-}
-
-class Airavata_registerApplicationModule_args {
-  static $_TSPEC;
-
-  /**
-   * @var \Airavata\Model\Security\AuthzToken
-   */
-  public $authzToken = null;
-  /**
-   * @var string
-   */
-  public $gatewayId = null;
-  /**
-   * @var \Airavata\Model\AppCatalog\AppDeployment\ApplicationModule
-   */
-  public $applicationModule = null;
-
-  public function __construct($vals=null) {
-    if (!isset(self::$_TSPEC)) {
-      self::$_TSPEC = array(
-        1 => array(
-          'var' => 'authzToken',
-          'type' => TType::STRUCT,
-          'class' => '\Airavata\Model\Security\AuthzToken',
-          ),
-        2 => array(
-          'var' => 'gatewayId',
-          'type' => TType::STRING,
-          ),
-        3 => array(
-          'var' => 'applicationModule',
-          'type' => TType::STRUCT,
-          'class' => '\Airavata\Model\AppCatalog\AppDeployment\ApplicationModule',
-          ),
-        );
-    }
-    if (is_array($vals)) {
-      if (isset($vals['authzToken'])) {
-        $this->authzToken = $vals['authzToken'];
-      }
-      if (isset($vals['gatewayId'])) {
-        $this->gatewayId = $vals['gatewayId'];
-      }
-      if (isset($vals['applicationModule'])) {
-        $this->applicationModule = $vals['applicationModule'];
-      }
-    }
-  }
-
-  public function getName() {
-    return 'Airavata_registerApplicationModule_args';
-  }
-
-  public function read($input)
-  {
-    $xfer = 0;
-    $fname = null;
-    $ftype = 0;
-    $fid = 0;
-    $xfer += $input->readStructBegin($fname);
-    while (true)
-    {
-      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
-      if ($ftype == TType::STOP) {
-        break;
-      }
-      switch ($fid)
-      {
-        case 1:
-          if ($ftype == TType::STRUCT) {
-            $this->authzToken = new \Airavata\Model\Security\AuthzToken();
-            $xfer += $this->authzToken->read($input);
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
-        case 2:
-          if ($ftype == TType::STRING) {
-            $xfer += $input->readString($this->gatewayId);
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
-        case 3:
-          if ($ftype == TType::STRUCT) {
-            $this->applicationModule = new \Airavata\Model\AppCatalog\AppDeployment\ApplicationModule();
-            $xfer += $this->applicationModule->read($input);
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
-        default:
-          $xfer += $input->skip($ftype);
-          break;
-      }
-      $xfer += $input->readFieldEnd();
-    }
-    $xfer += $input->readStructEnd();
-    return $xfer;
-  }
-
-  public function write($output) {
-    $xfer = 0;
-    $xfer += $output->writeStructBegin('Airavata_registerApplicationModule_args');
-    if ($this->authzToken !== null) {
-      if (!is_object($this->authzToken)) {
-        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
-      }
-      $xfer += $output->writeFieldBegin('authzToken', TType::STRUCT, 1);
-      $xfer += $this->authzToken->write($output);
-      $xfer += $output->writeFieldEnd();
-    }
-    if ($this->gatewayId !== null) {
-      $xfer += $output->writeFieldBegin('gatewayId', TType::STRING, 2);
-      $xfer += $output->writeString($this->gatewayId);
-      $xfer += $output->writeFieldEnd();
-    }
-    if ($this->applicationModule !== null) {
-      if (!is_object($this->applicationModule)) {
-        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
-      }
-      $xfer += $output->writeFieldBegin('applicationModule', TType::STRUCT, 3);
-      $xfer += $this->applicationModule->write($output);
-      $xfer += $output->writeFieldEnd();
-    }
-    $xfer += $output->writeFieldStop();
-    $xfer += $output->writeStructEnd();
-    return $xfer;
-  }
-
-}
-
-class Airavata_registerApplicationModule_result {
-  static $_TSPEC;
-
-  /**
-   * @var string
-   */
-  public $success = null;
-  /**
-   * @var \Airavata\API\Error\InvalidRequestException
-   */
-  public $ire = null;
-  /**
-   * @var \Airavata\API\Error\AiravataClientException
-   */
-  public $ace = null;
-  /**
-   * @var \Airavata\API\Error\AiravataSystemException
-   */
-  public $ase = null;
-  /**
-   * @var \Airavata\API\Error\AuthorizationException
-   */
-  public $ae = null;
-
-  public function __construct($vals=null) {
-    if (!isset(self::$_TSPEC)) {
-      self::$_TSPEC = array(
-        0 => array(
-          'var' => 'success',
-          'type' => TType::STRING,
-          ),
-        1 => array(
-          'var' => 'ire',
-          'type' => TType::STRUCT,
-          'class' => '\Airavata\API\Error\InvalidRequestException',
-          ),
-        2 => array(
-          'var' => 'ace',
-          'type' => TType::STRUCT,
-          'class' => '\Airavata\API\Error\AiravataClientException',
-          ),
-        3 => array(
-          'var' => 'ase',
-          'type' => TType::STRUCT,
-          'class' => '\Airavata\API\Error\AiravataSystemException',
-          ),
-        4 => array(
-          'var' => 'ae',
-          'type' => TType::STRUCT,
-          'class' => '\Airavata\API\Error\AuthorizationException',
-          ),
-        );
-    }
-    if (is_array($vals)) {
-      if (isset($vals['success'])) {
-        $this->success = $vals['success'];
-      }
-      if (isset($vals['ire'])) {
-        $this->ire = $vals['ire'];
-      }
-      if (isset($vals['ace'])) {
-        $this->ace = $vals['ace'];
-      }
-      if (isset($vals['ase'])) {
-        $this->ase = $vals['ase'];
-      }
-      if (isset($vals['ae'])) {
-        $this->ae = $vals['ae'];
-      }
-    }
-  }
-
-  public function getName() {
-    return 'Airavata_registerApplicationModule_result';
-  }
-
-  public function read($input)
-  {
-    $xfer = 0;
-    $fname = null;
-    $ftype = 0;
-    $fid = 0;
-    $xfer += $input->readStructBegin($fname);
-    while (true)
-    {
-      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
-      if ($ftype == TType::STOP) {
-        break;
-      }
-      switch ($fid)
-      {
-        case 0:
-          if ($ftype == TType::STRING) {
-            $xfer += $input->readString($this->success);
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
-        case 1:
-          if ($ftype == TType::STRUCT) {
-            $this->ire = new \Airavata\API\Error\InvalidRequestException();
-            $xfer += $this->ire->read($input);
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
-        case 2:
-          if ($ftype == TType::STRUCT) {
-            $this->ace = new \Airavata\API\Error\AiravataClientException();
-            $xfer += $this->ace->read($input);
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
-        case 3:
-          if ($ftype == TType::STRUCT) {
-            $this->ase = new \Airavata\API\Error\AiravataSystemException();
-            $xfer += $this->ase->read($input);
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
-        case 4:
-          if ($ftype == TType::STRUCT) {
-            $this->ae = new \Airavata\API\Error\AuthorizationException();
-            $xfer += $this->ae->read($input);
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
-        default:
-          $xfer += $input->skip($ftype);
-          break;
-      }
-      $xfer += $input->readFieldEnd();
-    }
-    $xfer += $input->readStructEnd();
-    return $xfer;
-  }
-
-  public function write($output) {
-    $xfer = 0;
-    $xfer += $output->writeStructBegin('Airavata_registerApplicationModule_result');
-    if ($this->success !== null) {
-      $xfer += $output->writeFieldBegin('success', TType::STRING, 0);
-      $xfer += $output->writeString($this->success);
-      $xfer += $output->writeFieldEnd();
-    }
-    if ($this->ire !== null) {
-      $xfer += $output->writeFieldBegin('ire', TType::STRUCT, 1);
-      $xfer += $this->ire->write($output);
-      $xfer += $output->writeFieldEnd();
-    }
-    if ($this->ace !== null) {
-      $xfer += $output->writeFieldBegin('ace', TType::STRUCT, 2);
-      $xfer += $this->ace->write($output);
-      $xfer += $output->writeFieldEnd();
-    }
-    if ($this->ase !== null) {
-      $xfer += $output->writeFieldBegin('ase', TType::STRUCT, 3);
-      $xfer += $this->ase->write($output);
-      $xfer += $output->writeFieldEnd();
-    }
-    if ($this->ae !== null) {
-      $xfer += $output->writeFieldBegin('ae', TType::STRUCT, 4);
-      $xfer += $this->ae->write($output);
-      $xfer += $output->writeFieldEnd();
-    }
-    $xfer += $output->writeFieldStop();
-    $xfer += $output->writeStructEnd();
-    return $xfer;
-  }
-
-}
-
-class Airavata_getApplicationModule_args {
-  static $_TSPEC;
-
-  /**
-   * @var \Airavata\Model\Security\AuthzToken
-   */
-  public $authzToken = null;
-  /**
-   * @var string
-   */
-  public $appModuleId = null;
-
-  public function __construct($vals=null) {
-    if (!isset(self::$_TSPEC)) {
-      self::$_TSPEC = array(
-        1 => array(
-          'var' => 'authzToken',
-          'type' => TType::STRUCT,
-          'class' => '\Airavata\Model\Security\AuthzToken',
-          ),
-        2 => array(
-          'var' => 'appModuleId',
-          'type' => TType::STRING,
-          ),
-        );
-    }
-    if (is_array($vals)) {
-      if (isset($vals['authzToken'])) {
-        $this->authzToken = $vals['authzToken'];
-      }
-      if (isset($vals['appModuleId'])) {
-        $this->appModuleId = $vals['appModuleId'];
-      }
-    }
-  }
-
-  public function getName() {
-    return 'Airavata_getApplicationModule_args';
-  }
-
-  public function read($input)
-  {
-    $xfer = 0;
-    $fname = null;
-    $ftype = 0;
-    $fid = 0;
-    $xfer += $input->readStructBegin($fname);
-    while (true)
-    {
-      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
-      if ($ftype == TType::STOP) {
-        break;
-      }
-      switch ($fid)
-      {
-        case 1:
-          if ($ftype == TType::STRUCT) {
-            $this->authzToken = new \Airavata\Model\Security\AuthzToken();
-            $xfer += $this->authzToken->read($input);
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
-        case 2:
-          if ($ftype == TType::STRING) {
-            $xfer += $input->readString($this->appModuleId);
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
-        default:
-          $xfer += $input->skip($ftype);
-          break;
-      }
-      $xfer += $input->readFieldEnd();
-    }
-    $xfer += $input->readStructEnd();
-    return $xfer;
-  }
-
-  public function write($output) {
-    $xfer = 0;
-    $xfer += $output->writeStructBegin('Airavata_getApplicationModule_args');
-    if ($this->authzToken !== null) {
-      if (!is_object($this->authzToken)) {
-        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
-      }
-      $xfer += $output->writeFieldBegin('authzToken', TType::STRUCT, 1);
-      $xfer += $this->authzToken->write($output);
-      $xfer += $output->writeFieldEnd();
-    }
-    if ($this->appModuleId !== null) {
-      $xfer += $output->writeFieldBegin('appModuleId', TType::STRING, 2);
-      $xfer += $output->writeString($this->appModuleId);
-      $xfer += $output->writeFieldEnd();
-    }
-    $xfer += $output->writeFieldStop();
-    $xfer += $output->writeStructEnd();
-    return $xfer;
-  }
-
-}
-
-class Airavata_getApplicationModule_result {
-  static $_TSPEC;
-
-  /**
-   * @var \Airavata\Model\AppCatalog\AppDeployment\ApplicationModule
-   */
-  public $success = null;
-  /**
-   * @var \Airavata\API\Error\InvalidRequestException
-   */
-  public $ire = null;
-  /**
-   * @var \Airavata\API\Error\AiravataClientException
-   */
-  public $ace = null;
-  /**
-   * @var \Airavata\API\Error\AiravataSystemException
-   */
-  public $ase = null;
-  /**
-   * @var \Airavata\API\Error\AuthorizationException
-   */
-  public $ae = null;
-
-  public function __construct($vals=null) {
-    if (!isset(self::$_TSPEC)) {
-      self::$_TSPEC = array(
-        0 => array(
-          'var' => 'success',
-          'type' => TType::STRUCT,
-          'class' => '\Airavata\Model\AppCatalog\AppDeployment\ApplicationModule',
-          ),
-        1 => array(
-          'var' => 'ire',
-          'type' => TType::STRUCT,
-          'class' => '\Airavata\API\Error\InvalidRequestException',
-          ),
-        2 => array(
-          'var' => 'ace',
-          'type' => TType::STRUCT,
-          'class' => '\Airavata\API\Error\AiravataClientException',
-          ),
-        3 => array(
-          'var' => 'ase',
-          'type' => TType::STRUCT,
-          'class' => '\Airavata\API\Error\AiravataSystemException',
-          ),
-        4 => array(
-          'var' => 'ae',
-          'type' => TType::STRUCT,
-          'class' => '\Airavata\API\Error\AuthorizationException',
-          ),
-        );
-    }
-    if (is_array($vals)) {
-      if (isset($vals['success'])) {
-        $this->success = $vals['success'];
-      }
-      if (isset($vals['ire'])) {
-        $this->ire = $vals['ire'];
-      }
-      if (isset($vals['ace'])) {
-        $this->ace = $vals['ace'];
-      }
-      if (isset($vals['ase'])) {
-        $this->ase = $vals['ase'];
-      }
-      if (isset($vals['ae'])) {
-        $this->ae = $vals['ae'];
-      }
-    }
-  }
-
-  public function getName() {
-    return 'Airavata_getApplicationModule_result';
-  }
-
-  public function read($input)
-  {
-    $xfer = 0;
-    $fname = null;
-    $ftype = 0;
-    $fid = 0;
-    $xfer += $input->readStructBegin($fname);
-    while (true)
-    {
-      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
-      if ($ftype == TType::STOP) {
-        break;
-      }
-      switch ($fid)
-      {
-        case 0:
-          if ($ftype == TType::STRUCT) {
-            $this->success = new \Airavata\Model\AppCatalog\AppDeployment\ApplicationModule();
-            $xfer += $this->success->read($input);
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
-        case 1:
-          if ($ftype == TType::STRUCT) {
-            $this->ire = new \Airavata\API\Error\InvalidRequestException();
-            $xfer += $this->ire->read($input);
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
-        case 2:
-          if ($ftype == TType::STRUCT) {
-            $this->ace = new \Airavata\API\Error\AiravataClientException();
-            $xfer += $this->ace->read($input);
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
-        case 3:
-          if ($ftype == TType::STRUCT) {
-            $this->ase = new \Airavata\API\Error\AiravataSystemException();
-            $xfer += $this->ase->read($input);
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
-        case 4:
-          if ($ftype == TType::STRUCT) {
-            $this->ae = new \Airavata\API\Error\AuthorizationException();
-            $xfer += $this->ae->read($input);
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
-        default:
-          $xfer += $input->skip($ftype);
-          break;
-      }
-      $xfer += $input->readFieldEnd();
-    }
-    $xfer += $input->readStructEnd();
-    return $xfer;
-  }
-
-  public function write($output) {
-    $xfer = 0;
-    $xfer += $output->writeStructBegin('Airavata_getApplicationModule_result');
-    if ($this->success !== null) {
-      if (!is_object($this->success)) {
-        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
-      }
-      $xfer += $output->writeFieldBegin('success', TType::STRUCT, 0);
-      $xfer += $this->success->write($output);
-      $xfer += $output->writeFieldEnd();
-    }
-    if ($this->ire !== null) {
-      $xfer += $output->writeFieldBegin('ire', TType::STRUCT, 1);
-      $xfer += $this->ire->write($output);
-      $xfer += $output->writeFieldEnd();
-    }
-    if ($this->ace !== null) {
-      $xfer += $output->writeFieldBegin('ace', TType::STRUCT, 2);
-      $xfer += $this->ace->write($output);
-      $xfer += $output->writeFieldEnd();
-    }
-    if ($this->ase !== null) {
-      $xfer += $output->writeFieldBegin('ase', TType::STRUCT, 3);
-      $xfer += $this->ase->write($output);
-      $xfer += $output->writeFieldEnd();
-    }
-    if ($this->ae !== null) {
-      $xfer += $output->writeFieldBegin('ae', TType::STRUCT, 4);
-      $xfer += $this->ae->write($output);
-      $xfer += $output->writeFieldEnd();
-    }
-    $xfer += $output->writeFieldStop();
-    $xfer += $output->writeStructEnd();
-    return $xfer;
-  }
-
-}
-
-class Airavata_updateApplicationModule_args {
-  static $_TSPEC;
-
-  /**
-   * @var \Airavata\Model\Security\AuthzToken
-   */
-  public $authzToken = null;
-  /**
-   * @var string
-   */
-  public $appModuleId = null;
-  /**
-   * @var \Airavata\Model\AppCatalog\AppDeployment\ApplicationModule
-   */
-  public $applicationModule = null;
-
-  public function __construct($vals=null) {
-    if (!isset(self::$_TSPEC)) {
-      self::$_TSPEC = array(
-        1 => array(
-          'var' => 'authzToken',
-          'type' => TType::STRUCT,
-          'class' => '\Airavata\Model\Security\AuthzToken',
-          ),
-        2 => array(
-          'var' => 'appModuleId',
-          'type' => TType::STRING,
-          ),
-        3 => array(
-          'var' => 'applicationModule',
-          'type' => TType::STRUCT,
-          'class' => '\Airavata\Model\AppCatalog\AppDeployment\ApplicationModule',
-          ),
-        );
-    }
-    if (is_array($vals)) {
-      if (isset($vals['authzToken'])) {
-        $this->authzToken = $vals['authzToken'];
-      }
-      if (isset($vals['appModuleId'])) {
-        $this->appModuleId = $vals['appModuleId'];
-      }
-      if (isset($vals['applicationModule'])) {
-        $this->applicationModule = $vals['applicationModule'];
-      }
-    }
-  }
-
-  public function getName() {
-    return 'Airavata_updateApplicationModule_args';
-  }
-
-  public function read($input)
-  {
-    $xfer = 0;
-    $fname = null;
-    $ftype = 0;
-    $fid = 0;
-    $xfer += $input->readStructBegin($fname);
-    while (true)
-    {
-      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
-      if ($ftype == TType::STOP) {
-        break;
-      }
-      switch ($fid)
-      {
-        case 1:
-          if ($ftype == TType::STRUCT) {
-            $this->authzToken = new \Airavata\Model\Security\AuthzToken();
-            $xfer += $this->authzToken->read($input);
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
-        case 2:
-          if ($ftype == TType::STRING) {
-            $xfer += $input->readString($this->appModuleId);
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
-        case 3:
-          if ($ftype == TType::STRUCT) {
-            $this->applicationModule = new \Airavata\Model\AppCatalog\AppDeployment\ApplicationModule();
-            $xfer += $this->applicationModule->read($input);
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
-        default:
-          $xfer += $input->skip($ftype);
-          break;
-      }
-      $xfer += $input->readFieldEnd();
-    }
-    $xfer += $input->readStructEnd();
-    return $xfer;
-  }
-
-  public function write($output) {
-    $xfer = 0;
-    $xfer += $output->writeStructBegin('Airavata_updateApplicationModule_args');
-    if ($this->authzToken !== null) {
-      if (!is_object($this->authzToken)) {
-        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
-      }
-      $xfer += $output->writeFieldBegin('authzToken', TType::STRUCT, 1);
-      $xfer += $this->authzToken->write($output);
-      $xfer += $output->writeFieldEnd();
-    }
-    if ($this->appModuleId !== null) {
-      $xfer += $output->writeFieldBegin('appModuleId', TType::STRING, 2);
-      $xfer += $output->writeString($this->appModuleId);
-      $xfer += $output->writeFieldEnd();
-    }
-    if ($this->applicationModule !== null) {
-      if (!is_object($this->applicationModule)) {
-        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
-      }
-      $xfer += $output->writeFieldBegin('applicationModule', TType::STRUCT, 3);
-      $xfer += $this->applicationModule->write($output);
-      $xfer += $output->writeFieldEnd();
-    }
-    $xfer += $output->writeFieldStop();
-    $xfer += $output->writeStructEnd();
-    return $xfer;
-  }
-
-}
-
-class Airavata_updateApplicationModule_result {
-  static $_TSPEC;
-
-  /**
-   * @var bool
-   */
-  public $success = null;
-  /**
-   * @var \Airavata\API\Error\InvalidRequestException
-   */
-  public $ire = null;
-  /**
-   * @var \Airavata\API\Error\AiravataClientException
-   */
-  public $ace = null;
-  /**
-   * @var \Airavata\API\Error\AiravataSystemException
-   */
-  public $ase = null;
-  /**
-   * @var \Airavata\API\Error\AuthorizationException
-   */
-  public $ae = null;
-
-  public function __construct($vals=null) {
-    if (!isset(self::$_TSPEC)) {
-      self::$_TSPEC = array(
-        0 => array(
-          'var' => 'success',
-          'type' => TType::BOOL,
-          ),
-        1 => array(
-          'var' => 'ire',
-          'type' => TType::STRUCT,
-          'class' => '\Airavata\API\Error\InvalidRequestException',
-          ),
-        2 => array(
-          'var' => 'ace',
-          'type' => TType::STRUCT,
-          'class' => '\Airavata\API\Error\AiravataClientException',
-          ),
-        3 => array(
-          'var' => 'ase',
-          'type' => TType::STRUCT,
-          'class' => '\Airavata\API\Error\AiravataSystemException',
-          ),
-        4 => array(
-          'var' => 'ae',
-          'type' => TType::STRUCT,
-          'class' => '\Airavata\API\Error\AuthorizationException',
-          ),
-        );
-    }
-    if (is_array($vals)) {
-      if (isset($vals['success'])) {
-        $this->success = $vals['success'];
-      }
-      if (isset($vals['ire'])) {
-        $this->ire = $vals['ire'];
-      }
-      if (isset($vals['ace'])) {
-        $this->ace = $vals['ace'];
-      }
-      if (isset($vals['ase'])) {
-        $this->ase = $vals['ase'];
-      }
-      if (isset($vals['ae'])) {
-        $this->ae = $vals['ae'];
-      }
-    }
-  }
-
-  public function getName() {
-    return 'Airavata_updateApplicationModule_result';
-  }
-
-  public function read($input)
-  {
-    $xfer = 0;
-    $fname = null;
-    $ftype = 0;
-    $fid = 0;
-    $xfer += $input->readStructBegin($fname);
-    while (true)
-    {
-      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
-      if ($ftype == TType::STOP) {
-        break;
-      }
-      switch ($fid)
-      {
-        case 0:
-          if ($ftype == TType::BOOL) {
-            $xfer += $input->readBool($this->success);
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
-        case 1:
-          if ($ftype == TType::STRUCT) {
-            $this->ire = new \Airavata\API\Error\InvalidRequestException();
-            $xfer += $this->ire->read($input);
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
-        case 2:
-          if ($ftype == TType::STRUCT) {
-            $this->ace = new \Airavata\API\Error\AiravataClientException();
-            $xfer += $this->ace->read($input);
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
-        case 3:
-          if ($ftype == TType::STRUCT) {
-            $this->ase = new \Airavata\API\Error\AiravataSystemException();
-            $xfer += $this->ase->read($input);
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
-        case 4:
-          if ($ftype == TType::STRUCT) {
-            $this->ae = new \Airavata\API\Error\AuthorizationException();
-            $xfer += $this->ae->read($input);
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
-        default:
-          $xfer += $input->skip($ftype);
-          break;
-      }
-      $xfer += $input->readFieldEnd();
-    }
-    $xfer += $input->readStructEnd();
-    return $xfer;
-  }
-
-  public function write($output) {
-    $xfer = 0;
-    $xfer += $output->writeStructBegin('Airavata_updateApplicationModule_result');
-    if ($this->success !== null) {
-      $xfer += $output->writeFieldBegin('success', TType::BOOL, 0);
-      $xfer += $output->writeBool($this->success);
-      $xfer += $output->writeFieldEnd();
-    }
-    if ($this->ire !== null) {
-      $xfer += $output->writeFieldBegin('ire', TType::STRUCT, 1);
-      $xfer += $this->ire->write($output);
-      $xfer += $output->writeFieldEnd();
-    }
-    if ($this->ace !== null) {
-      $xfer += $output->writeFieldBegin('ace', TType::STRUCT, 2);
-      $xfer += $this->ace->write($output);
-      $xfer += $output->writeFieldEnd();
-    }
-    if ($this->ase !== null) {
-      $xfer += $output->writeFieldBegin('ase', TType::STRUCT, 3);
-      $xfer += $this->ase->write($output);
-      $xfer += $output->writeFieldEnd();
-    }
-    if ($this->ae !== null) {
-      $xfer += $output->writeFieldBegin('ae', TType::STRUCT, 4);
-      $xfer += $this->ae->write($output);
-      $xfer += $output->writeFieldEnd();
-    }
-    $xfer += $output->writeFieldStop();
-    $xfer += $output->writeStructEnd();
-    return $xfer;
-  }
-
-}
-
-class Airavata_getAllAppModules_args {
-  static $_TSPEC;
-
-  /**
-   * @var \Airavata\Model\Security\AuthzToken
-   */
-  public $authzToken = null;
-  /**
-   * @var string
-   */
-  public $gatewayId = null;
-
-  public function __construct($vals=null) {
-    if (!isset(self::$_TSPEC)) {
-      self::$_TSPEC = array(
-        1 => array(
-          'var' => 'authzToken',
-          'type' => TType::STRUCT,
-          'class' => '\Airavata\Model\Security\AuthzToken',
-          ),
-        2 => array(
-          'var' => 'gatewayId',
-          'type' => TType::STRING,
-          ),
-        );
-    }
-    if (is_array($vals)) {
-      if (isset($vals['authzToken'])) {
-        $this->authzToken = $vals['authzToken'];
-      }
-      if (isset($vals['gatewayId'])) {
-        $this->gatewayId = $vals['gatewayId'];
-      }
-    }
-  }
-
-  public function getName() {
-    return 'Airavata_getAllAppModules_args';
-  }
-
-  public function read($input)
-  {
-    $xfer = 0;
-    $fname = null;
-    $ftype = 0;
-    $fid = 0;
-    $xfer += $input->readStructBegin($fname);
-    while (true)
-    {
-      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
-      if ($ftype == TType::STOP) {
-        break;
-      }
-      switch ($fid)
-      {
-        case 1:
-          if ($ftype == TType::STRUCT) {
-            $this->authzToken = new \Airavata\Model\Security\AuthzToken();
-            $xfer += $this->authzToken->read($input);
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
-        case 2:
-          if ($ftype == TType::STRING) {
-            $xfer += $input->readString($this->gatewayId);
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
-        default:
-          $xfer += $input->skip($ftype);
-          break;
-      }
-      $xfer += $input->readFieldEnd();
-    }
-    $xfer += $input->readStructEnd();
-    return $xfer;
-  }
-
-  public function write($output) {
-    $xfer = 0;
-    $xfer += $output->writeStructBegin('Airavata_getAllAppModules_args');
-    if ($this->authzToken !== null) {
-      if (!is_object($this->authzToken)) {
-        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
-      }
-      $xfer += $output->writeFieldBegin('authzToken', TType::STRUCT, 1);
-      $xfer += $this->authzToken->write($output);
-      $xfer += $output->writeFieldEnd();
-    }
-    if ($this->gatewayId !== null) {
-      $xfer += $output->writeFieldBegin('gatewayId', TType::STRING, 2);
-      $xfer += $output->writeString($this->gatewayId);
-      $xfer += $output->writeFieldEnd();
-    }
-    $xfer += $output->writeFieldStop();
-    $xfer += $output->writeStructEnd();
-    return $xfer;
-  }
-
-}
-
-class Airavata_getAllAppModules_result {
-  static $_TSPEC;
-
-  /**
-   * @var \Airavata\Model\AppCatalog\AppDeployment\ApplicationModule[]
-   */
-  public $success = null;
-  /**
-   * @var \Airavata\API\Error\InvalidRequestException
-   */
-  public $ire = null;
-  /**
-   * @var \Airavata\API\Error\AiravataClientException
-   */
-  public $ace = null;
-  /**
-   * @var \Airavata\API\Error\AiravataSystemException
-   */
-  public $ase = null;
-  /**
-   * @var \Airavata\API\Error\AuthorizationException
-   */
-  public $ae = null;
-
-  public function __construct($vals=null) {
-    if (!isset(self::$_TSPEC)) {
-      self::$_TSPEC = array(
-        0 => array(
-          'var' => 'success',
-          'type' => TType::LST,
-          'etype' => TType::STRUCT,
-          'elem' => array(
-            'type' => TType::STRUCT,
-            'class' => '\Airavata\Model\AppCatalog\AppDeployment\ApplicationModule',
-            ),
-          ),
-        1 => array(
-          'var' => 'ire',
-          'type' => TType::STRUCT,
-          'class' => '\Airavata\API\Error\InvalidRequestException',
-          ),
-        2 => array(
-          'var' => 'ace',
-          'type' => TType::STRUCT,
-          'class' => '\Airavata\API\Error\AiravataClientException',
-          ),
-        3 => array(
-          'var' => 'ase',
-          'type' => TType::STRUCT,
-          'class' => '\Airavata\API\Error\AiravataSystemException',
-          ),
-        4 => array(
-          'var' => 'ae',
-          'type' => TType::STRUCT,
-          'class' => '\Airavata\API\Error\AuthorizationException',
-          ),
-        );
-    }
-    if (is_array($vals)) {
-      if (isset($vals['success'])) {
-        $this->success = $vals['success'];
-      }
-      if (isset($vals['ire'])) {
-        $this->ire = $vals['ire'];
-      }
-      if (isset($vals['ace'])) {
-        $this->ace = $vals['ace'];
-      }
-      if (isset($vals['ase'])) {
-        $this->ase = $vals['ase'];
-      }
-      if (isset($vals['ae'])) {
-        $this->ae = $vals['ae'];
-      }
-    }
-  }
-
-  public function getName() {
-    return 'Airavata_getAllAppModules_result';
-  }
-
-  public function read($input)
-  {
-    $xfer = 0;
-    $fname = null;
-    $ftype = 0;
-    $fid = 0;
-    $xfer += $input->readStructBegin($fname);
-    while (true)
-    {
-      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
-      if ($ftype == TType::STOP) {
-        break;
-      }
-      switch ($fid)
-      {
-        case 0:
-          if ($ftype == TType::LST) {
-            $this->success = array();
-            $_size136 = 0;
-            $_etype139 = 0;
-            $xfer += $input->readListBegin($_etype139, $_size136);
-            for ($_i140 = 0; $_i140 < $_size136; ++$_i140)
-            {
-              $elem141 = null;
-              $elem141 = new \Airavata\Model\AppCatalog\AppDeployment\ApplicationModule();
-              $xfer += $elem141->read($input);
-              $this->success []= $elem141;
-            }
-            $xfer += $input->readListEnd();
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
-        case 1:
-          if ($ftype == TType::STRUCT) {
-            $this->ire = new \Airavata\API\Error\InvalidRequestException();
-            $xfer += $this->ire->read($input);
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
-        case 2:
-          if ($ftype == TType::STRUCT) {
-            $this->ace = new \Airavata\API\Error\AiravataClientException();
-            $xfer += $this->ace->read($input);
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
-        case 3:
-          if ($ftype == TType::STRUCT) {
-            $this->ase = new \Airavata\API\Error\AiravataSystemException();
-            $xfer += $this->ase->read($input);
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
-        case 4:
-          if ($ftype == TType::STRUCT) {
-            $this->ae = new \Airavata\API\Error\AuthorizationException();
-            $xfer += $this->ae->read($input);
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
-        default:
-          $xfer += $input->skip($ftype);
-          break;
-      }
-      $xfer += $input->readFieldEnd();
-    }
-    $xfer += $input->readStructEnd();
-    return $xfer;
-  }
-
-  public function write($output) {
-    $xfer = 0;
-    $xfer += $output->writeStructBegin('Airavata_getAllAppModules_result');
-    if ($this->success !== null) {
-      if (!is_array($this->success)) {
-        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
-      }
-      $xfer += $output->writeFieldBegin('success', TType::LST, 0);
-      {
-        $output->writeListBegin(TType::STRUCT, count($this->success));
-        {
-          foreach ($this->success as $iter142)
-          {
-            $xfer += $iter142->write($output);
-          }
-        }
-        $output->writeListEnd();
-      }
-      $xfer += $output->writeFieldEnd();
-    }
-    if ($this->ire !== null) {
-      $xfer += $output->writeFieldBegin('ire', TType::STRUCT, 1);
-      $xfer += $this->ire->write($output);
-      $xfer += $output->writeFieldEnd();
-    }
-    if ($this->ace !== null) {
-      $xfer += $output->writeFieldBegin('ace', TType::STRUCT, 2);
-      $xfer += $this->ace->write($output);
-      $xfer += $output->writeFieldEnd();
-    }
-    if ($this->ase !== null) {
-      $xfer += $output->writeFieldBegin('ase', TType::STRUCT, 3);
-      $xfer += $this->ase->write($output);
-      $xfer += $output->writeFieldEnd();
-    }
-    if ($this->ae !== null) {
-      $xfer += $output->writeFieldBegin('ae', TType::STRUCT, 4);
-      $xfer += $this->ae->write($output);
-      $xfer += $output->writeFieldEnd();
-    }
-    $xfer += $output->writeFieldStop();
-    $xfer += $output->writeStructEnd();
-    return $xfer;
-  }
-
-}
-
-class Airavata_deleteApplicationModule_args {
-  static $_TSPEC;
-
-  /**
-   * @var \Airavata\Model\Security\AuthzToken
-   */
-  public $authzToken = null;
-  /**
-   * @var string
-   */
-  public $appModuleId = null;
-
-  public function __construct($vals=null) {
-    if (!isset(self::$_TSPEC)) {
-      self::$_TSPEC = array(
-        1 => array(
-          'var' => 'authzToken',
-          'type' => TType::STRUCT,
-          'class' => '\Airavata\Model\Security\AuthzToken',
-          ),
-        2 => array(
-          'var' => 'appModuleId',
-          'type' => TType::STRING,
-          ),
-        );
-    }
-    if (is_array($vals)) {
-      if (isset($vals['authzToken'])) {
-        $this->authzToken = $vals['authzToken'];
-      }
-      if (isset($vals['appModuleId'])) {
-        $this->appModuleId = $vals['appModuleId'];
-      }
-    }
-  }
-
-  public function getName() {
-    return 'Airavata_deleteApplicationModule_args';
-  }
-
-  public function read($input)
-  {
-    $xfer = 0;
-    $fname = null;
-    $ftype = 0;
-    $fid = 0;
-    $xfer += $input->readStructBegin($fname);
-    while (true)
-    {
-      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
-      if ($ftype == TType::STOP) {
-        break;
-      }
-      switch ($fid)
-      {
-        case 1:
-          if ($ftype == TType::STRUCT) {
-            $this->authzToken = new \Airavata\Model\Security\AuthzToken();
-            $xfer += $this->authzToken->read($input);
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
-        case 2:
-          if ($ftype == TType::STRING) {
-            $xfer += $input->readString($this->appModuleId);
+            $xfer += $input->readString($this->existingExperimentID);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 3:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->newExperimentName);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 4:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->newExperimentProjectId);
           } else {
             $xfer += $input->skip($ftype);
           }
@@ -32743,7 +30393,7 @@ class Airavata_deleteApplicationModule_args {
 
   public function write($output) {
     $xfer = 0;
-    $xfer += $output->writeStructBegin('Airavata_deleteApplicationModule_args');
+    $xfer += $output->writeStructBegin('Airavata_cloneExperimentByAdmin_args');
     if ($this->authzToken !== null) {
       if (!is_object($this->authzToken)) {
         throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
@@ -32752,9 +30402,19 @@ class Airavata_deleteApplicationModule_args {
       $xfer += $this->authzToken->write($output);
       $xfer += $output->writeFieldEnd();
     }
-    if ($this->appModuleId !== null) {
-      $xfer += $output->writeFieldBegin('appModuleId', TType::STRING, 2);
-      $xfer += $output->writeString($this->appModuleId);
+    if ($this->existingExperimentID !== null) {
+      $xfer += $output->writeFieldBegin('existingExperimentID', TType::STRING, 2);
+      $xfer += $output->writeString($this->existingExperimentID);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->newExperimentName !== null) {
+      $xfer += $output->writeFieldBegin('newExperimentName', TType::STRING, 3);
+      $xfer += $output->writeString($this->newExperimentName);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->newExperimentProjectId !== null) {
+      $xfer += $output->writeFieldBegin('newExperimentProjectId', TType::STRING, 4);
+      $xfer += $output->writeString($this->newExperimentProjectId);
       $xfer += $output->writeFieldEnd();
     }
     $xfer += $output->writeFieldStop();
@@ -32764,11 +30424,11 @@ class Airavata_deleteApplicationModule_args {
 
 }
 
-class Airavata_deleteApplicationModule_result {
+class Airavata_cloneExperimentByAdmin_result {
   static $_TSPEC;
 
   /**
-   * @var bool
+   * @var string
    */
   public $success = null;
   /**
@@ -32776,6 +30436,10 @@ class Airavata_deleteApplicationModule_result {
    */
   public $ire = null;
   /**
+   * @var \Airavata\API\Error\ExperimentNotFoundException
+   */
+  public $enf = null;
+  /**
    * @var \Airavata\API\Error\AiravataClientException
    */
   public $ace = null;
@@ -32787,13 +30451,17 @@ class Airavata_deleteApplicationModule_result {
    * @var \Airavata\API\Error\AuthorizationException
    */
   public $ae = null;
+  /**
+   * @var \Airavata\API\Error\ProjectNotFoundException
+   */
+  public $pnfe = null;
 
   public function __construct($vals=null) {
     if (!isset(self::$_TSPEC)) {
       self::$_TSPEC = array(
         0 => array(
           'var' => 'success',
-          'type' => TType::BOOL,
+          'type' => TType::STRING,
           ),
         1 => array(
           'var' => 'ire',
@@ -32801,20 +30469,30 @@ class Airavata_deleteApplicationModule_result {
           'class' => '\Airavata\API\Error\InvalidRequestException',
           ),
         2 => array(
+          'var' => 'enf',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\API\Error\ExperimentNotFoundException',
+          ),
+        3 => array(
           'var' => 'ace',
           'type' => TType::STRUCT,
           'class' => '\Airavata\API\Error\AiravataClientException',
           ),
-        3 => array(
+        4 => array(
           'var' => 'ase',
           'type' => TType::STRUCT,
           'class' => '\Airavata\API\Error\AiravataSystemException',
           ),
-        4 => array(
+        5 => array(
           'var' => 'ae',
           'type' => TType::STRUCT,
           'class' => '\Airavata\API\Error\AuthorizationException',
           ),
+        6 => array(
+          'var' => 'pnfe',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\API\Error\ProjectNotFoundException',
+          ),
         );
     }
     if (is_array($vals)) {
@@ -32824,6 +30502,9 @@ class Airavata_deleteApplicationModule_result {
       if (isset($vals['ire'])) {
         $this->ire = $vals['ire'];
       }
+      if (isset($vals['enf'])) {
+        $this->enf = $vals['enf'];
+      }
       if (isset($vals['ace'])) {
         $this->ace = $vals['ace'];
       }
@@ -32833,11 +30514,14 @@ class Airavata_deleteApplicationModule_result {
       if (isset($vals['ae'])) {
         $this->ae = $vals['ae'];
       }
+      if (isset($vals['pnfe'])) {
+        $this->pnfe = $vals['pnfe'];
+      }
     }
   }
 
   public function getName() {
-    return 'Airavata_deleteApplicationModule_result';
+    return 'Airavata_cloneExperimentByAdmin_result';
   }
 
   public function read($input)
@@ -32856,8 +30540,8 @@ class Airavata_deleteApplicationModule_result {
       switch ($fid)
       {
         case 0:
-          if ($ftype == TType::BOOL) {
-            $xfer += $input->readBool($this->success);
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->success);
           } else {
             $xfer += $input->skip($ftype);
           }
@@ -32872,13 +30556,21 @@ class Airavata_deleteApplicationModule_result {
           break;
         case 2:
           if ($ftype == TType::STRUCT) {
+            $this->enf = new \Airavata\API\Error\ExperimentNotFoundException();
+            $xfer += $this->enf->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 3:
+          if ($ftype == TType::STRUCT) {
             $this->ace = new \Airavata\API\Error\AiravataClientException();
             $xfer += $this->ace->read($input);
           } else {
             $xfer += $input->skip($ftype);
           }
           break;
-        case 3:
+        case 4:
           if ($ftype == TType::STRUCT) {
             $this->ase = new \Airavata\API\Error\AiravataSystemException();
             $xfer += $this->ase->read($input);
@@ -32886,7 +30578,7 @@ class Airavata_deleteApplicationModule_result {
             $xfer += $input->skip($ftype);
           }
           break;
-        case 4:
+        case 5:
           if ($ftype == TType::STRUCT) {
             $this->ae = new \Airavata\API\Error\AuthorizationException();
             $xfer += $this->ae->read($input);
@@ -32894,6 +30586,14 @@ class Airavata_deleteApplicationModule_result {
             $xfer += $input->skip($ftype);
           }
           break;
+        case 6:
+          if ($ftype == TType::STRUCT) {
+            $this->pnfe = new \Airavata\API\Error\ProjectNotFoundException();
+            $xfer += $this->pnfe->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
         default:
           $xfer += $input->skip($ftype);
           break;
@@ -32906,10 +30606,10 @@ class Airavata_deleteApplicationModule_result {
 
   public function write($output) {
     $xfer = 0;
-    $xfer += $output->writeStructBegin('Airavata_deleteApplicationModule_result');
+    $xfer += $output->writeStructBegin('Airavata_cloneExperimentByAdmin_result');
     if ($this->success !== null) {
-      $xfer += $output->writeFieldBegin('success', TType::BOOL, 0);
-      $xfer += $output->writeBool($this->success);
+      $xfer += $output->writeFieldBegin('success', TType::STRING, 0);
+      $xfer += $output->writeString($this->success);
       $xfer += $output->writeFieldEnd();
     }
     if ($this->ire !== null) {
@@ -32917,21 +30617,31 @@ class Airavata_deleteApplicationModule_result {
       $xfer += $this->ire->write($output);
       $xfer += $output->writeFieldEnd();
     }
+    if ($this->enf !== null) {
+      $xfer += $output->writeFieldBegin('enf', TType::STRUCT, 2);
+      $xfer += $this->enf->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
     if ($this->ace !== null) {
-      $xfer += $output->writeFieldBegin('ace', TType::STRUCT, 2);
+      $xfer += $output->writeFieldBegin('ace', TType::STRUCT, 3);
       $xfer += $this->ace->write($output);
       $xfer += $output->writeFieldEnd();
     }
     if ($this->ase !== null) {
-      $xfer += $output->writeFieldBegin('ase', TType::STRUCT, 3);
+      $xfer += $output->writeFieldBegin('ase', TType::STRUCT, 4);
       $xfer += $this->ase->write($output);
       $xfer += $output->writeFieldEnd();
     }
     if ($this->ae !== null) {
-      $xfer += $output->writeFieldBegin('ae', TType::STRUCT, 4);
+      $xfer += $output->writeFieldBegin('ae', TType::STRUCT, 5);
       $xfer += $this->ae->write($output);
       $xfer += $output->writeFieldEnd();
     }
+    if ($this->pnfe !== null) {
+      $xfer += $output->writeFieldBegin('pnfe', TType::STRUCT, 6);
+      $xfer += $this->pnfe->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
     $xfer += $output->writeFieldStop();
     $xfer += $output->writeStructEnd();
     return $xfer;
@@ -32939,7 +30649,7 @@ class Airavata_deleteApplicationModule_result {
 
 }
 
-class Airavata_registerApplicationDeployment_args {
+class Airavata_terminateExperiment_args {
   static $_TSPEC;
 
   /**
@@ -32949,11 +30659,11 @@ class Airavata_registerApplicationDeployment_args {
   /**
    * @var string
    */
-  public $gatewayId = null;
+  public $airavataExperimentId = null;
   /**
-   * @var \Airavata\Model\AppCatalog\AppDeployment\ApplicationDeploymentDescription
+   * @var string
    */
-  public $applicationDeployment = null;
+  public $gatewayId = null;
 
   public function __construct($vals=null) {
     if (!isset(self::$_TSPEC)) {
@@ -32964,13 +30674,12 @@ class Airavata_registerApplicationDeployment_args {
           'class' => '\Airavata\Model\Security\AuthzToken',
           ),
         2 => array(
-          'var' => 'gatewayId',
+          'var' => 'airavataExperimentId',
           'type' => TType::STRING,
           ),
         3 => array(
-          'var' => 'applicationDeployment',
-          'type' => TType::STRUCT,
-          'class' => '\Airavata\Model\AppCatalog\AppDeployment\ApplicationDeploymentDescription',
+          'var' => 'gatewayId',
+          'type' => TType::STRING,
           ),
         );
     }
@@ -32978,17 +30687,17 @@ class Airavata_registerApplicationDeployment_args {
       if (isset($vals['authzToken'])) {
         $this->authzToken = $vals['authzToken'];
       }
+      if (isset($vals['airavataExperimentId'])) {
+        $this->airavataExperimentId = $vals['airavataExperimentId'];
+      }
       if (isset($vals['gatewayId'])) {
         $this->gatewayId = $vals['gatewayId'];
       }
-      if (isset($vals['applicationDeployment'])) {
-        $this->applicationDeployment = $vals['applicationDeployment'];
-      }
     }
   }
 
   public function getName() {
-    return 'Airavata_registerApplicationDeployment_args';
+    return 'Airavata_terminateExperiment_args';
   }
 
   public function read($input)
@@ -33016,15 +30725,14 @@ class Airavata_registerApplicationDeployment_args {
           break;
         case 2:
           if ($ftype == TType::STRING) {
-            $xfer += $input->readString($this->gatewayId);
+            $xfer += $input->readString($this->airavataExperimentId);
           } else {
             $xfer += $input->skip($ftype);
           }
           break;
         case 3:
-          if ($ftype == TType::STRUCT) {
-            $this->applicationDeployment = new \Airavata\Model\AppCatalog\AppDeployment\ApplicationDeploymentDescription();
-            $xfer += $this->applicationDeployment->read($input);
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->gatewayId);
           } else {
             $xfer += $input->skip($ftype);
           }
@@ -33041,7 +30749,7 @@ class Airavata_registerApplicationDeployment_args {
 
   public function write($output) {
     $xfer = 0;
-    $xfer += $output->writeStructBegin('Airavata_registerApplicationDeployment_args');
+    $xfer += $output->writeStructBegin('Airavata_terminateExperiment_args');
     if ($this->authzToken !== null) {
       if (!is_object($this->authzToken)) {
         throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
@@ -33050,17 +30758,14 @@ class Airavata_registerApplicationDeployment_args {
       $xfer += $this->authzToken->write($output);
       $xfer += $output->writeFieldEnd();
     }
-    if ($this->gatewayId !== null) {
-      $xfer += $output->writeFieldBegin('gatewayId', TType::STRING, 2);
-      $xfer += $output->writeString($this->gatewayId);
+    if ($this->airavataExperimentId !== null) {
+      $xfer += $output->writeFieldBegin('airavataExperimentId', TType::STRING, 2);
+      $xfer += $output->writeString($this->airavataExperimentId);
       $xfer += $output->writeFieldEnd();
     }
-    if ($this->applicationDeployment !== null) {
-      if (!is_object($this->applicationDeployment)) {
-        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
-      }
-      $xfer += $output->writeFieldBegin('applicationDeployment', TType::STRUCT, 3);
-      $xfer += $this->applicationDeployment->write($output);
+    if ($this->gatewayId !== null) {
+      $xfer += $output->writeFieldBegin('gatewayId', TType::STRING, 3);
+      $xfer += $output->writeString($this->gatewayId);
       $xfer += $output->writeFieldEnd();
     }
     $xfer += $output->writeFieldStop();
@@ -33070,18 +30775,18 @@ class Airavata_registerApplicationDeployment_args {
 
 }
 
-class Airavata_registerApplicationDeployment_result {
+class Airavata_terminateExperiment_result {
   static $_TSPEC;
 
   /**
-   * @var string
-   */
-  public $success = null;
-  /**
    * @var \Airavata\API\Error\InvalidRequestException
    */
   public $ire = null;
   /**
+   * @var \Airavata\API\Error\ExperimentNotFoundException
+   */
+  public $enf = null;
+  /**
    * @var \Airavata\API\Error\AiravataClientException
    */
   public $ace = null;
@@ -33097,26 +30802,27 @@ class Airavata_registerApplicationDeployment_result {
   public function __construct($vals=null) {
     if (!isset(self::$_TSPEC)) {
       self::$_TSPEC = array(
-        0 => array(
-          'var' => 'success',
-          'type' => TType::STRING,
-          )

<TRUNCATED>

[46/50] [abbrv] airavata-php-gateway git commit: AIRAVATA-2408 Switching User Profile calls to Profile Service

Posted by ma...@apache.org.
AIRAVATA-2408 Switching User Profile calls to Profile Service


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

Branch: refs/heads/develop
Commit: 3c17052fd23fe04c14c9b8843028369e92ef158c
Parents: 7897988
Author: Marcus Christie <ma...@iu.edu>
Authored: Mon Jun 12 16:35:40 2017 -0400
Committer: Marcus Christie <ma...@iu.edu>
Committed: Mon Jun 12 16:36:22 2017 -0400

----------------------------------------------------------------------
 app/config/app.php                              |    1 +
 .../Airavata/Facades/UserProfileServices.php    |   16 +
 .../Airavata/Model/Workspace/Types.php          |  133 +-
 .../Iam/Admin/Services/CPI/IamAdminServices.php |  272 ++
 .../Service/Profile/Tenant/CPI/Error/Types.php  |   95 +
 .../Profile/Tenant/CPI/TenantProfileService.php | 2435 ++++++++++++++++++
 .../Service/Profile/Tenant/CPI/Types.php        |   33 +
 .../Airavata/Service/Profile/Types.php          |   20 +
 .../Service/Profile/User/CPI/Error/Types.php    |   95 +
 .../Airavata/Service/Profile/User/CPI/Types.php |   33 +
 .../Profile/User/CPI/UserProfileService.php     | 2025 +++++++++++++++
 .../Airavata/UserProfileServiceProvider.php     |   83 +
 app/libraries/UserProfileUtilities.php          |    8 +-
 13 files changed, 5190 insertions(+), 59 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/3c17052f/app/config/app.php
----------------------------------------------------------------------
diff --git a/app/config/app.php b/app/config/app.php
index 9d863ce..ee2ff8b 100755
--- a/app/config/app.php
+++ b/app/config/app.php
@@ -125,6 +125,7 @@ return array(
         'Keycloak\KeycloakServiceProvider',
         'Airavata\AiravataServiceProvider',
         'Airavata\IamAdminServiceProvider',
+        'Airavata\UserProfileServiceProvider',
         'Teepluss\Theme\ThemeServiceProvider',
         'GrahamCampbell\Markdown\MarkdownServiceProvider',
     ),

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/3c17052f/app/libraries/Airavata/Facades/UserProfileServices.php
----------------------------------------------------------------------
diff --git a/app/libraries/Airavata/Facades/UserProfileServices.php b/app/libraries/Airavata/Facades/UserProfileServices.php
new file mode 100644
index 0000000..94abcf3
--- /dev/null
+++ b/app/libraries/Airavata/Facades/UserProfileServices.php
@@ -0,0 +1,16 @@
+<?php
+
+namespace Airavata\Facades;
+
+use Illuminate\Support\Facades\Facade;
+
+class UserProfileServices extends Facade {
+
+    /**
+     * Get the registered name of the component.
+     *
+     * @return string
+     */
+    protected static function getFacadeAccessor() { return 'user_profile_services'; }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/3c17052f/app/libraries/Airavata/Model/Workspace/Types.php
----------------------------------------------------------------------
diff --git a/app/libraries/Airavata/Model/Workspace/Types.php b/app/libraries/Airavata/Model/Workspace/Types.php
index 098511f..d929439 100644
--- a/app/libraries/Airavata/Model/Workspace/Types.php
+++ b/app/libraries/Airavata/Model/Workspace/Types.php
@@ -629,6 +629,10 @@ class Gateway {
   /**
    * @var string
    */
+  public $airavataInternalGatewayId = null;
+  /**
+   * @var string
+   */
   public $gatewayId = null;
   /**
    * @var int
@@ -707,84 +711,91 @@ class Gateway {
     if (!isset(self::$_TSPEC)) {
       self::$_TSPEC = array(
         1 => array(
-          'var' => 'gatewayId',
+          'var' => 'airavataInternalGatewayId',
           'type' => TType::STRING,
           ),
         2 => array(
+          'var' => 'gatewayId',
+          'type' => TType::STRING,
+          ),
+        3 => array(
           'var' => 'gatewayApprovalStatus',
           'type' => TType::I32,
           ),
-        3 => array(
+        4 => array(
           'var' => 'gatewayName',
           'type' => TType::STRING,
           ),
-        4 => array(
+        5 => array(
           'var' => 'domain',
           'type' => TType::STRING,
           ),
-        5 => array(
+        6 => array(
           'var' => 'emailAddress',
           'type' => TType::STRING,
           ),
-        6 => array(
+        7 => array(
           'var' => 'gatewayAcronym',
           'type' => TType::STRING,
           ),
-        7 => array(
+        8 => array(
           'var' => 'gatewayURL',
           'type' => TType::STRING,
           ),
-        8 => array(
+        9 => array(
           'var' => 'gatewayPublicAbstract',
           'type' => TType::STRING,
           ),
-        9 => array(
+        10 => array(
           'var' => 'reviewProposalDescription',
           'type' => TType::STRING,
           ),
-        10 => array(
+        11 => array(
           'var' => 'gatewayAdminFirstName',
           'type' => TType::STRING,
           ),
-        11 => array(
+        12 => array(
           'var' => 'gatewayAdminLastName',
           'type' => TType::STRING,
           ),
-        12 => array(
+        13 => array(
           'var' => 'gatewayAdminEmail',
           'type' => TType::STRING,
           ),
-        13 => array(
+        14 => array(
           'var' => 'identityServerUserName',
           'type' => TType::STRING,
           ),
-        14 => array(
+        15 => array(
           'var' => 'identityServerPasswordToken',
           'type' => TType::STRING,
           ),
-        15 => array(
+        16 => array(
           'var' => 'declinedReason',
           'type' => TType::STRING,
           ),
-        16 => array(
+        17 => array(
           'var' => 'oauthClientId',
           'type' => TType::STRING,
           ),
-        17 => array(
+        18 => array(
           'var' => 'oauthClientSecret',
           'type' => TType::STRING,
           ),
-        18 => array(
+        19 => array(
           'var' => 'requestCreationTime',
           'type' => TType::I64,
           ),
-        19 => array(
+        20 => array(
           'var' => 'requesterUsername',
           'type' => TType::STRING,
           ),
         );
     }
     if (is_array($vals)) {
+      if (isset($vals['airavataInternalGatewayId'])) {
+        $this->airavataInternalGatewayId = $vals['airavataInternalGatewayId'];
+      }
       if (isset($vals['gatewayId'])) {
         $this->gatewayId = $vals['gatewayId'];
       }
@@ -866,131 +877,138 @@ class Gateway {
       {
         case 1:
           if ($ftype == TType::STRING) {
-            $xfer += $input->readString($this->gatewayId);
+            $xfer += $input->readString($this->airavataInternalGatewayId);
           } else {
             $xfer += $input->skip($ftype);
           }
           break;
         case 2:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->gatewayId);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 3:
           if ($ftype == TType::I32) {
             $xfer += $input->readI32($this->gatewayApprovalStatus);
           } else {
             $xfer += $input->skip($ftype);
           }
           break;
-        case 3:
+        case 4:
           if ($ftype == TType::STRING) {
             $xfer += $input->readString($this->gatewayName);
           } else {
             $xfer += $input->skip($ftype);
           }
           break;
-        case 4:
+        case 5:
           if ($ftype == TType::STRING) {
             $xfer += $input->readString($this->domain);
           } else {
             $xfer += $input->skip($ftype);
           }
           break;
-        case 5:
+        case 6:
           if ($ftype == TType::STRING) {
             $xfer += $input->readString($this->emailAddress);
           } else {
             $xfer += $input->skip($ftype);
           }
           break;
-        case 6:
+        case 7:
           if ($ftype == TType::STRING) {
             $xfer += $input->readString($this->gatewayAcronym);
           } else {
             $xfer += $input->skip($ftype);
           }
           break;
-        case 7:
+        case 8:
           if ($ftype == TType::STRING) {
             $xfer += $input->readString($this->gatewayURL);
           } else {
             $xfer += $input->skip($ftype);
           }
           break;
-        case 8:
+        case 9:
           if ($ftype == TType::STRING) {
             $xfer += $input->readString($this->gatewayPublicAbstract);
           } else {
             $xfer += $input->skip($ftype);
           }
           break;
-        case 9:
+        case 10:
           if ($ftype == TType::STRING) {
             $xfer += $input->readString($this->reviewProposalDescription);
           } else {
             $xfer += $input->skip($ftype);
           }
           break;
-        case 10:
+        case 11:
           if ($ftype == TType::STRING) {
             $xfer += $input->readString($this->gatewayAdminFirstName);
           } else {
             $xfer += $input->skip($ftype);
           }
           break;
-        case 11:
+        case 12:
           if ($ftype == TType::STRING) {
             $xfer += $input->readString($this->gatewayAdminLastName);
           } else {
             $xfer += $input->skip($ftype);
           }
           break;
-        case 12:
+        case 13:
           if ($ftype == TType::STRING) {
             $xfer += $input->readString($this->gatewayAdminEmail);
           } else {
             $xfer += $input->skip($ftype);
           }
           break;
-        case 13:
+        case 14:
           if ($ftype == TType::STRING) {
             $xfer += $input->readString($this->identityServerUserName);
           } else {
             $xfer += $input->skip($ftype);
           }
           break;
-        case 14:
+        case 15:
           if ($ftype == TType::STRING) {
             $xfer += $input->readString($this->identityServerPasswordToken);
           } else {
             $xfer += $input->skip($ftype);
           }
           break;
-        case 15:
+        case 16:
           if ($ftype == TType::STRING) {
             $xfer += $input->readString($this->declinedReason);
           } else {
             $xfer += $input->skip($ftype);
           }
           break;
-        case 16:
+        case 17:
           if ($ftype == TType::STRING) {
             $xfer += $input->readString($this->oauthClientId);
           } else {
             $xfer += $input->skip($ftype);
           }
           break;
-        case 17:
+        case 18:
           if ($ftype == TType::STRING) {
             $xfer += $input->readString($this->oauthClientSecret);
           } else {
             $xfer += $input->skip($ftype);
           }
           break;
-        case 18:
+        case 19:
           if ($ftype == TType::I64) {
             $xfer += $input->readI64($this->requestCreationTime);
           } else {
             $xfer += $input->skip($ftype);
           }
           break;
-        case 19:
+        case 20:
           if ($ftype == TType::STRING) {
             $xfer += $input->readString($this->requesterUsername);
           } else {
@@ -1010,98 +1028,103 @@ class Gateway {
   public function write($output) {
     $xfer = 0;
     $xfer += $output->writeStructBegin('Gateway');
+    if ($this->airavataInternalGatewayId !== null) {
+      $xfer += $output->writeFieldBegin('airavataInternalGatewayId', TType::STRING, 1);
+      $xfer += $output->writeString($this->airavataInternalGatewayId);
+      $xfer += $output->writeFieldEnd();
+    }
     if ($this->gatewayId !== null) {
-      $xfer += $output->writeFieldBegin('gatewayId', TType::STRING, 1);
+      $xfer += $output->writeFieldBegin('gatewayId', TType::STRING, 2);
       $xfer += $output->writeString($this->gatewayId);
       $xfer += $output->writeFieldEnd();
     }
     if ($this->gatewayApprovalStatus !== null) {
-      $xfer += $output->writeFieldBegin('gatewayApprovalStatus', TType::I32, 2);
+      $xfer += $output->writeFieldBegin('gatewayApprovalStatus', TType::I32, 3);
       $xfer += $output->writeI32($this->gatewayApprovalStatus);
       $xfer += $output->writeFieldEnd();
     }
     if ($this->gatewayName !== null) {
-      $xfer += $output->writeFieldBegin('gatewayName', TType::STRING, 3);
+      $xfer += $output->writeFieldBegin('gatewayName', TType::STRING, 4);
       $xfer += $output->writeString($this->gatewayName);
       $xfer += $output->writeFieldEnd();
     }
     if ($this->domain !== null) {
-      $xfer += $output->writeFieldBegin('domain', TType::STRING, 4);
+      $xfer += $output->writeFieldBegin('domain', TType::STRING, 5);
       $xfer += $output->writeString($this->domain);
       $xfer += $output->writeFieldEnd();
     }
     if ($this->emailAddress !== null) {
-      $xfer += $output->writeFieldBegin('emailAddress', TType::STRING, 5);
+      $xfer += $output->writeFieldBegin('emailAddress', TType::STRING, 6);
       $xfer += $output->writeString($this->emailAddress);
       $xfer += $output->writeFieldEnd();
     }
     if ($this->gatewayAcronym !== null) {
-      $xfer += $output->writeFieldBegin('gatewayAcronym', TType::STRING, 6);
+      $xfer += $output->writeFieldBegin('gatewayAcronym', TType::STRING, 7);
       $xfer += $output->writeString($this->gatewayAcronym);
       $xfer += $output->writeFieldEnd();
     }
     if ($this->gatewayURL !== null) {
-      $xfer += $output->writeFieldBegin('gatewayURL', TType::STRING, 7);
+      $xfer += $output->writeFieldBegin('gatewayURL', TType::STRING, 8);
       $xfer += $output->writeString($this->gatewayURL);
       $xfer += $output->writeFieldEnd();
     }
     if ($this->gatewayPublicAbstract !== null) {
-      $xfer += $output->writeFieldBegin('gatewayPublicAbstract', TType::STRING, 8);
+      $xfer += $output->writeFieldBegin('gatewayPublicAbstract', TType::STRING, 9);
       $xfer += $output->writeString($this->gatewayPublicAbstract);
       $xfer += $output->writeFieldEnd();
     }
     if ($this->reviewProposalDescription !== null) {
-      $xfer += $output->writeFieldBegin('reviewProposalDescription', TType::STRING, 9);
+      $xfer += $output->writeFieldBegin('reviewProposalDescription', TType::STRING, 10);
       $xfer += $output->writeString($this->reviewProposalDescription);
       $xfer += $output->writeFieldEnd();
     }
     if ($this->gatewayAdminFirstName !== null) {
-      $xfer += $output->writeFieldBegin('gatewayAdminFirstName', TType::STRING, 10);
+      $xfer += $output->writeFieldBegin('gatewayAdminFirstName', TType::STRING, 11);
       $xfer += $output->writeString($this->gatewayAdminFirstName);
       $xfer += $output->writeFieldEnd();
     }
     if ($this->gatewayAdminLastName !== null) {
-      $xfer += $output->writeFieldBegin('gatewayAdminLastName', TType::STRING, 11);
+      $xfer += $output->writeFieldBegin('gatewayAdminLastName', TType::STRING, 12);
       $xfer += $output->writeString($this->gatewayAdminLastName);
       $xfer += $output->writeFieldEnd();
     }
     if ($this->gatewayAdminEmail !== null) {
-      $xfer += $output->writeFieldBegin('gatewayAdminEmail', TType::STRING, 12);
+      $xfer += $output->writeFieldBegin('gatewayAdminEmail', TType::STRING, 13);
       $xfer += $output->writeString($this->gatewayAdminEmail);
       $xfer += $output->writeFieldEnd();
     }
     if ($this->identityServerUserName !== null) {
-      $xfer += $output->writeFieldBegin('identityServerUserName', TType::STRING, 13);
+      $xfer += $output->writeFieldBegin('identityServerUserName', TType::STRING, 14);
       $xfer += $output->writeString($this->identityServerUserName);
       $xfer += $output->writeFieldEnd();
     }
     if ($this->identityServerPasswordToken !== null) {
-      $xfer += $output->writeFieldBegin('identityServerPasswordToken', TType::STRING, 14);
+      $xfer += $output->writeFieldBegin('identityServerPasswordToken', TType::STRING, 15);
       $xfer += $output->writeString($this->identityServerPasswordToken);
       $xfer += $output->writeFieldEnd();
     }
     if ($this->declinedReason !== null) {
-      $xfer += $output->writeFieldBegin('declinedReason', TType::STRING, 15);
+      $xfer += $output->writeFieldBegin('declinedReason', TType::STRING, 16);
       $xfer += $output->writeString($this->declinedReason);
       $xfer += $output->writeFieldEnd();
     }
     if ($this->oauthClientId !== null) {
-      $xfer += $output->writeFieldBegin('oauthClientId', TType::STRING, 16);
+      $xfer += $output->writeFieldBegin('oauthClientId', TType::STRING, 17);
       $xfer += $output->writeString($this->oauthClientId);
       $xfer += $output->writeFieldEnd();
     }
     if ($this->oauthClientSecret !== null) {
-      $xfer += $output->writeFieldBegin('oauthClientSecret', TType::STRING, 17);
+      $xfer += $output->writeFieldBegin('oauthClientSecret', TType::STRING, 18);
       $xfer += $output->writeString($this->oauthClientSecret);
       $xfer += $output->writeFieldEnd();
     }
     if ($this->requestCreationTime !== null) {
-      $xfer += $output->writeFieldBegin('requestCreationTime', TType::I64, 18);
+      $xfer += $output->writeFieldBegin('requestCreationTime', TType::I64, 19);
       $xfer += $output->writeI64($this->requestCreationTime);
       $xfer += $output->writeFieldEnd();
     }
     if ($this->requesterUsername !== null) {
-      $xfer += $output->writeFieldBegin('requesterUsername', TType::STRING, 19);
+      $xfer += $output->writeFieldBegin('requesterUsername', TType::STRING, 20);
       $xfer += $output->writeString($this->requesterUsername);
       $xfer += $output->writeFieldEnd();
     }

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/3c17052f/app/libraries/Airavata/Service/Iam/Admin/Services/CPI/IamAdminServices.php
----------------------------------------------------------------------
diff --git a/app/libraries/Airavata/Service/Iam/Admin/Services/CPI/IamAdminServices.php b/app/libraries/Airavata/Service/Iam/Admin/Services/CPI/IamAdminServices.php
index a6cb9ff..bda8df7 100644
--- a/app/libraries/Airavata/Service/Iam/Admin/Services/CPI/IamAdminServices.php
+++ b/app/libraries/Airavata/Service/Iam/Admin/Services/CPI/IamAdminServices.php
@@ -73,6 +73,13 @@ interface IamAdminServicesIf {
    * @throws \Airavata\API\Error\AuthorizationException
    */
   public function findUsers(\Airavata\Model\Security\AuthzToken $authzToken, $gatewayID, $email, $userId, \Airavata\Model\Credential\Store\PasswordCredential $isRealmAdminCredentials);
+  /**
+   * @param \Airavata\Model\Security\AuthzToken $authzToken
+   * @param \Airavata\Model\User\UserProfile $userDetails
+   * @throws \Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException
+   * @throws \Airavata\API\Error\AuthorizationException
+   */
+  public function updateUserProfile(\Airavata\Model\Security\AuthzToken $authzToken, \Airavata\Model\User\UserProfile $userDetails);
 }
 
 class IamAdminServicesClient implements \Airavata\Service\Iam\Admin\Services\CPI\IamAdminServicesIf {
@@ -442,6 +449,61 @@ class IamAdminServicesClient implements \Airavata\Service\Iam\Admin\Services\CPI
     throw new \Exception("findUsers failed: unknown result");
   }
 
+  public function updateUserProfile(\Airavata\Model\Security\AuthzToken $authzToken, \Airavata\Model\User\UserProfile $userDetails)
+  {
+    $this->send_updateUserProfile($authzToken, $userDetails);
+    $this->recv_updateUserProfile();
+  }
+
+  public function send_updateUserProfile(\Airavata\Model\Security\AuthzToken $authzToken, \Airavata\Model\User\UserProfile $userDetails)
+  {
+    $args = new \Airavata\Service\Iam\Admin\Services\CPI\IamAdminServices_updateUserProfile_args();
+    $args->authzToken = $authzToken;
+    $args->userDetails = $userDetails;
+    $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');
+    if ($bin_accel)
+    {
+      thrift_protocol_write_binary($this->output_, 'updateUserProfile', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());
+    }
+    else
+    {
+      $this->output_->writeMessageBegin('updateUserProfile', TMessageType::CALL, $this->seqid_);
+      $args->write($this->output_);
+      $this->output_->writeMessageEnd();
+      $this->output_->getTransport()->flush();
+    }
+  }
+
+  public function recv_updateUserProfile()
+  {
+    $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');
+    if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\Airavata\Service\Iam\Admin\Services\CPI\IamAdminServices_updateUserProfile_result', $this->input_->isStrictRead());
+    else
+    {
+      $rseqid = 0;
+      $fname = null;
+      $mtype = 0;
+
+      $this->input_->readMessageBegin($fname, $mtype, $rseqid);
+      if ($mtype == TMessageType::EXCEPTION) {
+        $x = new TApplicationException();
+        $x->read($this->input_);
+        $this->input_->readMessageEnd();
+        throw $x;
+      }
+      $result = new \Airavata\Service\Iam\Admin\Services\CPI\IamAdminServices_updateUserProfile_result();
+      $result->read($this->input_);
+      $this->input_->readMessageEnd();
+    }
+    if ($result->Idse !== null) {
+      throw $result->Idse;
+    }
+    if ($result->ae !== null) {
+      throw $result->ae;
+    }
+    return;
+  }
+
 }
 
 // HELPER FUNCTIONS AND STRUCTURES
@@ -2066,4 +2128,214 @@ class IamAdminServices_findUsers_result {
 
 }
 
+class IamAdminServices_updateUserProfile_args {
+  static $_TSPEC;
+
+  /**
+   * @var \Airavata\Model\Security\AuthzToken
+   */
+  public $authzToken = null;
+  /**
+   * @var \Airavata\Model\User\UserProfile
+   */
+  public $userDetails = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        1 => array(
+          'var' => 'authzToken',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\Model\Security\AuthzToken',
+          ),
+        2 => array(
+          'var' => 'userDetails',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\Model\User\UserProfile',
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['authzToken'])) {
+        $this->authzToken = $vals['authzToken'];
+      }
+      if (isset($vals['userDetails'])) {
+        $this->userDetails = $vals['userDetails'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'IamAdminServices_updateUserProfile_args';
+  }
+
+  public function read($input)
+  {
+    $xfer = 0;
+    $fname = null;
+    $ftype = 0;
+    $fid = 0;
+    $xfer += $input->readStructBegin($fname);
+    while (true)
+    {
+      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
+      if ($ftype == TType::STOP) {
+        break;
+      }
+      switch ($fid)
+      {
+        case 1:
+          if ($ftype == TType::STRUCT) {
+            $this->authzToken = new \Airavata\Model\Security\AuthzToken();
+            $xfer += $this->authzToken->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 2:
+          if ($ftype == TType::STRUCT) {
+            $this->userDetails = new \Airavata\Model\User\UserProfile();
+            $xfer += $this->userDetails->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        default:
+          $xfer += $input->skip($ftype);
+          break;
+      }
+      $xfer += $input->readFieldEnd();
+    }
+    $xfer += $input->readStructEnd();
+    return $xfer;
+  }
+
+  public function write($output) {
+    $xfer = 0;
+    $xfer += $output->writeStructBegin('IamAdminServices_updateUserProfile_args');
+    if ($this->authzToken !== null) {
+      if (!is_object($this->authzToken)) {
+        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
+      }
+      $xfer += $output->writeFieldBegin('authzToken', TType::STRUCT, 1);
+      $xfer += $this->authzToken->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->userDetails !== null) {
+      if (!is_object($this->userDetails)) {
+        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
+      }
+      $xfer += $output->writeFieldBegin('userDetails', TType::STRUCT, 2);
+      $xfer += $this->userDetails->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
+class IamAdminServices_updateUserProfile_result {
+  static $_TSPEC;
+
+  /**
+   * @var \Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException
+   */
+  public $Idse = null;
+  /**
+   * @var \Airavata\API\Error\AuthorizationException
+   */
+  public $ae = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        1 => array(
+          'var' => 'Idse',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException',
+          ),
+        2 => array(
+          'var' => 'ae',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\API\Error\AuthorizationException',
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['Idse'])) {
+        $this->Idse = $vals['Idse'];
+      }
+      if (isset($vals['ae'])) {
+        $this->ae = $vals['ae'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'IamAdminServices_updateUserProfile_result';
+  }
+
+  public function read($input)
+  {
+    $xfer = 0;
+    $fname = null;
+    $ftype = 0;
+    $fid = 0;
+    $xfer += $input->readStructBegin($fname);
+    while (true)
+    {
+      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
+      if ($ftype == TType::STOP) {
+        break;
+      }
+      switch ($fid)
+      {
+        case 1:
+          if ($ftype == TType::STRUCT) {
+            $this->Idse = new \Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException();
+            $xfer += $this->Idse->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 2:
+          if ($ftype == TType::STRUCT) {
+            $this->ae = new \Airavata\API\Error\AuthorizationException();
+            $xfer += $this->ae->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        default:
+          $xfer += $input->skip($ftype);
+          break;
+      }
+      $xfer += $input->readFieldEnd();
+    }
+    $xfer += $input->readStructEnd();
+    return $xfer;
+  }
+
+  public function write($output) {
+    $xfer = 0;
+    $xfer += $output->writeStructBegin('IamAdminServices_updateUserProfile_result');
+    if ($this->Idse !== null) {
+      $xfer += $output->writeFieldBegin('Idse', TType::STRUCT, 1);
+      $xfer += $this->Idse->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->ae !== null) {
+      $xfer += $output->writeFieldBegin('ae', TType::STRUCT, 2);
+      $xfer += $this->ae->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
 

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/3c17052f/app/libraries/Airavata/Service/Profile/Tenant/CPI/Error/Types.php
----------------------------------------------------------------------
diff --git a/app/libraries/Airavata/Service/Profile/Tenant/CPI/Error/Types.php b/app/libraries/Airavata/Service/Profile/Tenant/CPI/Error/Types.php
new file mode 100644
index 0000000..796dbf6
--- /dev/null
+++ b/app/libraries/Airavata/Service/Profile/Tenant/CPI/Error/Types.php
@@ -0,0 +1,95 @@
+<?php
+namespace Airavata\Service\Profile\Tenant\CPI\Error;
+
+/**
+ * Autogenerated by Thrift Compiler (0.9.3)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ *  @generated
+ */
+use Thrift\Base\TBase;
+use Thrift\Type\TType;
+use Thrift\Type\TMessageType;
+use Thrift\Exception\TException;
+use Thrift\Exception\TProtocolException;
+use Thrift\Protocol\TProtocol;
+use Thrift\Protocol\TBinaryProtocolAccelerated;
+use Thrift\Exception\TApplicationException;
+
+
+class TenantProfileServiceException extends TException {
+  static $_TSPEC;
+
+  /**
+   * @var string
+   */
+  public $message = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        1 => array(
+          'var' => 'message',
+          'type' => TType::STRING,
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['message'])) {
+        $this->message = $vals['message'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'TenantProfileServiceException';
+  }
+
+  public function read($input)
+  {
+    $xfer = 0;
+    $fname = null;
+    $ftype = 0;
+    $fid = 0;
+    $xfer += $input->readStructBegin($fname);
+    while (true)
+    {
+      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
+      if ($ftype == TType::STOP) {
+        break;
+      }
+      switch ($fid)
+      {
+        case 1:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->message);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        default:
+          $xfer += $input->skip($ftype);
+          break;
+      }
+      $xfer += $input->readFieldEnd();
+    }
+    $xfer += $input->readStructEnd();
+    return $xfer;
+  }
+
+  public function write($output) {
+    $xfer = 0;
+    $xfer += $output->writeStructBegin('TenantProfileServiceException');
+    if ($this->message !== null) {
+      $xfer += $output->writeFieldBegin('message', TType::STRING, 1);
+      $xfer += $output->writeString($this->message);
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
+


[07/50] [abbrv] airavata-php-gateway git commit: AIRAVATA-2342 Add support for removing roles from user

Posted by ma...@apache.org.
AIRAVATA-2342 Add support for removing roles from user


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

Branch: refs/heads/develop
Commit: 68cfa16faa2e60d45874760f781c8f497820fa93
Parents: ee4e98a
Author: Marcus Christie <ma...@iu.edu>
Authored: Thu Mar 23 15:40:52 2017 -0400
Committer: Marcus Christie <ma...@iu.edu>
Committed: Thu Mar 23 15:40:52 2017 -0400

----------------------------------------------------------------------
 app/libraries/Keycloak/API/RoleMapper.php | 38 ++++++++++++++++++++++++++
 app/libraries/Keycloak/Keycloak.php       | 12 +++++++-
 2 files changed, 49 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/68cfa16f/app/libraries/Keycloak/API/RoleMapper.php
----------------------------------------------------------------------
diff --git a/app/libraries/Keycloak/API/RoleMapper.php b/app/libraries/Keycloak/API/RoleMapper.php
index 738012b..18a477b 100644
--- a/app/libraries/Keycloak/API/RoleMapper.php
+++ b/app/libraries/Keycloak/API/RoleMapper.php
@@ -56,6 +56,10 @@ class RoleMapper {
         return $result;
     }
 
+    /**
+     * Add realm-level role mappings for a user
+     * POST /admin/realms/{realm}/users/{user_id}/role-mappings/realm
+     */
     public function addRealmRoleMappingsToUser($realm, $user_id, $role_representations) {
 
         // get access token for admin API
@@ -85,6 +89,40 @@ class RoleMapper {
         return;
     }
 
+    /*
+     * Delete realm-level role mappings for a user
+     * DELETE /admin/realms/{realm}/users/{user_id}/role-mappings/realm
+     */
+    public function deleteRealmRoleMappingsToUser($realm, $user_id, $role_representations) {
+
+        // get access token for admin API
+        $access_token = $this->getAPIAccessToken();
+        $url = $this->base_endpoint_url . '/admin/realms/' . rawurlencode($realm) . '/users/' . rawurlencode($user_id) . '/role-mappings/realm';
+        // Log::debug("deleteRealmRoleMappingsToUser", array($url, $role_representations));
+        $r = curl_init($url);
+        curl_setopt($r, CURLOPT_RETURNTRANSFER, 1);
+        curl_setopt($r, CURLOPT_ENCODING, 1);
+        curl_setopt($r, CURLOPT_SSL_VERIFYPEER, $this->verify_peer);
+
+        curl_setopt($r, CURLOPT_CUSTOMREQUEST, "DELETE");
+        curl_setopt($r, CURLOPT_POST, true);
+        $data = json_encode($role_representations);
+        // Log::debug("deleteRealmRoleMappingsToUser data=$data");
+        curl_setopt($r, CURLOPT_HTTPHEADER, array(
+            "Authorization: Bearer " . $access_token,
+            'Content-Type: application/json',
+            'Content-Length: ' . strlen($data))
+        );
+        curl_setopt($r, CURLOPT_POSTFIELDS, $data);
+
+        $response = curl_exec($r);
+        $info = curl_getinfo($r);
+        if ($info['http_code'] != 200 && $info['http_code'] != 204) {
+            throw new Exception("Failed to delete realm role mapping to user");
+        }
+        return;
+    }
+
     // TODO: factor this out into base class?
     private function getAPIAccessToken() {
 

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/68cfa16f/app/libraries/Keycloak/Keycloak.php
----------------------------------------------------------------------
diff --git a/app/libraries/Keycloak/Keycloak.php b/app/libraries/Keycloak/Keycloak.php
index 5dc57d4..a6d618b 100644
--- a/app/libraries/Keycloak/Keycloak.php
+++ b/app/libraries/Keycloak/Keycloak.php
@@ -188,7 +188,7 @@ class Keycloak {
      * @return void
      */
     public function updateUserRoles( $user_id, $roles){
-        Log::debug("updateUserRoles", array($user_id, $roles));
+        // Log::debug("updateUserRoles", array($user_id, $roles));
         try {
             // Get all of the roles into an array keyed by role name
             $all_roles = $this->roles->getRoles($this->realm);
@@ -196,6 +196,16 @@ class Keycloak {
             foreach ($all_roles as $role) {
                 $roles_by_name[$role->name] = $role;
             }
+
+            // Process the role deletions
+            if(isset($roles["deleted"])){
+                if(!is_array($roles["deleted"]))
+                    $roles["deleted"] = array($roles["deleted"]);
+                foreach ($roles["deleted"] as $role) {
+                    $this->role_mapper->deleteRealmRoleMappingsToUser($this->realm, $user_id, array($roles_by_name[$role]));
+                }
+            }
+
             // Process the role additions
             if(isset($roles["new"])){
                 if(!is_array($roles["new"]))


[23/50] [abbrv] airavata-php-gateway git commit: AIRAVATA-2342 Keycloak: adding ca cert

Posted by ma...@apache.org.
AIRAVATA-2342 Keycloak: adding ca cert


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

Branch: refs/heads/develop
Commit: ec006aad067c9715acbf588a8656b1ff2e079675
Parents: e9f3b24
Author: Marcus Christie <ma...@iu.edu>
Authored: Fri Apr 28 16:05:29 2017 -0400
Committer: Marcus Christie <ma...@iu.edu>
Committed: Fri Apr 28 16:05:29 2017 -0400

----------------------------------------------------------------------
 app/config/pga_config.php.template                 | 16 +++-------------
 app/libraries/Keycloak/Keycloak.php                |  9 ++++++++-
 app/libraries/Keycloak/KeycloakServiceProvider.php |  1 +
 3 files changed, 12 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/ec006aad/app/config/pga_config.php.template
----------------------------------------------------------------------
diff --git a/app/config/pga_config.php.template b/app/config/pga_config.php.template
index 782b6d3..e225cf0 100644
--- a/app/config/pga_config.php.template
+++ b/app/config/pga_config.php.template
@@ -59,7 +59,7 @@ return array(
         /**
          * OAuth Grant Type (password or authorization_code)
          */
-        'oauth-grant-type' => 'authorization_code',
+        'oauth-grant-type' => 'password',
 
         /**
          * OAuth call back url (only if the grant type is authorization_code)
@@ -69,17 +69,12 @@ return array(
         /**
          * For OIDC servers that support the discovery protocol.
          */
-        'openid-connect-discovery-url' => 'https://some.identity.provider.org/.well-known/openid-configuration',
-
-        /**
-         * Identity server domain
-         */
-        'server' => 'idp.scigap.org',
+        'openid-connect-discovery-url' => 'https://iam.scigap.org/auth/realms/_MY_REALM_/.well-known/openid-configuration',
 
         /**
          * Identity server url
          */
-        'service-url' => 'https://idp.scigap.org:9443/',
+        'service-url' => 'https://iam.scigap.org/auth',
 
         /**
          * Enable HTTPS server verification
@@ -90,11 +85,6 @@ return array(
          * Path to the server certificate file
          */
         'cafile-path' => app_path() . '/resources/security/idp_scigap_org.pem',
-
-        /**
-         * Allow self signed server certificates
-         */
-        'allow-self-signed-cert' => false
     ],
 
 

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/ec006aad/app/libraries/Keycloak/Keycloak.php
----------------------------------------------------------------------
diff --git a/app/libraries/Keycloak/Keycloak.php b/app/libraries/Keycloak/Keycloak.php
index 71706e5..a33b245 100644
--- a/app/libraries/Keycloak/Keycloak.php
+++ b/app/libraries/Keycloak/Keycloak.php
@@ -18,6 +18,7 @@ class Keycloak {
     private $client_id;
     private $client_secret;
     private $callback_url;
+    private $cafile_path;
     private $verify_peer;
 
     // API clients
@@ -29,13 +30,14 @@ class Keycloak {
      * Constructor
      *
      */
-    public function __construct($realm, $openid_connect_discovery_url, $client_id, $client_secret, $callback_url, $verify_peer, $base_endpoint_url, $admin_username, $admin_password) {
+    public function __construct($realm, $openid_connect_discovery_url, $client_id, $client_secret, $callback_url, $cafile_path, $verify_peer, $base_endpoint_url, $admin_username, $admin_password) {
 
         $this->realm = $realm;
         $this->openid_connect_discovery_url = $openid_connect_discovery_url;
         $this->client_id = $client_id;
         $this->client_secret = $client_secret;
         $this->callback_url = $callback_url;
+        $this->cafile_path = $cafile_path;
         $this->verify_peer = $verify_peer;
 
         $this->role_mapper = new RoleMapper($base_endpoint_url, $admin_username, $admin_password, $verify_peer);
@@ -62,6 +64,7 @@ class Keycloak {
         // Decode compressed responses.
         curl_setopt($r, CURLOPT_ENCODING, 1);
         curl_setopt($r, CURLOPT_SSL_VERIFYPEER, $this->verify_peer);
+        curl_setopt($r, CURLOPT_CAINFO, $this->cafile_path);
 
         // Add client ID and client secret to the headers.
         curl_setopt($r, CURLOPT_HTTPHEADER, array(
@@ -110,6 +113,7 @@ class Keycloak {
         // Decode compressed responses.
         curl_setopt($r, CURLOPT_ENCODING, 1);
         curl_setopt($r, CURLOPT_SSL_VERIFYPEER, $this->verify_peer);
+        curl_setopt($r, CURLOPT_CAINFO, $this->cafile_path);
 
         // Add client ID and client secret to the headers.
         curl_setopt($r, CURLOPT_HTTPHEADER, array(
@@ -145,6 +149,7 @@ class Keycloak {
         // Decode compressed responses.
         curl_setopt($r, CURLOPT_ENCODING, 1);
         curl_setopt($r, CURLOPT_SSL_VERIFYPEER, $this->verify_peer);
+        curl_setopt($r, CURLOPT_CAINFO, $this->cafile_path);
         curl_setopt($r, CURLOPT_HTTPHEADER, array(
             "Authorization: Bearer " . $token
         ));
@@ -187,6 +192,7 @@ class Keycloak {
         // Decode compressed responses.
         curl_setopt($r, CURLOPT_ENCODING, 1);
         curl_setopt($r, CURLOPT_SSL_VERIFYPEER, $this->verify_peer);
+        curl_setopt($r, CURLOPT_CAINFO, $this->cafile_path);
 
         // Add client ID and client secret to the headers.
         curl_setopt($r, CURLOPT_HTTPHEADER, array(
@@ -390,6 +396,7 @@ class Keycloak {
         // Decode compressed responses.
         curl_setopt($r, CURLOPT_ENCODING, 1);
         curl_setopt($r, CURLOPT_SSL_VERIFYPEER, $this->verify_peer);
+        curl_setopt($r, CURLOPT_CAINFO, $this->cafile_path);
 
         $result = curl_exec($r);
         if ($result == false) {

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/ec006aad/app/libraries/Keycloak/KeycloakServiceProvider.php
----------------------------------------------------------------------
diff --git a/app/libraries/Keycloak/KeycloakServiceProvider.php b/app/libraries/Keycloak/KeycloakServiceProvider.php
index 1992972..530d446 100644
--- a/app/libraries/Keycloak/KeycloakServiceProvider.php
+++ b/app/libraries/Keycloak/KeycloakServiceProvider.php
@@ -40,6 +40,7 @@ class KeycloakServiceProvider extends ServiceProvider {
                 $identityServerConfig['oauth-client-key'],
                 $identityServerConfig['oauth-client-secret'],
                 $identityServerConfig['oauth-callback-url'],
+                $identityServerConfig['cafile-path'],
                 $identityServerConfig['verify-peer'],
                 $identityServerConfig['service-url'],
                 $identityServerConfig['admin-username'],


[10/50] [abbrv] airavata-php-gateway git commit: merging the remote branch

Posted by ma...@apache.org.
merging the remote branch


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

Branch: refs/heads/develop
Commit: f55323c47dfc4f2838a54e9114e5a802d051fc0a
Parents: 1c6c44d dd00dd4
Author: scnakandala <su...@gmail.com>
Authored: Fri Mar 24 10:20:12 2017 -0400
Committer: scnakandala <su...@gmail.com>
Committed: Fri Mar 24 10:20:12 2017 -0400

----------------------------------------------------------------------
 app/controllers/AccountController.php     |  9 +++--
 app/controllers/AdminController.php       |  7 ++--
 app/libraries/Keycloak/API/RoleMapper.php | 54 +++++++++++++++++++++-----
 app/libraries/Keycloak/API/Users.php      | 30 +++++++++++++-
 app/libraries/Keycloak/Keycloak.php       | 25 +++++++++++-
 app/libraries/SharingUtilities.php        |  2 +-
 6 files changed, 107 insertions(+), 20 deletions(-)
----------------------------------------------------------------------



[14/50] [abbrv] airavata-php-gateway git commit: fixing minor issue in usernameExists

Posted by ma...@apache.org.
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/9a9e450c
Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/9a9e450c
Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/9a9e450c

Branch: refs/heads/develop
Commit: 9a9e450c0f46f1994d38ce8c0f8ebbdbca972d64
Parents: 501460f
Author: scnakandala <su...@gmail.com>
Authored: Fri Mar 24 13:21:59 2017 -0400
Committer: scnakandala <su...@gmail.com>
Committed: Fri Mar 24 13:21:59 2017 -0400

----------------------------------------------------------------------
 app/libraries/Keycloak/Keycloak.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/9a9e450c/app/libraries/Keycloak/Keycloak.php
----------------------------------------------------------------------
diff --git a/app/libraries/Keycloak/Keycloak.php b/app/libraries/Keycloak/Keycloak.php
index aeac3ad..3f12593 100644
--- a/app/libraries/Keycloak/Keycloak.php
+++ b/app/libraries/Keycloak/Keycloak.php
@@ -240,7 +240,7 @@ class Keycloak {
     public function usernameExists($user_id){
         try{
             $users = $this->users->getUsers($this->realm, $user_id);
-            return $users != null && len($users) > 0;
+            return $users != null && count($users) > 0;
         }catch (Exception $ex){
             // Username does not exists
             return false;


[04/50] [abbrv] airavata-php-gateway git commit: AIRAVATA-2342 Retrieves user's realm roles using Keycloak API

Posted by ma...@apache.org.
AIRAVATA-2342 Retrieves user's realm roles using Keycloak API


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

Branch: refs/heads/develop
Commit: c92cc2b9b8d583889c8875e429850c94ee2c348d
Parents: 8b483be
Author: Marcus Christie <ma...@iu.edu>
Authored: Thu Mar 23 09:59:45 2017 -0400
Committer: Marcus Christie <ma...@iu.edu>
Committed: Thu Mar 23 09:59:45 2017 -0400

----------------------------------------------------------------------
 app/controllers/AccountController.php           |  1 +
 app/filters.php                                 | 33 ++++----
 app/libraries/Keycloak/API/RoleMapper.php       | 83 ++++++++++++++++++++
 app/libraries/Keycloak/Keycloak.php             | 23 +++++-
 .../Keycloak/KeycloakServiceProvider.php        | 62 ++++++++-------
 5 files changed, 154 insertions(+), 48 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/c92cc2b9/app/controllers/AccountController.php
----------------------------------------------------------------------
diff --git a/app/controllers/AccountController.php b/app/controllers/AccountController.php
index e98db86..1f69fcf 100644
--- a/app/controllers/AccountController.php
+++ b/app/controllers/AccountController.php
@@ -187,6 +187,7 @@ class AccountController extends BaseController
         $expirationTime = time() + $response->expires_in - 5; //5 seconds safe margin
 
         $userProfile = Keycloak::getUserProfileFromOAuthToken($accessToken);
+        Log::debug("userProfile", array($userProfile));
         $username = $userProfile['username'];
 
         $userRoles = $userProfile['roles'];

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/c92cc2b9/app/filters.php
----------------------------------------------------------------------
diff --git a/app/filters.php b/app/filters.php
index 4dc9f38..a7d492a 100755
--- a/app/filters.php
+++ b/app/filters.php
@@ -20,22 +20,23 @@ App::before(function ($request) {
     if(Session::has('authz-token')){
         $currentTime = time();
         if($currentTime > Session::get('oauth-expiration-time')){
-            $response = WSIS::getRefreshedOAutheToken(Session::get('oauth-refresh-code'));
-            if(isset($response->access_token)){
-                $accessToken = $response->access_token;
-                $refreshToken = $response->refresh_token;
-                $expirationTime = time() + $response->expires_in - 300;
-                $authzToken = Session::get('authz-token');
-                $authzToken->accessToken = $accessToken;
-                $authzToken->claimsMap['gatewayID'] = Config::get('pga_config.airavata')['gateway-id'];
-                $authzToken->claimsMap['userName'] = Session::get('username');
-                Session::put('authz-token',$authzToken);
-                Session::put('oauth-refresh-code',$refreshToken);
-                Session::put('oauth-expiration-time',$expirationTime);
-            }else{
-                Session::flush();
-                return Redirect::to('home');
-            }
+            // TODO: implement for Keycloak
+            // $response = WSIS::getRefreshedOAutheToken(Session::get('oauth-refresh-code'));
+            // if(isset($response->access_token)){
+            //     $accessToken = $response->access_token;
+            //     $refreshToken = $response->refresh_token;
+            //     $expirationTime = time() + $response->expires_in - 300;
+            //     $authzToken = Session::get('authz-token');
+            //     $authzToken->accessToken = $accessToken;
+            //     $authzToken->claimsMap['gatewayID'] = Config::get('pga_config.airavata')['gateway-id'];
+            //     $authzToken->claimsMap['userName'] = Session::get('username');
+            //     Session::put('authz-token',$authzToken);
+            //     Session::put('oauth-refresh-code',$refreshToken);
+            //     Session::put('oauth-expiration-time',$expirationTime);
+            // }else{
+            //     Session::flush();
+            //     return Redirect::to('home');
+            // }
         }
     }
 });

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/c92cc2b9/app/libraries/Keycloak/API/RoleMapper.php
----------------------------------------------------------------------
diff --git a/app/libraries/Keycloak/API/RoleMapper.php b/app/libraries/Keycloak/API/RoleMapper.php
new file mode 100644
index 0000000..2e6d170
--- /dev/null
+++ b/app/libraries/Keycloak/API/RoleMapper.php
@@ -0,0 +1,83 @@
+<?php
+namespace Keycloak\API;
+
+use Log;
+
+/**
+ * RoleMapper class
+ *
+ * This class provide an easy to use interface for
+ * the Keycloak RoleMapper REST API.
+ */
+class RoleMapper {
+
+    private $base_endpoint_url;
+    private $admin_username;
+    private $admin_password;
+    private $verify_peer;
+
+    public function __construct($base_endpoint_url, $admin_username, $admin_password, $verify_peer) {
+        $this->base_endpoint_url = $base_endpoint_url;
+        $this->admin_username = $admin_username;
+        $this->admin_password = $admin_password;
+        $this->verify_peer = $verify_peer;
+    }
+
+    /**
+     * Get realm-level role mappings for a user
+     * GET /admin/realms/{realm}/users/{id}/role-mappings/realm
+     *
+     * Returns Array of RoleRepresentations
+     */
+    public function getRealmRoleMappingsForUser($realm, $user_id){
+
+        // curl -H "Authorization: bearer $access_token" https://149.165.156.62:8443/auth/admin/realms/airavata/users/2c9ad2c6-0212-4aef-a5fb-9df862578934/role-mappings/realm
+
+        // get access token for admin API
+        $access_token = $this->getAPIAccessToken();
+        $r = curl_init($this->base_endpoint_url . '/admin/realms/' . rawurlencode($realm) . '/users/' . rawurlencode($user_id) . '/role-mappings/realm');
+        curl_setopt($r, CURLOPT_RETURNTRANSFER, 1);
+        curl_setopt($r, CURLOPT_ENCODING, 1);
+        curl_setopt($r, CURLOPT_SSL_VERIFYPEER, $this->verify_peer);
+        curl_setopt($r, CURLOPT_HTTPHEADER, array(
+            "Authorization: Bearer " . $access_token
+        ));
+
+        $response = curl_exec($r);
+        if ($response == false) {
+            die("curl_exec() failed. Error: " . curl_error($r));
+        }
+        $result = json_decode($response);
+        // Log::debug("getRealmRoleMappingsForUser result", array($result));
+        return $result;
+    }
+
+    // TODO: factor this out into base class?
+    private function getAPIAccessToken() {
+
+        // http://www.keycloak.org/docs/2.5/server_development/topics/admin-rest-api.html
+        // curl -d client_id=admin-cli -d username=username \
+        //   -d "password=password" -d grant_type=password https://149.165.156.62:8443/auth/realms/master/protocol/openid-connect/token
+
+        $r = curl_init($this->base_endpoint_url . '/realms/master/protocol/openid-connect/token');
+        curl_setopt($r, CURLOPT_RETURNTRANSFER, 1);
+        curl_setopt($r, CURLOPT_ENCODING, 1);
+        curl_setopt($r, CURLOPT_SSL_VERIFYPEER, $this->verify_peer);
+
+        // Assemble POST parameters for the request.
+        $post_fields = "client_id=admin-cli&username=" . urlencode($this->admin_username) . "&password=" . urlencode($this->admin_password) . "&grant_type=password";
+
+        // Obtain and return the access token from the response.
+        curl_setopt($r, CURLOPT_POST, true);
+        curl_setopt($r, CURLOPT_POSTFIELDS, $post_fields);
+
+        $response = curl_exec($r);
+        if ($response == false) {
+            die("curl_exec() failed. Error: " . curl_error($r));
+        }
+
+        $result = json_decode($response);
+        // Log::debug("API Access Token result", array($result));
+        return $result->access_token;
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/c92cc2b9/app/libraries/Keycloak/Keycloak.php
----------------------------------------------------------------------
diff --git a/app/libraries/Keycloak/Keycloak.php b/app/libraries/Keycloak/Keycloak.php
index c1c6f33..93ac99d 100644
--- a/app/libraries/Keycloak/Keycloak.php
+++ b/app/libraries/Keycloak/Keycloak.php
@@ -2,29 +2,37 @@
 
 namespace Keycloak;
 
+use Keycloak\API\RoleMapper;
+
 use Log;
 use Illuminate\Routing\UrlGenerator;
 use Illuminate\Support\Facades\Config;
 
 class Keycloak {
 
+    private $realm;
     private $openid_connect_discovery_url;
     private $client_id;
     private $client_secret;
     private $callback_url;
     private $verify_peer;
 
+    private $role_mapper;
+
     /**
      * Constructor
      *
      */
-    public function __construct($openid_connect_discovery_url, $client_id, $client_secret, $callback_url, $verify_peer) {
+    public function __construct($realm, $openid_connect_discovery_url, $client_id, $client_secret, $callback_url, $verify_peer, $base_endpoint_url, $admin_username, $admin_password) {
 
+        $this->realm = $realm;
         $this->openid_connect_discovery_url = $openid_connect_discovery_url;
         $this->client_id = $client_id;
         $this->client_secret = $client_secret;
         $this->callback_url = $callback_url;
         $this->verify_peer = $verify_peer;
+
+        $this->role_mapper = new RoleMapper($base_endpoint_url, $admin_username, $admin_password, $verify_peer);
     }
 
     public function getOAuthRequestCodeUrl(){
@@ -100,8 +108,14 @@ class Keycloak {
         $firstname = $userinfo->given_name;
         $lastname = $userinfo->family_name;
         $email = $userinfo->email;
-        // TODO: get roles from Keycloak API
-        return array('username'=>$username, 'firstname'=>$firstname, 'lastname'=>$lastname, 'email'=>$email, 'roles'=>array());
+
+        // get roles from Keycloak API
+        $role_mappings = $this->role_mapper->getRealmRoleMappingsForUser($this->realm, $userinfo->sub);
+        $roles = [];
+        foreach ($role_mappings as $role_mapping) {
+            $roles[] = $role_mapping->name;
+        }
+        return array('username'=>$username, 'firstname'=>$firstname, 'lastname'=>$lastname, 'email'=>$email, 'roles'=>$roles);
     }
 
     private function getOpenIDConnectDiscoveryConfiguration() {
@@ -114,6 +128,9 @@ class Keycloak {
         curl_setopt($r, CURLOPT_SSL_VERIFYPEER, $this->verify_peer);
 
         $result = curl_exec($r);
+        if ($result == false) {
+            die("curl_exec() failed. Error: " . curl_error($r));
+        }
 
         $json = json_decode($result);
 

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/c92cc2b9/app/libraries/Keycloak/KeycloakServiceProvider.php
----------------------------------------------------------------------
diff --git a/app/libraries/Keycloak/KeycloakServiceProvider.php b/app/libraries/Keycloak/KeycloakServiceProvider.php
index b7e033c..b8bfcbb 100644
--- a/app/libraries/Keycloak/KeycloakServiceProvider.php
+++ b/app/libraries/Keycloak/KeycloakServiceProvider.php
@@ -5,40 +5,44 @@ use Illuminate\Support\Facades\Config;
 
 class KeycloakServiceProvider extends ServiceProvider {
 
-	/**
-	 * Indicates if loading of the provider is deferred.
-	 *
-	 * @var bool
-	 */
-	protected $defer = false;
+    /**
+    * Indicates if loading of the provider is deferred.
+    *
+    * @var bool
+    */
+    protected $defer = false;
 
     /**
-     * Bootstrap the application events.
-     *
-     * @return void
-     */
+    * Bootstrap the application events.
+    *
+    * @return void
+    */
     public function boot()
     {
         $this->package('keycloak/keycloak');
     }
 
-	/**
-	 * Register the service provider.
-	 *
-	 * @return void
-	 */
-	public function register()
-	{
+    /**
+    * Register the service provider.
+    *
+    * @return void
+    */
+    public function register()
+    {
         //registering service provider
         $this->app['keycloak'] = $this->app->share(function($app)
         {
             $identityServerConfig = Config::get('pga_config.wsis');
             return new Keycloak(
+                $identityServerConfig['tenant-domain'],
                 $identityServerConfig['openid-connect-discovery-url'],
                 $identityServerConfig['oauth-client-key'],
                 $identityServerConfig['oauth-client-secret'],
                 $identityServerConfig['oauth-callback-url'],
-                $identityServerConfig['verify-peer']
+                $identityServerConfig['verify-peer'],
+                $identityServerConfig['service-url'],
+                $identityServerConfig['admin-username'],
+                $identityServerConfig['admin-password']
             );
         });
 
@@ -48,16 +52,16 @@ class KeycloakServiceProvider extends ServiceProvider {
             $loader = \Illuminate\Foundation\AliasLoader::getInstance();
             $loader->alias('Keycloak', 'Keycloak\Facades\Keycloak');
         });
-	}
-
-	/**
-	 * Get the services provided by the provider.
-	 *
-	 * @return array
-	 */
-	public function provides()
-	{
-		return array('wsis');
-	}
+    }
+
+    /**
+    * Get the services provided by the provider.
+    *
+    * @return array
+    */
+    public function provides()
+    {
+        return array('keycloak');
+    }
 
 }


[17/50] [abbrv] airavata-php-gateway git commit: AIRAVATA-2342 Reverting to using username in API

Posted by ma...@apache.org.
AIRAVATA-2342 Reverting to using username in API

One difference between the Keycloak API and the WSO2 IS API is that
where WSO2 IS expects the username, Keycloak expects the Keycloak user
id.  This made for a mismatch in how to call the facade for WSO2 IS and
Keycloak.  However, now that I have a way to get the user id from the
username, I was able to revert some changes earlier so that now WSO2 IS
and Keycloak facades support the same methods.


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

Branch: refs/heads/develop
Commit: f065beeb7f84db9347fe3afdd7d0cac84b5f9e15
Parents: e4c524e
Author: Marcus Christie <ma...@iu.edu>
Authored: Sat Mar 25 13:36:45 2017 -0400
Committer: Marcus Christie <ma...@iu.edu>
Committed: Sat Mar 25 13:36:45 2017 -0400

----------------------------------------------------------------------
 app/controllers/AdminController.php    | 25 +++++++++---------
 app/libraries/Keycloak/Keycloak.php    | 40 +++++++++++++++++++++--------
 app/views/admin/manage-users.blade.php | 24 ++++++++---------
 3 files changed, 51 insertions(+), 38 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/f065beeb/app/controllers/AdminController.php
----------------------------------------------------------------------
diff --git a/app/controllers/AdminController.php b/app/controllers/AdminController.php
index 46caa9a..f52de91 100644
--- a/app/controllers/AdminController.php
+++ b/app/controllers/AdminController.php
@@ -152,7 +152,6 @@ class AdminController extends BaseController {
 		//check if username exists
 		if(Keycloak::usernameExists( Input::get("username")) )
 		{
-			// FIXME: this requires the user id not the username
             Keycloak::updateUserRoles(Input::get("username"), array( "new"=>array( Config::get('wsis::admin-role-name')), "deleted"=>array() ) );
 			return Redirect::to("admin/dashboard/users?role=" . Config::get('wsis::admin-role-name'))->with("Gateway Admin has been added.");
 		}
@@ -212,7 +211,7 @@ class AdminController extends BaseController {
 	}
 
     public function addRolesToUser(){
-        $currentRoles = Keycloak::getUserRoles(Input::get("userId"));
+        $currentRoles = Keycloak::getUserRoles(Input::get("username"));
 		if(!is_array($currentRoles))
 			$currentRoles = array($currentRoles);
         $roles["new"] = array_diff(Input::all()["roles"], $currentRoles);
@@ -228,14 +227,14 @@ class AdminController extends BaseController {
             unset($roles["deleted"][$index]);
         }
 
-        $userId = Input::all()["userId"];
-        Keycloak::updateUserRoles($userId, $roles);
-        $newCurrentRoles = Keycloak::getUserRoles($userId);
+        $username = Input::all()["username"];
+        Keycloak::updateUserRoles($username, $roles);
+        $newCurrentRoles = Keycloak::getUserRoles($username);
         if(in_array(Config::get("pga_config.wsis")["admin-role-name"], $newCurrentRoles) || in_array(Config::get("pga_config.wsis")["read-only-admin-role-name"], $newCurrentRoles)
                 || in_array(Config::get("pga_config.wsis")["user-role-name"], $newCurrentRoles)){
-            $userProfile = Keycloak::getUserProfile(Input::get("username"));
+            $userProfile = Keycloak::getUserProfile($username);
             $recipients = array($userProfile["email"]);
-            $this->sendAccessGrantedEmailToTheUser(Input::get("username"), $userId, $recipients);
+            $this->sendAccessGrantedEmailToTheUser(Input::get("username"), $recipients);
 
             // remove the initial role when the initial role isn't a privileged
             // role and the admin has now assigned the user to a privileged
@@ -247,12 +246,12 @@ class AdminController extends BaseController {
                 if(in_array($initialRoleName, $newCurrentRoles) && !in_array($initialRoleName, $roles["new"])) {
                     $userRoles["new"] = array();
                     $userRoles["deleted"] = $initialRoleName;
-                    Keycloak::updateUserRoles( $userId, $userRoles);
+                    Keycloak::updateUserRoles( $username, $userRoles);
                 } else if(in_array($initialRoleName, $newCurrentRoles) && in_array($initialRoleName, $roles["new"])) {
                     // When initial role added remove all roles except for initial role and Internal/everyone
                     $userRoles["new"] = array();
                     $userRoles["deleted"] = array_diff($newCurrentRoles, array($initialRoleName, "Internal/everyone"));
-                    Keycloak::updateUserRoles( $userId, $userRoles);
+                    Keycloak::updateUserRoles( $username, $userRoles);
                 }
             }
         }
@@ -278,13 +277,13 @@ class AdminController extends BaseController {
     public function removeRoleFromUser(){
         $roles["deleted"] = array(Input::all()["roleName"]);
         $roles["new"] = array();
-        $userId = Input::all()["userId"];
-        Keycloak::updateUserRoles($userId, $roles);
+        $username = Input::all()["username"];
+        Keycloak::updateUserRoles($username, $roles);
         return Redirect::to("admin/dashboard/roles")->with( "message", "Role has been deleted.");
     }
 
 	public function getRoles(){
-		return json_encode((array)Keycloak::getUserRoles(Input::get("userId")));
+		return json_encode((array)Keycloak::getUserRoles(Input::get("username")));
 	}
 
 	public function deleteRole(){
@@ -301,7 +300,7 @@ class AdminController extends BaseController {
 		return View::make("admin/manage-credentials", array("tokens" => $tokens , "pwdTokens" => $pwdTokens) );
 	}
 
-	private function sendAccessGrantedEmailToTheUser($username, $userId, $recipients){
+	private function sendAccessGrantedEmailToTheUser($username, $recipients){
 
 		$mail = new PHPMailer;
 

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/f065beeb/app/libraries/Keycloak/Keycloak.php
----------------------------------------------------------------------
diff --git a/app/libraries/Keycloak/Keycloak.php b/app/libraries/Keycloak/Keycloak.php
index fd2e437..446b7ad 100644
--- a/app/libraries/Keycloak/Keycloak.php
+++ b/app/libraries/Keycloak/Keycloak.php
@@ -129,15 +129,15 @@ class Keycloak {
     /**
      * Function to list users
      *
-     * @return Array of username and user id
+     * @return Array of usernames
      */
     public function listUsers(){
         $users = $this->users->getUsers($this->realm);
-        $user_infos = [];
+        $usernames = [];
         foreach ($users as $user) {
-            $user_infos[] = array("username" => $user->username, "id" => $user->id);
+            $usernames[] = $user->username;
         }
-        return $user_infos;
+        return $usernames;
     }
 
     /**
@@ -165,10 +165,12 @@ class Keycloak {
      *
      * @return array of role names
      */
-    public function getUserRoles( $userid ){
+    public function getUserRoles( $username ){
         try {
+            // get userid from username
+            $user_id = $this->getUserId($username);
             // Get the user's realm roles, then convert to an array of just names
-            $roles = $this->role_mapper->getRealmRoleMappingsForUser($this->realm, $userid);
+            $roles = $this->role_mapper->getRealmRoleMappingsForUser($this->realm, $user_id);
             $role_names = [];
             foreach ($roles as $role) {
                 $role_names[] = $role->name;
@@ -182,14 +184,16 @@ class Keycloak {
     /**
      * Function to update role list of user
      *
-     * @param $user_id
+     * @param $username
      * @param $roles, an Array with two entries, "deleted" and "new", each of
      * which has a value of roles to be removed or added respectively
      * @return void
      */
-    public function updateUserRoles( $user_id, $roles){
+    public function updateUserRoles( $username, $roles){
         // Log::debug("updateUserRoles", array($user_id, $roles));
         try {
+            // get userid from username
+            $user_id = $this->getUserId($username);
             // Get all of the roles into an array keyed by role name
             $all_roles = $this->roles->getRoles($this->realm);
             $roles_by_name = [];
@@ -240,12 +244,12 @@ class Keycloak {
 
     /**
      * Function to check whether a user exists with the given userId
-     * @param $user_id
+     * @param $username
      * @return bool
      */
-    public function usernameExists($user_id){
+    public function usernameExists($username){
         try{
-            $users = $this->users->getUsers($this->realm, $user_id);
+            $users = $this->users->getUsers($this->realm, $username);
             return $users != null && count($users) > 0;
         }catch (Exception $ex){
             // Username does not exists
@@ -253,6 +257,20 @@ class Keycloak {
         }
     }
 
+    /**
+     * Get the user's Keycloak user_id from their username
+     */
+    private function getUserId($username) {
+        $users = $this->users->getUsers($this->realm, $username);
+        if (count($users) > 1) {
+            throw new Exception("More than one user has username $username");
+        } else if (count($users) == 0) {
+            throw new Exception("No user found with username $username");
+        } else {
+            return $users[0]->id;
+        }
+    }
+
     private function getOpenIDConnectDiscoveryConfiguration() {
 
         // TODO: cache the result of the request

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/f065beeb/app/views/admin/manage-users.blade.php
----------------------------------------------------------------------
diff --git a/app/views/admin/manage-users.blade.php b/app/views/admin/manage-users.blade.php
index 15818ae..9f36ca8 100644
--- a/app/views/admin/manage-users.blade.php
+++ b/app/views/admin/manage-users.blade.php
@@ -68,10 +68,10 @@
                     </tr>
                     @foreach( (array)$users as $user)
                     <tr class="user-row">
-                        <td>{{ $user["username"] }}</td>
+                        <td>{{ $user }}</td>
                         <td>
                             <button class="button btn btn-default check-roles" type="button"
-                                    data-username="{{$user["username"]}}" data-userid="{{$user["id"]}}">Check All Roles
+                                    data-username="{{$user}}">Check All Roles
                             </button>
                             <div class="user-roles"></div>
                         </td>
@@ -113,7 +113,7 @@
                                 @endif
                             @endforeach
                         </select>
-                        <button type="button" class="btn btn-primary add-roles-submit" data-username="" data-userid="">Add Roles
+                        <button type="button" class="btn btn-primary add-roles-submit" data-username="">Add Roles
                         </button>
                     </div>
                 </div>
@@ -161,12 +161,12 @@
                 type: "POST",
                 url: $(".base-url").val() + "/admin/remove-role-from-user",
                 data: {
-                    userId: userId,
+                    username: userName,
                     roleName:$(this).attr("roleName")
                 }
             }).complete(function (data) {
                 //getting user's existing roles
-                repopulatePopup( userName, userId );
+                repopulatePopup( userName);
                 $(".success-message").html("<span class='alert alert-success col-md-12'>Role has been removed</span>");
             });
         }
@@ -174,8 +174,7 @@
 
     function update_users_existing_roles(that){
         userName = $(that).data("username");
-        userId = $(that).data("userid");
-        repopulatePopup( userName, userId );
+        repopulatePopup( userName);
     }
 
     $(".check-roles").click(function () {
@@ -192,8 +191,7 @@
         $(".success-message").html("");
         $(this).attr("disabled", "disabled");
         $(this).html("<img src='" + $(".base-url").val() + "/assets/ajax-loader.gif'/>");
-        userId = $(this).data("userid");
-        username = $(this).data("username");
+        userName = $(this).data("username");
         var rolesToAdd = $(".new-roles-select").val();
         if(rolesToAdd != null){
             $(".roles-list").find(".role-name").each(function () {
@@ -204,8 +202,7 @@
                 url: $(".base-url").val() + "/admin/add-roles-to-user",
                 data: {
                     add: true,
-                    userId: userId,
-                    username: username,
+                    username: userName,
                     roles: rolesToAdd
                 },
                 success : function(data)
@@ -224,21 +221,20 @@
         }
     });
 
-    function repopulatePopup( userName, userId ){
+    function repopulatePopup( username){
 
         $("#check-role-block").modal("show");
         $(".roles-of-user").html("User : " + userName);
         $(".roles-load").removeClass("hide");
         $(".roles-list").addClass("hide");
         $(".add-roles-submit").data("username", userName);
-        $(".add-roles-submit").data("userid", userId);
         $(document).find(".alert-success").remove();
 
         $.ajax({
             type: "POST",
             url: $(".base-url").val() + "/admin/check-roles",
             data: {
-                userId: userId
+                username: userName
             }
         }).complete(function (data) {
             roles = JSON.parse(data.responseText);


[20/50] [abbrv] airavata-php-gateway git commit: AIRAVATA-2342 Keycloak: search users

Posted by ma...@apache.org.
AIRAVATA-2342 Keycloak: search users


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

Branch: refs/heads/develop
Commit: 994483d0c48d0272eda12d8f2824bc7f342e181f
Parents: 64362fe
Author: Marcus Christie <ma...@iu.edu>
Authored: Tue Mar 28 17:15:54 2017 -0400
Committer: Marcus Christie <ma...@iu.edu>
Committed: Tue Mar 28 17:15:54 2017 -0400

----------------------------------------------------------------------
 app/controllers/AdminController.php  |  2 +-
 app/libraries/Keycloak/API/Users.php | 30 ++++++++++++++++++++++++++++++
 app/libraries/Keycloak/Keycloak.php  | 16 ++++++++++++++++
 3 files changed, 47 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/994483d0/app/controllers/AdminController.php
----------------------------------------------------------------------
diff --git a/app/controllers/AdminController.php b/app/controllers/AdminController.php
index f52de91..d6a19e0 100644
--- a/app/controllers/AdminController.php
+++ b/app/controllers/AdminController.php
@@ -85,7 +85,7 @@ class AdminController extends BaseController {
     public function searchUsersView(){
         if(Input::has("search_val"))
         {
-            $users =  WSIS::searchUsers(Input::get("search_val"));
+            $users =  Keycloak::searchUsers(Input::get("search_val"));
         }
         else
             $users = Keycloak::listUsers();

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/994483d0/app/libraries/Keycloak/API/Users.php
----------------------------------------------------------------------
diff --git a/app/libraries/Keycloak/API/Users.php b/app/libraries/Keycloak/API/Users.php
index c1c8aca..089ad3a 100644
--- a/app/libraries/Keycloak/API/Users.php
+++ b/app/libraries/Keycloak/API/Users.php
@@ -55,6 +55,36 @@ class Users {
     }
 
     /**
+     * Search users
+     * GET /admin/realms/{realm}/users
+     * NOTE: the search is a substring search across users' usernames, first and
+     * last names, and email address
+     * Returns Array of UserRepresentation
+     */
+    public function searchUsers($realm, $keyword){
+
+        // get access token for admin API
+        $access_token = $this->getAPIAccessToken();
+        $url = $this->base_endpoint_url . '/admin/realms/' . rawurlencode($realm) . '/users?search=' . rawurlencode($keyword);
+        // Log::debug("getUsers url", array($url));
+        $r = curl_init($url);
+        curl_setopt($r, CURLOPT_RETURNTRANSFER, 1);
+        curl_setopt($r, CURLOPT_ENCODING, 1);
+        curl_setopt($r, CURLOPT_SSL_VERIFYPEER, $this->verify_peer);
+        curl_setopt($r, CURLOPT_HTTPHEADER, array(
+            "Authorization: Bearer " . $access_token
+        ));
+
+        $response = curl_exec($r);
+        if ($response == false) {
+            die("curl_exec() failed. Error: " . curl_error($r));
+        }
+        $result = json_decode($response);
+        // Log::debug("getUsers result", array($result));
+        return $result;
+    }
+
+    /**
      * Get representation of a user
      * GET /admin/realms/{realm}/users/{id}
      * Returns a UserRepresentation

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/994483d0/app/libraries/Keycloak/Keycloak.php
----------------------------------------------------------------------
diff --git a/app/libraries/Keycloak/Keycloak.php b/app/libraries/Keycloak/Keycloak.php
index 8c9c1a1..1f876b0 100644
--- a/app/libraries/Keycloak/Keycloak.php
+++ b/app/libraries/Keycloak/Keycloak.php
@@ -191,6 +191,22 @@ class Keycloak {
     }
 
     /**
+     * Function to search users
+     * NOTE: Keycloak uses the keyword to search in the username, first and last
+     * name and email address
+     * @param $keyword
+     * @return Array of usernames
+     */
+    public function searchUsers($phrase){
+        $users = $this->users->searchUsers($this->realm, $phrase);
+        $usernames = [];
+        foreach ($users as $user) {
+            $usernames[] = $user->username;
+        }
+        return $usernames;
+    }
+
+    /**
      * Function to get the list of all existing roles
      * For Keycloak this is a list of "Realm roles"
      *


[02/50] [abbrv] airavata-php-gateway git commit: AIRAVATA-2342 Integrate Keycloak for auth code type login

Posted by ma...@apache.org.
AIRAVATA-2342 Integrate Keycloak for auth code type login

This is just the first part which redirects to Keycloak.  Still need to
handle when it redirects back to the callback URL.


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

Branch: refs/heads/develop
Commit: 5b0b2858d474b75b79863b614fa36ff438b1c01b
Parents: 99ffbef
Author: Marcus Christie <ma...@iu.edu>
Authored: Tue Mar 21 17:09:35 2017 -0400
Committer: Marcus Christie <ma...@iu.edu>
Committed: Tue Mar 21 17:09:35 2017 -0400

----------------------------------------------------------------------
 app/config/app.php                              |  3 +-
 app/config/pga_config.php.template              |  5 ++
 app/controllers/AccountController.php           |  2 +-
 app/libraries/Keycloak/Facades/Keycloak.php     | 16 +++++
 app/libraries/Keycloak/Keycloak.php             | 56 +++++++++++++++++
 .../Keycloak/KeycloakServiceProvider.php        | 63 ++++++++++++++++++++
 6 files changed, 143 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/5b0b2858/app/config/app.php
----------------------------------------------------------------------
diff --git a/app/config/app.php b/app/config/app.php
index 27f995f..5032866 100755
--- a/app/config/app.php
+++ b/app/config/app.php
@@ -121,7 +121,8 @@ return array(
         'Illuminate\Validation\ValidationServiceProvider',
         'Illuminate\View\ViewServiceProvider',
         'Illuminate\Workbench\WorkbenchServiceProvider',
-        'Wsis\WsisServiceProvider',
+        // 'Wsis\WsisServiceProvider',
+        'Keycloak\KeycloakServiceProvider',
         'Airavata\AiravataServiceProvider',
         'Teepluss\Theme\ThemeServiceProvider',
         'GrahamCampbell\Markdown\MarkdownServiceProvider',

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/5b0b2858/app/config/pga_config.php.template
----------------------------------------------------------------------
diff --git a/app/config/pga_config.php.template b/app/config/pga_config.php.template
index 8370364..782b6d3 100644
--- a/app/config/pga_config.php.template
+++ b/app/config/pga_config.php.template
@@ -67,6 +67,11 @@ return array(
         'oauth-callback-url' => 'https://dev.seagrid.org/callback-url',
 
         /**
+         * For OIDC servers that support the discovery protocol.
+         */
+        'openid-connect-discovery-url' => 'https://some.identity.provider.org/.well-known/openid-configuration',
+
+        /**
          * Identity server domain
          */
         'server' => 'idp.scigap.org',

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/5b0b2858/app/controllers/AccountController.php
----------------------------------------------------------------------
diff --git a/app/controllers/AccountController.php b/app/controllers/AccountController.php
index a9ac6b4..5c0de05 100644
--- a/app/controllers/AccountController.php
+++ b/app/controllers/AccountController.php
@@ -84,7 +84,7 @@ class AccountController extends BaseController
     public function loginView()
     {
         if(Config::get('pga_config.wsis')['oauth-grant-type'] == "authorization_code"){
-            $url = WSIS::getOAuthRequestCodeUrl();
+            $url = Keycloak::getOAuthRequestCodeUrl();
             return Redirect::away($url);
         }else{
             if(CommonUtilities::id_in_session()){

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/5b0b2858/app/libraries/Keycloak/Facades/Keycloak.php
----------------------------------------------------------------------
diff --git a/app/libraries/Keycloak/Facades/Keycloak.php b/app/libraries/Keycloak/Facades/Keycloak.php
new file mode 100644
index 0000000..5f7e4a9
--- /dev/null
+++ b/app/libraries/Keycloak/Facades/Keycloak.php
@@ -0,0 +1,16 @@
+<?php
+
+namespace Keycloak\Facades;
+
+use Illuminate\Support\Facades\Facade;
+
+class Keycloak extends Facade {
+
+    /**
+     * Get the registered name of the component.
+     *
+     * @return string
+     */
+    protected static function getFacadeAccessor() { return 'keycloak'; }
+
+}

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/5b0b2858/app/libraries/Keycloak/Keycloak.php
----------------------------------------------------------------------
diff --git a/app/libraries/Keycloak/Keycloak.php b/app/libraries/Keycloak/Keycloak.php
new file mode 100644
index 0000000..f28600c
--- /dev/null
+++ b/app/libraries/Keycloak/Keycloak.php
@@ -0,0 +1,56 @@
+<?php
+
+namespace Keycloak;
+
+use Log;
+use Illuminate\Routing\UrlGenerator;
+use Illuminate\Support\Facades\Config;
+
+class Keycloak {
+
+    private $openid_connect_discovery_url;
+    private $client_id;
+    private $client_secret;
+    private $callback_url;
+    private $verify_peer;
+
+    /**
+     * Constructor
+     *
+     */
+    public function __construct($openid_connect_discovery_url, $client_id, $client_secret, $callback_url, $verify_peer) {
+
+        $this->openid_connect_discovery_url = $openid_connect_discovery_url;
+        $this->client_id = $client_id;
+        $this->client_secret = $client_secret;
+        $this->callback_url = $callback_url;
+        $this->verify_peer = $verify_peer;
+    }
+
+    public function getOAuthRequestCodeUrl(){
+        $config = $this->getOpenIDConnectDiscoveryConfiguration();
+        $authorization_endpoint = $config->authorization_endpoint;
+
+        // TODO: add state variable to request and put into session
+        $url = $authorization_endpoint . '?response_type=code&client_id=' . urlencode($this->client_id)
+            . '&redirect_uri=' . urlencode($this->callback_url)
+            . '&scope=openid';
+        return $url;
+    }
+
+    private function getOpenIDConnectDiscoveryConfiguration() {
+
+        $r = curl_init($this->openid_connect_discovery_url);
+        curl_setopt($r, CURLOPT_RETURNTRANSFER, 1);
+        // Decode compressed responses.
+        curl_setopt($r, CURLOPT_ENCODING, 1);
+        curl_setopt($r, CURLOPT_SSL_VERIFYPEER, false);
+
+        $result = curl_exec($r);
+
+        $json = json_decode($result);
+
+        Log::debug("openid connect discovery configuration", array($json));
+        return $json;
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/5b0b2858/app/libraries/Keycloak/KeycloakServiceProvider.php
----------------------------------------------------------------------
diff --git a/app/libraries/Keycloak/KeycloakServiceProvider.php b/app/libraries/Keycloak/KeycloakServiceProvider.php
new file mode 100644
index 0000000..b7e033c
--- /dev/null
+++ b/app/libraries/Keycloak/KeycloakServiceProvider.php
@@ -0,0 +1,63 @@
+<?php namespace Keycloak;
+
+use Illuminate\Support\ServiceProvider;
+use Illuminate\Support\Facades\Config;
+
+class KeycloakServiceProvider extends ServiceProvider {
+
+	/**
+	 * Indicates if loading of the provider is deferred.
+	 *
+	 * @var bool
+	 */
+	protected $defer = false;
+
+    /**
+     * Bootstrap the application events.
+     *
+     * @return void
+     */
+    public function boot()
+    {
+        $this->package('keycloak/keycloak');
+    }
+
+	/**
+	 * Register the service provider.
+	 *
+	 * @return void
+	 */
+	public function register()
+	{
+        //registering service provider
+        $this->app['keycloak'] = $this->app->share(function($app)
+        {
+            $identityServerConfig = Config::get('pga_config.wsis');
+            return new Keycloak(
+                $identityServerConfig['openid-connect-discovery-url'],
+                $identityServerConfig['oauth-client-key'],
+                $identityServerConfig['oauth-client-secret'],
+                $identityServerConfig['oauth-callback-url'],
+                $identityServerConfig['verify-peer']
+            );
+        });
+
+        //registering alis
+        $this->app->booting(function()
+        {
+            $loader = \Illuminate\Foundation\AliasLoader::getInstance();
+            $loader->alias('Keycloak', 'Keycloak\Facades\Keycloak');
+        });
+	}
+
+	/**
+	 * Get the services provided by the provider.
+	 *
+	 * @return array
+	 */
+	public function provides()
+	{
+		return array('wsis');
+	}
+
+}


[42/50] [abbrv] airavata-php-gateway git commit: AIRAVATA-2408 Fixes to user profile editor

Posted by ma...@apache.org.
AIRAVATA-2408 Fixes to user profile editor


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

Branch: refs/heads/develop
Commit: 3f99eb644531b0904daf084e74543af6b32d2cfb
Parents: 31b1ca8
Author: Marcus Christie <ma...@iu.edu>
Authored: Sun Jun 11 16:25:02 2017 -0400
Committer: Marcus Christie <ma...@iu.edu>
Committed: Sun Jun 11 16:25:02 2017 -0400

----------------------------------------------------------------------
 app/controllers/UserSettingsController.php      |  11 +-
 app/libraries/Airavata/API/Airavata.php         | 466 +------------------
 app/views/account/user-profile.blade.php        |  43 +-
 app/views/layout/basic.blade.php                |   2 +-
 .../user-profile-phone-template.blade.php       |   9 -
 5 files changed, 32 insertions(+), 499 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/3f99eb64/app/controllers/UserSettingsController.php
----------------------------------------------------------------------
diff --git a/app/controllers/UserSettingsController.php b/app/controllers/UserSettingsController.php
index 7b93f19..0cd69ec 100644
--- a/app/controllers/UserSettingsController.php
+++ b/app/controllers/UserSettingsController.php
@@ -201,16 +201,9 @@ class UserSettingsController extends BaseController
         $userProfile = UserProfileUtilities::get_user_profile($username);
 
         // Copy data from form to $userProfile object and update
-        $userProfile->userName = Input::get("userName");
+        $userProfile->firstName = Input::get("firstName");
+        $userProfile->lastName = Input::get("lastName");
         $userProfile->homeOrganization = Input::get("homeOrganization");
-        $userProfile->country = Input::get("country");
-        if (Input::has("phones")) {
-            $phones = Input::get("phones");
-            // Filter out empty phone numbers
-            $userProfile->phones = array_filter($phones, function($phone) {
-                return trim($phone) !== "";
-            });
-        }
         try {
             UserProfileUtilities::update_user_profile($userProfile);
             // Now update the UserProfile in the Session

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/3f99eb64/app/libraries/Airavata/API/Airavata.php
----------------------------------------------------------------------
diff --git a/app/libraries/Airavata/API/Airavata.php b/app/libraries/Airavata/API/Airavata.php
index e1032be..9c20f39 100644
--- a/app/libraries/Airavata/API/Airavata.php
+++ b/app/libraries/Airavata/API/Airavata.php
@@ -4139,6 +4139,12 @@ interface AiravataIf {
    * *  Externally assertable unique identifier. SAML (primarly in higher education, academic) tends to keep
    * *   user name less opaque. OpenID Connect maintains them to be opaque.
    * *
+   * * firstName, middleName, lastName:
+   * *  First and Last names as assertede by the user
+   * *
+   * * namePrefix, nameSuffix:
+   * *  prefix and suffix to the users name as asserted by the user
+   * *
    * * emails:
    * *   Email identifier are Verified, REQUIRED and MULTIVALUED
    * *
@@ -4200,68 +4206,7 @@ interface AiravataIf {
   public function getAllUserProfilesInGateway(\Airavata\Model\Security\AuthzToken $authzToken, $gatewayId, $offset, $limit);
   /**
    * @param \Airavata\Model\Security\AuthzToken $authzToken
-   * @param string $userName
-   * @param string $gatewayId
-   * @return \Airavata\Model\User\UserProfile * A structure holding the user profile and its child models.
-   * *
-   * * Notes:
-   * *  The model does not include passwords as it is assumed an external identity provider is used to authenticate user.
-   * *  References:
-   * *     NSF Demographic Information - http://www.nsf.gov/pubs/2000/00form1225/00form1225.doc
-   * *     LDAP Schema - https://tools.ietf.org/html/rfc4519
-   * *     SCIM 2.0 - https://tools.ietf.org/html/rfc7643
-   * *
-   * * userModelVersion:
-   * *  Version number of profile
-   * *
-   * * airavataInternalUserId:
-   * *  internal to Airavata, not intended to be used outside of the Airavata platform or possibly by gateways
-   * *  (that is, never shown to users), never reassigned, REQUIRED
-   * *
-   * * userId:
-   * *  Externally assertable unique identifier. SAML (primarly in higher education, academic) tends to keep
-   * *   user name less opaque. OpenID Connect maintains them to be opaque.
-   * *
-   * * emails:
-   * *   Email identifier are Verified, REQUIRED and MULTIVALUED
-   * *
-   * * userName:
-   * *  Name-based identifiers can be multivalues. To keep it simple, Airavata will make it a string.
-   * *   In the future these can be enumerated as:
-   *     *   Official name (as asserted possibly by some external identity provider)
-   *     *   Prefered name (as asserted or suggested by user directly)
-   *     *   Components:
-   *     *      givenName
-   *     *      surname (familyName)
-   *     *      displayName (often asserted by user to handle things like middle names, suffix, prefix, and the like)
-   * *
-   * * orcidId: ORCID ID - http://orcid.org/about/what-is-orcid)
-   * *
-   * * phones: Telephone MULTIVALUED
-   * *
-   * * country: Country of Residance
-   * *
-   * * nationality Countries of citizenship
-   * *
-   * * comments:
-   * *   Free-form information (treated as opaque by Airavata and simply passed to resource).
-   * *
-   * * labeledURI:
-   *   * Google Scholar, Web of Science, ACS, e.t.c
-   * *
-   * * timeZone:
-   * *  User’s preferred timezone - IANA Timezone Databases - http://www.iana.org/time-zones.
-   * *
-   * 
-   * @throws \Airavata\API\Error\InvalidRequestException
-   * @throws \Airavata\API\Error\AiravataClientException
-   * @throws \Airavata\API\Error\AiravataSystemException
-   * @throws \Airavata\API\Error\AuthorizationException
-   */
-  public function getUserProfileByName(\Airavata\Model\Security\AuthzToken $authzToken, $userName, $gatewayId);
-  /**
-   * @param \Airavata\Model\Security\AuthzToken $authzToken
-   * @param string $userName
+   * @param string $userId
    * @param string $gatewayId
    * @return bool
    * @throws \Airavata\API\Error\InvalidRequestException
@@ -4269,7 +4214,7 @@ interface AiravataIf {
    * @throws \Airavata\API\Error\AiravataSystemException
    * @throws \Airavata\API\Error\AuthorizationException
    */
-  public function doesUserProfileExist(\Airavata\Model\Security\AuthzToken $authzToken, $userName, $gatewayId);
+  public function doesUserProfileExist(\Airavata\Model\Security\AuthzToken $authzToken, $userId, $gatewayId);
 }
 
 class AiravataClient implements \Airavata\API\AiravataIf {
@@ -15553,82 +15498,17 @@ class AiravataClient implements \Airavata\API\AiravataIf {
     throw new \Exception("getAllUserProfilesInGateway failed: unknown result");
   }
 
-  public function getUserProfileByName(\Airavata\Model\Security\AuthzToken $authzToken, $userName, $gatewayId)
-  {
-    $this->send_getUserProfileByName($authzToken, $userName, $gatewayId);
-    return $this->recv_getUserProfileByName();
-  }
-
-  public function send_getUserProfileByName(\Airavata\Model\Security\AuthzToken $authzToken, $userName, $gatewayId)
-  {
-    $args = new \Airavata\API\Airavata_getUserProfileByName_args();
-    $args->authzToken = $authzToken;
-    $args->userName = $userName;
-    $args->gatewayId = $gatewayId;
-    $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');
-    if ($bin_accel)
-    {
-      thrift_protocol_write_binary($this->output_, 'getUserProfileByName', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());
-    }
-    else
-    {
-      $this->output_->writeMessageBegin('getUserProfileByName', TMessageType::CALL, $this->seqid_);
-      $args->write($this->output_);
-      $this->output_->writeMessageEnd();
-      $this->output_->getTransport()->flush();
-    }
-  }
-
-  public function recv_getUserProfileByName()
-  {
-    $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');
-    if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\Airavata\API\Airavata_getUserProfileByName_result', $this->input_->isStrictRead());
-    else
-    {
-      $rseqid = 0;
-      $fname = null;
-      $mtype = 0;
-
-      $this->input_->readMessageBegin($fname, $mtype, $rseqid);
-      if ($mtype == TMessageType::EXCEPTION) {
-        $x = new TApplicationException();
-        $x->read($this->input_);
-        $this->input_->readMessageEnd();
-        throw $x;
-      }
-      $result = new \Airavata\API\Airavata_getUserProfileByName_result();
-      $result->read($this->input_);
-      $this->input_->readMessageEnd();
-    }
-    if ($result->success !== null) {
-      return $result->success;
-    }
-    if ($result->ire !== null) {
-      throw $result->ire;
-    }
-    if ($result->ace !== null) {
-      throw $result->ace;
-    }
-    if ($result->ase !== null) {
-      throw $result->ase;
-    }
-    if ($result->ae !== null) {
-      throw $result->ae;
-    }
-    throw new \Exception("getUserProfileByName failed: unknown result");
-  }
-
-  public function doesUserProfileExist(\Airavata\Model\Security\AuthzToken $authzToken, $userName, $gatewayId)
+  public function doesUserProfileExist(\Airavata\Model\Security\AuthzToken $authzToken, $userId, $gatewayId)
   {
-    $this->send_doesUserProfileExist($authzToken, $userName, $gatewayId);
+    $this->send_doesUserProfileExist($authzToken, $userId, $gatewayId);
     return $this->recv_doesUserProfileExist();
   }
 
-  public function send_doesUserProfileExist(\Airavata\Model\Security\AuthzToken $authzToken, $userName, $gatewayId)
+  public function send_doesUserProfileExist(\Airavata\Model\Security\AuthzToken $authzToken, $userId, $gatewayId)
   {
     $args = new \Airavata\API\Airavata_doesUserProfileExist_args();
     $args->authzToken = $authzToken;
-    $args->userName = $userName;
+    $args->userId = $userId;
     $args->gatewayId = $gatewayId;
     $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');
     if ($bin_accel)
@@ -69053,312 +68933,6 @@ class Airavata_getAllUserProfilesInGateway_result {
 
 }
 
-class Airavata_getUserProfileByName_args {
-  static $_TSPEC;
-
-  /**
-   * @var \Airavata\Model\Security\AuthzToken
-   */
-  public $authzToken = null;
-  /**
-   * @var string
-   */
-  public $userName = null;
-  /**
-   * @var string
-   */
-  public $gatewayId = null;
-
-  public function __construct($vals=null) {
-    if (!isset(self::$_TSPEC)) {
-      self::$_TSPEC = array(
-        1 => array(
-          'var' => 'authzToken',
-          'type' => TType::STRUCT,
-          'class' => '\Airavata\Model\Security\AuthzToken',
-          ),
-        2 => array(
-          'var' => 'userName',
-          'type' => TType::STRING,
-          ),
-        3 => array(
-          'var' => 'gatewayId',
-          'type' => TType::STRING,
-          ),
-        );
-    }
-    if (is_array($vals)) {
-      if (isset($vals['authzToken'])) {
-        $this->authzToken = $vals['authzToken'];
-      }
-      if (isset($vals['userName'])) {
-        $this->userName = $vals['userName'];
-      }
-      if (isset($vals['gatewayId'])) {
-        $this->gatewayId = $vals['gatewayId'];
-      }
-    }
-  }
-
-  public function getName() {
-    return 'Airavata_getUserProfileByName_args';
-  }
-
-  public function read($input)
-  {
-    $xfer = 0;
-    $fname = null;
-    $ftype = 0;
-    $fid = 0;
-    $xfer += $input->readStructBegin($fname);
-    while (true)
-    {
-      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
-      if ($ftype == TType::STOP) {
-        break;
-      }
-      switch ($fid)
-      {
-        case 1:
-          if ($ftype == TType::STRUCT) {
-            $this->authzToken = new \Airavata\Model\Security\AuthzToken();
-            $xfer += $this->authzToken->read($input);
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
-        case 2:
-          if ($ftype == TType::STRING) {
-            $xfer += $input->readString($this->userName);
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
-        case 3:
-          if ($ftype == TType::STRING) {
-            $xfer += $input->readString($this->gatewayId);
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
-        default:
-          $xfer += $input->skip($ftype);
-          break;
-      }
-      $xfer += $input->readFieldEnd();
-    }
-    $xfer += $input->readStructEnd();
-    return $xfer;
-  }
-
-  public function write($output) {
-    $xfer = 0;
-    $xfer += $output->writeStructBegin('Airavata_getUserProfileByName_args');
-    if ($this->authzToken !== null) {
-      if (!is_object($this->authzToken)) {
-        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
-      }
-      $xfer += $output->writeFieldBegin('authzToken', TType::STRUCT, 1);
-      $xfer += $this->authzToken->write($output);
-      $xfer += $output->writeFieldEnd();
-    }
-    if ($this->userName !== null) {
-      $xfer += $output->writeFieldBegin('userName', TType::STRING, 2);
-      $xfer += $output->writeString($this->userName);
-      $xfer += $output->writeFieldEnd();
-    }
-    if ($this->gatewayId !== null) {
-      $xfer += $output->writeFieldBegin('gatewayId', TType::STRING, 3);
-      $xfer += $output->writeString($this->gatewayId);
-      $xfer += $output->writeFieldEnd();
-    }
-    $xfer += $output->writeFieldStop();
-    $xfer += $output->writeStructEnd();
-    return $xfer;
-  }
-
-}
-
-class Airavata_getUserProfileByName_result {
-  static $_TSPEC;
-
-  /**
-   * @var \Airavata\Model\User\UserProfile
-   */
-  public $success = null;
-  /**
-   * @var \Airavata\API\Error\InvalidRequestException
-   */
-  public $ire = null;
-  /**
-   * @var \Airavata\API\Error\AiravataClientException
-   */
-  public $ace = null;
-  /**
-   * @var \Airavata\API\Error\AiravataSystemException
-   */
-  public $ase = null;
-  /**
-   * @var \Airavata\API\Error\AuthorizationException
-   */
-  public $ae = null;
-
-  public function __construct($vals=null) {
-    if (!isset(self::$_TSPEC)) {
-      self::$_TSPEC = array(
-        0 => array(
-          'var' => 'success',
-          'type' => TType::STRUCT,
-          'class' => '\Airavata\Model\User\UserProfile',
-          ),
-        1 => array(
-          'var' => 'ire',
-          'type' => TType::STRUCT,
-          'class' => '\Airavata\API\Error\InvalidRequestException',
-          ),
-        2 => array(
-          'var' => 'ace',
-          'type' => TType::STRUCT,
-          'class' => '\Airavata\API\Error\AiravataClientException',
-          ),
-        3 => array(
-          'var' => 'ase',
-          'type' => TType::STRUCT,
-          'class' => '\Airavata\API\Error\AiravataSystemException',
-          ),
-        4 => array(
-          'var' => 'ae',
-          'type' => TType::STRUCT,
-          'class' => '\Airavata\API\Error\AuthorizationException',
-          ),
-        );
-    }
-    if (is_array($vals)) {
-      if (isset($vals['success'])) {
-        $this->success = $vals['success'];
-      }
-      if (isset($vals['ire'])) {
-        $this->ire = $vals['ire'];
-      }
-      if (isset($vals['ace'])) {
-        $this->ace = $vals['ace'];
-      }
-      if (isset($vals['ase'])) {
-        $this->ase = $vals['ase'];
-      }
-      if (isset($vals['ae'])) {
-        $this->ae = $vals['ae'];
-      }
-    }
-  }
-
-  public function getName() {
-    return 'Airavata_getUserProfileByName_result';
-  }
-
-  public function read($input)
-  {
-    $xfer = 0;
-    $fname = null;
-    $ftype = 0;
-    $fid = 0;
-    $xfer += $input->readStructBegin($fname);
-    while (true)
-    {
-      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
-      if ($ftype == TType::STOP) {
-        break;
-      }
-      switch ($fid)
-      {
-        case 0:
-          if ($ftype == TType::STRUCT) {
-            $this->success = new \Airavata\Model\User\UserProfile();
-            $xfer += $this->success->read($input);
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
-        case 1:
-          if ($ftype == TType::STRUCT) {
-            $this->ire = new \Airavata\API\Error\InvalidRequestException();
-            $xfer += $this->ire->read($input);
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
-        case 2:
-          if ($ftype == TType::STRUCT) {
-            $this->ace = new \Airavata\API\Error\AiravataClientException();
-            $xfer += $this->ace->read($input);
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
-        case 3:
-          if ($ftype == TType::STRUCT) {
-            $this->ase = new \Airavata\API\Error\AiravataSystemException();
-            $xfer += $this->ase->read($input);
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
-        case 4:
-          if ($ftype == TType::STRUCT) {
-            $this->ae = new \Airavata\API\Error\AuthorizationException();
-            $xfer += $this->ae->read($input);
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
-        default:
-          $xfer += $input->skip($ftype);
-          break;
-      }
-      $xfer += $input->readFieldEnd();
-    }
-    $xfer += $input->readStructEnd();
-    return $xfer;
-  }
-
-  public function write($output) {
-    $xfer = 0;
-    $xfer += $output->writeStructBegin('Airavata_getUserProfileByName_result');
-    if ($this->success !== null) {
-      if (!is_object($this->success)) {
-        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
-      }
-      $xfer += $output->writeFieldBegin('success', TType::STRUCT, 0);
-      $xfer += $this->success->write($output);
-      $xfer += $output->writeFieldEnd();
-    }
-    if ($this->ire !== null) {
-      $xfer += $output->writeFieldBegin('ire', TType::STRUCT, 1);
-      $xfer += $this->ire->write($output);
-      $xfer += $output->writeFieldEnd();
-    }
-    if ($this->ace !== null) {
-      $xfer += $output->writeFieldBegin('ace', TType::STRUCT, 2);
-      $xfer += $this->ace->write($output);
-      $xfer += $output->writeFieldEnd();
-    }
-    if ($this->ase !== null) {
-      $xfer += $output->writeFieldBegin('ase', TType::STRUCT, 3);
-      $xfer += $this->ase->write($output);
-      $xfer += $output->writeFieldEnd();
-    }
-    if ($this->ae !== null) {
-      $xfer += $output->writeFieldBegin('ae', TType::STRUCT, 4);
-      $xfer += $this->ae->write($output);
-      $xfer += $output->writeFieldEnd();
-    }
-    $xfer += $output->writeFieldStop();
-    $xfer += $output->writeStructEnd();
-    return $xfer;
-  }
-
-}
-
 class Airavata_doesUserProfileExist_args {
   static $_TSPEC;
 
@@ -69369,7 +68943,7 @@ class Airavata_doesUserProfileExist_args {
   /**
    * @var string
    */
-  public $userName = null;
+  public $userId = null;
   /**
    * @var string
    */
@@ -69384,7 +68958,7 @@ class Airavata_doesUserProfileExist_args {
           'class' => '\Airavata\Model\Security\AuthzToken',
           ),
         2 => array(
-          'var' => 'userName',
+          'var' => 'userId',
           'type' => TType::STRING,
           ),
         3 => array(
@@ -69397,8 +68971,8 @@ class Airavata_doesUserProfileExist_args {
       if (isset($vals['authzToken'])) {
         $this->authzToken = $vals['authzToken'];
       }
-      if (isset($vals['userName'])) {
-        $this->userName = $vals['userName'];
+      if (isset($vals['userId'])) {
+        $this->userId = $vals['userId'];
       }
       if (isset($vals['gatewayId'])) {
         $this->gatewayId = $vals['gatewayId'];
@@ -69435,7 +69009,7 @@ class Airavata_doesUserProfileExist_args {
           break;
         case 2:
           if ($ftype == TType::STRING) {
-            $xfer += $input->readString($this->userName);
+            $xfer += $input->readString($this->userId);
           } else {
             $xfer += $input->skip($ftype);
           }
@@ -69468,9 +69042,9 @@ class Airavata_doesUserProfileExist_args {
       $xfer += $this->authzToken->write($output);
       $xfer += $output->writeFieldEnd();
     }
-    if ($this->userName !== null) {
-      $xfer += $output->writeFieldBegin('userName', TType::STRING, 2);
-      $xfer += $output->writeString($this->userName);
+    if ($this->userId !== null) {
+      $xfer += $output->writeFieldBegin('userId', TType::STRING, 2);
+      $xfer += $output->writeString($this->userId);
       $xfer += $output->writeFieldEnd();
     }
     if ($this->gatewayId !== null) {

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/3f99eb64/app/views/account/user-profile.blade.php
----------------------------------------------------------------------
diff --git a/app/views/account/user-profile.blade.php b/app/views/account/user-profile.blade.php
index 202284a..09bea45 100644
--- a/app/views/account/user-profile.blade.php
+++ b/app/views/account/user-profile.blade.php
@@ -42,10 +42,16 @@
             <p class="form-control-static">{{{ $userProfile->emails[0] }}}</p>
         </div>
         <div class="form-group required">
-            <label class="control-label">Name</label>
-            <div><input class="form-control" id="userName" maxlength="50" name="userName"
+            <label class="control-label">First Name</label>
+            <div><input class="form-control" id="firstName" maxlength="50" name="firstName"
                         placeholder="Name" type="text"
-                        value="{{{ $userProfile->userName }}}"/></div>
+                        value="{{{ $userProfile->firstName }}}"/></div>
+        </div>
+        <div class="form-group required">
+            <label class="control-label">Last Name</label>
+            <div><input class="form-control" id="lastName" maxlength="50" name="lastName"
+                        placeholder="Name" type="text"
+                        value="{{{ $userProfile->lastName }}}"/></div>
         </div>
         <div class="form-group">
             <label class="control-label">Organization</label>
@@ -54,41 +60,10 @@
                         value="{{{ $userProfile->homeOrganization }}}"/>
             </div>
         </div>
-        <div class="form-group">
-            <label class="control-label">Country</label>
-            <div><input class="form-control" id="country" name="country"
-                        placeholder="Country" type="text"
-                        value="{{{ $userProfile->country }}}"/>
-            </div>
-        </div>
-        <div class="form-group">
-            <label class="control-label">Phone Numbers</label>
-            @foreach ($userProfile->phones as $phone)
-                @include('partials/user-profile-phone-template', array('phone' => $phone))
-            @endforeach
-            <button id="add-phone-button" class="btn btn-default" type="button">Add Phone</button>
-        </div>
 
         <input name="update" type="submit" class="btn btn-primary btn-block" value="Update">
     </form>
 
 </div>
 
-<div id="new-phone-template" class="hidden">
-    @include('partials/user-profile-phone-template', array('phone' => ''))
-</div>
-
-@stop
-
-@section('scripts')
-@parent
-<script>
-
-    $('#add-phone-button').click(function(e){
-        $(this).before($('#new-phone-template').html());
-    });
-    $(document).on('click', '.delete-phone-button', function(e){
-        $(this).closest('.input-group').remove();
-    });
-</script>
 @stop

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/3f99eb64/app/views/layout/basic.blade.php
----------------------------------------------------------------------
diff --git a/app/views/layout/basic.blade.php b/app/views/layout/basic.blade.php
index ad833b4..7561252 100755
--- a/app/views/layout/basic.blade.php
+++ b/app/views/layout/basic.blade.php
@@ -31,7 +31,7 @@ $title = Session::get("portal-title");
 @if(Session::has("user-profile"))
 <script>
 var email =  {{ json_encode(Session::get("user-profile")->emails[0]) }};
-var fullName = {{ json_encode(Session::get("user-profile")->userName) }};
+var fullName = {{ json_encode(Session::get("user-profile")->firstName . " " . Session::get("user-profile")->lastName) }};
 </script>
 @endif
 

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/3f99eb64/app/views/partials/user-profile-phone-template.blade.php
----------------------------------------------------------------------
diff --git a/app/views/partials/user-profile-phone-template.blade.php b/app/views/partials/user-profile-phone-template.blade.php
deleted file mode 100644
index 6843f57..0000000
--- a/app/views/partials/user-profile-phone-template.blade.php
+++ /dev/null
@@ -1,9 +0,0 @@
-
-<div class="input-group">
-    <input class="form-control" name="phones[]"
-        placeholder="Phone number" type="text"
-        value="{{{ $phone or '' }}}" />
-    <span class="input-group-btn">
-        <button class="btn btn-default delete-phone-button" type="button">Delete</button>
-    </span>
-</div>


[18/50] [abbrv] airavata-php-gateway git commit: AIRAVATA-2339 Keycloak support for refreshing tokens

Posted by ma...@apache.org.
AIRAVATA-2339 Keycloak support for refreshing tokens


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

Branch: refs/heads/develop
Commit: a37c5aa5a25dc72fd4eac342ce3c936ebcd99d75
Parents: f065bee
Author: Marcus Christie <ma...@iu.edu>
Authored: Mon Mar 27 16:03:29 2017 -0400
Committer: Marcus Christie <ma...@iu.edu>
Committed: Mon Mar 27 16:03:29 2017 -0400

----------------------------------------------------------------------
 app/controllers/AccountController.php |  2 +-
 app/filters.php                       | 33 ++++++++++++------------
 app/libraries/Keycloak/Keycloak.php   | 41 ++++++++++++++++++++++++++++++
 3 files changed, 58 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/a37c5aa5/app/controllers/AccountController.php
----------------------------------------------------------------------
diff --git a/app/controllers/AccountController.php b/app/controllers/AccountController.php
index 0c3a3fc..77b1feb 100644
--- a/app/controllers/AccountController.php
+++ b/app/controllers/AccountController.php
@@ -185,7 +185,7 @@ class AccountController extends BaseController
 
         $accessToken = $response->access_token;
         $refreshToken = $response->refresh_token;
-        $expirationTime = time() + $response->expires_in - 5; //5 seconds safe margin
+        $expirationTime = time() + $response->expires_in - 300; //5 minutes safe margin
 
         $userProfile = Keycloak::getUserProfileFromOAuthToken($accessToken);
         Log::debug("userProfile", array($userProfile));

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/a37c5aa5/app/filters.php
----------------------------------------------------------------------
diff --git a/app/filters.php b/app/filters.php
index a7d492a..c92ff8a 100755
--- a/app/filters.php
+++ b/app/filters.php
@@ -20,23 +20,22 @@ App::before(function ($request) {
     if(Session::has('authz-token')){
         $currentTime = time();
         if($currentTime > Session::get('oauth-expiration-time')){
-            // TODO: implement for Keycloak
-            // $response = WSIS::getRefreshedOAutheToken(Session::get('oauth-refresh-code'));
-            // if(isset($response->access_token)){
-            //     $accessToken = $response->access_token;
-            //     $refreshToken = $response->refresh_token;
-            //     $expirationTime = time() + $response->expires_in - 300;
-            //     $authzToken = Session::get('authz-token');
-            //     $authzToken->accessToken = $accessToken;
-            //     $authzToken->claimsMap['gatewayID'] = Config::get('pga_config.airavata')['gateway-id'];
-            //     $authzToken->claimsMap['userName'] = Session::get('username');
-            //     Session::put('authz-token',$authzToken);
-            //     Session::put('oauth-refresh-code',$refreshToken);
-            //     Session::put('oauth-expiration-time',$expirationTime);
-            // }else{
-            //     Session::flush();
-            //     return Redirect::to('home');
-            // }
+            $response = Keycloak::getRefreshedOAuthToken(Session::get('oauth-refresh-code'));
+            if(isset($response->access_token)){
+                $accessToken = $response->access_token;
+                $refreshToken = $response->refresh_token;
+                $expirationTime = time() + $response->expires_in - 300; // 5 minutes safe margin
+                $authzToken = Session::get('authz-token');
+                $authzToken->accessToken = $accessToken;
+                $authzToken->claimsMap['gatewayID'] = Config::get('pga_config.airavata')['gateway-id'];
+                $authzToken->claimsMap['userName'] = Session::get('username');
+                Session::put('authz-token',$authzToken);
+                Session::put('oauth-refresh-code',$refreshToken);
+                Session::put('oauth-expiration-time',$expirationTime);
+            }else{
+                Session::flush();
+                return Redirect::to('home');
+            }
         }
     }
 });

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/a37c5aa5/app/libraries/Keycloak/Keycloak.php
----------------------------------------------------------------------
diff --git a/app/libraries/Keycloak/Keycloak.php b/app/libraries/Keycloak/Keycloak.php
index 446b7ad..0bfec52 100644
--- a/app/libraries/Keycloak/Keycloak.php
+++ b/app/libraries/Keycloak/Keycloak.php
@@ -127,6 +127,47 @@ class Keycloak {
     }
 
     /**
+     * Method to get refreshed access token
+     * @param $refreshToken
+     * @return mixed
+     */
+    public function getRefreshedOAuthToken($refresh_token){
+
+        $config = $this->getOpenIDConnectDiscoveryConfiguration();
+        $token_endpoint = $config->token_endpoint;
+
+        // Init cUrl.
+        $r = curl_init($token_endpoint);
+        curl_setopt($r, CURLOPT_RETURNTRANSFER, 1);
+        // Decode compressed responses.
+        curl_setopt($r, CURLOPT_ENCODING, 1);
+        curl_setopt($r, CURLOPT_SSL_VERIFYPEER, $this->verify_peer);
+
+        // Add client ID and client secret to the headers.
+        curl_setopt($r, CURLOPT_HTTPHEADER, array(
+            "Authorization: Basic " . base64_encode($this->client_id . ":" . $this->client_secret),
+        ));
+
+        // Assemble POST parameters for the request.
+        $post_fields = "refresh_token=" . urlencode($refresh_token) . "&grant_type=refresh_token";
+
+        // Obtain and return the access token from the response.
+        curl_setopt($r, CURLOPT_POST, true);
+        curl_setopt($r, CURLOPT_POSTFIELDS, $post_fields);
+
+        $response = curl_exec($r);
+        if ($response == false) {
+            die("curl_exec() failed. Error: " . curl_error($r));
+        }
+
+        //Parse JSON return object.
+        $result = json_decode($response);
+        Log::debug("getRefreshedOAuthToken response", array($result));
+
+        return $result;
+    }
+
+    /**
      * Function to list users
      *
      * @return Array of usernames


[32/50] [abbrv] airavata-php-gateway git commit: Regenerated Thrift stub code and models

Posted by ma...@apache.org.
Regenerated Thrift stub code and models


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

Branch: refs/heads/develop
Commit: d656b4ecc61c03211fb9fef14c1183515759d819
Parents: 6d9e208
Author: Marcus Christie <ma...@iu.edu>
Authored: Thu May 4 14:12:21 2017 -0400
Committer: Marcus Christie <ma...@iu.edu>
Committed: Thu May 4 14:12:21 2017 -0400

----------------------------------------------------------------------
 app/libraries/Airavata/API/Airavata.php         | 12979 ++++++++++-------
 app/libraries/Airavata/API/Error/Types.php      |    82 +
 .../Model/AppCatalog/ComputeResource/Types.php  |     2 +
 .../Airavata/Model/Application/Io/Types.php     |     6 +-
 .../Airavata/Model/Data/Replica/Types.php       |   572 +-
 app/libraries/Airavata/Model/Dbevent/Types.php  |   573 +
 .../Airavata/Model/Messaging/Event/Types.php    |     2 +
 app/libraries/Airavata/Model/Tenant/Types.php   |   528 +
 app/libraries/Airavata/Model/User/Types.php     |   292 +-
 9 files changed, 9558 insertions(+), 5478 deletions(-)
----------------------------------------------------------------------



[25/50] [abbrv] airavata-php-gateway git commit: adding email utilities for password reset and account confirmation.

Posted by ma...@apache.org.
adding email utilities for password reset and account confirmation.


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

Branch: refs/heads/develop
Commit: ff030373c3850f78e97afd6e829b6f7f35094233
Parents: d5b8836
Author: scnakandala <su...@gmail.com>
Authored: Fri Apr 28 19:24:23 2017 -0400
Committer: scnakandala <su...@gmail.com>
Committed: Fri Apr 28 19:24:23 2017 -0400

----------------------------------------------------------------------
 app/config/email_templates.json          | 27 ++++++++
 app/config/email_templates.json.template | 27 ++++++++
 app/config/pga_config.php.template       |  5 ++
 app/libraries/EmailUtilities.php         | 91 +++++++++++++++++++++++++++
 4 files changed, 150 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/ff030373/app/config/email_templates.json
----------------------------------------------------------------------
diff --git a/app/config/email_templates.json b/app/config/email_templates.json
new file mode 100644
index 0000000..0420948
--- /dev/null
+++ b/app/config/email_templates.json
@@ -0,0 +1,27 @@
+{
+  "account_verification" : {
+    "subject" : "Verify Your Email Account",
+    "body" : [
+      "<div><p>",
+      "Dear $firstName $lastName,<br/>",
+      "Someone has created a account with this email address. If this was you, click the link below to verify your email address<br/>",
+      "<a href=\"$url\">$url</a><br/>",
+      "This link will expire within $validTime minutes.<br/>",
+      "If you didn't create this account, just ignore this message.",
+      "</p></div>"
+    ]
+  },
+
+  "password_reset" : {
+    "subject" : "Password Reset Request",
+    "body" : [
+      "<div><p>",
+      "Dear $firstName $lastName,<br/>",
+      "Someone has initiated a password reset request for the account associated with this email address. If this was you, click the link below to verify it was you.<br/>",
+      "<a href=\"$url\">$url</a><br/>",
+      "This link will expire within $validTime minutes.<br/>",
+      "If you didn't request a password reset, just ignore this message.",
+      "</p></div>"
+    ]
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/ff030373/app/config/email_templates.json.template
----------------------------------------------------------------------
diff --git a/app/config/email_templates.json.template b/app/config/email_templates.json.template
new file mode 100644
index 0000000..7737844
--- /dev/null
+++ b/app/config/email_templates.json.template
@@ -0,0 +1,27 @@
+{
+  "account_verification" : {
+    "subject" : "Verify Your Email Account",
+    "body" : [
+      "<div><p>",
+        "Dear $firstName $lastName,<br/>",
+        "Someone has created a account with this email address. If this was you, click the link below to verify your email address<br/>",
+        "<a href=\"$url\">$url</a><br/>",
+        "This link will expire within $validTime minutes.<br/>",
+        "If you didn't create this account, just ignore this message.",
+      "</p></div>"
+    ]
+  },
+
+  "password_reset" : {
+    "subject" : "Password Reset Request",
+    "body" : [
+      "<div><p>",
+      "Dear $firstName $lastName,<br/>",
+      "Someone has initiated a password reset request for the account associated with this email address. If this was you, click the link below to verify it was you.<br/>",
+      "<a href=\"$url\">$url</a><br/>",
+      "This link will expire within $validTime minutes.<br/>",
+      "If you didn't request a password reset, just ignore this message.",
+      "</p></div>"
+    ]
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/ff030373/app/config/pga_config.php.template
----------------------------------------------------------------------
diff --git a/app/config/pga_config.php.template b/app/config/pga_config.php.template
index e225cf0..cd7f1df 100644
--- a/app/config/pga_config.php.template
+++ b/app/config/pga_config.php.template
@@ -215,6 +215,11 @@ return array(
         'portal-smtp-server-port' => '587',
 
         /**
+         * Email verification code valid time interval in minutes
+         */
+         'email-verify-code-valid-time' => 360,
+
+        /**
          * Set this to true if theme has set links to login
          */
         'theme-based-login-links-configured' => false,

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/ff030373/app/libraries/EmailUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/EmailUtilities.php b/app/libraries/EmailUtilities.php
new file mode 100644
index 0000000..c2d6741
--- /dev/null
+++ b/app/libraries/EmailUtilities.php
@@ -0,0 +1,91 @@
+<?php
+
+
+class EmailUtilities
+{
+
+    public static function sendVerifyEmailAccount($username, $firstName, $lastName, $email){
+        $validTime = Config::get('pga_config.portal')['mail-verify-code-valid-time'];
+        $code = uniqid();
+        Cache::put('PGA-VERIFY-EMAIL-' . $username, $code, $validTime);
+
+        $emailTemplates = json_decode(File::get(app_path() . '/config/email_templates.json'));
+        $subject = $emailTemplates->account_verification->subject;
+        $body = trim(implode($emailTemplates->account_verification->body));
+
+        $body = str_replace("\$url", URL::to('/') . '/confirmAccountCreation?username=' . $username . '&code=' . $code, $body);
+        $body = str_replace("\$firstName", $firstName, $body);
+        $body = str_replace("\$lastName", $lastName, $body);
+        $body = str_replace("\$validTime", $validTime, $body);
+
+        EmailUtilities::sendEmail($subject, [$email], $body);
+    }
+
+    public static function verifyEmailVerification($username, $code){
+        if(Cache::has('PGA-VERIFY-EMAIL-' . $username)){
+            $storedCode = Cache::get('PGA-VERIFY-EMAIL-' . $username);
+            Cache::forget('PGA-VERIFY-EMAIL-' . $username);
+            return $storedCode == $code;
+        }else{
+            return false;
+        }
+    }
+
+    public static function sendPasswordResetEmail($username, $firstName, $lastName, $email){
+        $validTime = Config::get('pga_config.portal')['mail-verify-code-valid-time'];
+        $code = uniqid();
+        Cache::put('PGA-RESET-PASSWORD-' . $username, $code, $validTime);
+
+        $emailTemplates = json_decode(File::get(app_path() . '/config/email_templates.json'));
+        $subject = $emailTemplates->password_reset->subject;
+        $body = trim(implode($emailTemplates->password_reset->body));
+
+        $body = str_replace("\$url", URL::to('/'). '/resetPassword?username=' . $username . '&code='.$code, $body);
+        $body = str_replace("\$firstName", $firstName, $body);
+        $body = str_replace("\$lastName", $lastName, $body);
+        $body = str_replace("\$validTime", $validTime, $body);
+
+        EmailUtilities::sendEmail($subject, [$email], $body);
+    }
+
+    public static function verifyPasswordResetCode($username, $code){
+        if(Cache::has('PGA-RESET-PASSWORD-' . $username)){
+            $storedCode = Cache::get('PGA-RESET-PASSWORD-' . $username);
+            Cache::forget('PGA-RESET-PASSWORD-' . $username);
+            return $storedCode == $code;
+        }else{
+            return false;
+        }
+    }
+
+    public static function sendEmail($subject, $recipients, $body){
+
+        $mail = new PHPMailer();
+
+        $mail->isSMTP();
+        $mail->SMTPDebug = 3;
+        $mail->Host = Config::get('pga_config.portal')['portal-smtp-server-host'];
+
+        $mail->SMTPAuth = true;
+
+        $mail->Username = Config::get('pga_config.portal')['portal-email-username'];
+        $mail->Password = Config::get('pga_config.portal')['portal-email-password'];
+
+        $mail->SMTPSecure = "tls";
+        $mail->Port = intval(Config::get('pga_config.portal')['portal-smtp-server-port']);
+
+        $mail->From = Config::get('pga_config.portal')['portal-email-username'];
+        $mail->FromName = "Airavata PHP Gateway";
+
+        $mail->Encoding    = '8bit';
+        $mail->ContentType = 'text/html; charset=utf-8\r\n';
+
+        foreach($recipients as $recipient){
+            $mail->addAddress($recipient);
+        }
+
+        $mail->Subject = $subject;
+        $mail->Body = html_entity_decode($body);
+        $mail->send();
+    }
+}
\ No newline at end of file


[40/50] [abbrv] airavata-php-gateway git commit: AIRAVATA-2342 Displaying password validation msg on reset password

Posted by ma...@apache.org.
AIRAVATA-2342 Displaying password validation msg on reset password


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

Branch: refs/heads/develop
Commit: d021668776df0dce970a469bbd1be17cf28be935
Parents: 12bcfca
Author: Marcus Christie <ma...@iu.edu>
Authored: Wed May 24 17:48:07 2017 -0400
Committer: Marcus Christie <ma...@iu.edu>
Committed: Wed May 24 17:48:07 2017 -0400

----------------------------------------------------------------------
 app/controllers/AccountController.php      |  4 ++--
 app/views/account/reset-password.blade.php | 18 +++++++++++++++---
 2 files changed, 17 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/d0216687/app/controllers/AccountController.php
----------------------------------------------------------------------
diff --git a/app/controllers/AccountController.php b/app/controllers/AccountController.php
index a3a6194..d8d4a4e 100644
--- a/app/controllers/AccountController.php
+++ b/app/controllers/AccountController.php
@@ -319,7 +319,7 @@ class AccountController extends BaseController
         if(empty($username) || empty($code)){
             return Redirect::to("forgot-password")->with("password-reset-error", "Reset password link failed. Please request to reset user password again.");
         }else{
-            return View::make("account/reset-password", array("code" => $code, "username"=>$username));
+            return View::make("account/reset-password", array("code" => $code, "username"=>$username, "password_regex_tooltip"=>self::PASSWORD_VALIDATION_MESSAGE));
         }
     }
 
@@ -411,7 +411,7 @@ class AccountController extends BaseController
             "confirm_new_password" => "required|same:new_password",
         );
         $messages = array(
-            'password.regex' => self::PASSWORD_VALIDATION_MESSAGE,
+            'new_password.regex' => self::PASSWORD_VALIDATION_MESSAGE,
         );
 
         $validator = Validator::make(Input::all(), $rules, $messages);

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/d0216687/app/views/account/reset-password.blade.php
----------------------------------------------------------------------
diff --git a/app/views/account/reset-password.blade.php b/app/views/account/reset-password.blade.php
index 6254415..6edf3a4 100644
--- a/app/views/account/reset-password.blade.php
+++ b/app/views/account/reset-password.blade.php
@@ -23,10 +23,13 @@
         <div class="form-group form-horizontal">
             <input name="username" type="hidden" value="{{$username}}" class="form-control"/>
             <input name="code" type="hidden" value="{{{$code}}}" class="form-control"/>
-            <div class="form-group required"><label class="control-label">Password</label>
+            <div class="form-group required"><label class="control-label">New Password</label>
 
                 <div><input class="form-control" id="new_password" minlength="6" name="new_password" placeholder="New Password"
-                            required="required" title="" type="password"/></div>
+                            required="required" title="" type="password"
+                            data-container="body" data-toggle="popover" data-placement="left"
+                            data-content="{{{ $password_regex_tooltip }}}"/>
+                </div>
             </div>
             <div class="form-group required"><label class="control-label">New Password (again)</label>
                 <div><input class="form-control" id="confirm_new_password" name="confirm_new_password"
@@ -42,4 +45,13 @@
         </div>
     </form>
 </div>
-@stop
\ No newline at end of file
+@stop
+
+@section('scripts')
+@parent
+<script>
+    $("#new_password").popover({
+        'trigger':'focus'
+    });
+</script>
+@stop


[03/50] [abbrv] airavata-php-gateway git commit: AIRAVATA-2342 Callback to handle Keycloak response

Posted by ma...@apache.org.
AIRAVATA-2342 Callback to handle Keycloak response


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

Branch: refs/heads/develop
Commit: 8b483bebadb3df6e34e520dc4b7da40b73a61a99
Parents: 5b0b285
Author: Marcus Christie <ma...@iu.edu>
Authored: Wed Mar 22 14:13:59 2017 -0400
Committer: Marcus Christie <ma...@iu.edu>
Committed: Wed Mar 22 14:13:59 2017 -0400

----------------------------------------------------------------------
 app/controllers/AccountController.php |  4 +-
 app/libraries/Keycloak/Keycloak.php   | 69 +++++++++++++++++++++++++++++-
 2 files changed, 70 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/8b483beb/app/controllers/AccountController.php
----------------------------------------------------------------------
diff --git a/app/controllers/AccountController.php b/app/controllers/AccountController.php
index 5c0de05..e98db86 100644
--- a/app/controllers/AccountController.php
+++ b/app/controllers/AccountController.php
@@ -177,7 +177,7 @@ class AccountController extends BaseController
         }
 
         $code = $_GET["code"];
-        $response = WSIS::getOAuthToken($code);
+        $response = Keycloak::getOAuthToken($code);
         if(!isset($response->access_token)){
             return Redirect::to('home');
         }
@@ -186,7 +186,7 @@ class AccountController extends BaseController
         $refreshToken = $response->refresh_token;
         $expirationTime = time() + $response->expires_in - 5; //5 seconds safe margin
 
-        $userProfile = WSIS::getUserProfileFromOAuthToken($accessToken);
+        $userProfile = Keycloak::getUserProfileFromOAuthToken($accessToken);
         $username = $userProfile['username'];
 
         $userRoles = $userProfile['roles'];

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/8b483beb/app/libraries/Keycloak/Keycloak.php
----------------------------------------------------------------------
diff --git a/app/libraries/Keycloak/Keycloak.php b/app/libraries/Keycloak/Keycloak.php
index f28600c..c1c6f33 100644
--- a/app/libraries/Keycloak/Keycloak.php
+++ b/app/libraries/Keycloak/Keycloak.php
@@ -38,13 +38,80 @@ class Keycloak {
         return $url;
     }
 
+    public function getOAuthToken($code){
+
+        $config = $this->getOpenIDConnectDiscoveryConfiguration();
+        $token_endpoint = $config->token_endpoint;
+
+        // Init cUrl.
+        $r = curl_init($token_endpoint);
+        curl_setopt($r, CURLOPT_RETURNTRANSFER, 1);
+        // Decode compressed responses.
+        curl_setopt($r, CURLOPT_ENCODING, 1);
+        curl_setopt($r, CURLOPT_SSL_VERIFYPEER, $this->verify_peer);
+
+        // Add client ID and client secret to the headers.
+        curl_setopt($r, CURLOPT_HTTPHEADER, array(
+            "Authorization: Basic " . base64_encode($this->client_id . ":" . $this->client_secret),
+        ));
+
+        // Assemble POST parameters for the request.
+        $post_fields = "code=" . urlencode($code) . "&grant_type=authorization_code&redirect_uri=" . urlencode($this->callback_url);
+
+        // Obtain and return the access token from the response.
+        curl_setopt($r, CURLOPT_POST, true);
+        curl_setopt($r, CURLOPT_POSTFIELDS, $post_fields);
+
+        $response = curl_exec($r);
+        if ($response == false) {
+            die("curl_exec() failed. Error: " . curl_error($r));
+        }
+
+        //Parse JSON return object.
+        $result = json_decode($response);
+        Log::debug("getOAuthToken response", array($result));
+
+        return $result;
+    }
+
+    public function getUserProfileFromOAuthToken($token){
+
+        $config = $this->getOpenIDConnectDiscoveryConfiguration();
+        $userinfo_endpoint = $config->userinfo_endpoint;
+
+        $r = curl_init($userinfo_endpoint);
+        curl_setopt($r, CURLOPT_RETURNTRANSFER, 1);
+        // Decode compressed responses.
+        curl_setopt($r, CURLOPT_ENCODING, 1);
+        curl_setopt($r, CURLOPT_SSL_VERIFYPEER, $this->verify_peer);
+        curl_setopt($r, CURLOPT_HTTPHEADER, array(
+            "Authorization: Bearer " . $token
+        ));
+
+        $response = curl_exec($r);
+        if ($response == false) {
+            die("curl_exec() failed. Error: " . curl_error($r));
+        }
+
+        //Parse JSON return object.
+        $userinfo = json_decode($response);
+        Log::debug("Keycloak userinfo", array($userinfo));
+        $username = $userinfo->preferred_username;
+        $firstname = $userinfo->given_name;
+        $lastname = $userinfo->family_name;
+        $email = $userinfo->email;
+        // TODO: get roles from Keycloak API
+        return array('username'=>$username, 'firstname'=>$firstname, 'lastname'=>$lastname, 'email'=>$email, 'roles'=>array());
+    }
+
     private function getOpenIDConnectDiscoveryConfiguration() {
 
+        // TODO: cache the result of the request
         $r = curl_init($this->openid_connect_discovery_url);
         curl_setopt($r, CURLOPT_RETURNTRANSFER, 1);
         // Decode compressed responses.
         curl_setopt($r, CURLOPT_ENCODING, 1);
-        curl_setopt($r, CURLOPT_SSL_VERIFYPEER, false);
+        curl_setopt($r, CURLOPT_SSL_VERIFYPEER, $this->verify_peer);
 
         $result = curl_exec($r);
 


[43/50] [abbrv] airavata-php-gateway git commit: AIRAVATA-2408 User profile update email UIs

Posted by ma...@apache.org.
AIRAVATA-2408 User profile update email UIs


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

Branch: refs/heads/develop
Commit: 78979887006be5b64c7abc409a7a37416599fdbb
Parents: 3f99eb6
Author: Marcus Christie <ma...@iu.edu>
Authored: Mon Jun 12 14:30:09 2017 -0400
Committer: Marcus Christie <ma...@iu.edu>
Committed: Mon Jun 12 14:30:09 2017 -0400

----------------------------------------------------------------------
 app/config/email_templates.json                 | 18 ++++++
 app/controllers/UserSettingsController.php      | 58 +++++++++++++++++++
 app/libraries/EmailUtilities.php                | 29 ++++++++++
 app/routes.php                                  |  3 +
 .../account/user-profile-update-email.blade.php | 60 ++++++++++++++++++++
 app/views/account/user-profile.blade.php        | 56 +++++++++---------
 6 files changed, 198 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/78979887/app/config/email_templates.json
----------------------------------------------------------------------
diff --git a/app/config/email_templates.json b/app/config/email_templates.json
index b4e7f1f..f379ca0 100644
--- a/app/config/email_templates.json
+++ b/app/config/email_templates.json
@@ -19,6 +19,24 @@
     ]
   },
 
+  "email_update_verification" : {
+    "subject" : "Verify Your Email Account",
+    "body" : [
+      "<div>",
+          "<p>",
+              "Dear $firstName $lastName,<br/>",
+
+              "Please click on the following link to confirm your email address",
+              " and complete updating your email address<br/>",
+
+              "<a href=\"$url\">$url</a><br/>",
+
+              "This link will expire within $validTime minutes.<br/>",
+          "</p>",
+      "</div>"
+    ]
+  },
+
   "password_reset" : {
     "subject" : "Password Reset Request",
     "body" : [

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/78979887/app/controllers/UserSettingsController.php
----------------------------------------------------------------------
diff --git a/app/controllers/UserSettingsController.php b/app/controllers/UserSettingsController.php
index 0cd69ec..959c5dc 100644
--- a/app/controllers/UserSettingsController.php
+++ b/app/controllers/UserSettingsController.php
@@ -218,4 +218,62 @@ class UserSettingsController extends BaseController
         }
 
     }
+
+    public function showUpdateEmailView() {
+        $userProfile = UserProfileUtilities::get_user_profile(Session::get("username"));
+        return View::make("account/user-profile-update-email", array(
+            "email" => $userProfile->emails[0]
+        ));
+    }
+
+    public function submitUpdateEmail() {
+
+        try {
+            $username = Session::get("username");
+            $newEmail = Input::get("newEmail");
+            $user_profile = UserProfileUtilities::get_user_profile($username);
+            EmailUtilities::sendVerifyUpdatedEmailAccount($username, $user_profile->firstName, $user_profile->lastName, $newEmail);
+            Session::put("UserSettingsController_newEmail", $newEmail);
+            return Redirect::to("account/user-profile")->with("message",
+                "Confirmation email has been sent to " . htmlspecialchars($newEmail)
+                . ". Please click on the confirmation link in the email once you receive it.");
+        } catch (Exception $e) {
+            return View::make("account/user-profile-update-email", array(
+                "email" => Input::get("newEmail"),
+                "errorMessage" => "An error occurred while trying to submit updated email address: " . $e->getMessage()
+            ));
+        }
+    }
+
+    public function confirmUpdateEmail() {
+
+        try {
+            $username = Input::get("username");
+            $code = Input::get("code");
+
+            $verified = EmailUtilities::verifyUpdatedEmailAccount($username, $code);
+            if ($verified) {
+                $newEmail = Session::get("UserSettingsController_newEmail");
+                if (empty($newEmail)) {
+                    throw new Exception("New email not found in session");
+                }
+                $user_profile = UserProfileUtilities::get_user_profile($username);
+                $user_profile->emails = array($newEmail);
+                $result = UserProfileUtilities::update_user_profile($user_profile);
+                if ($result) {
+                    return Redirect::to("account/user-profile")->with(
+                        "message", "Email address updated successfully");
+                } else {
+                    return Redirect::to("account/user-profile-update-email")->with(
+                        "errorMessage", "Failed to update email address, please try again.");
+                }
+            } else {
+                return Redirect::to("account/user-profile-update-email")->with(
+                    "errorMessage", "Failed to update email address, please try again. Reason: confirmation link was not verified successfully.");
+            }
+        } catch (Exception $e) {
+            return Redirect::to("account/user-profile-update-email")->with(
+                "errorMessage", "Failed to update email address, please try again. Reason: " . $e->message);
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/78979887/app/libraries/EmailUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/EmailUtilities.php b/app/libraries/EmailUtilities.php
index 541d9f2..7f55afc 100644
--- a/app/libraries/EmailUtilities.php
+++ b/app/libraries/EmailUtilities.php
@@ -32,6 +32,35 @@ class EmailUtilities
         }
     }
 
+    public static function sendVerifyUpdatedEmailAccount($username, $firstName, $lastName, $email){
+        $portalConfig = Config::get('pga_config.portal');
+        $validTime = isset($portalConfig['mail-verify-code-valid-time']) ? $portalConfig['mail-verify-code-valid-time'] : 30;
+        $code = uniqid();
+        Cache::put('PGA-VERIFY-UPDATED-EMAIL-' . $username, $code, $validTime);
+
+        $emailTemplates = json_decode(File::get(app_path() . '/config/email_templates.json'));
+        $subject = $emailTemplates->email_update_verification->subject;
+        $body = trim(implode($emailTemplates->email_update_verification->body));
+
+        $body = str_replace("\$url", URL::to('/') . '/user-profile-confirm-email?username=' . $username . '&code=' . $code, $body);
+        $body = str_replace("\$firstName", $firstName, $body);
+        $body = str_replace("\$lastName", $lastName, $body);
+        $body = str_replace("\$validTime", $validTime, $body);
+
+        EmailUtilities::sendEmail($subject, [$email], $body);
+    }
+
+    public static function verifyUpdatedEmailAccount($username, $code){
+        if(Cache::has('PGA-VERIFY-UPDATED-EMAIL-' . $username)){
+            $storedCode = Cache::get('PGA-VERIFY-UPDATED-EMAIL-' . $username);
+            Cache::forget('PGA-VERIFY-UPDATED-EMAIL-' . $username);
+            return $storedCode == $code;
+        }else{
+            return false;
+        }
+    }
+
+
     public static function sendPasswordResetEmail($username, $firstName, $lastName, $email){
         $portalConfig = Config::get('pga_config.portal');
         $validTime = isset($portalConfig['mail-verify-code-valid-time']) ? $portalConfig['mail-verify-code-valid-time'] : 30;

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/78979887/app/routes.php
----------------------------------------------------------------------
diff --git a/app/routes.php b/app/routes.php
index 1486751..8ab72fc 100755
--- a/app/routes.php
+++ b/app/routes.php
@@ -66,6 +66,9 @@ Route::post("account/delete-user-srp", "UserSettingsController@deleteUserStorage
 
 Route::get("account/user-profile", "UserSettingsController@getUserProfile");
 Route::post("account/user-profile", "UserSettingsController@updateUserProfile");
+Route::get("account/user-profile-update-email", "UserSettingsController@showUpdateEmailView");
+Route::post("account/user-profile-update-email", "UserSettingsController@submitUpdateEmail");
+Route::get("user-profile-confirm-email", "UserSettingsController@confirmUpdateEmail");
 
 /*
  * The following routes will not work without logging in.

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/78979887/app/views/account/user-profile-update-email.blade.php
----------------------------------------------------------------------
diff --git a/app/views/account/user-profile-update-email.blade.php b/app/views/account/user-profile-update-email.blade.php
new file mode 100644
index 0000000..ea05bfb
--- /dev/null
+++ b/app/views/account/user-profile-update-email.blade.php
@@ -0,0 +1,60 @@
+
+@extends('layout.basic')
+
+@section('page-header')
+@parent
+{{ HTML::style('css/user-settings.css')}}
+@stop
+
+@section('content')
+<div class="container">
+    <ol class="breadcrumb">
+        <li><a href="{{ URL::to('account/settings') }}">User Settings</a></li>
+        <li><a href="{{ URL::to('account/user-profile') }}">Your Profile</a></li>
+        <li class="active">Update Email</li>
+    </ol>
+
+    @if( Session::has("message") )
+        <div class="alert alert-success alert-dismissible" role="alert">
+            <button type="button" class="close" data-dismiss="alert"><span
+                    aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
+            {{{ Session::get("message") }}}
+        </div>
+    @endif
+
+    @if( isset($errorMessage) )
+        <div class="alert alert-danger" role="alert">
+            {{{ $errorMessage }}}
+        </div>
+    @endif
+
+    <div class="row">
+        <div class="col-md-6 col-md-offset-3">
+            <h1>Email address update for {{ Session::get("username") }}</h1>
+        </div>
+    </div>
+
+    <div class="row">
+        <div class="col-md-6 col-md-offset-3">
+            <p>
+                Once you submit the following updated email address we'll send
+                you an email to confirm the email address.
+            </p>
+
+            <form action="{{ URL::to("account/user-profile-update-email") }}" method="post" role="form">
+
+                <div class="form-group required">
+                    <label class="control-label">Email</label>
+                    <div><input class="form-control" id="newEmail" maxlength="50" name="newEmail"
+                                placeholder="Email address" type="text"
+                                value="{{{ $email }}}"/></div>
+                </div>
+
+                <input name="update" type="submit" class="btn btn-primary btn-block" value="Submit">
+            </form>
+        </div>
+    </div>
+
+</div>
+
+@stop

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/78979887/app/views/account/user-profile.blade.php
----------------------------------------------------------------------
diff --git a/app/views/account/user-profile.blade.php b/app/views/account/user-profile.blade.php
index 09bea45..e7d9e3b 100644
--- a/app/views/account/user-profile.blade.php
+++ b/app/views/account/user-profile.blade.php
@@ -35,34 +35,38 @@
 
     <div class="row">
         <div class="col-md-6 col-md-offset-3">
-    <form action="{{ URL::to("account/user-profile") }}" method="post" role="form">
+            <form action="{{ URL::to("account/user-profile") }}" method="post" role="form">
 
-        <div class="form-group">
-            <label class="control-label">E-mail</label>
-            <p class="form-control-static">{{{ $userProfile->emails[0] }}}</p>
-        </div>
-        <div class="form-group required">
-            <label class="control-label">First Name</label>
-            <div><input class="form-control" id="firstName" maxlength="50" name="firstName"
-                        placeholder="Name" type="text"
-                        value="{{{ $userProfile->firstName }}}"/></div>
-        </div>
-        <div class="form-group required">
-            <label class="control-label">Last Name</label>
-            <div><input class="form-control" id="lastName" maxlength="50" name="lastName"
-                        placeholder="Name" type="text"
-                        value="{{{ $userProfile->lastName }}}"/></div>
-        </div>
-        <div class="form-group">
-            <label class="control-label">Organization</label>
-            <div><input class="form-control" id="homeOrganization" name="homeOrganization"
-                        placeholder="Organization" type="text"
-                        value="{{{ $userProfile->homeOrganization }}}"/>
-            </div>
-        </div>
+                <div class="form-group">
+                    <label class="control-label">Email</label>
+                    <p class="form-control-static">{{{ $userProfile->emails[0] }}}
+                        <a href="{{ URL::to("account/user-profile-update-email") }}" role="button" class="btn btn-primary btn-sm">Update Email</a>
+                    </p>
+                </div>
+                <div class="form-group required">
+                    <label class="control-label">First Name</label>
+                    <div><input class="form-control" id="firstName" maxlength="50" name="firstName"
+                                placeholder="Name" type="text"
+                                value="{{{ $userProfile->firstName }}}"/></div>
+                </div>
+                <div class="form-group required">
+                    <label class="control-label">Last Name</label>
+                    <div><input class="form-control" id="lastName" maxlength="50" name="lastName"
+                                placeholder="Name" type="text"
+                                value="{{{ $userProfile->lastName }}}"/></div>
+                </div>
+                <div class="form-group">
+                    <label class="control-label">Organization</label>
+                    <div><input class="form-control" id="homeOrganization" name="homeOrganization"
+                                placeholder="Organization" type="text"
+                                value="{{{ $userProfile->homeOrganization }}}"/>
+                    </div>
+                </div>
 
-        <input name="update" type="submit" class="btn btn-primary btn-block" value="Update">
-    </form>
+                <input name="update" type="submit" class="btn btn-primary btn-block" value="Update">
+            </form>
+        </div>
+    </div>
 
 </div>
 


[36/50] [abbrv] airavata-php-gateway git commit: Updating Thrift client stubs

Posted by ma...@apache.org.
Updating Thrift client stubs


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

Branch: refs/heads/develop
Commit: 5e50b51d89602e3bb0dea4cf8856613b5deba2d7
Parents: 1a39567
Author: Marcus Christie <ma...@iu.edu>
Authored: Mon May 22 16:27:06 2017 -0400
Committer: Marcus Christie <ma...@iu.edu>
Committed: Mon May 22 16:27:06 2017 -0400

----------------------------------------------------------------------
 app/libraries/Airavata/API/Airavata.php         | 466 +------------------
 .../Model/AppCatalog/AppDeployment/Types.php    |  25 +-
 .../Model/AppCatalog/ComputeResource/Types.php  | 140 +++++-
 app/libraries/Airavata/Model/User/Types.php     | 109 ++---
 .../Iam/Admin/Services/CPI/IamAdminServices.php |  70 ++-
 5 files changed, 250 insertions(+), 560 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/5e50b51d/app/libraries/Airavata/API/Airavata.php
----------------------------------------------------------------------
diff --git a/app/libraries/Airavata/API/Airavata.php b/app/libraries/Airavata/API/Airavata.php
index 23df7a4..9c20f39 100644
--- a/app/libraries/Airavata/API/Airavata.php
+++ b/app/libraries/Airavata/API/Airavata.php
@@ -4206,74 +4206,7 @@ interface AiravataIf {
   public function getAllUserProfilesInGateway(\Airavata\Model\Security\AuthzToken $authzToken, $gatewayId, $offset, $limit);
   /**
    * @param \Airavata\Model\Security\AuthzToken $authzToken
-   * @param string $userName
-   * @param string $gatewayId
-   * @return \Airavata\Model\User\UserProfile * A structure holding the user profile and its child models.
-   * *
-   * * Notes:
-   * *  The model does not include passwords as it is assumed an external identity provider is used to authenticate user.
-   * *  References:
-   * *     NSF Demographic Information - http://www.nsf.gov/pubs/2000/00form1225/00form1225.doc
-   * *     LDAP Schema - https://tools.ietf.org/html/rfc4519
-   * *     SCIM 2.0 - https://tools.ietf.org/html/rfc7643
-   * *
-   * * userModelVersion:
-   * *  Version number of profile
-   * *
-   * * airavataInternalUserId:
-   * *  internal to Airavata, not intended to be used outside of the Airavata platform or possibly by gateways
-   * *  (that is, never shown to users), never reassigned, REQUIRED
-   * *
-   * * userId:
-   * *  Externally assertable unique identifier. SAML (primarly in higher education, academic) tends to keep
-   * *   user name less opaque. OpenID Connect maintains them to be opaque.
-   * *
-   * * firstName, middleName, lastName:
-   * *  First and Last names as assertede by the user
-   * *
-   * * namePrefix, nameSuffix:
-   * *  prefix and suffix to the users name as asserted by the user
-   * *
-   * * emails:
-   * *   Email identifier are Verified, REQUIRED and MULTIVALUED
-   * *
-   * * userName:
-   * *  Name-based identifiers can be multivalues. To keep it simple, Airavata will make it a string.
-   * *   In the future these can be enumerated as:
-   *     *   Official name (as asserted possibly by some external identity provider)
-   *     *   Prefered name (as asserted or suggested by user directly)
-   *     *   Components:
-   *     *      givenName
-   *     *      surname (familyName)
-   *     *      displayName (often asserted by user to handle things like middle names, suffix, prefix, and the like)
-   * *
-   * * orcidId: ORCID ID - http://orcid.org/about/what-is-orcid)
-   * *
-   * * phones: Telephone MULTIVALUED
-   * *
-   * * country: Country of Residance
-   * *
-   * * nationality Countries of citizenship
-   * *
-   * * comments:
-   * *   Free-form information (treated as opaque by Airavata and simply passed to resource).
-   * *
-   * * labeledURI:
-   *   * Google Scholar, Web of Science, ACS, e.t.c
-   * *
-   * * timeZone:
-   * *  User’s preferred timezone - IANA Timezone Databases - http://www.iana.org/time-zones.
-   * *
-   * 
-   * @throws \Airavata\API\Error\InvalidRequestException
-   * @throws \Airavata\API\Error\AiravataClientException
-   * @throws \Airavata\API\Error\AiravataSystemException
-   * @throws \Airavata\API\Error\AuthorizationException
-   */
-  public function getUserProfileByName(\Airavata\Model\Security\AuthzToken $authzToken, $userName, $gatewayId);
-  /**
-   * @param \Airavata\Model\Security\AuthzToken $authzToken
-   * @param string $userName
+   * @param string $userId
    * @param string $gatewayId
    * @return bool
    * @throws \Airavata\API\Error\InvalidRequestException
@@ -4281,7 +4214,7 @@ interface AiravataIf {
    * @throws \Airavata\API\Error\AiravataSystemException
    * @throws \Airavata\API\Error\AuthorizationException
    */
-  public function doesUserProfileExist(\Airavata\Model\Security\AuthzToken $authzToken, $userName, $gatewayId);
+  public function doesUserProfileExist(\Airavata\Model\Security\AuthzToken $authzToken, $userId, $gatewayId);
 }
 
 class AiravataClient implements \Airavata\API\AiravataIf {
@@ -15565,82 +15498,17 @@ class AiravataClient implements \Airavata\API\AiravataIf {
     throw new \Exception("getAllUserProfilesInGateway failed: unknown result");
   }
 
-  public function getUserProfileByName(\Airavata\Model\Security\AuthzToken $authzToken, $userName, $gatewayId)
-  {
-    $this->send_getUserProfileByName($authzToken, $userName, $gatewayId);
-    return $this->recv_getUserProfileByName();
-  }
-
-  public function send_getUserProfileByName(\Airavata\Model\Security\AuthzToken $authzToken, $userName, $gatewayId)
-  {
-    $args = new \Airavata\API\Airavata_getUserProfileByName_args();
-    $args->authzToken = $authzToken;
-    $args->userName = $userName;
-    $args->gatewayId = $gatewayId;
-    $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');
-    if ($bin_accel)
-    {
-      thrift_protocol_write_binary($this->output_, 'getUserProfileByName', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());
-    }
-    else
-    {
-      $this->output_->writeMessageBegin('getUserProfileByName', TMessageType::CALL, $this->seqid_);
-      $args->write($this->output_);
-      $this->output_->writeMessageEnd();
-      $this->output_->getTransport()->flush();
-    }
-  }
-
-  public function recv_getUserProfileByName()
-  {
-    $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');
-    if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\Airavata\API\Airavata_getUserProfileByName_result', $this->input_->isStrictRead());
-    else
-    {
-      $rseqid = 0;
-      $fname = null;
-      $mtype = 0;
-
-      $this->input_->readMessageBegin($fname, $mtype, $rseqid);
-      if ($mtype == TMessageType::EXCEPTION) {
-        $x = new TApplicationException();
-        $x->read($this->input_);
-        $this->input_->readMessageEnd();
-        throw $x;
-      }
-      $result = new \Airavata\API\Airavata_getUserProfileByName_result();
-      $result->read($this->input_);
-      $this->input_->readMessageEnd();
-    }
-    if ($result->success !== null) {
-      return $result->success;
-    }
-    if ($result->ire !== null) {
-      throw $result->ire;
-    }
-    if ($result->ace !== null) {
-      throw $result->ace;
-    }
-    if ($result->ase !== null) {
-      throw $result->ase;
-    }
-    if ($result->ae !== null) {
-      throw $result->ae;
-    }
-    throw new \Exception("getUserProfileByName failed: unknown result");
-  }
-
-  public function doesUserProfileExist(\Airavata\Model\Security\AuthzToken $authzToken, $userName, $gatewayId)
+  public function doesUserProfileExist(\Airavata\Model\Security\AuthzToken $authzToken, $userId, $gatewayId)
   {
-    $this->send_doesUserProfileExist($authzToken, $userName, $gatewayId);
+    $this->send_doesUserProfileExist($authzToken, $userId, $gatewayId);
     return $this->recv_doesUserProfileExist();
   }
 
-  public function send_doesUserProfileExist(\Airavata\Model\Security\AuthzToken $authzToken, $userName, $gatewayId)
+  public function send_doesUserProfileExist(\Airavata\Model\Security\AuthzToken $authzToken, $userId, $gatewayId)
   {
     $args = new \Airavata\API\Airavata_doesUserProfileExist_args();
     $args->authzToken = $authzToken;
-    $args->userName = $userName;
+    $args->userId = $userId;
     $args->gatewayId = $gatewayId;
     $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');
     if ($bin_accel)
@@ -69065,312 +68933,6 @@ class Airavata_getAllUserProfilesInGateway_result {
 
 }
 
-class Airavata_getUserProfileByName_args {
-  static $_TSPEC;
-
-  /**
-   * @var \Airavata\Model\Security\AuthzToken
-   */
-  public $authzToken = null;
-  /**
-   * @var string
-   */
-  public $userName = null;
-  /**
-   * @var string
-   */
-  public $gatewayId = null;
-
-  public function __construct($vals=null) {
-    if (!isset(self::$_TSPEC)) {
-      self::$_TSPEC = array(
-        1 => array(
-          'var' => 'authzToken',
-          'type' => TType::STRUCT,
-          'class' => '\Airavata\Model\Security\AuthzToken',
-          ),
-        2 => array(
-          'var' => 'userName',
-          'type' => TType::STRING,
-          ),
-        3 => array(
-          'var' => 'gatewayId',
-          'type' => TType::STRING,
-          ),
-        );
-    }
-    if (is_array($vals)) {
-      if (isset($vals['authzToken'])) {
-        $this->authzToken = $vals['authzToken'];
-      }
-      if (isset($vals['userName'])) {
-        $this->userName = $vals['userName'];
-      }
-      if (isset($vals['gatewayId'])) {
-        $this->gatewayId = $vals['gatewayId'];
-      }
-    }
-  }
-
-  public function getName() {
-    return 'Airavata_getUserProfileByName_args';
-  }
-
-  public function read($input)
-  {
-    $xfer = 0;
-    $fname = null;
-    $ftype = 0;
-    $fid = 0;
-    $xfer += $input->readStructBegin($fname);
-    while (true)
-    {
-      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
-      if ($ftype == TType::STOP) {
-        break;
-      }
-      switch ($fid)
-      {
-        case 1:
-          if ($ftype == TType::STRUCT) {
-            $this->authzToken = new \Airavata\Model\Security\AuthzToken();
-            $xfer += $this->authzToken->read($input);
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
-        case 2:
-          if ($ftype == TType::STRING) {
-            $xfer += $input->readString($this->userName);
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
-        case 3:
-          if ($ftype == TType::STRING) {
-            $xfer += $input->readString($this->gatewayId);
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
-        default:
-          $xfer += $input->skip($ftype);
-          break;
-      }
-      $xfer += $input->readFieldEnd();
-    }
-    $xfer += $input->readStructEnd();
-    return $xfer;
-  }
-
-  public function write($output) {
-    $xfer = 0;
-    $xfer += $output->writeStructBegin('Airavata_getUserProfileByName_args');
-    if ($this->authzToken !== null) {
-      if (!is_object($this->authzToken)) {
-        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
-      }
-      $xfer += $output->writeFieldBegin('authzToken', TType::STRUCT, 1);
-      $xfer += $this->authzToken->write($output);
-      $xfer += $output->writeFieldEnd();
-    }
-    if ($this->userName !== null) {
-      $xfer += $output->writeFieldBegin('userName', TType::STRING, 2);
-      $xfer += $output->writeString($this->userName);
-      $xfer += $output->writeFieldEnd();
-    }
-    if ($this->gatewayId !== null) {
-      $xfer += $output->writeFieldBegin('gatewayId', TType::STRING, 3);
-      $xfer += $output->writeString($this->gatewayId);
-      $xfer += $output->writeFieldEnd();
-    }
-    $xfer += $output->writeFieldStop();
-    $xfer += $output->writeStructEnd();
-    return $xfer;
-  }
-
-}
-
-class Airavata_getUserProfileByName_result {
-  static $_TSPEC;
-
-  /**
-   * @var \Airavata\Model\User\UserProfile
-   */
-  public $success = null;
-  /**
-   * @var \Airavata\API\Error\InvalidRequestException
-   */
-  public $ire = null;
-  /**
-   * @var \Airavata\API\Error\AiravataClientException
-   */
-  public $ace = null;
-  /**
-   * @var \Airavata\API\Error\AiravataSystemException
-   */
-  public $ase = null;
-  /**
-   * @var \Airavata\API\Error\AuthorizationException
-   */
-  public $ae = null;
-
-  public function __construct($vals=null) {
-    if (!isset(self::$_TSPEC)) {
-      self::$_TSPEC = array(
-        0 => array(
-          'var' => 'success',
-          'type' => TType::STRUCT,
-          'class' => '\Airavata\Model\User\UserProfile',
-          ),
-        1 => array(
-          'var' => 'ire',
-          'type' => TType::STRUCT,
-          'class' => '\Airavata\API\Error\InvalidRequestException',
-          ),
-        2 => array(
-          'var' => 'ace',
-          'type' => TType::STRUCT,
-          'class' => '\Airavata\API\Error\AiravataClientException',
-          ),
-        3 => array(
-          'var' => 'ase',
-          'type' => TType::STRUCT,
-          'class' => '\Airavata\API\Error\AiravataSystemException',
-          ),
-        4 => array(
-          'var' => 'ae',
-          'type' => TType::STRUCT,
-          'class' => '\Airavata\API\Error\AuthorizationException',
-          ),
-        );
-    }
-    if (is_array($vals)) {
-      if (isset($vals['success'])) {
-        $this->success = $vals['success'];
-      }
-      if (isset($vals['ire'])) {
-        $this->ire = $vals['ire'];
-      }
-      if (isset($vals['ace'])) {
-        $this->ace = $vals['ace'];
-      }
-      if (isset($vals['ase'])) {
-        $this->ase = $vals['ase'];
-      }
-      if (isset($vals['ae'])) {
-        $this->ae = $vals['ae'];
-      }
-    }
-  }
-
-  public function getName() {
-    return 'Airavata_getUserProfileByName_result';
-  }
-
-  public function read($input)
-  {
-    $xfer = 0;
-    $fname = null;
-    $ftype = 0;
-    $fid = 0;
-    $xfer += $input->readStructBegin($fname);
-    while (true)
-    {
-      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
-      if ($ftype == TType::STOP) {
-        break;
-      }
-      switch ($fid)
-      {
-        case 0:
-          if ($ftype == TType::STRUCT) {
-            $this->success = new \Airavata\Model\User\UserProfile();
-            $xfer += $this->success->read($input);
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
-        case 1:
-          if ($ftype == TType::STRUCT) {
-            $this->ire = new \Airavata\API\Error\InvalidRequestException();
-            $xfer += $this->ire->read($input);
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
-        case 2:
-          if ($ftype == TType::STRUCT) {
-            $this->ace = new \Airavata\API\Error\AiravataClientException();
-            $xfer += $this->ace->read($input);
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
-        case 3:
-          if ($ftype == TType::STRUCT) {
-            $this->ase = new \Airavata\API\Error\AiravataSystemException();
-            $xfer += $this->ase->read($input);
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
-        case 4:
-          if ($ftype == TType::STRUCT) {
-            $this->ae = new \Airavata\API\Error\AuthorizationException();
-            $xfer += $this->ae->read($input);
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
-        default:
-          $xfer += $input->skip($ftype);
-          break;
-      }
-      $xfer += $input->readFieldEnd();
-    }
-    $xfer += $input->readStructEnd();
-    return $xfer;
-  }
-
-  public function write($output) {
-    $xfer = 0;
-    $xfer += $output->writeStructBegin('Airavata_getUserProfileByName_result');
-    if ($this->success !== null) {
-      if (!is_object($this->success)) {
-        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
-      }
-      $xfer += $output->writeFieldBegin('success', TType::STRUCT, 0);
-      $xfer += $this->success->write($output);
-      $xfer += $output->writeFieldEnd();
-    }
-    if ($this->ire !== null) {
-      $xfer += $output->writeFieldBegin('ire', TType::STRUCT, 1);
-      $xfer += $this->ire->write($output);
-      $xfer += $output->writeFieldEnd();
-    }
-    if ($this->ace !== null) {
-      $xfer += $output->writeFieldBegin('ace', TType::STRUCT, 2);
-      $xfer += $this->ace->write($output);
-      $xfer += $output->writeFieldEnd();
-    }
-    if ($this->ase !== null) {
-      $xfer += $output->writeFieldBegin('ase', TType::STRUCT, 3);
-      $xfer += $this->ase->write($output);
-      $xfer += $output->writeFieldEnd();
-    }
-    if ($this->ae !== null) {
-      $xfer += $output->writeFieldBegin('ae', TType::STRUCT, 4);
-      $xfer += $this->ae->write($output);
-      $xfer += $output->writeFieldEnd();
-    }
-    $xfer += $output->writeFieldStop();
-    $xfer += $output->writeStructEnd();
-    return $xfer;
-  }
-
-}
-
 class Airavata_doesUserProfileExist_args {
   static $_TSPEC;
 
@@ -69381,7 +68943,7 @@ class Airavata_doesUserProfileExist_args {
   /**
    * @var string
    */
-  public $userName = null;
+  public $userId = null;
   /**
    * @var string
    */
@@ -69396,7 +68958,7 @@ class Airavata_doesUserProfileExist_args {
           'class' => '\Airavata\Model\Security\AuthzToken',
           ),
         2 => array(
-          'var' => 'userName',
+          'var' => 'userId',
           'type' => TType::STRING,
           ),
         3 => array(
@@ -69409,8 +68971,8 @@ class Airavata_doesUserProfileExist_args {
       if (isset($vals['authzToken'])) {
         $this->authzToken = $vals['authzToken'];
       }
-      if (isset($vals['userName'])) {
-        $this->userName = $vals['userName'];
+      if (isset($vals['userId'])) {
+        $this->userId = $vals['userId'];
       }
       if (isset($vals['gatewayId'])) {
         $this->gatewayId = $vals['gatewayId'];
@@ -69447,7 +69009,7 @@ class Airavata_doesUserProfileExist_args {
           break;
         case 2:
           if ($ftype == TType::STRING) {
-            $xfer += $input->readString($this->userName);
+            $xfer += $input->readString($this->userId);
           } else {
             $xfer += $input->skip($ftype);
           }
@@ -69480,9 +69042,9 @@ class Airavata_doesUserProfileExist_args {
       $xfer += $this->authzToken->write($output);
       $xfer += $output->writeFieldEnd();
     }
-    if ($this->userName !== null) {
-      $xfer += $output->writeFieldBegin('userName', TType::STRING, 2);
-      $xfer += $output->writeString($this->userName);
+    if ($this->userId !== null) {
+      $xfer += $output->writeFieldBegin('userId', TType::STRING, 2);
+      $xfer += $output->writeString($this->userId);
       $xfer += $output->writeFieldEnd();
     }
     if ($this->gatewayId !== null) {

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/5e50b51d/app/libraries/Airavata/Model/AppCatalog/AppDeployment/Types.php
----------------------------------------------------------------------
diff --git a/app/libraries/Airavata/Model/AppCatalog/AppDeployment/Types.php b/app/libraries/Airavata/Model/AppCatalog/AppDeployment/Types.php
index 03d1121..abcb322 100644
--- a/app/libraries/Airavata/Model/AppCatalog/AppDeployment/Types.php
+++ b/app/libraries/Airavata/Model/AppCatalog/AppDeployment/Types.php
@@ -506,6 +506,10 @@ class ApplicationDeploymentDescription {
    */
   public $defaultCPUCount = null;
   /**
+   * @var int
+   */
+  public $defaultWalltime = null;
+  /**
    * @var bool
    */
   public $editableByUser = null;
@@ -604,6 +608,10 @@ class ApplicationDeploymentDescription {
           'type' => TType::I32,
           ),
         16 => array(
+          'var' => 'defaultWalltime',
+          'type' => TType::I32,
+          ),
+        17 => array(
           'var' => 'editableByUser',
           'type' => TType::BOOL,
           ),
@@ -655,6 +663,9 @@ class ApplicationDeploymentDescription {
       if (isset($vals['defaultCPUCount'])) {
         $this->defaultCPUCount = $vals['defaultCPUCount'];
       }
+      if (isset($vals['defaultWalltime'])) {
+        $this->defaultWalltime = $vals['defaultWalltime'];
+      }
       if (isset($vals['editableByUser'])) {
         $this->editableByUser = $vals['editableByUser'];
       }
@@ -852,6 +863,13 @@ class ApplicationDeploymentDescription {
           }
           break;
         case 16:
+          if ($ftype == TType::I32) {
+            $xfer += $input->readI32($this->defaultWalltime);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 17:
           if ($ftype == TType::BOOL) {
             $xfer += $input->readBool($this->editableByUser);
           } else {
@@ -1018,8 +1036,13 @@ class ApplicationDeploymentDescription {
       $xfer += $output->writeI32($this->defaultCPUCount);
       $xfer += $output->writeFieldEnd();
     }
+    if ($this->defaultWalltime !== null) {
+      $xfer += $output->writeFieldBegin('defaultWalltime', TType::I32, 16);
+      $xfer += $output->writeI32($this->defaultWalltime);
+      $xfer += $output->writeFieldEnd();
+    }
     if ($this->editableByUser !== null) {
-      $xfer += $output->writeFieldBegin('editableByUser', TType::BOOL, 16);
+      $xfer += $output->writeFieldBegin('editableByUser', TType::BOOL, 17);
       $xfer += $output->writeBool($this->editableByUser);
       $xfer += $output->writeFieldEnd();
     }

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/5e50b51d/app/libraries/Airavata/Model/AppCatalog/ComputeResource/Types.php
----------------------------------------------------------------------
diff --git a/app/libraries/Airavata/Model/AppCatalog/ComputeResource/Types.php b/app/libraries/Airavata/Model/AppCatalog/ComputeResource/Types.php
index 86e6c5d..47e6e24 100644
--- a/app/libraries/Airavata/Model/AppCatalog/ComputeResource/Types.php
+++ b/app/libraries/Airavata/Model/AppCatalog/ComputeResource/Types.php
@@ -539,6 +539,14 @@ class BatchQueue {
    */
   public $defaultCPUCount = null;
   /**
+   * @var int
+   */
+  public $defaultWalltime = null;
+  /**
+   * @var string
+   */
+  public $queueSpecificMacros = null;
+  /**
    * @var bool
    */
   public $isDefaultQueue = null;
@@ -587,6 +595,14 @@ class BatchQueue {
           'type' => TType::I32,
           ),
         11 => array(
+          'var' => 'defaultWalltime',
+          'type' => TType::I32,
+          ),
+        12 => array(
+          'var' => 'queueSpecificMacros',
+          'type' => TType::STRING,
+          ),
+        13 => array(
           'var' => 'isDefaultQueue',
           'type' => TType::BOOL,
           ),
@@ -623,6 +639,12 @@ class BatchQueue {
       if (isset($vals['defaultCPUCount'])) {
         $this->defaultCPUCount = $vals['defaultCPUCount'];
       }
+      if (isset($vals['defaultWalltime'])) {
+        $this->defaultWalltime = $vals['defaultWalltime'];
+      }
+      if (isset($vals['queueSpecificMacros'])) {
+        $this->queueSpecificMacros = $vals['queueSpecificMacros'];
+      }
       if (isset($vals['isDefaultQueue'])) {
         $this->isDefaultQueue = $vals['isDefaultQueue'];
       }
@@ -719,6 +741,20 @@ class BatchQueue {
           }
           break;
         case 11:
+          if ($ftype == TType::I32) {
+            $xfer += $input->readI32($this->defaultWalltime);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 12:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->queueSpecificMacros);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 13:
           if ($ftype == TType::BOOL) {
             $xfer += $input->readBool($this->isDefaultQueue);
           } else {
@@ -788,8 +824,18 @@ class BatchQueue {
       $xfer += $output->writeI32($this->defaultCPUCount);
       $xfer += $output->writeFieldEnd();
     }
+    if ($this->defaultWalltime !== null) {
+      $xfer += $output->writeFieldBegin('defaultWalltime', TType::I32, 11);
+      $xfer += $output->writeI32($this->defaultWalltime);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->queueSpecificMacros !== null) {
+      $xfer += $output->writeFieldBegin('queueSpecificMacros', TType::STRING, 12);
+      $xfer += $output->writeString($this->queueSpecificMacros);
+      $xfer += $output->writeFieldEnd();
+    }
     if ($this->isDefaultQueue !== null) {
-      $xfer += $output->writeFieldBegin('isDefaultQueue', TType::BOOL, 11);
+      $xfer += $output->writeFieldBegin('isDefaultQueue', TType::BOOL, 13);
       $xfer += $output->writeBool($this->isDefaultQueue);
       $xfer += $output->writeFieldEnd();
     }
@@ -1885,6 +1931,22 @@ class ComputeResourceDescription {
    * @var string
    */
   public $gatewayUsageExecutable = null;
+  /**
+   * @var int
+   */
+  public $cpusPerNode = null;
+  /**
+   * @var int
+   */
+  public $defaultNodeCount = null;
+  /**
+   * @var int
+   */
+  public $defaultCPUCount = null;
+  /**
+   * @var int
+   */
+  public $defaultWalltime = null;
 
   public function __construct($vals=null) {
     if (!isset(self::$_TSPEC)) {
@@ -1976,6 +2038,22 @@ class ComputeResourceDescription {
           'var' => 'gatewayUsageExecutable',
           'type' => TType::STRING,
           ),
+        15 => array(
+          'var' => 'cpusPerNode',
+          'type' => TType::I32,
+          ),
+        16 => array(
+          'var' => 'defaultNodeCount',
+          'type' => TType::I32,
+          ),
+        17 => array(
+          'var' => 'defaultCPUCount',
+          'type' => TType::I32,
+          ),
+        18 => array(
+          'var' => 'defaultWalltime',
+          'type' => TType::I32,
+          ),
         );
     }
     if (is_array($vals)) {
@@ -2021,6 +2099,18 @@ class ComputeResourceDescription {
       if (isset($vals['gatewayUsageExecutable'])) {
         $this->gatewayUsageExecutable = $vals['gatewayUsageExecutable'];
       }
+      if (isset($vals['cpusPerNode'])) {
+        $this->cpusPerNode = $vals['cpusPerNode'];
+      }
+      if (isset($vals['defaultNodeCount'])) {
+        $this->defaultNodeCount = $vals['defaultNodeCount'];
+      }
+      if (isset($vals['defaultCPUCount'])) {
+        $this->defaultCPUCount = $vals['defaultCPUCount'];
+      }
+      if (isset($vals['defaultWalltime'])) {
+        $this->defaultWalltime = $vals['defaultWalltime'];
+      }
     }
   }
 
@@ -2207,6 +2297,34 @@ class ComputeResourceDescription {
             $xfer += $input->skip($ftype);
           }
           break;
+        case 15:
+          if ($ftype == TType::I32) {
+            $xfer += $input->readI32($this->cpusPerNode);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 16:
+          if ($ftype == TType::I32) {
+            $xfer += $input->readI32($this->defaultNodeCount);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 17:
+          if ($ftype == TType::I32) {
+            $xfer += $input->readI32($this->defaultCPUCount);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 18:
+          if ($ftype == TType::I32) {
+            $xfer += $input->readI32($this->defaultWalltime);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
         default:
           $xfer += $input->skip($ftype);
           break;
@@ -2363,6 +2481,26 @@ class ComputeResourceDescription {
       $xfer += $output->writeString($this->gatewayUsageExecutable);
       $xfer += $output->writeFieldEnd();
     }
+    if ($this->cpusPerNode !== null) {
+      $xfer += $output->writeFieldBegin('cpusPerNode', TType::I32, 15);
+      $xfer += $output->writeI32($this->cpusPerNode);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->defaultNodeCount !== null) {
+      $xfer += $output->writeFieldBegin('defaultNodeCount', TType::I32, 16);
+      $xfer += $output->writeI32($this->defaultNodeCount);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->defaultCPUCount !== null) {
+      $xfer += $output->writeFieldBegin('defaultCPUCount', TType::I32, 17);
+      $xfer += $output->writeI32($this->defaultCPUCount);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->defaultWalltime !== null) {
+      $xfer += $output->writeFieldBegin('defaultWalltime', TType::I32, 18);
+      $xfer += $output->writeI32($this->defaultWalltime);
+      $xfer += $output->writeFieldEnd();
+    }
     $xfer += $output->writeFieldStop();
     $xfer += $output->writeStructEnd();
     return $xfer;

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/5e50b51d/app/libraries/Airavata/Model/User/Types.php
----------------------------------------------------------------------
diff --git a/app/libraries/Airavata/Model/User/Types.php b/app/libraries/Airavata/Model/User/Types.php
index 1ebd5db..493b615 100644
--- a/app/libraries/Airavata/Model/User/Types.php
+++ b/app/libraries/Airavata/Model/User/Types.php
@@ -499,10 +499,6 @@ class UserProfile {
   /**
    * @var string
    */
-  public $userName = null;
-  /**
-   * @var string
-   */
   public $orcidId = null;
   /**
    * @var string[]
@@ -609,14 +605,10 @@ class UserProfile {
           'type' => TType::STRING,
           ),
         11 => array(
-          'var' => 'userName',
-          'type' => TType::STRING,
-          ),
-        12 => array(
           'var' => 'orcidId',
           'type' => TType::STRING,
           ),
-        13 => array(
+        12 => array(
           'var' => 'phones',
           'type' => TType::LST,
           'etype' => TType::STRING,
@@ -624,11 +616,11 @@ class UserProfile {
             'type' => TType::STRING,
             ),
           ),
-        14 => array(
+        13 => array(
           'var' => 'country',
           'type' => TType::STRING,
           ),
-        15 => array(
+        14 => array(
           'var' => 'nationality',
           'type' => TType::LST,
           'etype' => TType::STRING,
@@ -636,35 +628,35 @@ class UserProfile {
             'type' => TType::STRING,
             ),
           ),
-        16 => array(
+        15 => array(
           'var' => 'homeOrganization',
           'type' => TType::STRING,
           ),
-        17 => array(
+        16 => array(
           'var' => 'orginationAffiliation',
           'type' => TType::STRING,
           ),
-        18 => array(
+        17 => array(
           'var' => 'creationTime',
           'type' => TType::I64,
           ),
-        19 => array(
+        18 => array(
           'var' => 'lastAccessTime',
           'type' => TType::I64,
           ),
-        20 => array(
+        19 => array(
           'var' => 'validUntil',
           'type' => TType::I64,
           ),
-        21 => array(
+        20 => array(
           'var' => 'State',
           'type' => TType::I32,
           ),
-        22 => array(
+        21 => array(
           'var' => 'comments',
           'type' => TType::STRING,
           ),
-        23 => array(
+        22 => array(
           'var' => 'labeledURI',
           'type' => TType::LST,
           'etype' => TType::STRING,
@@ -672,15 +664,15 @@ class UserProfile {
             'type' => TType::STRING,
             ),
           ),
-        24 => array(
+        23 => array(
           'var' => 'gpgKey',
           'type' => TType::STRING,
           ),
-        25 => array(
+        24 => array(
           'var' => 'timeZone',
           'type' => TType::STRING,
           ),
-        26 => array(
+        25 => array(
           'var' => 'nsfDemographics',
           'type' => TType::STRUCT,
           'class' => '\Airavata\Model\User\NSFDemographics',
@@ -718,9 +710,6 @@ class UserProfile {
       if (isset($vals['nameSuffix'])) {
         $this->nameSuffix = $vals['nameSuffix'];
       }
-      if (isset($vals['userName'])) {
-        $this->userName = $vals['userName'];
-      }
       if (isset($vals['orcidId'])) {
         $this->orcidId = $vals['orcidId'];
       }
@@ -870,19 +859,12 @@ class UserProfile {
           break;
         case 11:
           if ($ftype == TType::STRING) {
-            $xfer += $input->readString($this->userName);
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
-        case 12:
-          if ($ftype == TType::STRING) {
             $xfer += $input->readString($this->orcidId);
           } else {
             $xfer += $input->skip($ftype);
           }
           break;
-        case 13:
+        case 12:
           if ($ftype == TType::LST) {
             $this->phones = array();
             $_size27 = 0;
@@ -899,14 +881,14 @@ class UserProfile {
             $xfer += $input->skip($ftype);
           }
           break;
-        case 14:
+        case 13:
           if ($ftype == TType::STRING) {
             $xfer += $input->readString($this->country);
           } else {
             $xfer += $input->skip($ftype);
           }
           break;
-        case 15:
+        case 14:
           if ($ftype == TType::LST) {
             $this->nationality = array();
             $_size33 = 0;
@@ -923,56 +905,56 @@ class UserProfile {
             $xfer += $input->skip($ftype);
           }
           break;
-        case 16:
+        case 15:
           if ($ftype == TType::STRING) {
             $xfer += $input->readString($this->homeOrganization);
           } else {
             $xfer += $input->skip($ftype);
           }
           break;
-        case 17:
+        case 16:
           if ($ftype == TType::STRING) {
             $xfer += $input->readString($this->orginationAffiliation);
           } else {
             $xfer += $input->skip($ftype);
           }
           break;
-        case 18:
+        case 17:
           if ($ftype == TType::I64) {
             $xfer += $input->readI64($this->creationTime);
           } else {
             $xfer += $input->skip($ftype);
           }
           break;
-        case 19:
+        case 18:
           if ($ftype == TType::I64) {
             $xfer += $input->readI64($this->lastAccessTime);
           } else {
             $xfer += $input->skip($ftype);
           }
           break;
-        case 20:
+        case 19:
           if ($ftype == TType::I64) {
             $xfer += $input->readI64($this->validUntil);
           } else {
             $xfer += $input->skip($ftype);
           }
           break;
-        case 21:
+        case 20:
           if ($ftype == TType::I32) {
             $xfer += $input->readI32($this->State);
           } else {
             $xfer += $input->skip($ftype);
           }
           break;
-        case 22:
+        case 21:
           if ($ftype == TType::STRING) {
             $xfer += $input->readString($this->comments);
           } else {
             $xfer += $input->skip($ftype);
           }
           break;
-        case 23:
+        case 22:
           if ($ftype == TType::LST) {
             $this->labeledURI = array();
             $_size39 = 0;
@@ -989,21 +971,21 @@ class UserProfile {
             $xfer += $input->skip($ftype);
           }
           break;
-        case 24:
+        case 23:
           if ($ftype == TType::STRING) {
             $xfer += $input->readString($this->gpgKey);
           } else {
             $xfer += $input->skip($ftype);
           }
           break;
-        case 25:
+        case 24:
           if ($ftype == TType::STRING) {
             $xfer += $input->readString($this->timeZone);
           } else {
             $xfer += $input->skip($ftype);
           }
           break;
-        case 26:
+        case 25:
           if ($ftype == TType::STRUCT) {
             $this->nsfDemographics = new \Airavata\Model\User\NSFDemographics();
             $xfer += $this->nsfDemographics->read($input);
@@ -1086,13 +1068,8 @@ class UserProfile {
       $xfer += $output->writeString($this->nameSuffix);
       $xfer += $output->writeFieldEnd();
     }
-    if ($this->userName !== null) {
-      $xfer += $output->writeFieldBegin('userName', TType::STRING, 11);
-      $xfer += $output->writeString($this->userName);
-      $xfer += $output->writeFieldEnd();
-    }
     if ($this->orcidId !== null) {
-      $xfer += $output->writeFieldBegin('orcidId', TType::STRING, 12);
+      $xfer += $output->writeFieldBegin('orcidId', TType::STRING, 11);
       $xfer += $output->writeString($this->orcidId);
       $xfer += $output->writeFieldEnd();
     }
@@ -1100,7 +1077,7 @@ class UserProfile {
       if (!is_array($this->phones)) {
         throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
       }
-      $xfer += $output->writeFieldBegin('phones', TType::LST, 13);
+      $xfer += $output->writeFieldBegin('phones', TType::LST, 12);
       {
         $output->writeListBegin(TType::STRING, count($this->phones));
         {
@@ -1114,7 +1091,7 @@ class UserProfile {
       $xfer += $output->writeFieldEnd();
     }
     if ($this->country !== null) {
-      $xfer += $output->writeFieldBegin('country', TType::STRING, 14);
+      $xfer += $output->writeFieldBegin('country', TType::STRING, 13);
       $xfer += $output->writeString($this->country);
       $xfer += $output->writeFieldEnd();
     }
@@ -1122,7 +1099,7 @@ class UserProfile {
       if (!is_array($this->nationality)) {
         throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
       }
-      $xfer += $output->writeFieldBegin('nationality', TType::LST, 15);
+      $xfer += $output->writeFieldBegin('nationality', TType::LST, 14);
       {
         $output->writeListBegin(TType::STRING, count($this->nationality));
         {
@@ -1136,37 +1113,37 @@ class UserProfile {
       $xfer += $output->writeFieldEnd();
     }
     if ($this->homeOrganization !== null) {
-      $xfer += $output->writeFieldBegin('homeOrganization', TType::STRING, 16);
+      $xfer += $output->writeFieldBegin('homeOrganization', TType::STRING, 15);
       $xfer += $output->writeString($this->homeOrganization);
       $xfer += $output->writeFieldEnd();
     }
     if ($this->orginationAffiliation !== null) {
-      $xfer += $output->writeFieldBegin('orginationAffiliation', TType::STRING, 17);
+      $xfer += $output->writeFieldBegin('orginationAffiliation', TType::STRING, 16);
       $xfer += $output->writeString($this->orginationAffiliation);
       $xfer += $output->writeFieldEnd();
     }
     if ($this->creationTime !== null) {
-      $xfer += $output->writeFieldBegin('creationTime', TType::I64, 18);
+      $xfer += $output->writeFieldBegin('creationTime', TType::I64, 17);
       $xfer += $output->writeI64($this->creationTime);
       $xfer += $output->writeFieldEnd();
     }
     if ($this->lastAccessTime !== null) {
-      $xfer += $output->writeFieldBegin('lastAccessTime', TType::I64, 19);
+      $xfer += $output->writeFieldBegin('lastAccessTime', TType::I64, 18);
       $xfer += $output->writeI64($this->lastAccessTime);
       $xfer += $output->writeFieldEnd();
     }
     if ($this->validUntil !== null) {
-      $xfer += $output->writeFieldBegin('validUntil', TType::I64, 20);
+      $xfer += $output->writeFieldBegin('validUntil', TType::I64, 19);
       $xfer += $output->writeI64($this->validUntil);
       $xfer += $output->writeFieldEnd();
     }
     if ($this->State !== null) {
-      $xfer += $output->writeFieldBegin('State', TType::I32, 21);
+      $xfer += $output->writeFieldBegin('State', TType::I32, 20);
       $xfer += $output->writeI32($this->State);
       $xfer += $output->writeFieldEnd();
     }
     if ($this->comments !== null) {
-      $xfer += $output->writeFieldBegin('comments', TType::STRING, 22);
+      $xfer += $output->writeFieldBegin('comments', TType::STRING, 21);
       $xfer += $output->writeString($this->comments);
       $xfer += $output->writeFieldEnd();
     }
@@ -1174,7 +1151,7 @@ class UserProfile {
       if (!is_array($this->labeledURI)) {
         throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
       }
-      $xfer += $output->writeFieldBegin('labeledURI', TType::LST, 23);
+      $xfer += $output->writeFieldBegin('labeledURI', TType::LST, 22);
       {
         $output->writeListBegin(TType::STRING, count($this->labeledURI));
         {
@@ -1188,12 +1165,12 @@ class UserProfile {
       $xfer += $output->writeFieldEnd();
     }
     if ($this->gpgKey !== null) {
-      $xfer += $output->writeFieldBegin('gpgKey', TType::STRING, 24);
+      $xfer += $output->writeFieldBegin('gpgKey', TType::STRING, 23);
       $xfer += $output->writeString($this->gpgKey);
       $xfer += $output->writeFieldEnd();
     }
     if ($this->timeZone !== null) {
-      $xfer += $output->writeFieldBegin('timeZone', TType::STRING, 25);
+      $xfer += $output->writeFieldBegin('timeZone', TType::STRING, 24);
       $xfer += $output->writeString($this->timeZone);
       $xfer += $output->writeFieldEnd();
     }
@@ -1201,7 +1178,7 @@ class UserProfile {
       if (!is_object($this->nsfDemographics)) {
         throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
       }
-      $xfer += $output->writeFieldBegin('nsfDemographics', TType::STRUCT, 26);
+      $xfer += $output->writeFieldBegin('nsfDemographics', TType::STRUCT, 25);
       $xfer += $this->nsfDemographics->write($output);
       $xfer += $output->writeFieldEnd();
     }

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/5e50b51d/app/libraries/Airavata/Service/Iam/Admin/Services/CPI/IamAdminServices.php
----------------------------------------------------------------------
diff --git a/app/libraries/Airavata/Service/Iam/Admin/Services/CPI/IamAdminServices.php b/app/libraries/Airavata/Service/Iam/Admin/Services/CPI/IamAdminServices.php
index 9bf9a83..a6cb9ff 100644
--- a/app/libraries/Airavata/Service/Iam/Admin/Services/CPI/IamAdminServices.php
+++ b/app/libraries/Airavata/Service/Iam/Admin/Services/CPI/IamAdminServices.php
@@ -54,14 +54,14 @@ interface IamAdminServicesIf {
   public function enableUser(\Airavata\Model\Security\AuthzToken $authzToken, \Airavata\Model\User\UserProfile $userDetails, \Airavata\Model\Credential\Store\PasswordCredential $isRealmAdminCredentials);
   /**
    * @param \Airavata\Model\Security\AuthzToken $authzToken
-   * @param \Airavata\Model\User\UserProfile $userDetails
-   * @param \Airavata\Model\Credential\Store\PasswordCredential $isRealmAdminCredentials
+   * @param string $tenantId
+   * @param string $username
    * @param string $newPassword
    * @return bool
    * @throws \Airavata\Service\Iam\Admin\Services\CPI\Error\IamAdminServicesException
    * @throws \Airavata\API\Error\AuthorizationException
    */
-  public function resetUserPassword(\Airavata\Model\Security\AuthzToken $authzToken, \Airavata\Model\User\UserProfile $userDetails, \Airavata\Model\Credential\Store\PasswordCredential $isRealmAdminCredentials, $newPassword);
+  public function resetUserPassword(\Airavata\Model\Security\AuthzToken $authzToken, $tenantId, $username, $newPassword);
   /**
    * @param \Airavata\Model\Security\AuthzToken $authzToken
    * @param string $gatewayID
@@ -321,18 +321,18 @@ class IamAdminServicesClient implements \Airavata\Service\Iam\Admin\Services\CPI
     throw new \Exception("enableUser failed: unknown result");
   }
 
-  public function resetUserPassword(\Airavata\Model\Security\AuthzToken $authzToken, \Airavata\Model\User\UserProfile $userDetails, \Airavata\Model\Credential\Store\PasswordCredential $isRealmAdminCredentials, $newPassword)
+  public function resetUserPassword(\Airavata\Model\Security\AuthzToken $authzToken, $tenantId, $username, $newPassword)
   {
-    $this->send_resetUserPassword($authzToken, $userDetails, $isRealmAdminCredentials, $newPassword);
+    $this->send_resetUserPassword($authzToken, $tenantId, $username, $newPassword);
     return $this->recv_resetUserPassword();
   }
 
-  public function send_resetUserPassword(\Airavata\Model\Security\AuthzToken $authzToken, \Airavata\Model\User\UserProfile $userDetails, \Airavata\Model\Credential\Store\PasswordCredential $isRealmAdminCredentials, $newPassword)
+  public function send_resetUserPassword(\Airavata\Model\Security\AuthzToken $authzToken, $tenantId, $username, $newPassword)
   {
     $args = new \Airavata\Service\Iam\Admin\Services\CPI\IamAdminServices_resetUserPassword_args();
     $args->authzToken = $authzToken;
-    $args->userDetails = $userDetails;
-    $args->isRealmAdminCredentials = $isRealmAdminCredentials;
+    $args->tenantId = $tenantId;
+    $args->username = $username;
     $args->newPassword = $newPassword;
     $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');
     if ($bin_accel)
@@ -1470,13 +1470,13 @@ class IamAdminServices_resetUserPassword_args {
    */
   public $authzToken = null;
   /**
-   * @var \Airavata\Model\User\UserProfile
+   * @var string
    */
-  public $userDetails = null;
+  public $tenantId = null;
   /**
-   * @var \Airavata\Model\Credential\Store\PasswordCredential
+   * @var string
    */
-  public $isRealmAdminCredentials = null;
+  public $username = null;
   /**
    * @var string
    */
@@ -1491,14 +1491,12 @@ class IamAdminServices_resetUserPassword_args {
           'class' => '\Airavata\Model\Security\AuthzToken',
           ),
         2 => array(
-          'var' => 'userDetails',
-          'type' => TType::STRUCT,
-          'class' => '\Airavata\Model\User\UserProfile',
+          'var' => 'tenantId',
+          'type' => TType::STRING,
           ),
         3 => array(
-          'var' => 'isRealmAdminCredentials',
-          'type' => TType::STRUCT,
-          'class' => '\Airavata\Model\Credential\Store\PasswordCredential',
+          'var' => 'username',
+          'type' => TType::STRING,
           ),
         4 => array(
           'var' => 'newPassword',
@@ -1510,11 +1508,11 @@ class IamAdminServices_resetUserPassword_args {
       if (isset($vals['authzToken'])) {
         $this->authzToken = $vals['authzToken'];
       }
-      if (isset($vals['userDetails'])) {
-        $this->userDetails = $vals['userDetails'];
+      if (isset($vals['tenantId'])) {
+        $this->tenantId = $vals['tenantId'];
       }
-      if (isset($vals['isRealmAdminCredentials'])) {
-        $this->isRealmAdminCredentials = $vals['isRealmAdminCredentials'];
+      if (isset($vals['username'])) {
+        $this->username = $vals['username'];
       }
       if (isset($vals['newPassword'])) {
         $this->newPassword = $vals['newPassword'];
@@ -1550,17 +1548,15 @@ class IamAdminServices_resetUserPassword_args {
           }
           break;
         case 2:
-          if ($ftype == TType::STRUCT) {
-            $this->userDetails = new \Airavata\Model\User\UserProfile();
-            $xfer += $this->userDetails->read($input);
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->tenantId);
           } else {
             $xfer += $input->skip($ftype);
           }
           break;
         case 3:
-          if ($ftype == TType::STRUCT) {
-            $this->isRealmAdminCredentials = new \Airavata\Model\Credential\Store\PasswordCredential();
-            $xfer += $this->isRealmAdminCredentials->read($input);
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->username);
           } else {
             $xfer += $input->skip($ftype);
           }
@@ -1593,20 +1589,14 @@ class IamAdminServices_resetUserPassword_args {
       $xfer += $this->authzToken->write($output);
       $xfer += $output->writeFieldEnd();
     }
-    if ($this->userDetails !== null) {
-      if (!is_object($this->userDetails)) {
-        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
-      }
-      $xfer += $output->writeFieldBegin('userDetails', TType::STRUCT, 2);
-      $xfer += $this->userDetails->write($output);
+    if ($this->tenantId !== null) {
+      $xfer += $output->writeFieldBegin('tenantId', TType::STRING, 2);
+      $xfer += $output->writeString($this->tenantId);
       $xfer += $output->writeFieldEnd();
     }
-    if ($this->isRealmAdminCredentials !== null) {
-      if (!is_object($this->isRealmAdminCredentials)) {
-        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
-      }
-      $xfer += $output->writeFieldBegin('isRealmAdminCredentials', TType::STRUCT, 3);
-      $xfer += $this->isRealmAdminCredentials->write($output);
+    if ($this->username !== null) {
+      $xfer += $output->writeFieldBegin('username', TType::STRING, 3);
+      $xfer += $output->writeString($this->username);
       $xfer += $output->writeFieldEnd();
     }
     if ($this->newPassword !== null) {


[15/50] [abbrv] airavata-php-gateway git commit: updating getUserProfile method in keycloak

Posted by ma...@apache.org.
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/develop
Commit: b55a828b88c9f5f2623771140c81623046eb202b
Parents: 9a9e450
Author: scnakandala <su...@gmail.com>
Authored: Fri Mar 24 13:24:22 2017 -0400
Committer: scnakandala <su...@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 [];
+        }
+
     }
 
     /**


[21/50] [abbrv] airavata-php-gateway git commit: AIRAVATA-2342 TODO: can derive discovery url

Posted by ma...@apache.org.
AIRAVATA-2342 TODO: can derive discovery url


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

Branch: refs/heads/develop
Commit: 60951a22d79722f20be3abd533e7040f1e8c0666
Parents: 994483d
Author: Marcus Christie <ma...@iu.edu>
Authored: Wed Apr 19 09:50:47 2017 -0400
Committer: Marcus Christie <ma...@iu.edu>
Committed: Wed Apr 19 09:50:47 2017 -0400

----------------------------------------------------------------------
 app/libraries/Keycloak/KeycloakServiceProvider.php | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/60951a22/app/libraries/Keycloak/KeycloakServiceProvider.php
----------------------------------------------------------------------
diff --git a/app/libraries/Keycloak/KeycloakServiceProvider.php b/app/libraries/Keycloak/KeycloakServiceProvider.php
index b8bfcbb..1992972 100644
--- a/app/libraries/Keycloak/KeycloakServiceProvider.php
+++ b/app/libraries/Keycloak/KeycloakServiceProvider.php
@@ -35,6 +35,7 @@ class KeycloakServiceProvider extends ServiceProvider {
             $identityServerConfig = Config::get('pga_config.wsis');
             return new Keycloak(
                 $identityServerConfig['tenant-domain'],
+                // TODO: we can derive this from tenant-domain and service-url
                 $identityServerConfig['openid-connect-discovery-url'],
                 $identityServerConfig['oauth-client-key'],
                 $identityServerConfig['oauth-client-secret'],


[26/50] [abbrv] airavata-php-gateway git commit: minor formating for the email templates

Posted by ma...@apache.org.
minor formating for the email templates


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

Branch: refs/heads/develop
Commit: 99f04a0f115003283ba94ccb9785b8fd4e5d9c97
Parents: ff03037
Author: scnakandala <su...@gmail.com>
Authored: Fri Apr 28 19:33:59 2017 -0400
Committer: scnakandala <su...@gmail.com>
Committed: Fri Apr 28 19:33:59 2017 -0400

----------------------------------------------------------------------
 app/config/email_templates.json          | 42 ++++++++++++++++++---------
 app/config/email_templates.json.template | 42 ++++++++++++++++++---------
 2 files changed, 56 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/99f04a0f/app/config/email_templates.json
----------------------------------------------------------------------
diff --git a/app/config/email_templates.json b/app/config/email_templates.json
index 0420948..b4e7f1f 100644
--- a/app/config/email_templates.json
+++ b/app/config/email_templates.json
@@ -2,26 +2,40 @@
   "account_verification" : {
     "subject" : "Verify Your Email Account",
     "body" : [
-      "<div><p>",
-      "Dear $firstName $lastName,<br/>",
-      "Someone has created a account with this email address. If this was you, click the link below to verify your email address<br/>",
-      "<a href=\"$url\">$url</a><br/>",
-      "This link will expire within $validTime minutes.<br/>",
-      "If you didn't create this account, just ignore this message.",
-      "</p></div>"
+      "<div>",
+          "<p>",
+              "Dear $firstName $lastName,<br/>",
+
+              "Someone has created a account with this email address. If this was you,",
+              " click the link below to verify your email address<br/>",
+
+              "<a href=\"$url\">$url</a><br/>",
+
+              "This link will expire within $validTime minutes.<br/>",
+
+              "If you didn't create this account, just ignore this message.",
+          "</p>",
+      "</div>"
     ]
   },
 
   "password_reset" : {
     "subject" : "Password Reset Request",
     "body" : [
-      "<div><p>",
-      "Dear $firstName $lastName,<br/>",
-      "Someone has initiated a password reset request for the account associated with this email address. If this was you, click the link below to verify it was you.<br/>",
-      "<a href=\"$url\">$url</a><br/>",
-      "This link will expire within $validTime minutes.<br/>",
-      "If you didn't request a password reset, just ignore this message.",
-      "</p></div>"
+      "<div>",
+          "<p>",
+              "Dear $firstName $lastName,<br/>",
+
+              "Someone has initiated a password reset request for the account associated with this email address.",
+              " If this was you, click the link below to verify it was you.<br/>",
+
+              "<a href=\"$url\">$url</a><br/>",
+
+              "This link will expire within $validTime minutes.<br/>",
+
+              "If you didn't request a password reset, just ignore this message.",
+          "</p>",
+      "</div>"
     ]
   }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/99f04a0f/app/config/email_templates.json.template
----------------------------------------------------------------------
diff --git a/app/config/email_templates.json.template b/app/config/email_templates.json.template
index 7737844..b4e7f1f 100644
--- a/app/config/email_templates.json.template
+++ b/app/config/email_templates.json.template
@@ -2,26 +2,40 @@
   "account_verification" : {
     "subject" : "Verify Your Email Account",
     "body" : [
-      "<div><p>",
-        "Dear $firstName $lastName,<br/>",
-        "Someone has created a account with this email address. If this was you, click the link below to verify your email address<br/>",
-        "<a href=\"$url\">$url</a><br/>",
-        "This link will expire within $validTime minutes.<br/>",
-        "If you didn't create this account, just ignore this message.",
-      "</p></div>"
+      "<div>",
+          "<p>",
+              "Dear $firstName $lastName,<br/>",
+
+              "Someone has created a account with this email address. If this was you,",
+              " click the link below to verify your email address<br/>",
+
+              "<a href=\"$url\">$url</a><br/>",
+
+              "This link will expire within $validTime minutes.<br/>",
+
+              "If you didn't create this account, just ignore this message.",
+          "</p>",
+      "</div>"
     ]
   },
 
   "password_reset" : {
     "subject" : "Password Reset Request",
     "body" : [
-      "<div><p>",
-      "Dear $firstName $lastName,<br/>",
-      "Someone has initiated a password reset request for the account associated with this email address. If this was you, click the link below to verify it was you.<br/>",
-      "<a href=\"$url\">$url</a><br/>",
-      "This link will expire within $validTime minutes.<br/>",
-      "If you didn't request a password reset, just ignore this message.",
-      "</p></div>"
+      "<div>",
+          "<p>",
+              "Dear $firstName $lastName,<br/>",
+
+              "Someone has initiated a password reset request for the account associated with this email address.",
+              " If this was you, click the link below to verify it was you.<br/>",
+
+              "<a href=\"$url\">$url</a><br/>",
+
+              "This link will expire within $validTime minutes.<br/>",
+
+              "If you didn't request a password reset, just ignore this message.",
+          "</p>",
+      "</div>"
     ]
   }
 }
\ No newline at end of file


[22/50] [abbrv] airavata-php-gateway git commit: AIRAVATA-2342 Keycloak: implement password grant type flow

Posted by ma...@apache.org.
AIRAVATA-2342 Keycloak: implement password grant type flow


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

Branch: refs/heads/develop
Commit: e9f3b24a04bf5e2353039b31779578aaad25418d
Parents: 60951a2
Author: Marcus Christie <ma...@iu.edu>
Authored: Thu Apr 27 12:17:44 2017 -0400
Committer: Marcus Christie <ma...@iu.edu>
Committed: Thu Apr 27 12:17:44 2017 -0400

----------------------------------------------------------------------
 app/controllers/AccountController.php           | 16 ++-----
 .../Keycloak/API/BaseKeycloakAPIEndpoint.php    | 49 +++++++++++++++++++
 app/libraries/Keycloak/API/RoleMapper.php       | 50 ++------------------
 app/libraries/Keycloak/API/Roles.php            | 45 +-----------------
 app/libraries/Keycloak/API/Users.php            | 49 ++-----------------
 app/libraries/Keycloak/Keycloak.php             | 45 ++++++++++++++++++
 6 files changed, 107 insertions(+), 147 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/e9f3b24a/app/controllers/AccountController.php
----------------------------------------------------------------------
diff --git a/app/controllers/AccountController.php b/app/controllers/AccountController.php
index 7900c7c..303c3b4 100644
--- a/app/controllers/AccountController.php
+++ b/app/controllers/AccountController.php
@@ -99,32 +99,22 @@ class AccountController extends BaseController
     {
         if (CommonUtilities::form_submitted()) {
             $wsisConfig = Config::get('pga_config.wsis');
-            if( $wsisConfig['tenant-domain'] == "")
-                $username = Input::get("username");
-            else
-                $username = Input::get("username") . "@" . $wsisConfig['tenant-domain'];
+            $username = Input::get("username");
 
             $password = $_POST['password'];
-            $response = WSIS::authenticate($username, $password);
+            $response = Keycloak::authenticate($username, $password);
             if(!isset($response->access_token)){
                 return Redirect::to("login")->with("invalid-credentials", true);
             }
 
             $accessToken = $response->access_token;
             $refreshToken = $response->refresh_token;
-            $expirationTime = time() + $response->expires_in - 5; //5 seconds safe margin
+            $expirationTime = time() + $response->expires_in - 300; // 5 minutes safe margin
 
             $userProfile = Keycloak::getUserProfileFromOAuthToken($accessToken);
             $username = $userProfile['username'];
             $userRoles = $userProfile['roles'];
 
-            //FIXME There is a bug in WSO2 IS which doest not return the admin role for the default admin user.
-            //FIXME Hence as a workaround we manually add it here.
-            if ($username == Config::get('pga_config.wsis')['admin-username']
-                || $username == Config::get('pga_config.wsis')['admin-username'] . '@' . Config::get('pga_config.wsis')['tenant-domain']){
-                $userRoles[] = Config::get('pga_config.wsis')['admin-role-name'];
-            }
-
             $authzToken = new Airavata\Model\Security\AuthzToken();
             $authzToken->accessToken = $accessToken;
             $authzToken->claimsMap['gatewayID'] = Config::get('pga_config.airavata')['gateway-id'];

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/e9f3b24a/app/libraries/Keycloak/API/BaseKeycloakAPIEndpoint.php
----------------------------------------------------------------------
diff --git a/app/libraries/Keycloak/API/BaseKeycloakAPIEndpoint.php b/app/libraries/Keycloak/API/BaseKeycloakAPIEndpoint.php
new file mode 100644
index 0000000..c440179
--- /dev/null
+++ b/app/libraries/Keycloak/API/BaseKeycloakAPIEndpoint.php
@@ -0,0 +1,49 @@
+<?php
+namespace Keycloak\API;
+
+use Exception;
+use Log;
+
+class BaseKeycloakAPIEndpoint {
+
+    protected $base_endpoint_url;
+    protected $admin_username;
+    protected $admin_password;
+    protected $verify_peer;
+
+    function __construct($base_endpoint_url, $admin_username, $admin_password, $verify_peer) {
+        $this->base_endpoint_url = $base_endpoint_url;
+        $this->admin_username = $admin_username;
+        $this->admin_password = $admin_password;
+        $this->verify_peer = $verify_peer;
+    }
+
+    protected function getAPIAccessToken($realm) {
+
+        // http://www.keycloak.org/docs/2.5/server_development/topics/admin-rest-api.html
+        // curl -d client_id=admin-cli -d username=username \
+        //   -d "password=password" -d grant_type=password https://149.165.156.62:8443/auth/realms/master/protocol/openid-connect/token
+
+        $r = curl_init($this->base_endpoint_url . '/realms/' . rawurlencode($realm) . '/protocol/openid-connect/token');
+        curl_setopt($r, CURLOPT_RETURNTRANSFER, 1);
+        curl_setopt($r, CURLOPT_ENCODING, 1);
+        curl_setopt($r, CURLOPT_SSL_VERIFYPEER, $this->verify_peer);
+
+        // Assemble POST parameters for the request.
+        $post_fields = "client_id=admin-cli&username=" . urlencode($this->admin_username) . "&password=" . urlencode($this->admin_password) . "&grant_type=password";
+
+        // Obtain and return the access token from the response.
+        curl_setopt($r, CURLOPT_POST, true);
+        curl_setopt($r, CURLOPT_POSTFIELDS, $post_fields);
+
+        $response = curl_exec($r);
+        if ($response == false) {
+            Log::error("Failed to retrieve API Access Token");
+            die("curl_exec() failed. Error: " . curl_error($r));
+        }
+
+        $result = json_decode($response);
+        // Log::debug("API Access Token result", array($result));
+        return $result->access_token;
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/e9f3b24a/app/libraries/Keycloak/API/RoleMapper.php
----------------------------------------------------------------------
diff --git a/app/libraries/Keycloak/API/RoleMapper.php b/app/libraries/Keycloak/API/RoleMapper.php
index 18a477b..f2fab42 100644
--- a/app/libraries/Keycloak/API/RoleMapper.php
+++ b/app/libraries/Keycloak/API/RoleMapper.php
@@ -10,19 +10,7 @@ use Log;
  * This class provide an easy to use interface for
  * the Keycloak RoleMapper REST API.
  */
-class RoleMapper {
-
-    private $base_endpoint_url;
-    private $admin_username;
-    private $admin_password;
-    private $verify_peer;
-
-    public function __construct($base_endpoint_url, $admin_username, $admin_password, $verify_peer) {
-        $this->base_endpoint_url = $base_endpoint_url;
-        $this->admin_username = $admin_username;
-        $this->admin_password = $admin_password;
-        $this->verify_peer = $verify_peer;
-    }
+class RoleMapper extends BaseKeycloakAPIEndpoint {
 
     /**
      * Get realm-level role mappings for a user
@@ -35,7 +23,7 @@ class RoleMapper {
         // curl -H "Authorization: bearer $access_token" https://149.165.156.62:8443/auth/admin/realms/airavata/users/2c9ad2c6-0212-4aef-a5fb-9df862578934/role-mappings/realm
 
         // get access token for admin API
-        $access_token = $this->getAPIAccessToken();
+        $access_token = $this->getAPIAccessToken($realm);
         $url = $this->base_endpoint_url . '/admin/realms/' . rawurlencode($realm) . '/users/' . rawurlencode($user_id) . '/role-mappings/realm';
         // Log::debug("getRealmRoleMappingsForUser url", array($url));
         $r = curl_init($url);
@@ -63,7 +51,7 @@ class RoleMapper {
     public function addRealmRoleMappingsToUser($realm, $user_id, $role_representations) {
 
         // get access token for admin API
-        $access_token = $this->getAPIAccessToken();
+        $access_token = $this->getAPIAccessToken($realm);
         $url = $this->base_endpoint_url . '/admin/realms/' . rawurlencode($realm) . '/users/' . rawurlencode($user_id) . '/role-mappings/realm';
         // Log::debug("addRealmRoleMappingsToUser", array($url, $role_representations));
         $r = curl_init($url);
@@ -96,7 +84,7 @@ class RoleMapper {
     public function deleteRealmRoleMappingsToUser($realm, $user_id, $role_representations) {
 
         // get access token for admin API
-        $access_token = $this->getAPIAccessToken();
+        $access_token = $this->getAPIAccessToken($realm);
         $url = $this->base_endpoint_url . '/admin/realms/' . rawurlencode($realm) . '/users/' . rawurlencode($user_id) . '/role-mappings/realm';
         // Log::debug("deleteRealmRoleMappingsToUser", array($url, $role_representations));
         $r = curl_init($url);
@@ -122,34 +110,4 @@ class RoleMapper {
         }
         return;
     }
-
-    // TODO: factor this out into base class?
-    private function getAPIAccessToken() {
-
-        // http://www.keycloak.org/docs/2.5/server_development/topics/admin-rest-api.html
-        // curl -d client_id=admin-cli -d username=username \
-        //   -d "password=password" -d grant_type=password https://149.165.156.62:8443/auth/realms/master/protocol/openid-connect/token
-
-        $r = curl_init($this->base_endpoint_url . '/realms/master/protocol/openid-connect/token');
-        curl_setopt($r, CURLOPT_RETURNTRANSFER, 1);
-        curl_setopt($r, CURLOPT_ENCODING, 1);
-        curl_setopt($r, CURLOPT_SSL_VERIFYPEER, $this->verify_peer);
-
-        // Assemble POST parameters for the request.
-        $post_fields = "client_id=admin-cli&username=" . urlencode($this->admin_username) . "&password=" . urlencode($this->admin_password) . "&grant_type=password";
-
-        // Obtain and return the access token from the response.
-        curl_setopt($r, CURLOPT_POST, true);
-        curl_setopt($r, CURLOPT_POSTFIELDS, $post_fields);
-
-        $response = curl_exec($r);
-        if ($response == false) {
-            Log::error("Failed to retrieve API Access Token");
-            die("curl_exec() failed. Error: " . curl_error($r));
-        }
-
-        $result = json_decode($response);
-        // Log::debug("API Access Token result", array($result));
-        return $result->access_token;
-    }
 }

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/e9f3b24a/app/libraries/Keycloak/API/Roles.php
----------------------------------------------------------------------
diff --git a/app/libraries/Keycloak/API/Roles.php b/app/libraries/Keycloak/API/Roles.php
index 02f5b8f..565b860 100644
--- a/app/libraries/Keycloak/API/Roles.php
+++ b/app/libraries/Keycloak/API/Roles.php
@@ -7,19 +7,7 @@ namespace Keycloak\API;
  * This class provide an easy to use interface for
  * the Keycloak Roles REST API.
  */
-class Roles {
-
-    private $base_endpoint_url;
-    private $admin_username;
-    private $admin_password;
-    private $verify_peer;
-
-    public function __construct($base_endpoint_url, $admin_username, $admin_password, $verify_peer) {
-        $this->base_endpoint_url = $base_endpoint_url;
-        $this->admin_username = $admin_username;
-        $this->admin_password = $admin_password;
-        $this->verify_peer = $verify_peer;
-    }
+class Roles extends BaseKeycloakAPIEndpoint {
 
     /**
      * Get representations of all of a realm's roles
@@ -29,7 +17,7 @@ class Roles {
     public function getRoles($realm){
 
         // get access token for admin API
-        $access_token = $this->getAPIAccessToken();
+        $access_token = $this->getAPIAccessToken($realm);
         $r = curl_init($this->base_endpoint_url . '/admin/realms/' . rawurlencode($realm) . '/roles');
         curl_setopt($r, CURLOPT_RETURNTRANSFER, 1);
         curl_setopt($r, CURLOPT_ENCODING, 1);
@@ -46,33 +34,4 @@ class Roles {
         // Log::debug("getRealmRoleMappingsForUser result", array($result));
         return $result;
     }
-
-    // TODO: factor this out into base class?
-    private function getAPIAccessToken() {
-
-        // http://www.keycloak.org/docs/2.5/server_development/topics/admin-rest-api.html
-        // curl -d client_id=admin-cli -d username=username \
-        //   -d "password=password" -d grant_type=password https://149.165.156.62:8443/auth/realms/master/protocol/openid-connect/token
-
-        $r = curl_init($this->base_endpoint_url . '/realms/master/protocol/openid-connect/token');
-        curl_setopt($r, CURLOPT_RETURNTRANSFER, 1);
-        curl_setopt($r, CURLOPT_ENCODING, 1);
-        curl_setopt($r, CURLOPT_SSL_VERIFYPEER, $this->verify_peer);
-
-        // Assemble POST parameters for the request.
-        $post_fields = "client_id=admin-cli&username=" . urlencode($this->admin_username) . "&password=" . urlencode($this->admin_password) . "&grant_type=password";
-
-        // Obtain and return the access token from the response.
-        curl_setopt($r, CURLOPT_POST, true);
-        curl_setopt($r, CURLOPT_POSTFIELDS, $post_fields);
-
-        $response = curl_exec($r);
-        if ($response == false) {
-            die("curl_exec() failed. Error: " . curl_error($r));
-        }
-
-        $result = json_decode($response);
-        // Log::debug("API Access Token result", array($result));
-        return $result->access_token;
-    }
 }

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/e9f3b24a/app/libraries/Keycloak/API/Users.php
----------------------------------------------------------------------
diff --git a/app/libraries/Keycloak/API/Users.php b/app/libraries/Keycloak/API/Users.php
index 089ad3a..d03be02 100644
--- a/app/libraries/Keycloak/API/Users.php
+++ b/app/libraries/Keycloak/API/Users.php
@@ -9,19 +9,7 @@ use Log;
  * This class provide an easy to use interface for
  * the Keycloak Users REST API.
  */
-class Users {
-
-    private $base_endpoint_url;
-    private $admin_username;
-    private $admin_password;
-    private $verify_peer;
-
-    public function __construct($base_endpoint_url, $admin_username, $admin_password, $verify_peer) {
-        $this->base_endpoint_url = $base_endpoint_url;
-        $this->admin_username = $admin_username;
-        $this->admin_password = $admin_password;
-        $this->verify_peer = $verify_peer;
-    }
+class Users extends BaseKeycloakAPIEndpoint {
 
     /**
      * Get representations of all users
@@ -31,7 +19,7 @@ class Users {
     public function getUsers($realm, $username = null){
 
         // get access token for admin API
-        $access_token = $this->getAPIAccessToken();
+        $access_token = $this->getAPIAccessToken($realm);
         $url = $this->base_endpoint_url . '/admin/realms/' . rawurlencode($realm) . '/users';
         if ($username) {
             $url = $url . '?username=' . rawurlencode($username);
@@ -64,7 +52,7 @@ class Users {
     public function searchUsers($realm, $keyword){
 
         // get access token for admin API
-        $access_token = $this->getAPIAccessToken();
+        $access_token = $this->getAPIAccessToken($realm);
         $url = $this->base_endpoint_url . '/admin/realms/' . rawurlencode($realm) . '/users?search=' . rawurlencode($keyword);
         // Log::debug("getUsers url", array($url));
         $r = curl_init($url);
@@ -92,7 +80,7 @@ class Users {
     public function getUser($realm, $user_id) {
 
         // get access token for admin API
-        $access_token = $this->getAPIAccessToken();
+        $access_token = $this->getAPIAccessToken($realm);
         $url = $this->base_endpoint_url . '/admin/realms/' . rawurlencode($realm) . '/users/' . rawurlencode($user_id);
         // Log::debug("getUser url", array($url));
         $r = curl_init($url);
@@ -111,33 +99,4 @@ class Users {
         // Log::debug("getUsers result", array($result));
         return $result;
     }
-
-    // TODO: factor this out into base class?
-    private function getAPIAccessToken() {
-
-        // http://www.keycloak.org/docs/2.5/server_development/topics/admin-rest-api.html
-        // curl -d client_id=admin-cli -d username=username \
-        //   -d "password=password" -d grant_type=password https://149.165.156.62:8443/auth/realms/master/protocol/openid-connect/token
-
-        $r = curl_init($this->base_endpoint_url . '/realms/master/protocol/openid-connect/token');
-        curl_setopt($r, CURLOPT_RETURNTRANSFER, 1);
-        curl_setopt($r, CURLOPT_ENCODING, 1);
-        curl_setopt($r, CURLOPT_SSL_VERIFYPEER, $this->verify_peer);
-
-        // Assemble POST parameters for the request.
-        $post_fields = "client_id=admin-cli&username=" . urlencode($this->admin_username) . "&password=" . urlencode($this->admin_password) . "&grant_type=password";
-
-        // Obtain and return the access token from the response.
-        curl_setopt($r, CURLOPT_POST, true);
-        curl_setopt($r, CURLOPT_POSTFIELDS, $post_fields);
-
-        $response = curl_exec($r);
-        if ($response == false) {
-            die("curl_exec() failed. Error: " . curl_error($r));
-        }
-
-        $result = json_decode($response);
-        // Log::debug("API Access Token result", array($result));
-        return $result->access_token;
-    }
 }

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/e9f3b24a/app/libraries/Keycloak/Keycloak.php
----------------------------------------------------------------------
diff --git a/app/libraries/Keycloak/Keycloak.php b/app/libraries/Keycloak/Keycloak.php
index 1f876b0..71706e5 100644
--- a/app/libraries/Keycloak/Keycloak.php
+++ b/app/libraries/Keycloak/Keycloak.php
@@ -43,6 +43,51 @@ class Keycloak {
         $this->users = new Users($base_endpoint_url, $admin_username, $admin_password, $verify_peer);
     }
 
+    /**
+     * Function to authenticate user
+     *
+     * @param string $username
+     * @param string $password
+     * @return boolean
+     * @throws Exception
+     */
+     public function authenticate($username, $password){
+
+        $config = $this->getOpenIDConnectDiscoveryConfiguration();
+        $token_endpoint = $config->token_endpoint;
+
+        // Init cUrl.
+        $r = curl_init($token_endpoint);
+        curl_setopt($r, CURLOPT_RETURNTRANSFER, 1);
+        // Decode compressed responses.
+        curl_setopt($r, CURLOPT_ENCODING, 1);
+        curl_setopt($r, CURLOPT_SSL_VERIFYPEER, $this->verify_peer);
+
+        // Add client ID and client secret to the headers.
+        curl_setopt($r, CURLOPT_HTTPHEADER, array(
+            "Authorization: Basic " . base64_encode($this->client_id . ":" . $this->client_secret),
+        ));
+
+        // Assemble POST parameters for the request.
+        $post_fields = "client_id=" . urlencode($this->client_id) . "&client_secret=" . urlencode($this->client_secret) . "&grant_type=password";
+        $post_fields .= "&username=" . urlencode($username) . "&password=" . urlencode($password);
+
+        // Obtain and return the access token from the response.
+        curl_setopt($r, CURLOPT_POST, true);
+        curl_setopt($r, CURLOPT_POSTFIELDS, $post_fields);
+
+        $response = curl_exec($r);
+        if ($response == false) {
+            die("curl_exec() failed. Error: " . curl_error($r));
+        }
+
+        //Parse JSON return object.
+        $result = json_decode($response);
+        // Log::debug("password grant type authenciation response", array($result));
+
+        return $result;
+     }
+
     public function getOAuthRequestCodeUrl(){
         $config = $this->getOpenIDConnectDiscoveryConfiguration();
         $authorization_endpoint = $config->authorization_endpoint;


[05/50] [abbrv] airavata-php-gateway git commit: AIRAVATA-2342 WIP implementation on user roles management

Posted by ma...@apache.org.
AIRAVATA-2342 WIP implementation on user roles management


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

Branch: refs/heads/develop
Commit: 471b3808b85ebd6dac6b31b025b90f92fcf64f34
Parents: c92cc2b
Author: Marcus Christie <ma...@iu.edu>
Authored: Thu Mar 23 14:36:40 2017 -0400
Committer: Marcus Christie <ma...@iu.edu>
Committed: Thu Mar 23 14:36:40 2017 -0400

----------------------------------------------------------------------
 app/controllers/AdminController.php       | 34 +++++-----
 app/libraries/Keycloak/API/RoleMapper.php | 40 ++++++++++-
 app/libraries/Keycloak/API/Roles.php      | 78 ++++++++++++++++++++++
 app/libraries/Keycloak/API/Users.php      | 85 ++++++++++++++++++++++++
 app/libraries/Keycloak/Keycloak.php       | 91 ++++++++++++++++++++++++++
 app/views/admin/manage-users.blade.php    | 24 ++++---
 6 files changed, 324 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/471b3808/app/controllers/AdminController.php
----------------------------------------------------------------------
diff --git a/app/controllers/AdminController.php b/app/controllers/AdminController.php
index 6dd27bd..b2f95d7 100644
--- a/app/controllers/AdminController.php
+++ b/app/controllers/AdminController.php
@@ -70,9 +70,9 @@ class AdminController extends BaseController {
 			$users = AdminController::getUsersWithRole( Input::get("role"));
 		}
 		else
-	    	$users =  WSIS::listUsers();
+			$users =  Keycloak::listUsers();
 
-	    $roles = WSIS::getAllRoles();
+	    $roles = Keycloak::getAllRoles();
         Session::put("admin-nav", "manage-users");
 	    return View::make("admin/manage-users", array("users" => $users, "roles" => $roles));
 	}
@@ -88,12 +88,12 @@ class AdminController extends BaseController {
             $users =  WSIS::searchUsers(Input::get("search_val"));
         }
         else
-            $users = WSIS::listUsers();
+            $users = Keycloak::listUsers();
 
 		if(!isset($users) || empty($users)){
 			$users = array();
 		}
-        $roles = WSIS::getAllRoles();
+        $roles = Keycloak::getAllRoles();
         Session::put("admin-nav", "manage-users");
         return View::make("admin/manage-users", array("users" => $users, "roles" => $roles));
 
@@ -184,7 +184,7 @@ class AdminController extends BaseController {
 	}
 
 	public function rolesView(){
-		$roles = WSIS::getAllRoles();
+		$roles = Keycloak::getAllRoles();
         Session::put("admin-nav", "manage-roles");
         return View::make("admin/manage-roles", array("roles" => $roles));
 	}
@@ -211,7 +211,7 @@ class AdminController extends BaseController {
 	}
 
     public function addRolesToUser(){
-        $currentRoles = WSIS::getUserRoles(Input::get("username"));
+        $currentRoles = Keycloak::getUserRoles(Input::get("userId"));
 		if(!is_array($currentRoles))
 			$currentRoles = array($currentRoles);
         $roles["new"] = array_diff(Input::all()["roles"], $currentRoles);
@@ -227,12 +227,12 @@ class AdminController extends BaseController {
             unset($roles["deleted"][$index]);
         }
 
-        $username = Input::all()["username"];
-        WSIS::updateUserRoles($username, $roles);
-        $newCurrentRoles = WSIS::getUserRoles(Input::get("username"));
+        $userId = Input::all()["userId"];
+        Keycloak::updateUserRoles($userId, $roles);
+        $newCurrentRoles = Keycloak::getUserRoles($userId);
         if(in_array(Config::get("pga_config.wsis")["admin-role-name"], $newCurrentRoles) || in_array(Config::get("pga_config.wsis")["read-only-admin-role-name"], $newCurrentRoles)
                 || in_array(Config::get("pga_config.wsis")["user-role-name"], $newCurrentRoles)){
-            $userProfile = WSIS::getUserProfile(Input::get("username"));
+            $userProfile = Keycloak::getUserProfile($userId);
             $recipients = array($userProfile["email"]);
             $this->sendAccessGrantedEmailToTheUser(Input::get("username"), $recipients);
 
@@ -246,12 +246,12 @@ class AdminController extends BaseController {
                 if(in_array($initialRoleName, $newCurrentRoles) && !in_array($initialRoleName, $roles["new"])) {
                     $userRoles["new"] = array();
                     $userRoles["deleted"] = $initialRoleName;
-                    WSIS::updateUserRoles( $username, $userRoles);
+                    Keycloak::updateUserRoles( $userId, $userRoles);
                 } else if(in_array($initialRoleName, $newCurrentRoles) && in_array($initialRoleName, $roles["new"])) {
                     // When initial role added remove all roles except for initial role and Internal/everyone
                     $userRoles["new"] = array();
                     $userRoles["deleted"] = array_diff($newCurrentRoles, array($initialRoleName, "Internal/everyone"));
-                    WSIS::updateUserRoles( $username, $userRoles);
+                    Keycloak::updateUserRoles( $userId, $userRoles);
                 }
             }
         }
@@ -277,13 +277,13 @@ class AdminController extends BaseController {
     public function removeRoleFromUser(){
         $roles["deleted"] = array(Input::all()["roleName"]);
         $roles["new"] = array();
-        $username = Input::all()["username"];
-        WSIS::updateUserRoles($username, $roles);
+        $userId = Input::all()["userId"];
+        Keycloak::updateUserRoles($userId, $roles);
         return Redirect::to("admin/dashboard/roles")->with( "message", "Role has been deleted.");
     }
 
 	public function getRoles(){
-		return json_encode((array)WSIS::getUserRoles(Input::get("username")));
+		return json_encode((array)Keycloak::getUserRoles(Input::get("userId")));
 	}
 
 	public function deleteRole(){
@@ -300,7 +300,7 @@ class AdminController extends BaseController {
 		return View::make("admin/manage-credentials", array("tokens" => $tokens , "pwdTokens" => $pwdTokens) );
 	}
 
-	private function sendAccessGrantedEmailToTheUser($username, $recipients){
+	private function sendAccessGrantedEmailToTheUser($username, $userId, $recipients){
 
 		$mail = new PHPMailer;
 
@@ -326,7 +326,7 @@ class AdminController extends BaseController {
 		$mail->isHTML(true);
 
 		$mail->Subject = "Your user account (".$username.") privileges changed!";
-		$userProfile = WSIS::getUserProfile($username);
+		$userProfile = WSIS::getUserProfile($userId);
 		$wsisConfig = Config::get('pga_config.wsis');
 		if( $wsisConfig['tenant-domain'] == "")
 			$username = $username;

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/471b3808/app/libraries/Keycloak/API/RoleMapper.php
----------------------------------------------------------------------
diff --git a/app/libraries/Keycloak/API/RoleMapper.php b/app/libraries/Keycloak/API/RoleMapper.php
index 2e6d170..e79246e 100644
--- a/app/libraries/Keycloak/API/RoleMapper.php
+++ b/app/libraries/Keycloak/API/RoleMapper.php
@@ -35,7 +35,9 @@ class RoleMapper {
 
         // get access token for admin API
         $access_token = $this->getAPIAccessToken();
-        $r = curl_init($this->base_endpoint_url . '/admin/realms/' . rawurlencode($realm) . '/users/' . rawurlencode($user_id) . '/role-mappings/realm');
+        $url = $this->base_endpoint_url . '/admin/realms/' . rawurlencode($realm) . '/users/' . rawurlencode($user_id) . '/role-mappings/realm';
+        // Log::debug("getRealmRoleMappingsForUser url", array($url));
+        $r = curl_init($url);
         curl_setopt($r, CURLOPT_RETURNTRANSFER, 1);
         curl_setopt($r, CURLOPT_ENCODING, 1);
         curl_setopt($r, CURLOPT_SSL_VERIFYPEER, $this->verify_peer);
@@ -45,6 +47,7 @@ class RoleMapper {
 
         $response = curl_exec($r);
         if ($response == false) {
+            Log::error("Failed to retrieve realm role mappings for user");
             die("curl_exec() failed. Error: " . curl_error($r));
         }
         $result = json_decode($response);
@@ -52,6 +55,40 @@ class RoleMapper {
         return $result;
     }
 
+    // TODO: change this to an Array of role representations
+    public function addRealmRoleMappingsToUser($realm, $user_id, $role_representations) {
+
+        // get access token for admin API
+        $access_token = $this->getAPIAccessToken();
+        $url = $this->base_endpoint_url . '/admin/realms/' . rawurlencode($realm) . '/users/' . rawurlencode($user_id) . '/role-mappings/realm';
+        // Log::debug("addRealmRoleMappingsToUser", array($url, $role_representations));
+        $r = curl_init($url);
+        curl_setopt($r, CURLOPT_RETURNTRANSFER, 1);
+        curl_setopt($r, CURLOPT_ENCODING, 1);
+        curl_setopt($r, CURLOPT_SSL_VERIFYPEER, $this->verify_peer);
+        curl_setopt($r, CURLOPT_HTTPHEADER, array(
+            "Authorization: Bearer " . $access_token
+        ));
+
+        curl_setopt($r, CURLOPT_POST, true);
+        $data = json_encode($role_representations);
+        curl_setopt($r, CURLOPT_HTTPHEADER, array(
+            'Content-Type: application/json',
+            'Content-Length: ' . strlen($data))
+        );
+        curl_setopt($r, CURLOPT_POSTFIELDS, $data);
+
+        $response = curl_exec($r);
+        if ($response == false) {
+            Log::error("Failed to add realm role mapping to user");
+            die("curl_exec() failed. Error: " . curl_error($r));
+        }
+        $result = json_decode($response);
+        $info = curl_getinfo($r);
+        // Log::debug("addRealmRoleMappingsToUser result", array($result, $info));
+        return $result;
+    }
+
     // TODO: factor this out into base class?
     private function getAPIAccessToken() {
 
@@ -73,6 +110,7 @@ class RoleMapper {
 
         $response = curl_exec($r);
         if ($response == false) {
+            Log::error("Failed to retrieve API Access Token");
             die("curl_exec() failed. Error: " . curl_error($r));
         }
 

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/471b3808/app/libraries/Keycloak/API/Roles.php
----------------------------------------------------------------------
diff --git a/app/libraries/Keycloak/API/Roles.php b/app/libraries/Keycloak/API/Roles.php
new file mode 100644
index 0000000..02f5b8f
--- /dev/null
+++ b/app/libraries/Keycloak/API/Roles.php
@@ -0,0 +1,78 @@
+<?php
+namespace Keycloak\API;
+
+/**
+ * Roles class
+ *
+ * This class provide an easy to use interface for
+ * the Keycloak Roles REST API.
+ */
+class Roles {
+
+    private $base_endpoint_url;
+    private $admin_username;
+    private $admin_password;
+    private $verify_peer;
+
+    public function __construct($base_endpoint_url, $admin_username, $admin_password, $verify_peer) {
+        $this->base_endpoint_url = $base_endpoint_url;
+        $this->admin_username = $admin_username;
+        $this->admin_password = $admin_password;
+        $this->verify_peer = $verify_peer;
+    }
+
+    /**
+     * Get representations of all of a realm's roles
+     * GET /admin/realms/{realm}/roles
+     * Returns Array of RoleRepresentation
+     */
+    public function getRoles($realm){
+
+        // get access token for admin API
+        $access_token = $this->getAPIAccessToken();
+        $r = curl_init($this->base_endpoint_url . '/admin/realms/' . rawurlencode($realm) . '/roles');
+        curl_setopt($r, CURLOPT_RETURNTRANSFER, 1);
+        curl_setopt($r, CURLOPT_ENCODING, 1);
+        curl_setopt($r, CURLOPT_SSL_VERIFYPEER, $this->verify_peer);
+        curl_setopt($r, CURLOPT_HTTPHEADER, array(
+            "Authorization: Bearer " . $access_token
+        ));
+
+        $response = curl_exec($r);
+        if ($response == false) {
+            die("curl_exec() failed. Error: " . curl_error($r));
+        }
+        $result = json_decode($response);
+        // Log::debug("getRealmRoleMappingsForUser result", array($result));
+        return $result;
+    }
+
+    // TODO: factor this out into base class?
+    private function getAPIAccessToken() {
+
+        // http://www.keycloak.org/docs/2.5/server_development/topics/admin-rest-api.html
+        // curl -d client_id=admin-cli -d username=username \
+        //   -d "password=password" -d grant_type=password https://149.165.156.62:8443/auth/realms/master/protocol/openid-connect/token
+
+        $r = curl_init($this->base_endpoint_url . '/realms/master/protocol/openid-connect/token');
+        curl_setopt($r, CURLOPT_RETURNTRANSFER, 1);
+        curl_setopt($r, CURLOPT_ENCODING, 1);
+        curl_setopt($r, CURLOPT_SSL_VERIFYPEER, $this->verify_peer);
+
+        // Assemble POST parameters for the request.
+        $post_fields = "client_id=admin-cli&username=" . urlencode($this->admin_username) . "&password=" . urlencode($this->admin_password) . "&grant_type=password";
+
+        // Obtain and return the access token from the response.
+        curl_setopt($r, CURLOPT_POST, true);
+        curl_setopt($r, CURLOPT_POSTFIELDS, $post_fields);
+
+        $response = curl_exec($r);
+        if ($response == false) {
+            die("curl_exec() failed. Error: " . curl_error($r));
+        }
+
+        $result = json_decode($response);
+        // Log::debug("API Access Token result", array($result));
+        return $result->access_token;
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/471b3808/app/libraries/Keycloak/API/Users.php
----------------------------------------------------------------------
diff --git a/app/libraries/Keycloak/API/Users.php b/app/libraries/Keycloak/API/Users.php
new file mode 100644
index 0000000..ac99995
--- /dev/null
+++ b/app/libraries/Keycloak/API/Users.php
@@ -0,0 +1,85 @@
+<?php
+namespace Keycloak\API;
+
+use Log;
+
+/**
+ * Users class
+ *
+ * This class provide an easy to use interface for
+ * the Keycloak Users REST API.
+ */
+class Users {
+
+    private $base_endpoint_url;
+    private $admin_username;
+    private $admin_password;
+    private $verify_peer;
+
+    public function __construct($base_endpoint_url, $admin_username, $admin_password, $verify_peer) {
+        $this->base_endpoint_url = $base_endpoint_url;
+        $this->admin_username = $admin_username;
+        $this->admin_password = $admin_password;
+        $this->verify_peer = $verify_peer;
+    }
+
+    /**
+     * Get representations of all users
+     * GET /admin/realms/{realm}/users
+     * Returns Array of UserRepresentation
+     */
+    public function getUsers($realm, $username = null){
+
+        // get access token for admin API
+        $access_token = $this->getAPIAccessToken();
+        $url = $this->base_endpoint_url . '/admin/realms/' . rawurlencode($realm) . '/users';
+        if ($username) {
+            $url = $url . '?username=' . rawurlencode($username);
+        }
+        // Log::debug("getUsers url", array($url));
+        $r = curl_init($this->base_endpoint_url . '/admin/realms/' . rawurlencode($realm) . '/users');
+        curl_setopt($r, CURLOPT_RETURNTRANSFER, 1);
+        curl_setopt($r, CURLOPT_ENCODING, 1);
+        curl_setopt($r, CURLOPT_SSL_VERIFYPEER, $this->verify_peer);
+        curl_setopt($r, CURLOPT_HTTPHEADER, array(
+            "Authorization: Bearer " . $access_token
+        ));
+
+        $response = curl_exec($r);
+        if ($response == false) {
+            die("curl_exec() failed. Error: " . curl_error($r));
+        }
+        $result = json_decode($response);
+        // Log::debug("getUsers result", array($result));
+        return $result;
+    }
+
+    // TODO: factor this out into base class?
+    private function getAPIAccessToken() {
+
+        // http://www.keycloak.org/docs/2.5/server_development/topics/admin-rest-api.html
+        // curl -d client_id=admin-cli -d username=username \
+        //   -d "password=password" -d grant_type=password https://149.165.156.62:8443/auth/realms/master/protocol/openid-connect/token
+
+        $r = curl_init($this->base_endpoint_url . '/realms/master/protocol/openid-connect/token');
+        curl_setopt($r, CURLOPT_RETURNTRANSFER, 1);
+        curl_setopt($r, CURLOPT_ENCODING, 1);
+        curl_setopt($r, CURLOPT_SSL_VERIFYPEER, $this->verify_peer);
+
+        // Assemble POST parameters for the request.
+        $post_fields = "client_id=admin-cli&username=" . urlencode($this->admin_username) . "&password=" . urlencode($this->admin_password) . "&grant_type=password";
+
+        // Obtain and return the access token from the response.
+        curl_setopt($r, CURLOPT_POST, true);
+        curl_setopt($r, CURLOPT_POSTFIELDS, $post_fields);
+
+        $response = curl_exec($r);
+        if ($response == false) {
+            die("curl_exec() failed. Error: " . curl_error($r));
+        }
+
+        $result = json_decode($response);
+        // Log::debug("API Access Token result", array($result));
+        return $result->access_token;
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/471b3808/app/libraries/Keycloak/Keycloak.php
----------------------------------------------------------------------
diff --git a/app/libraries/Keycloak/Keycloak.php b/app/libraries/Keycloak/Keycloak.php
index 93ac99d..5dc57d4 100644
--- a/app/libraries/Keycloak/Keycloak.php
+++ b/app/libraries/Keycloak/Keycloak.php
@@ -3,7 +3,10 @@
 namespace Keycloak;
 
 use Keycloak\API\RoleMapper;
+use Keycloak\API\Roles;
+use Keycloak\API\Users;
 
+use Exception;
 use Log;
 use Illuminate\Routing\UrlGenerator;
 use Illuminate\Support\Facades\Config;
@@ -17,7 +20,10 @@ class Keycloak {
     private $callback_url;
     private $verify_peer;
 
+    // API clients
     private $role_mapper;
+    private $roles;
+    private $users;
 
     /**
      * Constructor
@@ -33,6 +39,8 @@ class Keycloak {
         $this->verify_peer = $verify_peer;
 
         $this->role_mapper = new RoleMapper($base_endpoint_url, $admin_username, $admin_password, $verify_peer);
+        $this->roles = new Roles($base_endpoint_url, $admin_username, $admin_password, $verify_peer);
+        $this->users = new Users($base_endpoint_url, $admin_username, $admin_password, $verify_peer);
     }
 
     public function getOAuthRequestCodeUrl(){
@@ -118,6 +126,89 @@ class Keycloak {
         return array('username'=>$username, 'firstname'=>$firstname, 'lastname'=>$lastname, 'email'=>$email, 'roles'=>$roles);
     }
 
+    /**
+     * Function to list users
+     *
+     * @return Array of username and user id
+     */
+    public function listUsers(){
+        $users = $this->users->getUsers($this->realm);
+        $user_infos = [];
+        foreach ($users as $user) {
+            $user_infos[] = array("username" => $user->username, "id" => $user->id);
+        }
+        return $user_infos;
+    }
+
+    /**
+     * Function to get the list of all existing roles
+     * For Keycloak this is a list of "Realm roles"
+     *
+     * @return roles list
+     */
+    public function getAllRoles(){
+        try {
+            $roles = $this->roles->getRoles($this->realm);
+            $role_names = [];
+            foreach ($roles as $role) {
+                $role_names[] = $role->name;
+            }
+            return $role_names;
+        } catch (Exception $ex) {
+            throw new Exception("Unable to get all roles", 0, $ex);
+        }
+    }
+
+    /**
+     * Function to get roles of a user
+     * For Keycloak this is a list of "Realm roles"
+     *
+     * @return array of role names
+     */
+    public function getUserRoles( $userid ){
+        try {
+            // Get the user's realm roles, then convert to an array of just names
+            $roles = $this->role_mapper->getRealmRoleMappingsForUser($this->realm, $userid);
+            $role_names = [];
+            foreach ($roles as $role) {
+                $role_names[] = $role->name;
+            }
+            return $role_names;
+        } catch (Exception $ex) {
+            throw new Exception("Unable to get User roles.", 0, $ex);
+        }
+    }
+
+    /**
+     * Function to update role list of user
+     *
+     * @param $user_id
+     * @param $roles, an Array with two entries, "deleted" and "new", each of
+     * which has a value of roles to be removed or added respectively
+     * @return void
+     */
+    public function updateUserRoles( $user_id, $roles){
+        Log::debug("updateUserRoles", array($user_id, $roles));
+        try {
+            // Get all of the roles into an array keyed by role name
+            $all_roles = $this->roles->getRoles($this->realm);
+            $roles_by_name = [];
+            foreach ($all_roles as $role) {
+                $roles_by_name[$role->name] = $role;
+            }
+            // Process the role additions
+            if(isset($roles["new"])){
+                if(!is_array($roles["new"]))
+                    $roles["new"] = array($roles["new"]);
+                foreach ($roles["new"] as $role) {
+                    $this->role_mapper->addRealmRoleMappingsToUser($this->realm, $user_id, array($roles_by_name[$role]));
+                }
+            }
+        } catch (Exception $ex) {
+            throw new Exception("Unable to update role of the user.", 0, $ex);
+        }
+    }
+
     private function getOpenIDConnectDiscoveryConfiguration() {
 
         // TODO: cache the result of the request

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/471b3808/app/views/admin/manage-users.blade.php
----------------------------------------------------------------------
diff --git a/app/views/admin/manage-users.blade.php b/app/views/admin/manage-users.blade.php
index 9f36ca8..15818ae 100644
--- a/app/views/admin/manage-users.blade.php
+++ b/app/views/admin/manage-users.blade.php
@@ -68,10 +68,10 @@
                     </tr>
                     @foreach( (array)$users as $user)
                     <tr class="user-row">
-                        <td>{{ $user }}</td>
+                        <td>{{ $user["username"] }}</td>
                         <td>
                             <button class="button btn btn-default check-roles" type="button"
-                                    data-username="{{$user}}">Check All Roles
+                                    data-username="{{$user["username"]}}" data-userid="{{$user["id"]}}">Check All Roles
                             </button>
                             <div class="user-roles"></div>
                         </td>
@@ -113,7 +113,7 @@
                                 @endif
                             @endforeach
                         </select>
-                        <button type="button" class="btn btn-primary add-roles-submit" data-username="">Add Roles
+                        <button type="button" class="btn btn-primary add-roles-submit" data-username="" data-userid="">Add Roles
                         </button>
                     </div>
                 </div>
@@ -161,12 +161,12 @@
                 type: "POST",
                 url: $(".base-url").val() + "/admin/remove-role-from-user",
                 data: {
-                    username: userName,
+                    userId: userId,
                     roleName:$(this).attr("roleName")
                 }
             }).complete(function (data) {
                 //getting user's existing roles
-                repopulatePopup( userName);
+                repopulatePopup( userName, userId );
                 $(".success-message").html("<span class='alert alert-success col-md-12'>Role has been removed</span>");
             });
         }
@@ -174,7 +174,8 @@
 
     function update_users_existing_roles(that){
         userName = $(that).data("username");
-        repopulatePopup( userName);
+        userId = $(that).data("userid");
+        repopulatePopup( userName, userId );
     }
 
     $(".check-roles").click(function () {
@@ -191,7 +192,8 @@
         $(".success-message").html("");
         $(this).attr("disabled", "disabled");
         $(this).html("<img src='" + $(".base-url").val() + "/assets/ajax-loader.gif'/>");
-        userName = $(this).data("username");
+        userId = $(this).data("userid");
+        username = $(this).data("username");
         var rolesToAdd = $(".new-roles-select").val();
         if(rolesToAdd != null){
             $(".roles-list").find(".role-name").each(function () {
@@ -202,7 +204,8 @@
                 url: $(".base-url").val() + "/admin/add-roles-to-user",
                 data: {
                     add: true,
-                    username: userName,
+                    userId: userId,
+                    username: username,
                     roles: rolesToAdd
                 },
                 success : function(data)
@@ -221,20 +224,21 @@
         }
     });
 
-    function repopulatePopup( username){
+    function repopulatePopup( userName, userId ){
 
         $("#check-role-block").modal("show");
         $(".roles-of-user").html("User : " + userName);
         $(".roles-load").removeClass("hide");
         $(".roles-list").addClass("hide");
         $(".add-roles-submit").data("username", userName);
+        $(".add-roles-submit").data("userid", userId);
         $(document).find(".alert-success").remove();
 
         $.ajax({
             type: "POST",
             url: $(".base-url").val() + "/admin/check-roles",
             data: {
-                username: userName
+                userId: userId
             }
         }).complete(function (data) {
             roles = JSON.parse(data.responseText);


[44/50] [abbrv] airavata-php-gateway git commit: AIRAVATA-2408 Switching User Profile calls to Profile Service

Posted by ma...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/3c17052f/app/libraries/Airavata/Service/Profile/User/CPI/UserProfileService.php
----------------------------------------------------------------------
diff --git a/app/libraries/Airavata/Service/Profile/User/CPI/UserProfileService.php b/app/libraries/Airavata/Service/Profile/User/CPI/UserProfileService.php
new file mode 100644
index 0000000..6c773b6
--- /dev/null
+++ b/app/libraries/Airavata/Service/Profile/User/CPI/UserProfileService.php
@@ -0,0 +1,2025 @@
+<?php
+namespace Airavata\Service\Profile\User\CPI;
+/**
+ * Autogenerated by Thrift Compiler (0.9.3)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ *  @generated
+ */
+use Thrift\Base\TBase;
+use Thrift\Type\TType;
+use Thrift\Type\TMessageType;
+use Thrift\Exception\TException;
+use Thrift\Exception\TProtocolException;
+use Thrift\Protocol\TProtocol;
+use Thrift\Protocol\TBinaryProtocolAccelerated;
+use Thrift\Exception\TApplicationException;
+
+
+interface UserProfileServiceIf {
+  /**
+   * @param \Airavata\Model\Security\AuthzToken $authzToken
+   * @param \Airavata\Model\User\UserProfile $userProfile
+   * @return string
+   * @throws \Airavata\Service\Profile\User\CPI\Error\UserProfileServiceException
+   * @throws \Airavata\API\Error\AuthorizationException
+   */
+  public function addUserProfile(\Airavata\Model\Security\AuthzToken $authzToken, \Airavata\Model\User\UserProfile $userProfile);
+  /**
+   * @param \Airavata\Model\Security\AuthzToken $authzToken
+   * @param \Airavata\Model\User\UserProfile $userProfile
+   * @return bool
+   * @throws \Airavata\Service\Profile\User\CPI\Error\UserProfileServiceException
+   * @throws \Airavata\API\Error\AuthorizationException
+   */
+  public function updateUserProfile(\Airavata\Model\Security\AuthzToken $authzToken, \Airavata\Model\User\UserProfile $userProfile);
+  /**
+   * @param \Airavata\Model\Security\AuthzToken $authzToken
+   * @param string $userId
+   * @param string $gatewayId
+   * @return \Airavata\Model\User\UserProfile * A structure holding the user profile and its child models.
+   * *
+   * * Notes:
+   * *  The model does not include passwords as it is assumed an external identity provider is used to authenticate user.
+   * *  References:
+   * *     NSF Demographic Information - http://www.nsf.gov/pubs/2000/00form1225/00form1225.doc
+   * *     LDAP Schema - https://tools.ietf.org/html/rfc4519
+   * *     SCIM 2.0 - https://tools.ietf.org/html/rfc7643
+   * *
+   * * userModelVersion:
+   * *  Version number of profile
+   * *
+   * * airavataInternalUserId:
+   * *  internal to Airavata, not intended to be used outside of the Airavata platform or possibly by gateways
+   * *  (that is, never shown to users), never reassigned, REQUIRED
+   * *
+   * * userId:
+   * *  Externally assertable unique identifier. SAML (primarly in higher education, academic) tends to keep
+   * *   user name less opaque. OpenID Connect maintains them to be opaque.
+   * *
+   * * firstName, middleName, lastName:
+   * *  First and Last names as assertede by the user
+   * *
+   * * namePrefix, nameSuffix:
+   * *  prefix and suffix to the users name as asserted by the user
+   * *
+   * * emails:
+   * *   Email identifier are Verified, REQUIRED and MULTIVALUED
+   * *
+   * * userName:
+   * *  Name-based identifiers can be multivalues. To keep it simple, Airavata will make it a string.
+   * *   In the future these can be enumerated as:
+   *     *   Official name (as asserted possibly by some external identity provider)
+   *     *   Prefered name (as asserted or suggested by user directly)
+   *     *   Components:
+   *     *      givenName
+   *     *      surname (familyName)
+   *     *      displayName (often asserted by user to handle things like middle names, suffix, prefix, and the like)
+   * *
+   * * orcidId: ORCID ID - http://orcid.org/about/what-is-orcid)
+   * *
+   * * phones: Telephone MULTIVALUED
+   * *
+   * * country: Country of Residance
+   * *
+   * * nationality Countries of citizenship
+   * *
+   * * comments:
+   * *   Free-form information (treated as opaque by Airavata and simply passed to resource).
+   * *
+   * * labeledURI:
+   *   * Google Scholar, Web of Science, ACS, e.t.c
+   * *
+   * * timeZone:
+   * *  User’s preferred timezone - IANA Timezone Databases - http://www.iana.org/time-zones.
+   * *
+   * 
+   * @throws \Airavata\Service\Profile\User\CPI\Error\UserProfileServiceException
+   * @throws \Airavata\API\Error\AuthorizationException
+   */
+  public function getUserProfileById(\Airavata\Model\Security\AuthzToken $authzToken, $userId, $gatewayId);
+  /**
+   * @param \Airavata\Model\Security\AuthzToken $authzToken
+   * @param string $userId
+   * @param string $gatewayId
+   * @return bool
+   * @throws \Airavata\Service\Profile\User\CPI\Error\UserProfileServiceException
+   * @throws \Airavata\API\Error\AuthorizationException
+   */
+  public function deleteUserProfile(\Airavata\Model\Security\AuthzToken $authzToken, $userId, $gatewayId);
+  /**
+   * @param \Airavata\Model\Security\AuthzToken $authzToken
+   * @param string $gatewayId
+   * @param int $offset
+   * @param int $limit
+   * @return \Airavata\Model\User\UserProfile[]
+   * @throws \Airavata\Service\Profile\User\CPI\Error\UserProfileServiceException
+   * @throws \Airavata\API\Error\AuthorizationException
+   */
+  public function getAllUserProfilesInGateway(\Airavata\Model\Security\AuthzToken $authzToken, $gatewayId, $offset, $limit);
+  /**
+   * @param \Airavata\Model\Security\AuthzToken $authzToken
+   * @param string $userId
+   * @param string $gatewayId
+   * @return bool
+   * @throws \Airavata\Service\Profile\User\CPI\Error\UserProfileServiceException
+   * @throws \Airavata\API\Error\AuthorizationException
+   */
+  public function doesUserExist(\Airavata\Model\Security\AuthzToken $authzToken, $userId, $gatewayId);
+}
+
+class UserProfileServiceClient implements \Airavata\Service\Profile\User\CPI\UserProfileServiceIf {
+  protected $input_ = null;
+  protected $output_ = null;
+
+  protected $seqid_ = 0;
+
+  public function __construct($input, $output=null) {
+    $this->input_ = $input;
+    $this->output_ = $output ? $output : $input;
+  }
+
+  public function addUserProfile(\Airavata\Model\Security\AuthzToken $authzToken, \Airavata\Model\User\UserProfile $userProfile)
+  {
+    $this->send_addUserProfile($authzToken, $userProfile);
+    return $this->recv_addUserProfile();
+  }
+
+  public function send_addUserProfile(\Airavata\Model\Security\AuthzToken $authzToken, \Airavata\Model\User\UserProfile $userProfile)
+  {
+    $args = new \Airavata\Service\Profile\User\CPI\UserProfileService_addUserProfile_args();
+    $args->authzToken = $authzToken;
+    $args->userProfile = $userProfile;
+    $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');
+    if ($bin_accel)
+    {
+      thrift_protocol_write_binary($this->output_, 'addUserProfile', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());
+    }
+    else
+    {
+      $this->output_->writeMessageBegin('addUserProfile', TMessageType::CALL, $this->seqid_);
+      $args->write($this->output_);
+      $this->output_->writeMessageEnd();
+      $this->output_->getTransport()->flush();
+    }
+  }
+
+  public function recv_addUserProfile()
+  {
+    $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');
+    if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\Airavata\Service\Profile\User\CPI\UserProfileService_addUserProfile_result', $this->input_->isStrictRead());
+    else
+    {
+      $rseqid = 0;
+      $fname = null;
+      $mtype = 0;
+
+      $this->input_->readMessageBegin($fname, $mtype, $rseqid);
+      if ($mtype == TMessageType::EXCEPTION) {
+        $x = new TApplicationException();
+        $x->read($this->input_);
+        $this->input_->readMessageEnd();
+        throw $x;
+      }
+      $result = new \Airavata\Service\Profile\User\CPI\UserProfileService_addUserProfile_result();
+      $result->read($this->input_);
+      $this->input_->readMessageEnd();
+    }
+    if ($result->success !== null) {
+      return $result->success;
+    }
+    if ($result->upe !== null) {
+      throw $result->upe;
+    }
+    if ($result->ae !== null) {
+      throw $result->ae;
+    }
+    throw new \Exception("addUserProfile failed: unknown result");
+  }
+
+  public function updateUserProfile(\Airavata\Model\Security\AuthzToken $authzToken, \Airavata\Model\User\UserProfile $userProfile)
+  {
+    $this->send_updateUserProfile($authzToken, $userProfile);
+    return $this->recv_updateUserProfile();
+  }
+
+  public function send_updateUserProfile(\Airavata\Model\Security\AuthzToken $authzToken, \Airavata\Model\User\UserProfile $userProfile)
+  {
+    $args = new \Airavata\Service\Profile\User\CPI\UserProfileService_updateUserProfile_args();
+    $args->authzToken = $authzToken;
+    $args->userProfile = $userProfile;
+    $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');
+    if ($bin_accel)
+    {
+      thrift_protocol_write_binary($this->output_, 'updateUserProfile', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());
+    }
+    else
+    {
+      $this->output_->writeMessageBegin('updateUserProfile', TMessageType::CALL, $this->seqid_);
+      $args->write($this->output_);
+      $this->output_->writeMessageEnd();
+      $this->output_->getTransport()->flush();
+    }
+  }
+
+  public function recv_updateUserProfile()
+  {
+    $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');
+    if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\Airavata\Service\Profile\User\CPI\UserProfileService_updateUserProfile_result', $this->input_->isStrictRead());
+    else
+    {
+      $rseqid = 0;
+      $fname = null;
+      $mtype = 0;
+
+      $this->input_->readMessageBegin($fname, $mtype, $rseqid);
+      if ($mtype == TMessageType::EXCEPTION) {
+        $x = new TApplicationException();
+        $x->read($this->input_);
+        $this->input_->readMessageEnd();
+        throw $x;
+      }
+      $result = new \Airavata\Service\Profile\User\CPI\UserProfileService_updateUserProfile_result();
+      $result->read($this->input_);
+      $this->input_->readMessageEnd();
+    }
+    if ($result->success !== null) {
+      return $result->success;
+    }
+    if ($result->upe !== null) {
+      throw $result->upe;
+    }
+    if ($result->ae !== null) {
+      throw $result->ae;
+    }
+    throw new \Exception("updateUserProfile failed: unknown result");
+  }
+
+  public function getUserProfileById(\Airavata\Model\Security\AuthzToken $authzToken, $userId, $gatewayId)
+  {
+    $this->send_getUserProfileById($authzToken, $userId, $gatewayId);
+    return $this->recv_getUserProfileById();
+  }
+
+  public function send_getUserProfileById(\Airavata\Model\Security\AuthzToken $authzToken, $userId, $gatewayId)
+  {
+    $args = new \Airavata\Service\Profile\User\CPI\UserProfileService_getUserProfileById_args();
+    $args->authzToken = $authzToken;
+    $args->userId = $userId;
+    $args->gatewayId = $gatewayId;
+    $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');
+    if ($bin_accel)
+    {
+      thrift_protocol_write_binary($this->output_, 'getUserProfileById', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());
+    }
+    else
+    {
+      $this->output_->writeMessageBegin('getUserProfileById', TMessageType::CALL, $this->seqid_);
+      $args->write($this->output_);
+      $this->output_->writeMessageEnd();
+      $this->output_->getTransport()->flush();
+    }
+  }
+
+  public function recv_getUserProfileById()
+  {
+    $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');
+    if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\Airavata\Service\Profile\User\CPI\UserProfileService_getUserProfileById_result', $this->input_->isStrictRead());
+    else
+    {
+      $rseqid = 0;
+      $fname = null;
+      $mtype = 0;
+
+      $this->input_->readMessageBegin($fname, $mtype, $rseqid);
+      if ($mtype == TMessageType::EXCEPTION) {
+        $x = new TApplicationException();
+        $x->read($this->input_);
+        $this->input_->readMessageEnd();
+        throw $x;
+      }
+      $result = new \Airavata\Service\Profile\User\CPI\UserProfileService_getUserProfileById_result();
+      $result->read($this->input_);
+      $this->input_->readMessageEnd();
+    }
+    if ($result->success !== null) {
+      return $result->success;
+    }
+    if ($result->upe !== null) {
+      throw $result->upe;
+    }
+    if ($result->ae !== null) {
+      throw $result->ae;
+    }
+    throw new \Exception("getUserProfileById failed: unknown result");
+  }
+
+  public function deleteUserProfile(\Airavata\Model\Security\AuthzToken $authzToken, $userId, $gatewayId)
+  {
+    $this->send_deleteUserProfile($authzToken, $userId, $gatewayId);
+    return $this->recv_deleteUserProfile();
+  }
+
+  public function send_deleteUserProfile(\Airavata\Model\Security\AuthzToken $authzToken, $userId, $gatewayId)
+  {
+    $args = new \Airavata\Service\Profile\User\CPI\UserProfileService_deleteUserProfile_args();
+    $args->authzToken = $authzToken;
+    $args->userId = $userId;
+    $args->gatewayId = $gatewayId;
+    $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');
+    if ($bin_accel)
+    {
+      thrift_protocol_write_binary($this->output_, 'deleteUserProfile', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());
+    }
+    else
+    {
+      $this->output_->writeMessageBegin('deleteUserProfile', TMessageType::CALL, $this->seqid_);
+      $args->write($this->output_);
+      $this->output_->writeMessageEnd();
+      $this->output_->getTransport()->flush();
+    }
+  }
+
+  public function recv_deleteUserProfile()
+  {
+    $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');
+    if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\Airavata\Service\Profile\User\CPI\UserProfileService_deleteUserProfile_result', $this->input_->isStrictRead());
+    else
+    {
+      $rseqid = 0;
+      $fname = null;
+      $mtype = 0;
+
+      $this->input_->readMessageBegin($fname, $mtype, $rseqid);
+      if ($mtype == TMessageType::EXCEPTION) {
+        $x = new TApplicationException();
+        $x->read($this->input_);
+        $this->input_->readMessageEnd();
+        throw $x;
+      }
+      $result = new \Airavata\Service\Profile\User\CPI\UserProfileService_deleteUserProfile_result();
+      $result->read($this->input_);
+      $this->input_->readMessageEnd();
+    }
+    if ($result->success !== null) {
+      return $result->success;
+    }
+    if ($result->upe !== null) {
+      throw $result->upe;
+    }
+    if ($result->ae !== null) {
+      throw $result->ae;
+    }
+    throw new \Exception("deleteUserProfile failed: unknown result");
+  }
+
+  public function getAllUserProfilesInGateway(\Airavata\Model\Security\AuthzToken $authzToken, $gatewayId, $offset, $limit)
+  {
+    $this->send_getAllUserProfilesInGateway($authzToken, $gatewayId, $offset, $limit);
+    return $this->recv_getAllUserProfilesInGateway();
+  }
+
+  public function send_getAllUserProfilesInGateway(\Airavata\Model\Security\AuthzToken $authzToken, $gatewayId, $offset, $limit)
+  {
+    $args = new \Airavata\Service\Profile\User\CPI\UserProfileService_getAllUserProfilesInGateway_args();
+    $args->authzToken = $authzToken;
+    $args->gatewayId = $gatewayId;
+    $args->offset = $offset;
+    $args->limit = $limit;
+    $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');
+    if ($bin_accel)
+    {
+      thrift_protocol_write_binary($this->output_, 'getAllUserProfilesInGateway', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());
+    }
+    else
+    {
+      $this->output_->writeMessageBegin('getAllUserProfilesInGateway', TMessageType::CALL, $this->seqid_);
+      $args->write($this->output_);
+      $this->output_->writeMessageEnd();
+      $this->output_->getTransport()->flush();
+    }
+  }
+
+  public function recv_getAllUserProfilesInGateway()
+  {
+    $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');
+    if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\Airavata\Service\Profile\User\CPI\UserProfileService_getAllUserProfilesInGateway_result', $this->input_->isStrictRead());
+    else
+    {
+      $rseqid = 0;
+      $fname = null;
+      $mtype = 0;
+
+      $this->input_->readMessageBegin($fname, $mtype, $rseqid);
+      if ($mtype == TMessageType::EXCEPTION) {
+        $x = new TApplicationException();
+        $x->read($this->input_);
+        $this->input_->readMessageEnd();
+        throw $x;
+      }
+      $result = new \Airavata\Service\Profile\User\CPI\UserProfileService_getAllUserProfilesInGateway_result();
+      $result->read($this->input_);
+      $this->input_->readMessageEnd();
+    }
+    if ($result->success !== null) {
+      return $result->success;
+    }
+    if ($result->upe !== null) {
+      throw $result->upe;
+    }
+    if ($result->ae !== null) {
+      throw $result->ae;
+    }
+    throw new \Exception("getAllUserProfilesInGateway failed: unknown result");
+  }
+
+  public function doesUserExist(\Airavata\Model\Security\AuthzToken $authzToken, $userId, $gatewayId)
+  {
+    $this->send_doesUserExist($authzToken, $userId, $gatewayId);
+    return $this->recv_doesUserExist();
+  }
+
+  public function send_doesUserExist(\Airavata\Model\Security\AuthzToken $authzToken, $userId, $gatewayId)
+  {
+    $args = new \Airavata\Service\Profile\User\CPI\UserProfileService_doesUserExist_args();
+    $args->authzToken = $authzToken;
+    $args->userId = $userId;
+    $args->gatewayId = $gatewayId;
+    $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');
+    if ($bin_accel)
+    {
+      thrift_protocol_write_binary($this->output_, 'doesUserExist', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());
+    }
+    else
+    {
+      $this->output_->writeMessageBegin('doesUserExist', TMessageType::CALL, $this->seqid_);
+      $args->write($this->output_);
+      $this->output_->writeMessageEnd();
+      $this->output_->getTransport()->flush();
+    }
+  }
+
+  public function recv_doesUserExist()
+  {
+    $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');
+    if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\Airavata\Service\Profile\User\CPI\UserProfileService_doesUserExist_result', $this->input_->isStrictRead());
+    else
+    {
+      $rseqid = 0;
+      $fname = null;
+      $mtype = 0;
+
+      $this->input_->readMessageBegin($fname, $mtype, $rseqid);
+      if ($mtype == TMessageType::EXCEPTION) {
+        $x = new TApplicationException();
+        $x->read($this->input_);
+        $this->input_->readMessageEnd();
+        throw $x;
+      }
+      $result = new \Airavata\Service\Profile\User\CPI\UserProfileService_doesUserExist_result();
+      $result->read($this->input_);
+      $this->input_->readMessageEnd();
+    }
+    if ($result->success !== null) {
+      return $result->success;
+    }
+    if ($result->upe !== null) {
+      throw $result->upe;
+    }
+    if ($result->ae !== null) {
+      throw $result->ae;
+    }
+    throw new \Exception("doesUserExist failed: unknown result");
+  }
+
+}
+
+// HELPER FUNCTIONS AND STRUCTURES
+
+class UserProfileService_addUserProfile_args {
+  static $_TSPEC;
+
+  /**
+   * @var \Airavata\Model\Security\AuthzToken
+   */
+  public $authzToken = null;
+  /**
+   * @var \Airavata\Model\User\UserProfile
+   */
+  public $userProfile = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        1 => array(
+          'var' => 'authzToken',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\Model\Security\AuthzToken',
+          ),
+        2 => array(
+          'var' => 'userProfile',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\Model\User\UserProfile',
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['authzToken'])) {
+        $this->authzToken = $vals['authzToken'];
+      }
+      if (isset($vals['userProfile'])) {
+        $this->userProfile = $vals['userProfile'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'UserProfileService_addUserProfile_args';
+  }
+
+  public function read($input)
+  {
+    $xfer = 0;
+    $fname = null;
+    $ftype = 0;
+    $fid = 0;
+    $xfer += $input->readStructBegin($fname);
+    while (true)
+    {
+      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
+      if ($ftype == TType::STOP) {
+        break;
+      }
+      switch ($fid)
+      {
+        case 1:
+          if ($ftype == TType::STRUCT) {
+            $this->authzToken = new \Airavata\Model\Security\AuthzToken();
+            $xfer += $this->authzToken->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 2:
+          if ($ftype == TType::STRUCT) {
+            $this->userProfile = new \Airavata\Model\User\UserProfile();
+            $xfer += $this->userProfile->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        default:
+          $xfer += $input->skip($ftype);
+          break;
+      }
+      $xfer += $input->readFieldEnd();
+    }
+    $xfer += $input->readStructEnd();
+    return $xfer;
+  }
+
+  public function write($output) {
+    $xfer = 0;
+    $xfer += $output->writeStructBegin('UserProfileService_addUserProfile_args');
+    if ($this->authzToken !== null) {
+      if (!is_object($this->authzToken)) {
+        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
+      }
+      $xfer += $output->writeFieldBegin('authzToken', TType::STRUCT, 1);
+      $xfer += $this->authzToken->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->userProfile !== null) {
+      if (!is_object($this->userProfile)) {
+        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
+      }
+      $xfer += $output->writeFieldBegin('userProfile', TType::STRUCT, 2);
+      $xfer += $this->userProfile->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
+class UserProfileService_addUserProfile_result {
+  static $_TSPEC;
+
+  /**
+   * @var string
+   */
+  public $success = null;
+  /**
+   * @var \Airavata\Service\Profile\User\CPI\Error\UserProfileServiceException
+   */
+  public $upe = null;
+  /**
+   * @var \Airavata\API\Error\AuthorizationException
+   */
+  public $ae = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        0 => array(
+          'var' => 'success',
+          'type' => TType::STRING,
+          ),
+        1 => array(
+          'var' => 'upe',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\Service\Profile\User\CPI\Error\UserProfileServiceException',
+          ),
+        2 => array(
+          'var' => 'ae',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\API\Error\AuthorizationException',
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['success'])) {
+        $this->success = $vals['success'];
+      }
+      if (isset($vals['upe'])) {
+        $this->upe = $vals['upe'];
+      }
+      if (isset($vals['ae'])) {
+        $this->ae = $vals['ae'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'UserProfileService_addUserProfile_result';
+  }
+
+  public function read($input)
+  {
+    $xfer = 0;
+    $fname = null;
+    $ftype = 0;
+    $fid = 0;
+    $xfer += $input->readStructBegin($fname);
+    while (true)
+    {
+      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
+      if ($ftype == TType::STOP) {
+        break;
+      }
+      switch ($fid)
+      {
+        case 0:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->success);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 1:
+          if ($ftype == TType::STRUCT) {
+            $this->upe = new \Airavata\Service\Profile\User\CPI\Error\UserProfileServiceException();
+            $xfer += $this->upe->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 2:
+          if ($ftype == TType::STRUCT) {
+            $this->ae = new \Airavata\API\Error\AuthorizationException();
+            $xfer += $this->ae->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        default:
+          $xfer += $input->skip($ftype);
+          break;
+      }
+      $xfer += $input->readFieldEnd();
+    }
+    $xfer += $input->readStructEnd();
+    return $xfer;
+  }
+
+  public function write($output) {
+    $xfer = 0;
+    $xfer += $output->writeStructBegin('UserProfileService_addUserProfile_result');
+    if ($this->success !== null) {
+      $xfer += $output->writeFieldBegin('success', TType::STRING, 0);
+      $xfer += $output->writeString($this->success);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->upe !== null) {
+      $xfer += $output->writeFieldBegin('upe', TType::STRUCT, 1);
+      $xfer += $this->upe->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->ae !== null) {
+      $xfer += $output->writeFieldBegin('ae', TType::STRUCT, 2);
+      $xfer += $this->ae->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
+class UserProfileService_updateUserProfile_args {
+  static $_TSPEC;
+
+  /**
+   * @var \Airavata\Model\Security\AuthzToken
+   */
+  public $authzToken = null;
+  /**
+   * @var \Airavata\Model\User\UserProfile
+   */
+  public $userProfile = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        1 => array(
+          'var' => 'authzToken',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\Model\Security\AuthzToken',
+          ),
+        2 => array(
+          'var' => 'userProfile',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\Model\User\UserProfile',
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['authzToken'])) {
+        $this->authzToken = $vals['authzToken'];
+      }
+      if (isset($vals['userProfile'])) {
+        $this->userProfile = $vals['userProfile'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'UserProfileService_updateUserProfile_args';
+  }
+
+  public function read($input)
+  {
+    $xfer = 0;
+    $fname = null;
+    $ftype = 0;
+    $fid = 0;
+    $xfer += $input->readStructBegin($fname);
+    while (true)
+    {
+      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
+      if ($ftype == TType::STOP) {
+        break;
+      }
+      switch ($fid)
+      {
+        case 1:
+          if ($ftype == TType::STRUCT) {
+            $this->authzToken = new \Airavata\Model\Security\AuthzToken();
+            $xfer += $this->authzToken->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 2:
+          if ($ftype == TType::STRUCT) {
+            $this->userProfile = new \Airavata\Model\User\UserProfile();
+            $xfer += $this->userProfile->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        default:
+          $xfer += $input->skip($ftype);
+          break;
+      }
+      $xfer += $input->readFieldEnd();
+    }
+    $xfer += $input->readStructEnd();
+    return $xfer;
+  }
+
+  public function write($output) {
+    $xfer = 0;
+    $xfer += $output->writeStructBegin('UserProfileService_updateUserProfile_args');
+    if ($this->authzToken !== null) {
+      if (!is_object($this->authzToken)) {
+        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
+      }
+      $xfer += $output->writeFieldBegin('authzToken', TType::STRUCT, 1);
+      $xfer += $this->authzToken->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->userProfile !== null) {
+      if (!is_object($this->userProfile)) {
+        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
+      }
+      $xfer += $output->writeFieldBegin('userProfile', TType::STRUCT, 2);
+      $xfer += $this->userProfile->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
+class UserProfileService_updateUserProfile_result {
+  static $_TSPEC;
+
+  /**
+   * @var bool
+   */
+  public $success = null;
+  /**
+   * @var \Airavata\Service\Profile\User\CPI\Error\UserProfileServiceException
+   */
+  public $upe = null;
+  /**
+   * @var \Airavata\API\Error\AuthorizationException
+   */
+  public $ae = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        0 => array(
+          'var' => 'success',
+          'type' => TType::BOOL,
+          ),
+        1 => array(
+          'var' => 'upe',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\Service\Profile\User\CPI\Error\UserProfileServiceException',
+          ),
+        2 => array(
+          'var' => 'ae',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\API\Error\AuthorizationException',
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['success'])) {
+        $this->success = $vals['success'];
+      }
+      if (isset($vals['upe'])) {
+        $this->upe = $vals['upe'];
+      }
+      if (isset($vals['ae'])) {
+        $this->ae = $vals['ae'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'UserProfileService_updateUserProfile_result';
+  }
+
+  public function read($input)
+  {
+    $xfer = 0;
+    $fname = null;
+    $ftype = 0;
+    $fid = 0;
+    $xfer += $input->readStructBegin($fname);
+    while (true)
+    {
+      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
+      if ($ftype == TType::STOP) {
+        break;
+      }
+      switch ($fid)
+      {
+        case 0:
+          if ($ftype == TType::BOOL) {
+            $xfer += $input->readBool($this->success);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 1:
+          if ($ftype == TType::STRUCT) {
+            $this->upe = new \Airavata\Service\Profile\User\CPI\Error\UserProfileServiceException();
+            $xfer += $this->upe->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 2:
+          if ($ftype == TType::STRUCT) {
+            $this->ae = new \Airavata\API\Error\AuthorizationException();
+            $xfer += $this->ae->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        default:
+          $xfer += $input->skip($ftype);
+          break;
+      }
+      $xfer += $input->readFieldEnd();
+    }
+    $xfer += $input->readStructEnd();
+    return $xfer;
+  }
+
+  public function write($output) {
+    $xfer = 0;
+    $xfer += $output->writeStructBegin('UserProfileService_updateUserProfile_result');
+    if ($this->success !== null) {
+      $xfer += $output->writeFieldBegin('success', TType::BOOL, 0);
+      $xfer += $output->writeBool($this->success);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->upe !== null) {
+      $xfer += $output->writeFieldBegin('upe', TType::STRUCT, 1);
+      $xfer += $this->upe->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->ae !== null) {
+      $xfer += $output->writeFieldBegin('ae', TType::STRUCT, 2);
+      $xfer += $this->ae->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
+class UserProfileService_getUserProfileById_args {
+  static $_TSPEC;
+
+  /**
+   * @var \Airavata\Model\Security\AuthzToken
+   */
+  public $authzToken = null;
+  /**
+   * @var string
+   */
+  public $userId = null;
+  /**
+   * @var string
+   */
+  public $gatewayId = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        1 => array(
+          'var' => 'authzToken',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\Model\Security\AuthzToken',
+          ),
+        2 => array(
+          'var' => 'userId',
+          'type' => TType::STRING,
+          ),
+        3 => array(
+          'var' => 'gatewayId',
+          'type' => TType::STRING,
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['authzToken'])) {
+        $this->authzToken = $vals['authzToken'];
+      }
+      if (isset($vals['userId'])) {
+        $this->userId = $vals['userId'];
+      }
+      if (isset($vals['gatewayId'])) {
+        $this->gatewayId = $vals['gatewayId'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'UserProfileService_getUserProfileById_args';
+  }
+
+  public function read($input)
+  {
+    $xfer = 0;
+    $fname = null;
+    $ftype = 0;
+    $fid = 0;
+    $xfer += $input->readStructBegin($fname);
+    while (true)
+    {
+      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
+      if ($ftype == TType::STOP) {
+        break;
+      }
+      switch ($fid)
+      {
+        case 1:
+          if ($ftype == TType::STRUCT) {
+            $this->authzToken = new \Airavata\Model\Security\AuthzToken();
+            $xfer += $this->authzToken->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 2:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->userId);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 3:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->gatewayId);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        default:
+          $xfer += $input->skip($ftype);
+          break;
+      }
+      $xfer += $input->readFieldEnd();
+    }
+    $xfer += $input->readStructEnd();
+    return $xfer;
+  }
+
+  public function write($output) {
+    $xfer = 0;
+    $xfer += $output->writeStructBegin('UserProfileService_getUserProfileById_args');
+    if ($this->authzToken !== null) {
+      if (!is_object($this->authzToken)) {
+        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
+      }
+      $xfer += $output->writeFieldBegin('authzToken', TType::STRUCT, 1);
+      $xfer += $this->authzToken->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->userId !== null) {
+      $xfer += $output->writeFieldBegin('userId', TType::STRING, 2);
+      $xfer += $output->writeString($this->userId);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->gatewayId !== null) {
+      $xfer += $output->writeFieldBegin('gatewayId', TType::STRING, 3);
+      $xfer += $output->writeString($this->gatewayId);
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
+class UserProfileService_getUserProfileById_result {
+  static $_TSPEC;
+
+  /**
+   * @var \Airavata\Model\User\UserProfile
+   */
+  public $success = null;
+  /**
+   * @var \Airavata\Service\Profile\User\CPI\Error\UserProfileServiceException
+   */
+  public $upe = null;
+  /**
+   * @var \Airavata\API\Error\AuthorizationException
+   */
+  public $ae = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        0 => array(
+          'var' => 'success',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\Model\User\UserProfile',
+          ),
+        1 => array(
+          'var' => 'upe',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\Service\Profile\User\CPI\Error\UserProfileServiceException',
+          ),
+        2 => array(
+          'var' => 'ae',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\API\Error\AuthorizationException',
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['success'])) {
+        $this->success = $vals['success'];
+      }
+      if (isset($vals['upe'])) {
+        $this->upe = $vals['upe'];
+      }
+      if (isset($vals['ae'])) {
+        $this->ae = $vals['ae'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'UserProfileService_getUserProfileById_result';
+  }
+
+  public function read($input)
+  {
+    $xfer = 0;
+    $fname = null;
+    $ftype = 0;
+    $fid = 0;
+    $xfer += $input->readStructBegin($fname);
+    while (true)
+    {
+      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
+      if ($ftype == TType::STOP) {
+        break;
+      }
+      switch ($fid)
+      {
+        case 0:
+          if ($ftype == TType::STRUCT) {
+            $this->success = new \Airavata\Model\User\UserProfile();
+            $xfer += $this->success->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 1:
+          if ($ftype == TType::STRUCT) {
+            $this->upe = new \Airavata\Service\Profile\User\CPI\Error\UserProfileServiceException();
+            $xfer += $this->upe->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 2:
+          if ($ftype == TType::STRUCT) {
+            $this->ae = new \Airavata\API\Error\AuthorizationException();
+            $xfer += $this->ae->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        default:
+          $xfer += $input->skip($ftype);
+          break;
+      }
+      $xfer += $input->readFieldEnd();
+    }
+    $xfer += $input->readStructEnd();
+    return $xfer;
+  }
+
+  public function write($output) {
+    $xfer = 0;
+    $xfer += $output->writeStructBegin('UserProfileService_getUserProfileById_result');
+    if ($this->success !== null) {
+      if (!is_object($this->success)) {
+        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
+      }
+      $xfer += $output->writeFieldBegin('success', TType::STRUCT, 0);
+      $xfer += $this->success->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->upe !== null) {
+      $xfer += $output->writeFieldBegin('upe', TType::STRUCT, 1);
+      $xfer += $this->upe->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->ae !== null) {
+      $xfer += $output->writeFieldBegin('ae', TType::STRUCT, 2);
+      $xfer += $this->ae->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
+class UserProfileService_deleteUserProfile_args {
+  static $_TSPEC;
+
+  /**
+   * @var \Airavata\Model\Security\AuthzToken
+   */
+  public $authzToken = null;
+  /**
+   * @var string
+   */
+  public $userId = null;
+  /**
+   * @var string
+   */
+  public $gatewayId = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        1 => array(
+          'var' => 'authzToken',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\Model\Security\AuthzToken',
+          ),
+        2 => array(
+          'var' => 'userId',
+          'type' => TType::STRING,
+          ),
+        3 => array(
+          'var' => 'gatewayId',
+          'type' => TType::STRING,
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['authzToken'])) {
+        $this->authzToken = $vals['authzToken'];
+      }
+      if (isset($vals['userId'])) {
+        $this->userId = $vals['userId'];
+      }
+      if (isset($vals['gatewayId'])) {
+        $this->gatewayId = $vals['gatewayId'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'UserProfileService_deleteUserProfile_args';
+  }
+
+  public function read($input)
+  {
+    $xfer = 0;
+    $fname = null;
+    $ftype = 0;
+    $fid = 0;
+    $xfer += $input->readStructBegin($fname);
+    while (true)
+    {
+      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
+      if ($ftype == TType::STOP) {
+        break;
+      }
+      switch ($fid)
+      {
+        case 1:
+          if ($ftype == TType::STRUCT) {
+            $this->authzToken = new \Airavata\Model\Security\AuthzToken();
+            $xfer += $this->authzToken->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 2:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->userId);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 3:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->gatewayId);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        default:
+          $xfer += $input->skip($ftype);
+          break;
+      }
+      $xfer += $input->readFieldEnd();
+    }
+    $xfer += $input->readStructEnd();
+    return $xfer;
+  }
+
+  public function write($output) {
+    $xfer = 0;
+    $xfer += $output->writeStructBegin('UserProfileService_deleteUserProfile_args');
+    if ($this->authzToken !== null) {
+      if (!is_object($this->authzToken)) {
+        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
+      }
+      $xfer += $output->writeFieldBegin('authzToken', TType::STRUCT, 1);
+      $xfer += $this->authzToken->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->userId !== null) {
+      $xfer += $output->writeFieldBegin('userId', TType::STRING, 2);
+      $xfer += $output->writeString($this->userId);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->gatewayId !== null) {
+      $xfer += $output->writeFieldBegin('gatewayId', TType::STRING, 3);
+      $xfer += $output->writeString($this->gatewayId);
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
+class UserProfileService_deleteUserProfile_result {
+  static $_TSPEC;
+
+  /**
+   * @var bool
+   */
+  public $success = null;
+  /**
+   * @var \Airavata\Service\Profile\User\CPI\Error\UserProfileServiceException
+   */
+  public $upe = null;
+  /**
+   * @var \Airavata\API\Error\AuthorizationException
+   */
+  public $ae = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        0 => array(
+          'var' => 'success',
+          'type' => TType::BOOL,
+          ),
+        1 => array(
+          'var' => 'upe',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\Service\Profile\User\CPI\Error\UserProfileServiceException',
+          ),
+        2 => array(
+          'var' => 'ae',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\API\Error\AuthorizationException',
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['success'])) {
+        $this->success = $vals['success'];
+      }
+      if (isset($vals['upe'])) {
+        $this->upe = $vals['upe'];
+      }
+      if (isset($vals['ae'])) {
+        $this->ae = $vals['ae'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'UserProfileService_deleteUserProfile_result';
+  }
+
+  public function read($input)
+  {
+    $xfer = 0;
+    $fname = null;
+    $ftype = 0;
+    $fid = 0;
+    $xfer += $input->readStructBegin($fname);
+    while (true)
+    {
+      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
+      if ($ftype == TType::STOP) {
+        break;
+      }
+      switch ($fid)
+      {
+        case 0:
+          if ($ftype == TType::BOOL) {
+            $xfer += $input->readBool($this->success);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 1:
+          if ($ftype == TType::STRUCT) {
+            $this->upe = new \Airavata\Service\Profile\User\CPI\Error\UserProfileServiceException();
+            $xfer += $this->upe->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 2:
+          if ($ftype == TType::STRUCT) {
+            $this->ae = new \Airavata\API\Error\AuthorizationException();
+            $xfer += $this->ae->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        default:
+          $xfer += $input->skip($ftype);
+          break;
+      }
+      $xfer += $input->readFieldEnd();
+    }
+    $xfer += $input->readStructEnd();
+    return $xfer;
+  }
+
+  public function write($output) {
+    $xfer = 0;
+    $xfer += $output->writeStructBegin('UserProfileService_deleteUserProfile_result');
+    if ($this->success !== null) {
+      $xfer += $output->writeFieldBegin('success', TType::BOOL, 0);
+      $xfer += $output->writeBool($this->success);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->upe !== null) {
+      $xfer += $output->writeFieldBegin('upe', TType::STRUCT, 1);
+      $xfer += $this->upe->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->ae !== null) {
+      $xfer += $output->writeFieldBegin('ae', TType::STRUCT, 2);
+      $xfer += $this->ae->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
+class UserProfileService_getAllUserProfilesInGateway_args {
+  static $_TSPEC;
+
+  /**
+   * @var \Airavata\Model\Security\AuthzToken
+   */
+  public $authzToken = null;
+  /**
+   * @var string
+   */
+  public $gatewayId = null;
+  /**
+   * @var int
+   */
+  public $offset = null;
+  /**
+   * @var int
+   */
+  public $limit = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        1 => array(
+          'var' => 'authzToken',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\Model\Security\AuthzToken',
+          ),
+        2 => array(
+          'var' => 'gatewayId',
+          'type' => TType::STRING,
+          ),
+        3 => array(
+          'var' => 'offset',
+          'type' => TType::I32,
+          ),
+        4 => array(
+          'var' => 'limit',
+          'type' => TType::I32,
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['authzToken'])) {
+        $this->authzToken = $vals['authzToken'];
+      }
+      if (isset($vals['gatewayId'])) {
+        $this->gatewayId = $vals['gatewayId'];
+      }
+      if (isset($vals['offset'])) {
+        $this->offset = $vals['offset'];
+      }
+      if (isset($vals['limit'])) {
+        $this->limit = $vals['limit'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'UserProfileService_getAllUserProfilesInGateway_args';
+  }
+
+  public function read($input)
+  {
+    $xfer = 0;
+    $fname = null;
+    $ftype = 0;
+    $fid = 0;
+    $xfer += $input->readStructBegin($fname);
+    while (true)
+    {
+      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
+      if ($ftype == TType::STOP) {
+        break;
+      }
+      switch ($fid)
+      {
+        case 1:
+          if ($ftype == TType::STRUCT) {
+            $this->authzToken = new \Airavata\Model\Security\AuthzToken();
+            $xfer += $this->authzToken->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 2:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->gatewayId);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 3:
+          if ($ftype == TType::I32) {
+            $xfer += $input->readI32($this->offset);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 4:
+          if ($ftype == TType::I32) {
+            $xfer += $input->readI32($this->limit);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        default:
+          $xfer += $input->skip($ftype);
+          break;
+      }
+      $xfer += $input->readFieldEnd();
+    }
+    $xfer += $input->readStructEnd();
+    return $xfer;
+  }
+
+  public function write($output) {
+    $xfer = 0;
+    $xfer += $output->writeStructBegin('UserProfileService_getAllUserProfilesInGateway_args');
+    if ($this->authzToken !== null) {
+      if (!is_object($this->authzToken)) {
+        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
+      }
+      $xfer += $output->writeFieldBegin('authzToken', TType::STRUCT, 1);
+      $xfer += $this->authzToken->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->gatewayId !== null) {
+      $xfer += $output->writeFieldBegin('gatewayId', TType::STRING, 2);
+      $xfer += $output->writeString($this->gatewayId);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->offset !== null) {
+      $xfer += $output->writeFieldBegin('offset', TType::I32, 3);
+      $xfer += $output->writeI32($this->offset);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->limit !== null) {
+      $xfer += $output->writeFieldBegin('limit', TType::I32, 4);
+      $xfer += $output->writeI32($this->limit);
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
+class UserProfileService_getAllUserProfilesInGateway_result {
+  static $_TSPEC;
+
+  /**
+   * @var \Airavata\Model\User\UserProfile[]
+   */
+  public $success = null;
+  /**
+   * @var \Airavata\Service\Profile\User\CPI\Error\UserProfileServiceException
+   */
+  public $upe = null;
+  /**
+   * @var \Airavata\API\Error\AuthorizationException
+   */
+  public $ae = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        0 => array(
+          'var' => 'success',
+          'type' => TType::LST,
+          'etype' => TType::STRUCT,
+          'elem' => array(
+            'type' => TType::STRUCT,
+            'class' => '\Airavata\Model\User\UserProfile',
+            ),
+          ),
+        1 => array(
+          'var' => 'upe',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\Service\Profile\User\CPI\Error\UserProfileServiceException',
+          ),
+        2 => array(
+          'var' => 'ae',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\API\Error\AuthorizationException',
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['success'])) {
+        $this->success = $vals['success'];
+      }
+      if (isset($vals['upe'])) {
+        $this->upe = $vals['upe'];
+      }
+      if (isset($vals['ae'])) {
+        $this->ae = $vals['ae'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'UserProfileService_getAllUserProfilesInGateway_result';
+  }
+
+  public function read($input)
+  {
+    $xfer = 0;
+    $fname = null;
+    $ftype = 0;
+    $fid = 0;
+    $xfer += $input->readStructBegin($fname);
+    while (true)
+    {
+      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
+      if ($ftype == TType::STOP) {
+        break;
+      }
+      switch ($fid)
+      {
+        case 0:
+          if ($ftype == TType::LST) {
+            $this->success = array();
+            $_size0 = 0;
+            $_etype3 = 0;
+            $xfer += $input->readListBegin($_etype3, $_size0);
+            for ($_i4 = 0; $_i4 < $_size0; ++$_i4)
+            {
+              $elem5 = null;
+              $elem5 = new \Airavata\Model\User\UserProfile();
+              $xfer += $elem5->read($input);
+              $this->success []= $elem5;
+            }
+            $xfer += $input->readListEnd();
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 1:
+          if ($ftype == TType::STRUCT) {
+            $this->upe = new \Airavata\Service\Profile\User\CPI\Error\UserProfileServiceException();
+            $xfer += $this->upe->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 2:
+          if ($ftype == TType::STRUCT) {
+            $this->ae = new \Airavata\API\Error\AuthorizationException();
+            $xfer += $this->ae->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        default:
+          $xfer += $input->skip($ftype);
+          break;
+      }
+      $xfer += $input->readFieldEnd();
+    }
+    $xfer += $input->readStructEnd();
+    return $xfer;
+  }
+
+  public function write($output) {
+    $xfer = 0;
+    $xfer += $output->writeStructBegin('UserProfileService_getAllUserProfilesInGateway_result');
+    if ($this->success !== null) {
+      if (!is_array($this->success)) {
+        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
+      }
+      $xfer += $output->writeFieldBegin('success', TType::LST, 0);
+      {
+        $output->writeListBegin(TType::STRUCT, count($this->success));
+        {
+          foreach ($this->success as $iter6)
+          {
+            $xfer += $iter6->write($output);
+          }
+        }
+        $output->writeListEnd();
+      }
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->upe !== null) {
+      $xfer += $output->writeFieldBegin('upe', TType::STRUCT, 1);
+      $xfer += $this->upe->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->ae !== null) {
+      $xfer += $output->writeFieldBegin('ae', TType::STRUCT, 2);
+      $xfer += $this->ae->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
+class UserProfileService_doesUserExist_args {
+  static $_TSPEC;
+
+  /**
+   * @var \Airavata\Model\Security\AuthzToken
+   */
+  public $authzToken = null;
+  /**
+   * @var string
+   */
+  public $userId = null;
+  /**
+   * @var string
+   */
+  public $gatewayId = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        1 => array(
+          'var' => 'authzToken',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\Model\Security\AuthzToken',
+          ),
+        2 => array(
+          'var' => 'userId',
+          'type' => TType::STRING,
+          ),
+        3 => array(
+          'var' => 'gatewayId',
+          'type' => TType::STRING,
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['authzToken'])) {
+        $this->authzToken = $vals['authzToken'];
+      }
+      if (isset($vals['userId'])) {
+        $this->userId = $vals['userId'];
+      }
+      if (isset($vals['gatewayId'])) {
+        $this->gatewayId = $vals['gatewayId'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'UserProfileService_doesUserExist_args';
+  }
+
+  public function read($input)
+  {
+    $xfer = 0;
+    $fname = null;
+    $ftype = 0;
+    $fid = 0;
+    $xfer += $input->readStructBegin($fname);
+    while (true)
+    {
+      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
+      if ($ftype == TType::STOP) {
+        break;
+      }
+      switch ($fid)
+      {
+        case 1:
+          if ($ftype == TType::STRUCT) {
+            $this->authzToken = new \Airavata\Model\Security\AuthzToken();
+            $xfer += $this->authzToken->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 2:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->userId);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 3:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->gatewayId);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        default:
+          $xfer += $input->skip($ftype);
+          break;
+      }
+      $xfer += $input->readFieldEnd();
+    }
+    $xfer += $input->readStructEnd();
+    return $xfer;
+  }
+
+  public function write($output) {
+    $xfer = 0;
+    $xfer += $output->writeStructBegin('UserProfileService_doesUserExist_args');
+    if ($this->authzToken !== null) {
+      if (!is_object($this->authzToken)) {
+        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
+      }
+      $xfer += $output->writeFieldBegin('authzToken', TType::STRUCT, 1);
+      $xfer += $this->authzToken->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->userId !== null) {
+      $xfer += $output->writeFieldBegin('userId', TType::STRING, 2);
+      $xfer += $output->writeString($this->userId);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->gatewayId !== null) {
+      $xfer += $output->writeFieldBegin('gatewayId', TType::STRING, 3);
+      $xfer += $output->writeString($this->gatewayId);
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
+class UserProfileService_doesUserExist_result {
+  static $_TSPEC;
+
+  /**
+   * @var bool
+   */
+  public $success = null;
+  /**
+   * @var \Airavata\Service\Profile\User\CPI\Error\UserProfileServiceException
+   */
+  public $upe = null;
+  /**
+   * @var \Airavata\API\Error\AuthorizationException
+   */
+  public $ae = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        0 => array(
+          'var' => 'success',
+          'type' => TType::BOOL,
+          ),
+        1 => array(
+          'var' => 'upe',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\Service\Profile\User\CPI\Error\UserProfileServiceException',
+          ),
+        2 => array(
+          'var' => 'ae',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\API\Error\AuthorizationException',
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['success'])) {
+        $this->success = $vals['success'];
+      }
+      if (isset($vals['upe'])) {
+        $this->upe = $vals['upe'];
+      }
+      if (isset($vals['ae'])) {
+        $this->ae = $vals['ae'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'UserProfileService_doesUserExist_result';
+  }
+
+  public function read($input)
+  {
+    $xfer = 0;
+    $fname = null;
+    $ftype = 0;
+    $fid = 0;
+    $xfer += $input->readStructBegin($fname);
+    while (true)
+    {
+      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
+      if ($ftype == TType::STOP) {
+        break;
+      }
+      switch ($fid)
+      {
+        case 0:
+          if ($ftype == TType::BOOL) {
+            $xfer += $input->readBool($this->success);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 1:
+          if ($ftype == TType::STRUCT) {
+            $this->upe = new \Airavata\Service\Profile\User\CPI\Error\UserProfileServiceException();
+            $xfer += $this->upe->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 2:
+          if ($ftype == TType::STRUCT) {
+            $this->ae = new \Airavata\API\Error\AuthorizationException();
+            $xfer += $this->ae->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        default:
+          $xfer += $input->skip($ftype);
+          break;
+      }
+      $xfer += $input->readFieldEnd();
+    }
+    $xfer += $input->readStructEnd();
+    return $xfer;
+  }
+
+  public function write($output) {
+    $xfer = 0;
+    $xfer += $output->writeStructBegin('UserProfileService_doesUserExist_result');
+    if ($this->success !== null) {
+      $xfer += $output->writeFieldBegin('success', TType::BOOL, 0);
+      $xfer += $output->writeBool($this->success);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->upe !== null) {
+      $xfer += $output->writeFieldBegin('upe', TType::STRUCT, 1);
+      $xfer += $this->upe->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->ae !== null) {
+      $xfer += $output->writeFieldBegin('ae', TType::STRUCT, 2);
+      $xfer += $this->ae->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
+

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/3c17052f/app/libraries/Airavata/UserProfileServiceProvider.php
----------------------------------------------------------------------
diff --git a/app/libraries/Airavata/UserProfileServiceProvider.php b/app/libraries/Airavata/UserProfileServiceProvider.php
new file mode 100644
index 0000000..7a54b69
--- /dev/null
+++ b/app/libraries/Airavata/UserProfileServiceProvider.php
@@ -0,0 +1,83 @@
+<?php namespace Airavata;
+
+use Airavata\Service\Profile\User\CPI\UserProfileServiceClient;
+use Illuminate\Routing\UrlGenerator;
+use Illuminate\Support\ServiceProvider;
+use Illuminate\Support\Facades\Config;
+use Thrift\Transport\TSocket;
+use Thrift\Protocol\TBinaryProtocol;
+use Thrift\Protocol\TMultiplexedProtocol;
+use Illuminate\Routing\Redirector;
+
+class UserProfileServiceProvider extends ServiceProvider {
+
+	/**
+	 * Indicates if loading of the provider is deferred.
+	 *
+	 * @var bool
+	 */
+	protected $defer = false;
+
+    /**
+     * Bootstrap the application events.
+     *
+     * @return void
+     */
+    public function boot()
+    {
+        $this->package('airavata/user_profile_services');
+    }
+
+	/**
+	 * Register the service provider.
+	 *
+	 * @return void
+	 */
+	public function register()
+	{
+        //registering service provider
+        $this->app['user_profile_services'] = $this->app->share(function($app)
+        {
+            try{
+                $transport = new TSocket(
+                    Config::get('pga_config.airavata')['airavata-server'],
+                    Config::get('pga_config.airavata')['airavata-profile-service-port']
+                );
+                $transport->setRecvTimeout( Config::get('pga_config.airavata')['airavata-timeout']);
+                $transport->setSendTimeout( Config::get('pga_config.airavata')['airavata-timeout']);
+
+                $protocol = new TBinaryProtocol($transport);
+                $protocol = new TMultiplexedProtocol($protocol, "UserProfileService");
+                $transport->open();
+
+                $client = new UserProfileServiceClient($protocol);
+
+            }catch (\Exception $ex){
+                throw new \Exception("Unable to instantiate Airavata UserProfileService Client", 0,  $ex);
+            }
+
+            if( is_object( $client))
+                return $client;
+            else
+                throw new \Exception("Unable to instantiate Airavata UserProfileService Client");
+        });
+
+        //registering alis
+        $this->app->booting(function()
+        {
+            $loader = \Illuminate\Foundation\AliasLoader::getInstance();
+            $loader->alias('UserProfileService', 'Airavata\Facades\UserProfileServices');
+        });
+	}
+
+	/**
+	 * Get the services provided by the provider.
+	 *
+	 * @return array
+	 */
+	public function provides()
+	{
+		return array('user_profile_services');
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/3c17052f/app/libraries/UserProfileUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/UserProfileUtilities.php b/app/libraries/UserProfileUtilities.php
index 720bdd7..8d9c99d 100644
--- a/app/libraries/UserProfileUtilities.php
+++ b/app/libraries/UserProfileUtilities.php
@@ -8,7 +8,7 @@ class UserProfileUtilities
 
     public static function does_user_profile_exist($userId) {
         $gatewayId = Session::get('gateway_id');
-        return Airavata::doesUserProfileExist(Session::get('authz-token'), $userId, $gatewayId);
+        return UserProfileService::doesUserProfileExist(Session::get('authz-token'), $userId, $gatewayId);
     }
 
     public static function create_basic_user_profile($username, $userEmail) {
@@ -30,18 +30,18 @@ class UserProfileUtilities
         $userProfile->lastAccessTime = time();
         $userProfile->validUntil = -1;
         $userProfile->State = Status::ACTIVE;
-        return Airavata::addUserProfile(Session::get('authz-token'), $userProfile);
+        return UserProfileService::addUserProfile(Session::get('authz-token'), $userProfile);
     }
 
     public static function get_user_profile($userId) {
 
         $gatewayId = Session::get('gateway_id');
-        return Airavata::getUserProfileById(Session::get('authz-token'), $userId, $gatewayId);
+        return UserProfileService::getUserProfileById(Session::get('authz-token'), $userId, $gatewayId);
     }
 
     public static function update_user_profile($userProfile) {
 
-        return Airavata::updateUserProfile(Session::get('authz-token'), $userProfile);
+        return UserProfileService::updateUserProfile(Session::get('authz-token'), $userProfile);
     }
 }
 


[38/50] [abbrv] airavata-php-gateway git commit: AIRAVATA-2342 Success/error handling for reset password

Posted by ma...@apache.org.
AIRAVATA-2342 Success/error handling for reset password


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

Branch: refs/heads/develop
Commit: 9f754b2de51c43f0c0fb3fe9a3e247c373f4be35
Parents: c62cb17
Author: Marcus Christie <ma...@iu.edu>
Authored: Wed May 24 17:08:37 2017 -0400
Committer: Marcus Christie <ma...@iu.edu>
Committed: Wed May 24 17:08:37 2017 -0400

----------------------------------------------------------------------
 app/controllers/AccountController.php       | 27 ++++++++++++------------
 app/views/account/forgot-password.blade.php | 15 +++++++++++++
 app/views/account/login.blade.php           |  5 +++++
 app/views/account/reset-password.blade.php  |  5 +++++
 4 files changed, 39 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/9f754b2d/app/controllers/AccountController.php
----------------------------------------------------------------------
diff --git a/app/controllers/AccountController.php b/app/controllers/AccountController.php
index 7698ad3..a3a6194 100644
--- a/app/controllers/AccountController.php
+++ b/app/controllers/AccountController.php
@@ -278,12 +278,10 @@ class AccountController extends BaseController
             try{
                 $user_profile = Keycloak::getUserProfile($username);
                 EmailUtilities::sendPasswordResetEmail($username, $user_profile["firstname"], $user_profile["lastname"], $user_profile["email"]);
-                CommonUtilities::print_success_message("Password reset notification was sent to your email account");
-                return View::make("home");
+                return Redirect::to("forgot-password")->with("forgot-password-success", "Password reset notification was sent to your email account");
             }catch (Exception $ex){
                 Log::error($ex);
-                CommonUtilities::print_error_message("Password reset operation failed");
-                return View::make("home");
+                return Redirect::to("forgot-password")->with("forgot-password-error", "Password reset operation failed");
             }
         }
     }
@@ -319,7 +317,7 @@ class AccountController extends BaseController
         $code = Input::get("code", Input::old("code"));
         $username = Input::get("username", Input::old("username"));
         if(empty($username) || empty($code)){
-            return View::make("home");
+            return Redirect::to("forgot-password")->with("password-reset-error", "Reset password link failed. Please request to reset user password again.");
         }else{
             return View::make("account/reset-password", array("code" => $code, "username"=>$username));
         }
@@ -431,8 +429,7 @@ class AccountController extends BaseController
         try{
             $verified = EmailUtilities::verifyPasswordResetCode($username, $code);
             if (!$verified){
-                CommonUtilities::print_error_message("Resetting user password operation failed. Please request to reset user password again.");
-                return View::make("home");
+                return Redirect::to("forgot-password")->with("password-reset-error", "Resetting user password operation failed. Please request to reset user password again.");
             }
 
             $admin_authz_token = Keycloak::getAdminAuthzToken();
@@ -440,15 +437,19 @@ class AccountController extends BaseController
 
             $result = IamAdminServices::resetUserPassword($admin_authz_token, $tenant_id, $username, $new_password);
             if($result){
-                CommonUtilities::print_success_message("User password was reset successfully");
-                return View::make("login");
+                return Redirect::to("login")->with("password-reset-success", "User password was reset successfully");
             }else{
-                CommonUtilities::print_error_message("Resetting user password operation failed");
-                return View::make("home");
+                Log::error("Failed to reset password for user $username");
+                return Redirect::to("reset-password")
+                    ->withInput(Input::except('new_password', 'confirm_new_password'))
+                    ->with("password-reset-error", "Resetting user password operation failed");
             }
         }catch (Exception $e){
-            CommonUtilities::print_error_message("Resetting user password operation failed");
-            return View::make("home");
+            Log::error("Failed to reset password for user $username");
+            Log::error($e);
+            return Redirect::to("reset-password")
+                ->withInput(Input::except('new_password', 'confirm_new_password'))
+                ->with("password-reset-error", "Resetting user password operation failed");
         }
     }
 

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/9f754b2d/app/views/account/forgot-password.blade.php
----------------------------------------------------------------------
diff --git a/app/views/account/forgot-password.blade.php b/app/views/account/forgot-password.blade.php
index 2fa2883..6fdc0d4 100644
--- a/app/views/account/forgot-password.blade.php
+++ b/app/views/account/forgot-password.blade.php
@@ -8,6 +8,21 @@
 
     <div class="col-md-offset-3 col-md-6">
 
+        @if( Session::has("forgot-password-success") )
+        <div class="alert alert-success">
+            {{{ Session::get("forgot-password-success") }}}
+        </div>
+        @endif
+        @if( Session::has("forgot-password-error") )
+        <div class="alert alert-danger">
+            {{{ Session::get("forgot-password-error") }}}
+        </div>
+        @endif
+        @if( Session::has("password-reset-error") )
+        <div class="alert alert-danger">
+            {{{ Session::get("password-reset-error") }}}
+        </div>
+        @endif
         <h3> Did you forget the password to your account? </h3>
         <h4> Please enter your username, you registered with.</h4>
         <form role="form" method="POST" action="{{ URL::to('/') }}/forgot-password">

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/9f754b2d/app/views/account/login.blade.php
----------------------------------------------------------------------
diff --git a/app/views/account/login.blade.php b/app/views/account/login.blade.php
index bfbb152..f9305aa 100755
--- a/app/views/account/login.blade.php
+++ b/app/views/account/login.blade.php
@@ -25,6 +25,11 @@
             Your password has expired. Please <a href="{{URL::to('/') }}/forgot-password">reset your password</a>.
         </div>
         @endif
+        @if( Session::has("password-reset-success") )
+        <div class="alert alert-success">
+            {{{ Session::get("password-reset-success") }}}
+        </div>
+        @endif
 
         <div class="form-group">
             <label class="sr-only" for="username">Username</label>

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/9f754b2d/app/views/account/reset-password.blade.php
----------------------------------------------------------------------
diff --git a/app/views/account/reset-password.blade.php b/app/views/account/reset-password.blade.php
index 7bc07e0..6254415 100644
--- a/app/views/account/reset-password.blade.php
+++ b/app/views/account/reset-password.blade.php
@@ -9,6 +9,11 @@
 <div class="col-md-offset-3 col-md-6">
 
     <h3>Reset Password</h3>
+    @if( Session::has("password-reset-error") )
+    <div class="alert alert-danger">
+        {{{ Session::get("password-reset-error") }}}
+    </div>
+    @endif
     @if ($errors->has())
     @foreach ($errors->all() as $error)
     {{ CommonUtilities::print_error_message($error) }}