You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sm...@apache.org on 2015/05/09 15:11:53 UTC
[1/8] airavata-php-gateway git commit: wrapping Airavata and WSIS
code as laravel library component and service providers
Repository: airavata-php-gateway
Updated Branches:
refs/heads/master b70ad1326 -> c1174e1e7
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/3ca02155/app/libraries/wsis_utilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/wsis_utilities.php b/app/libraries/wsis_utilities.php
deleted file mode 100755
index 530fa52..0000000
--- a/app/libraries/wsis_utilities.php
+++ /dev/null
@@ -1,320 +0,0 @@
-<?php
-
-require_once 'id_utilities.php';
-
-/**
- * Utilities for ID management with a WSO2 IS 4.6.0
- */
-
-class WSISUtilities implements IdUtilities{
-
- /**
- * Return true if the given username exists in the identity server.
- * @param $username
- * @return bool
- */
- public function username_exists($username) {
- try{
- //$this->wsis_client = new WSISClient( $username);
- return WSIS::username_exists($username);
- } catch (Exception $ex) {
- print_r( $ex);
- throw new Exception("Unable to check whether username exists", 0, NULL);
- }
-
- }
-
- /**
- * authenticate a given user
- * @param $username
- * @param $password
- * @return boolean
- */
- public function authenticate($username, $password) {
- try{
- return WSIS::authenticate($username, $password);
- } catch (Exception $ex) {
- var_dump( $ex);
- throw new Exception("Unable to authenticate user", 0, NULL);
- }
- }
-
- /**
- * Add a new user to the identity server.
- * @param $username
- * @param $password
- * @return void
- */
- public function add_user($username, $password, $first_name, $last_name, $email, $organization,
- $address, $country,$telephone, $mobile, $im, $url) {
- try{
- WSIS::addUser($username, $password, $first_name . " " . $last_name);
- } catch (Exception $ex) {
- var_dump($ex);
- throw new Exception("Unable to add new user", 0, NULL);
- }
- }
-
- /**
- * Get the user profile
- * @param $username
- * @return mixed|void
- */
- public function get_user_profile($username)
- {
- // TODO: Implement get_user_profile() method.
- }
-
- /**
- * Update the user profile
- *
- * @param $username
- * @param $first_name
- * @param $last_name
- * @param $email
- * @param $organization
- * @param $address
- * @param $country
- * @param $telephone
- * @param $mobile
- * @param $im
- * @param $url
- * @return mixed
- */
- public function update_user_profile($username, $first_name, $last_name, $email, $organization, $address,
- $country, $telephone, $mobile, $im, $url)
- {
- // TODO: Implement update_user_profile() method.
- }
-
- /**
- * Function to update user password
- *
- * @param $username
- * @param $current_password
- * @param $new_password
- * @return mixed
- */
- public function change_password($username, $current_password, $new_password)
- {
- // TODO: Implement change_password() method.
- }
-
- /**
- * Function to remove an existing user
- *
- * @param $username
- * @return void
- */
- public function remove_user($username)
- {
- // TODO: Implement remove_user() method.
- }
-
- /**
- * Function to check whether a user has permission for a particular permission string(api method).
- *
- * @param $username
- * @param $permission_string
- * @return bool
- */
- public function checkPermissionForUser($username, $permission_string)
- {
- // TODO: Implement checkPermissionForUser() method.
- }
-
- /**
- * Function to get all the permissions that a particular user has.
- *
- * @param $username
- * @return mixed
- */
- public function getUserPermissions($username)
- {
- // TODO: Implement getUserPermissions() method.
- }
-
- /**
- * Function to check whether a role is existing
- *
- * @param string $roleName
- * @return IsExistingRoleResponse
- */
- public function isExistingRole( $roleName){
- try{
- return WSIS::is_existing_role( $roleName);
- } catch (Exception $ex) {
- var_dump($ex);
- throw new Exception("Unable to check if role exists.", 0, $ex);
- }
- }
-
- /**
- * Function to add new role by providing the role name.
- *
- * @param string $roleName
- */
- public function addRole($roleName){
- try{
- return WSIS::add_role( $roleName);
- } catch (Exception $ex) {
- var_dump( $ex);
- throw new Exception("Unable to add role.", 0, $ex);
- }
- }
-
- /**
- * Function to delete existing role
- *
- * @param string $roleName
- * @return void
- * @throws Exception
- */
- public function deleteRole($roleName) {
- try {
- WSIS::delete_role($roleName);
- } catch (Exception $ex) {
- throw new Exception("Unable to delete role", 0, $ex);
- }
- }
-
- /**
- * Function to get the entire list of roles in the application
- *
- * @return mixed
- */
- public function getRoleNames()
- {
- try{
- WSIS::get_all_roles();
- } catch (Exception $ex) {
- var_dump($ex);
- throw new Exception("Unable to get roles.", 0, NULL);
- }
- }
-
- /**
- * Function to get the role list of a user
- *
- * @param $username
- * @return mixed
- */
- public function getRoleListOfUser($username)
- {
- try{
- return WSIS::get_user_roles( $username);
- } catch (Exception $ex) {
- var_dump($ex);
- throw new Exception("Unable to get roles.", 0, NULL);
- }
- }
-
- /**
- * Function to get the user list of a particular role
- *
- * @param $role
- * @return mixed
- */
- public function getUserListOfRole($role)
- {
- try{
- return WSIS::get_userlist_of_role( $role);
- } catch (Exception $ex) {
- var_dump( $ex); exit;
- throw new Exception("Unable to get users.", 0, NULL);
- }
- }
-
- /**
- * Function to add a role to a user
- *
- * @param $username
- * @param $role
- * @return void
- */
- public function addUserToRole($username, $role)
- {
- // TODO: Implement addUserToRole() method.
- }
-
- /**
- * Function to role from user
- *
- * @param $username
- * @param $role
- * @return void
- */
-
- /**
- * Function to update role list of user
- *
- * @param UpdateRoleListOfUser $parameters
- * @return void
- */
- public function updateRoleListOfUser($username, $roles)
- {
- try{
- return WSIS::update_user_roles( $username, $roles);
- } catch (Exception $ex) {
- var_dump($ex); exit;
- throw new Exception("Unable to update User roles.", 0, NULL);
- }
- }
- public function removeUserFromRole($username, $role)
- {
- // TODO: Implement removeUserFromRole() method.
- }
-
- /**
- * Function to list users
- *
- * @param void
- * @return void
- */
- public function listUsers(){
- try {
- return WSIS::list_users();
- } catch (Exception $ex) {
-
- throw new Exception( "Unable to list users", 0, $ex);
- }
- }
-
- /**
- * Function to get the tenant id
- *
- * @param GetTenantId $parameters
- * @return GetTenantIdResponse
- */
- public function getTenantId(){
- try {
- return WSIS::get_tenant_id();
- } catch (Exception $ex) {
- var_dump( $ex->debug_message);
- throw new Exception("Unable to get the Tenant Id.", 0, $ex);
- }
- }
- /**
- * Function create a new Tenant
- *
- * @param Tenant $parameters
- * @return void
- */
- public function createTenant( $inputs){
- try {
- return WSIS::create_tenant( $inputs);
- } catch (Exception $ex) {
- var_dump( $ex);
- //throw new Exception("Unable to create Tenant.", 0, $ex);
- }
- }
-
- /**
- * Connect to the user database.
- * @return mixed|void
- */
- public function connect()
- {
- // TODO: Implement connect() method.
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/3ca02155/app/libraries/xml_id_utilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/xml_id_utilities.php b/app/libraries/xml_id_utilities.php
deleted file mode 100755
index 0ba9760..0000000
--- a/app/libraries/xml_id_utilities.php
+++ /dev/null
@@ -1,294 +0,0 @@
-<?php
-/**
- * Utilities for ID management with an XML file
- */
-
-//include 'id_utilities.php';
-
-class XmlIdUtilities implements IdUtilities
-{
- const DB_PATH = 'users.xml';
-
- /**
- * Connect to the user database.
- * @return mixed|void
- */
- public function connect()
- {
- global $db;
-
-
- try
- {
- if (file_exists(self::DB_PATH))
- {
- $db = simplexml_load_file(self::DB_PATH);
- }
- else
- {
- throw new Exception("Error: Cannot connect to database!");
- }
-
-
- if (!$db)
- {
- throw new Exception('Error: Cannot open database!');
- }
- }
- catch (Exception $e)
- {
- echo '<div>' . $e->getMessage() . '</div>';
- }
- }
-
- /**
- * Return true if the given username exists in the database.
- * @param $username
- * @return bool
- */
- public function username_exists($username)
- {
- global $db;
-
- foreach($db->xpath('//username') as $db_username)
- {
- if ($db_username == $username)
- {
- return true;
- }
- }
-
- return false;
- }
-
- /**
- * Authenticate the user given username and password.
- * @param $username
- * @param $password
- * @return int|mixed
- */
- public function authenticate($username, $password)
- {
- global $db;
-
- $hashed_password = md5($password);
-
- $user = $db->xpath('//user[username="' . $username . '"]');
-
- if (sizeof($user) == 1)
- {
- return $user[0]->password_hash == $hashed_password;
- }
- elseif(sizeof($user) == 0)
- {
- return -1;
- }
- else // duplicate users in database
- {
- return -2;
- }
- }
-
- /**
- * Add a new user to the database.
- * @param $username
- * @param $password
- * @return mixed|void
- */
- public function add_user($username, $password, $first_name, $last_name, $email, $organization,
- $address, $country,$telephone, $mobile, $im, $url)
- {
- global $db;
-
- $users = $db->xpath('//users');
-
- $user = $users[0]->addChild('user');
-
- $user->addChild('username', $username);
- $user->addChild('password_hash', md5($password));
-
- //Format XML to save indented tree rather than one line
- $dom = new DOMDocument('1.0');
- $dom->preserveWhiteSpace = false;
- $dom->formatOutput = true;
- $dom->loadXML($db->asXML());
- $dom->save('users.xml');
- }
-
- /**
- * Get the user profile
- * @param $username
- * @return mixed|void
- */
- public function get_user_profile($username)
- {
- // TODO: Implement get_user_profile() method.
- }
-
- /**
- * Update the user profile
- *
- * @param $username
- * @param $first_name
- * @param $last_name
- * @param $email
- * @param $organization
- * @param $address
- * @param $country
- * @param $telephone
- * @param $mobile
- * @param $im
- * @param $url
- * @return mixed
- */
- public function update_user_profile($username, $first_name, $last_name, $email, $organization, $address,
- $country, $telephone, $mobile, $im, $url)
- {
- // TODO: Implement update_user_profile() method.
- }
-
- /**
- * Function to update user password
- *
- * @param $username
- * @param $current_password
- * @param $new_password
- * @return mixed
- */
- public function change_password($username, $current_password, $new_password)
- {
- // TODO: Implement change_password() method.
- }
-
- /**
- * Function to remove an existing user
- *
- * @param $username
- * @return void
- */
- public function remove_user($username)
- {
- // TODO: Implement remove_user() method.
- }
-
- /**
- * Function to check whether a user has permission for a particular permission string(api method).
- *
- * @param $username
- * @param $permission_string
- * @return bool
- */
- public function checkPermissionForUser($username, $permission_string)
- {
- // TODO: Implement checkPermissionForUser() method.
- }
-
- /**
- * Function to get all the permissions that a particular user has.
- *
- * @param $username
- * @return mixed
- */
- public function getUserPermissions($username)
- {
- // TODO: Implement getUserPermissions() method.
- }
-
- /**
- * Function to get the entire list of roles in the application
- *
- * @return mixed
- */
- public function getRoleList()
- {
- // TODO: Implement getRoleList() method.
- }
-
- /**
- * Function to get the role list of a user
- *
- * @param $username
- * @return mixed
- */
- public function getRoleListOfUser($username)
- {
- // TODO: Implement getRoleListOfUser() method.
- }
-
- /**
- * Function to get the user list of a particular role
- *
- * @param $role
- * @return mixed
- */
- public function getUserListOfRole($role)
- {
- // TODO: Implement getUserListOfRole() method.
- }
-
- /**
- * Function to add a role to a user
- *
- * @param $username
- * @param $role
- * @return void
- */
- public function addUserToRole($username, $role)
- {
- // TODO: Implement addUserToRole() method.
- }
-
- /**
- * Function to role from user
- *
- * @param $username
- * @param $role
- * @return void
- */
- public function removeUserFromRole($username, $role)
- {
- // TODO: Implement removeUserFromRole() method.
- }
-
- /**
- * Function to get the entire list of roles in the application
- *
- * @return mixed
- */
- public function getRoleNames()
- {
- // TODO: Implement getRoleNames() method.
- }
-
- /**
- * Function to check whether a role is existing
- *
- * @param string $roleName
- * @return IsExistingRoleResponse
- */
- public function isExistingRole($roleName)
- {
- // TODO: Implement isExistingRole() method.
- }
-
- /**
- * Function to add new role by providing the role name.
- *
- * @param string $roleName
- */
- public function addRole($roleName)
- {
- // TODO: Implement addRole() method.
- }
-
- /**
- * Function to update role list of user
- *
- * @param UpdateRoleListOfUser $parameters
- * @return void
- */
- public function updateRoleListOfUser($username, $roles)
- {
- // TODO: Implement updateRoleListOfUser() method.
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/3ca02155/workbench/airavata/wsis/.gitignore
----------------------------------------------------------------------
diff --git a/workbench/airavata/wsis/.gitignore b/workbench/airavata/wsis/.gitignore
deleted file mode 100755
index 5826402..0000000
--- a/workbench/airavata/wsis/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-/vendor
-composer.phar
-composer.lock
-.DS_Store
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/3ca02155/workbench/airavata/wsis/.travis.yml
----------------------------------------------------------------------
diff --git a/workbench/airavata/wsis/.travis.yml b/workbench/airavata/wsis/.travis.yml
deleted file mode 100755
index f60bbe0..0000000
--- a/workbench/airavata/wsis/.travis.yml
+++ /dev/null
@@ -1,13 +0,0 @@
-language: php
-
-php:
- - 5.4
- - 5.5
- - 5.6
- - hhvm
-
-before_script:
- - travis_retry composer self-update
- - travis_retry composer install --prefer-source --no-interaction --dev
-
-script: phpunit
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/3ca02155/workbench/airavata/wsis/composer.json
----------------------------------------------------------------------
diff --git a/workbench/airavata/wsis/composer.json b/workbench/airavata/wsis/composer.json
deleted file mode 100755
index 2af236e..0000000
--- a/workbench/airavata/wsis/composer.json
+++ /dev/null
@@ -1,20 +0,0 @@
-{
- "name": "airavata/wsis",
- "description": "",
- "authors": [
- {
- "name": "Apache Airavata",
- "email": "dev@airavata.apache.org"
- }
- ],
- "require": {
- "php": ">=5.4.0",
- "illuminate/support": "4.2.*"
- },
- "autoload": {
- "psr-0": {
- "Airavata\\Wsis": "src/"
- }
- },
- "minimum-stability": "stable"
-}
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/3ca02155/workbench/airavata/wsis/phpunit.xml
----------------------------------------------------------------------
diff --git a/workbench/airavata/wsis/phpunit.xml b/workbench/airavata/wsis/phpunit.xml
deleted file mode 100755
index 3347b75..0000000
--- a/workbench/airavata/wsis/phpunit.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<phpunit backupGlobals="false"
- backupStaticAttributes="false"
- bootstrap="vendor/autoload.php"
- colors="true"
- convertErrorsToExceptions="true"
- convertNoticesToExceptions="true"
- convertWarningsToExceptions="true"
- processIsolation="false"
- stopOnFailure="false"
- syntaxCheck="false"
->
- <testsuites>
- <testsuite name="Package Test Suite">
- <directory suffix=".php">./tests/</directory>
- </testsuite>
- </testsuites>
-</phpunit>
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/3ca02155/workbench/airavata/wsis/src/Airavata/Wsis/Facades/Wsis.php
----------------------------------------------------------------------
diff --git a/workbench/airavata/wsis/src/Airavata/Wsis/Facades/Wsis.php b/workbench/airavata/wsis/src/Airavata/Wsis/Facades/Wsis.php
deleted file mode 100755
index d89bc7c..0000000
--- a/workbench/airavata/wsis/src/Airavata/Wsis/Facades/Wsis.php
+++ /dev/null
@@ -1,16 +0,0 @@
-<?php
-
-namespace Airavata\Wsis\Facades;
-
-use Illuminate\Support\Facades\Facade;
-
-class Wsis extends Facade {
-
- /**
- * Get the registered name of the component.
- *
- * @return string
- */
- protected static function getFacadeAccessor() { return 'wsis'; }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/3ca02155/workbench/airavata/wsis/src/Airavata/Wsis/Stubs/TenantManager.php
----------------------------------------------------------------------
diff --git a/workbench/airavata/wsis/src/Airavata/Wsis/Stubs/TenantManager.php b/workbench/airavata/wsis/src/Airavata/Wsis/Stubs/TenantManager.php
deleted file mode 100755
index 90bcd3f..0000000
--- a/workbench/airavata/wsis/src/Airavata/Wsis/Stubs/TenantManager.php
+++ /dev/null
@@ -1,139 +0,0 @@
-<?php
-namespace Airavata\Wsis\Stubs;
-
-use Airavata\Wsis\Stubs\TenantMgtAdminStub;
-
-/**
- * TenantManager class
- *
- * This class provide an easy to use interface for
- * WSO2 IS 5.0.0 TenantMgtAdmin service.
- */
-class TenantManager {
- /**
- * @var TenantMgtAdminStub $serviceStub
- * @access private
- */
- private $serviceStub;
-
- public function __construct($server_url, $options) {
- $this->serviceStub = new TenantMgtAdminStub(
- $server_url . "TenantMgtAdminService?wsdl", $options
- );
- }
-
- /**
- * Function to get the soap client
- *
- * @return SoapClient
- */
- public function getSoapClient(){
- return $this->serviceStub;
- }
-
- /**
- * Method to retrieve all tenant information. Some tenant information
- * such as admin name are not returned by wso2 IS
- * @return mixed
- */
- public function retrieveTenants(){
- $parameters = new retrieveTenants();
- return $this->serviceStub->retrieveTenants($parameters)->return;
- }
-
- /**
- * Method to get tenant information giving tenant domain
- * @param $domain domain of the tenant
- * @return mixed
- */
- public function getTenant($domain){
- $parameters = new getTenant();
- $parameters->tenantDomain = $domain;
- return $this->serviceStub->getTenant($parameters)->return;
- }
-
- /**
- * Method to create a new tenant
- * @param $active whether tenant active or not
- * @param $adminUsername
- * @param $adminPassword
- * @param $email
- * @param $firstName Admin's first name
- * @param $lastName Admin's last name
- * @param $tenantDomain
- */
- public function addTenant($active, $adminUsername, $adminPassword, $email,
- $firstName, $lastName, $tenantDomain){
- $tenantInfoBean = new TenantInfoBean();
- $tenantInfoBean->active = $active;
- $tenantInfoBean->admin = $adminUsername;
- $tenantInfoBean->adminPassword = $adminPassword;
- $tenantInfoBean->email = $email;
- $tenantInfoBean->firstName = $firstName;
- $tenantInfoBean->lastName = $lastName;
- $tenantInfoBean->tenantDomain = $tenantDomain;
-
- $addTenant = new addTenant();
- $addTenant->tenantInfoBean = $tenantInfoBean;
- $this->serviceStub->addTenant($addTenant);
- }
-
- /**
- * Method to remove an existing tenant giving tenant domain
- * @param $tenantDomain
- */
- public function deleteTenant($tenantDomain){
- $parameters = new deleteTenant();
- $parameters->tenantDomain = $tenantDomain;
- $this->serviceStub->deleteTenant($parameters);
- }
-
- /**
- * Method to activate a tenant
- * @param $tenantDomain
- */
- public function activateTenant($tenantDomain){
- $parameters = new activateTenant();
- $parameters->tenantDomain = $tenantDomain;
- $this->serviceStub->activateTenant($parameters);
- }
-
- /**
- * Method to deactivate a tenant
- * @param $tenantDomain
- */
- public function deactivateTenant($tenantDomain){
- $parameters = new deactivateTenant();
- $parameters->tenantDomain = $tenantDomain;
- $this->serviceStub->deactivateTenant($parameters);
- }
-
- /**
- * Method to update an existing tenant
- * @param $tenantId
- * @param $active
- * @param $adminUsername
- * @param $adminPassword
- * @param $email
- * @param $firstName
- * @param $lastName
- * @param $tenantDomain
- */
- public function updateTenant($tenantId, $active, $adminUsername, $adminPassword, $email,
- $firstName, $lastName, $tenantDomain){
- $tenantInfoBean = new TenantInfoBean();
- $tenantInfoBean->tenantId = $tenantId;
- $tenantInfoBean->active = $active;
- $tenantInfoBean->admin = $adminUsername;
- $tenantInfoBean->adminPassword = $adminPassword;
- $tenantInfoBean->email = $email;
- $tenantInfoBean->firstName = $firstName;
- $tenantInfoBean->lastName = $lastName;
- $tenantInfoBean->tenantDomain = $tenantDomain;
-
- $updateTenant = new updateTenant();
- $updateTenant->tenantInfoBean = $tenantInfoBean;
- $this->serviceStub->updateTenant($updateTenant);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/3ca02155/workbench/airavata/wsis/src/Airavata/Wsis/Stubs/TenantMgtAdminStub.php
----------------------------------------------------------------------
diff --git a/workbench/airavata/wsis/src/Airavata/Wsis/Stubs/TenantMgtAdminStub.php b/workbench/airavata/wsis/src/Airavata/Wsis/Stubs/TenantMgtAdminStub.php
deleted file mode 100755
index 70dca16..0000000
--- a/workbench/airavata/wsis/src/Airavata/Wsis/Stubs/TenantMgtAdminStub.php
+++ /dev/null
@@ -1,306 +0,0 @@
-<?php
-namespace Airavata\Wsis\Stubs;
-use SoapClient;
-/**
- * This file contains the DTOs and the method stubs for
- * WSO2 IS 5.0.0 TenantMgtAdmin service.
- */
-class TenantMgtAdminServiceException {
- public $TenantMgtAdminServiceException; // Exception
-}
-
-
-class deleteTenant {
- public $tenantDomain; // string
-}
-
-class updateTenant {
- public $tenantInfoBean; // TenantInfoBean
-}
-
-class addTenant {
- public $tenantInfoBean; // TenantInfoBean
-}
-
-class addTenantResponse {
- public $return; // string
-}
-
-class activateTenant {
- public $tenantDomain; // string
-}
-
-class deactivateTenant {
- public $tenantDomain; // string
-}
-
-class getTenant {
- public $tenantDomain; // string
-}
-
-class getTenantResponse {
- public $return; // TenantInfoBean
-}
-
-class retrievePaginatedTenants {
- public $pageNumber; // int
-}
-
-class retrievePaginatedTenantsResponse {
- public $return; // PaginatedTenantInfoBean
-}
-
-class retrieveTenants {
-}
-
-class retrieveTenantsResponse {
- public $return; // TenantInfoBean
-}
-
-class retrievePartialSearchTenants {
- public $domain; // string
-}
-
-class retrievePartialSearchTenantsResponse {
- public $return; // TenantInfoBean
-}
-
-class addSkeletonTenant {
- public $tenantInfoBean; // TenantInfoBean
-}
-
-class addSkeletonTenantResponse {
- public $return; // string
-}
-
-class retrievePaginatedPartialSearchTenants {
- public $domain; // string
- public $pageNumber; // int
-}
-
-class retrievePaginatedPartialSearchTenantsResponse {
- public $return; // PaginatedTenantInfoBean
-}
-
-class TenantInfoBean {
- public $active; // boolean
- public $admin; // string
- public $adminPassword; // string
- public $createdDate; // dateTime
- public $email; // string
- public $firstname; // string
- public $lastname; // string
- public $originatedService; // string
- public $successKey; // string
- public $tenantDomain; // string
- public $tenantId; // int
- public $usagePlan; // string
-}
-
-class PaginatedTenantInfoBean {
- public $numberOfPages; // int
- public $tenantInfoBeans; // TenantInfoBean
-}
-
-
-/**
- * TenantMgtAdminStub class
- *
- *
- *
- * @author {author}
- * @copyright {copyright}
- * @package {package}
- */
-class TenantMgtAdminStub extends SoapClient {
-
- private static $classmap = array(
- 'TenantMgtAdminServiceException' => 'TenantMgtAdminServiceException',
- 'deleteTenant' => 'deleteTenant',
- 'updateTenant' => 'updateTenant',
- 'addTenant' => 'addTenant',
- 'addTenantResponse' => 'addTenantResponse',
- 'activateTenant' => 'activateTenant',
- 'deactivateTenant' => 'deactivateTenant',
- 'getTenant' => 'getTenant',
- 'getTenantResponse' => 'getTenantResponse',
- 'retrievePaginatedTenants' => 'retrievePaginatedTenants',
- 'retrievePaginatedTenantsResponse' => 'retrievePaginatedTenantsResponse',
- 'retrieveTenants' => 'retrieveTenants',
- 'retrieveTenantsResponse' => 'retrieveTenantsResponse',
- 'retrievePartialSearchTenants' => 'retrievePartialSearchTenants',
- 'retrievePartialSearchTenantsResponse' => 'retrievePartialSearchTenantsResponse',
- 'addSkeletonTenant' => 'addSkeletonTenant',
- 'addSkeletonTenantResponse' => 'addSkeletonTenantResponse',
- 'retrievePaginatedPartialSearchTenants' => 'retrievePaginatedPartialSearchTenants',
- 'retrievePaginatedPartialSearchTenantsResponse' => 'retrievePaginatedPartialSearchTenantsResponse',
- 'TenantInfoBean' => 'TenantInfoBean',
- 'PaginatedTenantInfoBean' => 'PaginatedTenantInfoBean',
- );
-
- public function TenantMgtAdminStub($wsdl, $options = array()) {
- foreach(self::$classmap as $key => $value) {
- if(!isset($options['classmap'][$key])) {
- $options['classmap'][$key] = $value;
- }
- }
- parent::__construct($wsdl, $options);
- }
-
- /**
- *
- *
- * @param retrieveTenants $parameters
- * @return retrieveTenantsResponse
- */
- public function retrieveTenants(retrieveTenants $parameters) {
- return $this->__soapCall('retrieveTenants', array($parameters), array(
- 'uri' => 'http://services.mgt.tenant.carbon.wso2.org',
- 'soapaction' => ''
- )
- );
- }
-
- /**
- *
- *
- * @param getTenant $parameters
- * @return getTenantResponse
- */
- public function getTenant(getTenant $parameters) {
- return $this->__soapCall('getTenant', array($parameters), array(
- 'uri' => 'http://services.mgt.tenant.carbon.wso2.org',
- 'soapaction' => ''
- )
- );
- }
-
- /**
- *
- *
- * @param deactivateTenant $parameters
- * @return void
- */
- public function deactivateTenant(deactivateTenant $parameters) {
- return $this->__soapCall('deactivateTenant', array($parameters), array(
- 'uri' => 'http://services.mgt.tenant.carbon.wso2.org',
- 'soapaction' => ''
- )
- );
- }
-
- /**
- *
- *
- * @param retrievePartialSearchTenants $parameters
- * @return retrievePartialSearchTenantsResponse
- */
- public function retrievePartialSearchTenants(retrievePartialSearchTenants $parameters) {
- return $this->__soapCall('retrievePartialSearchTenants', array($parameters), array(
- 'uri' => 'http://services.mgt.tenant.carbon.wso2.org',
- 'soapaction' => ''
- )
- );
- }
-
- /**
- *
- *
- * @param retrievePaginatedTenants $parameters
- * @return retrievePaginatedTenantsResponse
- */
- public function retrievePaginatedTenants(retrievePaginatedTenants $parameters) {
- return $this->__soapCall('retrievePaginatedTenants', array($parameters), array(
- 'uri' => 'http://services.mgt.tenant.carbon.wso2.org',
- 'soapaction' => ''
- )
- );
- }
-
- /**
- *
- *
- * @param updateTenant $parameters
- * @return void
- */
- public function updateTenant(updateTenant $parameters) {
- return $this->__soapCall('updateTenant', array($parameters), array(
- 'uri' => 'http://services.mgt.tenant.carbon.wso2.org',
- 'soapaction' => ''
- )
- );
- }
-
- /**
- *
- *
- * @param addSkeletonTenant $parameters
- * @return addSkeletonTenantResponse
- */
- public function addSkeletonTenant(addSkeletonTenant $parameters) {
- return $this->__soapCall('addSkeletonTenant', array($parameters), array(
- 'uri' => 'http://services.mgt.tenant.carbon.wso2.org',
- 'soapaction' => ''
- )
- );
- }
-
- /**
- *
- *
- * @param addTenant $parameters
- * @return addTenantResponse
- */
- public function addTenant(addTenant $parameters) {
- return $this->__soapCall('addTenant', array($parameters), array(
- 'uri' => 'http://services.mgt.tenant.carbon.wso2.org',
- 'soapaction' => ''
- )
- );
- }
-
- /**
- *
- *
- * @param retrievePaginatedPartialSearchTenants $parameters
- * @return retrievePaginatedPartialSearchTenantsResponse
- */
- public function retrievePaginatedPartialSearchTenants(retrievePaginatedPartialSearchTenants $parameters) {
- return $this->__soapCall('retrievePaginatedPartialSearchTenants', array($parameters), array(
- 'uri' => 'http://services.mgt.tenant.carbon.wso2.org',
- 'soapaction' => ''
- )
- );
- }
-
- /**
- *
- *
- * @param activateTenant $parameters
- * @return void
- */
- public function activateTenant(activateTenant $parameters) {
- return $this->__soapCall('activateTenant', array($parameters), array(
- 'uri' => 'http://services.mgt.tenant.carbon.wso2.org',
- 'soapaction' => ''
- )
- );
- }
-
- /**
- *
- *
- * @param deleteTenant $parameters
- * @return void
- */
- public function deleteTenant(deleteTenant $parameters) {
- return $this->__soapCall('deleteTenant', array($parameters), array(
- 'uri' => 'http://services.mgt.tenant.carbon.wso2.org',
- 'soapaction' => ''
- )
- );
- }
-
-}
-
-?>
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/3ca02155/workbench/airavata/wsis/src/Airavata/Wsis/Stubs/UserStoreManager.php
----------------------------------------------------------------------
diff --git a/workbench/airavata/wsis/src/Airavata/Wsis/Stubs/UserStoreManager.php b/workbench/airavata/wsis/src/Airavata/Wsis/Stubs/UserStoreManager.php
deleted file mode 100755
index b1b013e..0000000
--- a/workbench/airavata/wsis/src/Airavata/Wsis/Stubs/UserStoreManager.php
+++ /dev/null
@@ -1,203 +0,0 @@
-<?php
-namespace Airavata\Wsis\Stubs;
-
-use Airavata\Wsis\Stubs\UserStoreManagerStub;
-
-/**
- * UsersStoreManager class
- *
- * This class provide an easy to use interface for
- * WSO2 IS 5.0.0 RemoteUserStoreManager service.
- */
-class UserStoreManager {
- /**
- * @var RemoteUserManagerStub $serviceStub
- * @access private
- */
- private $serviceStub;
-
- public function __construct($server_url, $options) {
- $this->serviceStub = new UserStoreManagerStub(
- $server_url . "RemoteUserStoreManagerService?wsdl", $options
- );
- }
-
- /**
- * Function to get the soap client
- *
- * @return SoapClient
- */
- public function getSoapClient(){
- return $this->serviceStub;
- }
-
- /**
- * Function to authenticate the user with RemoteUserStoreManager Service
- * @param type $username
- * @param type $password
- */
- public function authenticate($username, $password){
- $parameters = new Authenticate();
- $parameters->userName = $username;
- $parameters->credential = $password;
- return $this->serviceStub->authenticate($parameters)->return;
- }
-
- /**
- * Function to add new user by providing username and password
- *
- * @param type $userName
- * @param type $password
- */
- public function addUser($userName, $password, $fullName){
- $parameters = new AddUser();
- $parameters->userName = $userName;
- $parameters->credential = $password;
- $parameters->claims = null;
- $parameters->profileName = $fullName;
- $parameters->requirePasswordChange = false;
- $parameters->roleList = null;
- $this->serviceStub->addUser($parameters);
- }
- /**
- * Function to delete existing user by providing the username.
- *
- * @param string $username
- */
- public function deleteUser($username){
- $parameters = new DeleteUser();
- $parameters->userName = $username;
- $this->serviceStub->deleteUser($parameters);
- }
-
- /**
- * Function to check whether a role is existing
- *
- * @param string $roleName
- * @return IsExistingRoleResponse
- */
- public function isExistingRole( $roleName) {
- $parameters = new IsExistingRole();
- $parameters->roleName = $roleName;
- $this->serviceStub->isExistingRole( $parameters)->return;
- }
- /**
- * Function to add new role by providing the role name.
- *
- * @param string $roleName
- */
- public function addRole($roleName){
- $paramerters = new AddRole();
- $paramerters->roleName=$roleName;
- $paramerters->userList=null;
- $paramerters->permissions=null;
- $this->serviceStub->addRole($paramerters);
- }
-
- /**
- * Function to delete an existing role
- *
- * @param string $roleName
- */
- public function deleteRole($roleName){
- $parameters = new DeleteRole();
- $parameters->roleName = $roleName;
- $this->serviceStub->deleteRole($parameters);
- }
-
- /**
- * Function to get a list of users
- *
- * @return username list
- */
- public function listUsers(){
- $parameters = new ListUsers();
- $parameters->filter = "*";
- $parameters->maxItemLimit = -1;
-
- return $this->serviceStub->listUsers($parameters)->return;
- }
-
- /**
- * Function get user list
- *
- * @param GetUserList $parameters
- * @return GetUserListResponse
- */
- public function getUserList(){
- $parameters = new GetUserList();
- }
-
-
- /**
- * Function to check whether the given username already exists
- *
- * @param string $username
- * @return boolean
- */
- public function isExistingUser($username) {
- $parameters = new IsExistingUser();
- $parameters->userName = $username;
-
- return $this->serviceStub->isExistingUser($parameters)->return;
- }
-
- /**
- * Function to get the list of all existing roles
- *
- * @return roles list
- */
- public function getRoleNames( $parameters = null){
- $parameters = new GetRoleNames();
- return $this->serviceStub->getRoleNames( $parameters)->return;
- }
-
- /**
- * Function to get role of a user
- *
- * @return User Role
- */
- public function getRoleListOfUser( $username){
- $parameters = new GetRoleListOfUser();
- $parameters->userName = $username;
- return $this->serviceStub->GetRoleListOfUser( $parameters)->return;
- }
-
- /**
- * Function to get the user list of role
- *
- * @param GetUserListOfRole $parameters
- * @return GetUserListOfRoleResponse
- */
- public function getUserListOfRole( $roleName){
- $parameters = new GetUserListOfRole();
- $parameters->roleName = $roleName;
- return $this->serviceStub->getUserListOfRole( $parameters);
- }
-
- /**
- * Function to update role list of user
- *
- * @param UpdateRoleListOfUser $parameters
- * @return void
- */
- public function updateRoleListOfUser( $username, $roles){
- $parameters = new UpdateRoleListOfUser();
- $parameters->userName = $username;
- $parameters->deletedRoles = $roles["deleted"];
- $parameters->newRoles = $roles["new"];
- return $this->serviceStub->updateRoleListOfUser( $parameters);
- }
-
- /**
- * Function to get the tenant id
- *
- * @param GetTenantId $parameters
- * @return GetTenantIdResponse
- */
- public function getTenantId(){
- $parameters = new GetTenantId();
-
- return $this->serviceStub->getTenantId( $parameters);
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/3ca02155/workbench/airavata/wsis/src/Airavata/Wsis/Stubs/UserStoreManagerStub.php
----------------------------------------------------------------------
diff --git a/workbench/airavata/wsis/src/Airavata/Wsis/Stubs/UserStoreManagerStub.php b/workbench/airavata/wsis/src/Airavata/Wsis/Stubs/UserStoreManagerStub.php
deleted file mode 100755
index c43fa48..0000000
--- a/workbench/airavata/wsis/src/Airavata/Wsis/Stubs/UserStoreManagerStub.php
+++ /dev/null
@@ -1,1570 +0,0 @@
-<?php
-namespace Airavata\Wsis\Stubs;
-use SoapClient;
-
-/**
- * This file contains the DTOs and the method stubs for
- * WSO2 IS 4.6.0 RemoteUserStoreManger service.
- */
-
-class ClaimDTO {
-
- /**
- * @var string $claimUri
- * @access public
- */
- public $claimUri;
-
- /**
- * @var string $description
- * @access public
- */
- public $description;
-
- /**
- * @var string $dialectURI
- * @access public
- */
- public $dialectURI;
-
- /**
- * @var int $displayOrder
- * @access public
- */
- public $displayOrder;
-
- /**
- * @var string $displayTag
- * @access public
- */
- public $displayTag;
-
- /**
- * @var string $regEx
- * @access public
- */
- public $regEx;
-
- /**
- * @var boolean $required
- * @access public
- */
- public $required;
-
- /**
- * @var boolean $supportedByDefault
- * @access public
- */
- public $supportedByDefault;
-
- /**
- * @var string $value
- * @access public
- */
- public $value;
-
-}
-
-class PermissionDTO {
-
- /**
- * @var string $action
- * @access public
- */
- public $action;
-
- /**
- * @var string $resourceId
- * @access public
- */
- public $resourceId;
-
-}
-
-class Tenant {
-
- /**
- * @var boolean $active
- * @access public
- */
- public $active;
-
- /**
- * @var string $adminFirstName
- * @access public
- */
- public $adminFirstName;
-
- /**
- * @var string $adminFullName
- * @access public
- */
- public $adminFullName;
-
- /**
- * @var string $adminLastName
- * @access public
- */
- public $adminLastName;
-
- /**
- * @var string $adminName
- * @access public
- */
- public $adminName;
-
- /**
- * @var string $adminPassword
- * @access public
- */
- public $adminPassword;
-
- /**
- * @var string $createdDate YYYY-MM-DD
- * @access public
- */
- public $createdDate;
-
- /**
- * @var string $domain
- * @access public
- */
- public $domain;
-
- /**
- * @var string $email
- * @access public
- */
- public $email;
-
- /**
- * @var int $id
- * @access public
- */
- public $id;
-
- /**
- * @var RealmConfiguration $realmConfig
- * @access public
- */
- public $realmConfig;
-
-}
-
-class RealmConfiguration {
-
- /**
- * @var string $addAdmin
- * @access public
- */
- public $addAdmin;
-
- /**
- * @var string $adminPassword
- * @access public
- */
- public $adminPassword;
-
- /**
- * @var string $adminRoleName
- * @access public
- */
- public $adminRoleName;
-
- /**
- * @var string $adminUserName
- * @access public
- */
- public $adminUserName;
-
- /**
- * @var string $authorizationManagerClass
- * @access public
- */
- public $authorizationManagerClass;
-
- /**
- * @var string $authzProperties
- * @access public
- */
- public $authzProperties;
-
- /**
- * @var string $description
- * @access public
- */
- public $description;
-
- /**
- * @var string $everyOneRoleName
- * @access public
- */
- public $everyOneRoleName;
-
- /**
- * @var string $multipleCredentialProps
- * @access public
- */
- public $multipleCredentialProps;
-
- /**
- * @var boolean $passwordsExternallyManaged
- * @access public
- */
- public $passwordsExternallyManaged;
-
- /**
- * @var string $persistedTimestamp YYYY-MM-DD
- * @access public
- */
- public $persistedTimestamp;
-
- /**
- * @var boolean $primary
- * @access public
- */
- public $primary;
-
- /**
- * @var string $realmClassName
- * @access public
- */
- public $realmClassName;
-
- /**
- * @var string $realmProperties
- * @access public
- */
- public $realmProperties;
-
- /**
- * @var RealmConfiguration $secondaryRealmConfig
- * @access public
- */
- public $secondaryRealmConfig;
-
- /**
- * @var int $tenantId
- * @access public
- */
- public $tenantId;
-
- /**
- * @var string $userStoreClass
- * @access public
- */
- public $userStoreClass;
-
- /**
- * @var string $userStoreProperties
- * @access public
- */
- public $userStoreProperties;
-
-}
-
-class ClaimValue {
-
- /**
- * @var string $claimURI
- * @access public
- */
- public $claimURI;
-
- /**
- * @var string $value
- * @access public
- */
- public $value;
-
-}
-
-class AddUserClaimValues {
-
- /**
- * @var string $userName
- * @access public
- */
- public $userName;
-
- /**
- * @var ClaimValue $claims
- * @access public
- */
- public $claims;
-
- /**
- * @var string $profileName
- * @access public
- */
- public $profileName;
-
-}
-
-class GetUserClaimValuesForClaims {
-
- /**
- * @var string $userName
- * @access public
- */
- public $userName;
-
- /**
- * @var string $claims
- * @access public
- */
- public $claims;
-
- /**
- * @var string $profileName
- * @access public
- */
- public $profileName;
-
-}
-
-class GetUserClaimValuesForClaimsResponse {
-
- /**
- * @var ClaimValue $return
- * @access public
- */
- public $return;
-
-}
-
-class GetTenantIdofUser {
-
- /**
- * @var string $userName
- * @access public
- */
- public $username;
-
-}
-
-class GetTenantIdofUserResponse {
-
- /**
- * @var int $return
- * @access public
- */
- public $return; // int
-
-}
-
-class AddUserClaimValue {
-
- /**
- * @var string $userName
- * @access public
- */
- public $userName;
-
- /**
- * @var string $claimURI
- * @access public
- */
- public $claimURI;
-
- /**
- * @var string $claimValue
- * @access public
- */
- public $claimValue;
-
- /**
- * @var string $profileName
- * @access public
- */
- public $profileName;
-
-}
-
-class GetUserClaimValues {
-
- /**
- * @var string $userName
- * @access public
- */
- public $userName;
-
- /**
- * @var string $profileName
- * @access public
- */
- public $profileName;
-
-}
-
-class GetUserClaimValuesResponse {
-
- /**
- * @var ClaimDTO $return
- * @access public
- */
- public $return;
-
-}
-
-class GetTenantId {
-
-}
-
-class GetTenantIdResponse {
-
- /**
- * @var int $return
- * @access public
- */
- public $return;
-
-}
-
-class AddUser {
-
- /**
- * @var string $userName
- * @access public
- */
- public $userName;
-
- /**
- * @var string $credential
- * @access public
- */
- public $credential;
-
- /**
- * @var string $roleList
- * @access public
- */
- public $roleList;
-
- /**
- * @var ClaimValue $claims
- * @access public
- */
- public $claims;
-
- /**
- * @var string $profileName
- * @access public
- */
- public $profileName;
-
- /**
- * @var boolean $requiredPasswordChange
- * @access public
- */
- public $requirePasswordChange;
-
-}
-
-class AddRole {
-
- /**
- * @var string $roleName
- * @access public
- */
- public $roleName;
-
- /**
- * @var string $userList
- * @access public
- */
- public $userList;
-
- /**
- * @var PermissionDTO $permissions
- * @access public
- */
- public $permissions;
-
-}
-
-class GetUserList {
-
- /**
- * @var string $claimUri
- * @access public
- */
- public $claimUri;
-
- /**
- * @var string $claimValue
- * @access public
- */
- public $claimValue;
-
- /**
- * @var string $profile
- * @access public
- */
- public $profile;
-
-}
-
-class GetUserListResponse {
-
- /**
- * @var string $return
- * @access public
- */
- public $return;
-
-}
-
-class UpdateCredential {
-
- /**
- * @var string $userName
- * @access public
- */
- public $userName;
-
- /**
- * @var string $newCredential
- * @access public
- */
- public $newCredential;
-
- /**
- * @var string $oldCredential
- * @access public
- */
- public $oldCredential;
-
-}
-
-class UpdateUserListOfRole {
-
- /**
- * @var string $roleName
- * @access public
- */
- public $roleName;
-
- /**
- * @var string $deletedUsers
- * @access public
- */
- public $deletedUsers;
-
- /**
- * @var string $newUsers
- * @access public
- */
- public $newUsers;
-
-}
-
-class UpdateRoleListOfUser {
-
- /**
- * @var string $userName
- * @access public
- */
- public $userName;
-
- /**
- * @var string $deletedRoles
- * @access public
- */
- public $deletedRoles;
-
- /**
- * @var string $newRoles
- * @access public
- */
- public $newRoles;
-
-}
-
-class SetUserClaimValue {
-
- /**
- * @var string $userName
- * @access public
- */
- public $userName;
-
- /**
- * @var string $claimURI
- * @access public
- */
- public $claimURI;
-
- /**
- * @var string $claimValue
- * @access public
- */
- public $claimValue;
-
- /**
- * @var string $profileName
- * @access public
- */
- public $profileName;
-
-}
-
-class SetUserClaimValues {
-
- /**
- * @var string $userName
- * @access public
- */
- public $userName;
-
- /**
- * @var ClaimValue $claims
- * @access public
- */
- public $claims;
-
- /**
- * @var string $profileName
- * @access public
- */
- public $profileName;
-
-}
-
-class DeleteUserClaimValue {
-
- /**
- * @var string $userName
- * @access public
- */
- public $userName;
-
- /**
- * @var string $claimURI
- * @access public
- */
- public $claimURI;
-
- /**
- * @var string $profileName
- * @access public
- */
- public $profileName;
-
-}
-
-class DeleteUserClaimValues {
-
- /**
- * @var string $userName
- * @access public
- */
- public $userName;
-
- /**
- * @var string $claims
- * @access public
- */
- public $claims;
-
- /**
- * @var string $profileName
- * @access public
- */
- public $profileName;
-
-}
-
-class GetHybridRoles {
-
-}
-
-class GetHybridRolesResponse {
-
- /**
- * @var string $return
- * @access public
- */
- public $return;
-
-}
-
-class GetPasswordExpirationTime {
-
- /**
- * @var string $username
- * @access public
- */
- public $username;
-
-}
-
-class GetPasswordExpirationTimeResponse {
-
- /**
- * @var long $return
- * @access public
- */
- public $return;
-
-}
-
-class UpdateRoleName {
-
- /**
- * @var string $roleName
- * @access public
- */
- public $roleName;
-
- /**
- * @var string $newRoleName
- * @access public
- */
- public $newRoleName;
-
-}
-
-class ListUsers {
-
- /**
- * @var string $filter
- * @access public
- */
- public $filter;
-
- /**
- * @var int $maxItemLimit
- * @access public
- */
- public $maxItemLimit;
-
-}
-
-class ListUsersResponse {
-
- /**
- * @var string $return
- * @access public
- */
- public $return;
-
-}
-
-class IsExistingUser {
-
- /**
- * @var string $userName
- * @access public
- */
- public $userName;
-
-}
-
-class IsExistingUserResponse {
-
- /**
- * @var boolean $return
- * @access public
- */
- public $return;
-
-}
-
-class IsExistingRole {
-
- /**
- * @var string $roleName
- * @access public
- */
- public $roleName;
-
-}
-
-class IsExistingRoleResponse {
-
- /**
- * @var boolean $return
- * @access public
- */
- public $return;
-
-}
-
-class GetRoleNames {
-
-}
-
-class GetRoleNamesResponse {
-
- /**
- * @var string $return
- * @access public
- */
- public $return;
-
-}
-
-class GetProfileNames {
-
- /**
- * @var string $userName
- * @access public
- */
- public $userName;
-
-}
-
-class GetProfileNamesResponse {
-
- /**
- * @var string $return
- * @access public
- */
- public $return;
-
-}
-
-class GetUserListOfRole {
-
- /**
- * @var string $roleName
- * @access public
- */
- public $roleName;
-
-}
-
-class GetUserListOfRoleResponse {
-
- /**
- * @var string $return
- * @access public
- */
- public $return;
-
-}
-
-class GetUserClaimValue {
-
- /**
- * @var string $userName
- * @access public
- */
- public $userName;
-
- /**
- * @var string $claim
- * @access public
- */
- public $claim;
-
- /**
- * @var string $profileName
- * @access public
- */
- public $profileName;
-
-}
-
-class GetUserClaimValueResponse {
-
- /**
- * @var string $return
- * @access public
- */
- public $return;
-
-}
-
-class GetAllProfileNames {
-
-}
-
-class GetAllProfileNamesResponse {
-
- /**
- * @var string $return
- * @access public
- */
- public $return;
-
-}
-
-class UpdateCredentialByAdmin {
-
- /**
- * @var string $userName
- * @access public
- */
- public $userName;
-
- /**
- * @var string $newCredential
- * @access public
- */
- public $newCredential;
-
-}
-
-class DeleteUser {
-
- /**
- * @var string $userName
- * @access public
- */
- public $userName;
-
-}
-
-class DeleteRole {
-
- /**
- * @var string $roleName
- * @access public
- */
- public $roleName;
-
-}
-
-class GetUserId {
-
- /**
- * @var string $username
- * @access public
- */
- public $username;
-
-}
-
-class GetUserIdResponse {
-
- /**
- * @var int $return
- * @access public
- */
- public $return;
-
-}
-
-class GetRoleListOfUser {
-
- /**
- * @var string $userName
- * @access public
- */
- public $userName;
-
-}
-
-class getRoleListOfUserResponse {
-
- /**
- * @var string $return
- * @access public
- */
- public $return;
-
-}
-
-class GetProperties {
-
- /**
- * @var Tenant $tenant
- * @access public
- */
- public $tenant;
-
-}
-
-class GetPropertiesResponse {
-
- /**
- * @var Array<string> $return
- * @access public
- */
- public $return;
-
-}
-
-class IsReadOnly {
-
-}
-
-class IsReadOnlyResponse {
-
- /**
- * @var boolean $return
- * @access public
- */
- public $return;
-
-}
-
-class Authenticate {
-
- /**
- * @var string $userName
- * @access public
- */
- public $userName;
-
- /**
- * @var string $credential
- * @access public
- */
- public $credential;
-
-}
-
-class AuthenticateResponse {
-
- /**
- * @var boolean $return
- * @access public
- */
- public $return;
-
-}
-
-class UserStoreException {
-
-}
-
-/**
- * UserStoreManagerService class
- *
- */
-class UserStoreManagerStub extends SoapClient {
-
- private static $classmap = array(
- 'ClaimDTO' => 'ClaimDTO',
- 'PermissionDTO' => 'PermissionDTO',
- 'Tenant' => 'Tenant',
- 'RealmConfiguration' => 'RealmConfiguration',
- 'ClaimValue' => 'ClaimValue',
- 'addUserClaimValues' => 'AddUserClaimValues',
- 'getUserClaimValuesForClaims' => 'GetUserClaimValuesForClaims',
- 'getUserClaimValuesForClaimsResponse' => 'GetUserClaimValuesForClaimsResponse',
- 'getTenantIdofUser' => 'GetTenantIdofUser',
- 'getTenantIdofUserResponse' => 'GetTenantIdofUserResponse',
- 'addUserClaimValue' => 'AddUserClaimValue',
- 'getUserClaimValues' => 'GetUserClaimValues',
- 'getUserClaimValuesResponse' => 'GetUserClaimValuesResponse',
- 'getTenantId' => 'GetTenantId',
- 'getTenantIdResponse' => 'GetTenantIdResponse',
- 'addUser' => 'AddUser',
- 'addRole' => 'AddRole',
- 'getUserList' => 'GetUserList',
- 'getUserListResponse' => 'GetUserListResponse',
- 'updateCredential' => 'UpdateCredential',
- 'updateUserListOfRole' => 'UpdateUserListOfRole',
- 'updateRoleListOfUser' => 'UpdateRoleListOfUser',
- 'setUserClaimValue' => 'SetUserClaimValue',
- 'setUserClaimValues' => 'SetUserClaimValues',
- 'deleteUserClaimValue' => 'DeleteUserClaimValue',
- 'deleteUserClaimValues' => 'DeleteUserClaimValues',
- 'getHybridRoles' => 'GetHybridRoles',
- 'getHybridRolesResponse' => 'GetHybridRolesResponse',
- 'getPasswordExpirationTime' => 'GetPasswordExpirationTime',
- 'getPasswordExpirationTimeResponse' => 'GetPasswordExpirationTimeResponse',
- 'updateRoleName' => 'UpdateRoleName',
- 'listUsers' => 'ListUsers',
- 'listUsersResponse' => 'ListUsersResponse',
- 'isExistingUser' => 'IsExistingUser',
- 'isExistingUserResponse' => 'IsExistingUserResponse',
- 'isExistingRole' => 'IsExistingRole',
- 'isExistingRoleResponse' => 'IsExistingRoleResponse',
- 'getRoleNames' => 'GetRoleNames',
- 'getRoleNamesResponse' => 'GetRoleNamesResponse',
- 'getProfileNames' => 'GetProfileNames',
- 'getProfileNamesResponse' => 'GetProfileNamesResponse',
- 'getUserListOfRole' => 'GetUserListOfRole',
- 'getUserListOfRoleResponse' => 'GetUserListOfRoleResponse',
- 'getUserClaimValue' => 'GetUserClaimValue',
- 'getUserClaimValueResponse' => 'GetUserClaimValueResponse',
- 'getAllProfileNames' => 'GetAllProfileNames',
- 'getAllProfileNamesResponse' => 'GetAllProfileNamesResponse',
- 'updateCredentialByAdmin' => 'UpdateCredentialByAdmin',
- 'deleteUser' => 'DeleteUser',
- 'deleteRole' => 'DeleteRole',
- 'getUserId' => 'GetUserId',
- 'getUserIdResponse' => 'GetUserIdResponse',
- 'getRoleListOfUser' => 'GetRoleListOfUser',
- 'getRoleListOfUserResponse' => 'GetRoleListOfUserResponse',
- 'getProperties' => 'GetProperties',
- 'getPropertiesResponse' => 'GetPropertiesResponse',
- 'isReadOnly' => 'IsReadOnly',
- 'isReadOnlyResponse' => 'IsReadOnlyResponse',
- 'authenticate' => 'Authenticate',
- 'authenticateResponse' => 'AuthenticateResponse',
- 'Tenant' => 'Tenant'
- );
-
- public function RemoteUserStoreManagerStub($wsdl, $options = array()) {
- foreach (self::$classmap as $key => $value) {
- if (!isset($options['classmap'][$key])) {
- $options['classmap'][$key] = $value;
- }
- }
- parent::__construct($wsdl, $options);
- }
-
- /**
- * Function to authenticate
- *
- * @param Authenticate $parameters
- * @return AuthenticateResponse
- */
- public function authenticate(Authenticate $parameters) {
- return $this->__soapCall('authenticate', array($parameters), array(
- 'uri' => 'http://service.ws.um.carbon.wso2.org',
- 'soapaction' => ''
- ));
- }
-
- /**
- * Function get user list
- *
- * @param GetUserList $parameters
- * @return GetUserListResponse
- */
- public function getUserList(GetUserList $parameters) {
- return $this->__soapCall('getUserList', array($parameters), array(
- 'uri' => 'http://service.ws.um.carbon.wso2.org',
- 'soapaction' => ''
- ));
- }
-
- /**
- * Function to get the user claim value
- *
- * @param GetUserClaimValue $parameters
- * @return GetUserClaimValueResponse
- */
- public function getUserClaimValue(GetUserClaimValue $parameters) {
- return $this->__soapCall('getUserClaimValue', array($parameters), array(
- 'uri' => 'http://service.ws.um.carbon.wso2.org',
- 'soapaction' => ''
- ));
- }
-
- /**
- * Function to get the user list of role
- *
- * @param GetUserListOfRole $parameters
- * @return GetUserListOfRoleResponse
- */
- public function getUserListOfRole(GetUserListOfRole $parameters) {
- return $this->__soapCall('getUserListOfRole', array($parameters), array(
- 'uri' => 'http://service.ws.um.carbon.wso2.org',
- 'soapaction' => ''
- ));
- }
-
- /**
- * Function to check whether the service is read only
- *
- * @param IsReadOnly $parameters
- * @return IsReadOnlyResponse
- */
- public function isReadOnly(IsReadOnly $parameters) {
- return $this->__soapCall('isReadOnly', array($parameters), array(
- 'uri' => 'http://service.ws.um.carbon.wso2.org',
- 'soapaction' => ''
- ));
- }
-
- /**
- * Function to update the credentials
- *
- * @param UpdateCredential $parameters
- * @return void
- */
- public function updateCredential(UpdateCredential $parameters) {
- return $this->__soapCall('updateCredential', array($parameters), array(
- 'uri' => 'http://service.ws.um.carbon.wso2.org',
- 'soapaction' => ''
- ));
- }
-
- /**
- * Function to set user claim value
- *
- * @param SetUserClaimValue $parameters
- * @return void
- */
- public function setUserClaimValue(setUserClaimValue $parameters) {
- return $this->__soapCall('setUserClaimValue', array($parameters), array(
- 'uri' => 'http://service.ws.um.carbon.wso2.org',
- 'soapaction' => ''
- ));
- }
-
- /**
- * Function to get the claim values for claims
- *
- * @param GetUserClaimValuesForClaims $parameters
- * @return GetUserClaimValuesForClaimsResponse
- */
- public function getUserClaimValuesForClaims(GetUserClaimValuesForClaims $parameters) {
- return $this->__soapCall('getUserClaimValuesForClaims', array($parameters), array(
- 'uri' => 'http://service.ws.um.carbon.wso2.org',
- 'soapaction' => ''
- ));
- }
-
- /**
- * Function to delete user claim values
- *
- * @param DeleteUserClaimValues $parameters
- * @return void
- */
- public function deleteUserClaimValues(DeleteUserClaimValues $parameters) {
- return $this->__soapCall('deleteUserClaimValues', array($parameters), array(
- 'uri' => 'http://service.ws.um.carbon.wso2.org',
- 'soapaction' => ''
- ));
- }
-
- /**
- * Function to delete user claim value
- *
- * @param DeleteUserClaimValue $parameters
- * @return void
- */
- public function deleteUserClaimValue(DeleteUserClaimValue $parameters) {
- return $this->__soapCall('deleteUserClaimValue', array($parameters), array(
- 'uri' => 'http://service.ws.um.carbon.wso2.org',
- 'soapaction' => ''
- ));
- }
-
- /**
- * Function to check whether use is existing
- *
- * @param IsExistingUser $parameters
- * @return IsExistingUserResponse
- */
- public function isExistingUser(IsExistingUser $parameters) {
- return $this->__soapCall('isExistingUser', array($parameters), array(
- 'uri' => 'http://service.ws.um.carbon.wso2.org',
- 'soapaction' => ''
- ));
- }
-
- /**
- * Function to update credential by admin
- *
- * @param UpdateCredentialByAdmin $parameters
- * @return void
- */
- public function updateCredentialByAdmin(UpdateCredentialByAdmin $parameters) {
- return $this->__soapCall('updateCredentialByAdmin', array($parameters), array(
- 'uri' => 'http://service.ws.um.carbon.wso2.org',
- 'soapaction' => ''
- ));
- }
-
- /**
- * Function to get the tenant id
- *
- * @param GetTenantId $parameters
- * @return GetTenantIdResponse
- */
- public function getTenantId(GetTenantId $parameters) {
- return $this->__soapCall('getTenantId', array($parameters), array(
- 'uri' => 'http://service.ws.um.carbon.wso2.org',
- 'soapaction' => ''
- ));
- }
-
- /**
- * Function to get role names
- *
- * @param GetRoleNames $parameters
- * @return GetRoleNamesResponse
- */
- public function getRoleNames(GetRoleNames $parameters) {
- return $this->__soapCall('getRoleNames', array($parameters), array(
- 'uri' => 'http://service.ws.um.carbon.wso2.org',
- 'soapaction' => ''
- ));
- }
-
- /**
- * Funtion to get properties
- *
- * @param GetProperties $parameters
- * @return GetPropertiesResponse
- */
- public function getProperties(GetProperties $parameters) {
- return $this->__soapCall('getProperties', array($parameters), array(
- 'uri' => 'http://service.ws.um.carbon.wso2.org',
- 'soapaction' => ''
- ));
- }
-
- /**
- * Function to get user id
- *
- * @param GetUserId $parameters
- * @return GetUserIdResponse
- */
- public function getUserId(GetUserId $parameters) {
- return $this->__soapCall('getUserId', array($parameters), array(
- 'uri' => 'http://service.ws.um.carbon.wso2.org',
- 'soapaction' => ''
- ));
- }
-
- /**
- * Function to get all the profile names
- *
- * @param GetAllProfileNames $parameters
- * @return GetAllProfileNamesResponse
- */
- public function getAllProfileNames(GetAllProfileNames $parameters) {
- return $this->__soapCall('getAllProfileNames', array($parameters), array(
- 'uri' => 'http://service.ws.um.carbon.wso2.org',
- 'soapaction' => ''
- ));
- }
-
- /**
- * Function to get the password expiration time
- *
- * @param GetPasswordExpirationTime $parameters
- * @return GetPasswordExpirationTimeResponse
- */
- public function getPasswordExpirationTime(GetPasswordExpirationTime $parameters) {
- return $this->__soapCall('getPasswordExpirationTime', array($parameters), array(
- 'uri' => 'http://service.ws.um.carbon.wso2.org',
- 'soapaction' => ''
- ));
- }
-
- /**
- * Function to list users
- *
- * @param ListUsers $parameters
- * @return ListUsersResponse
- */
- public function listUsers(ListUsers $parameters) {
- return $this->__soapCall('listUsers', array($parameters), array(
- 'uri' => 'http://service.ws.um.carbon.wso2.org',
- 'soapaction' => ''
- ));
- }
-
- /**
- * Function to delete role
- *
- * @param DeleteRole $parameters
- * @return void
- */
- public function deleteRole(DeleteRole $parameters) {
- return $this->__soapCall('deleteRole', array($parameters), array(
- 'uri' => 'http://service.ws.um.carbon.wso2.org',
- 'soapaction' => ''
- ));
- }
-
- /**
- * Function to delete user
- *
- * @param DeleteUser $parameters
- * @return void
- */
- public function deleteUser(DeleteUser $parameters) {
- return $this->__soapCall('deleteUser', array($parameters), array(
- 'uri' => 'http://service.ws.um.carbon.wso2.org',
- 'soapaction' => ''
- ));
- }
-
- /**
- * Function get the role list of the user
- *
- * @param GetRoleListOfUser $parameters
- * @return GetRoleListOfUserResponse
- */
- public function getRoleListOfUser(GetRoleListOfUser $parameters) {
- return $this->__soapCall('getRoleListOfUser', array($parameters), array(
- 'uri' => 'http://service.ws.um.carbon.wso2.org',
- 'soapaction' => ''
- ));
- }
-
- /**
- * Function to update the role name
- *
- * @param UpdateRoleName $parameters
- * @return void
- */
- public function updateRoleName(UpdateRoleName $parameters) {
- return $this->__soapCall('updateRoleName', array($parameters), array(
- 'uri' => 'http://service.ws.um.carbon.wso2.org',
- 'soapaction' => ''
- ));
- }
-
- /**
- * Function to check whether a role is existing
- *
- * @param IsExistingRole $parameters
- * @return IsExistingRoleResponse
- */
- public function isExistingRole(IsExistingRole $parameters) {
- return $this->__soapCall('isExistingRole', array($parameters), array(
- 'uri' => 'http://service.ws.um.carbon.wso2.org',
- 'soapaction' => ''
- ));
- }
-
- /**
- * Function to update role list of user
- *
- * @param UpdateRoleListOfUser $parameters
- * @return void
- */
- public function updateRoleListOfUser(UpdateRoleListOfUser $parameters) {
- return $this->__soapCall('updateRoleListOfUser', array($parameters), array(
- 'uri' => 'http://service.ws.um.carbon.wso2.org',
- 'soapaction' => ''
- ));
- }
-
- /**
- * Function to get user claim values
- *
- * @param GetUserClaimValues $parameters
- * @return GetUserClaimValuesResponse
- */
- public function getUserClaimValues(GetUserClaimValues $parameters) {
- return $this->__soapCall('getUserClaimValues', array($parameters), array(
- 'uri' => 'http://service.ws.um.carbon.wso2.org',
- 'soapaction' => ''
- ));
- }
-
- /**
- * Function to get hybrid roles
- *
- * @param GetHybridRoles $parameters
- * @return GetHybridRolesResponse
- */
- public function getHybridRoles(GetHybridRoles $parameters) {
- return $this->__soapCall('getHybridRoles', array($parameters), array(
- 'uri' => 'http://service.ws.um.carbon.wso2.org',
- 'soapaction' => ''
- ));
- }
-
- /**
- * Function to add user claim values
- *
- * @param AddUserClaimValues $parameters
- * @return void
- */
- public function addUserClaimValues(AddUserClaimValues $parameters) {
- return $this->__soapCall('addUserClaimValues', array($parameters), array(
- 'uri' => 'http://service.ws.um.carbon.wso2.org',
- 'soapaction' => ''
- ));
- }
-
- /**
- * Function to add user
- *
- * @param AddUser $parameters
- * @return void
- */
- public function addUser(AddUser $parameters) {
- return $this->__soapCall('addUser', array($parameters), array(
- 'uri' => 'http://service.ws.um.carbon.wso2.org',
- 'soapaction' => ''
- ));
- }
-
- /**
- * Function to add role
- *
- * @param AddRole $parameters
- * @return void
- */
- public function addRole(AddRole $parameters) {
- return $this->__soapCall('addRole', array($parameters), array(
- 'uri' => 'http://service.ws.um.carbon.wso2.org',
- 'soapaction' => ''
- ));
- }
-
- /**
- * Function to update user list of roles
- *
- * @param UpdateUserListOfRole $parameters
- * @return void
- */
- public function updateUserListOfRole(UpdateUserListOfRole $parameters) {
- return $this->__soapCall('updateUserListOfRole', array($parameters), array(
- 'uri' => 'http://service.ws.um.carbon.wso2.org',
- 'soapaction' => ''
- ));
- }
-
- /**
- * Function to get the tenant Id
- *
- * @param GetTenantIdofUser $parameters
- * @return GetTenantIdofUserResponse
- */
- public function getTenantIdofUser(GetTenantIdofUser $parameters) {
- return $this->__soapCall('getTenantIdofUser', array($parameters), array(
- 'uri' => 'http://service.ws.um.carbon.wso2.org',
- 'soapaction' => ''
- ));
- }
-
- /**
- * Function to set user claim values
- *
- * @param SetUserClaimValues $parameters
- * @return void
- */
- public function setUserClaimValues(SetUserClaimValues $parameters) {
- return $this->__soapCall('setUserClaimValues', array($parameters), array(
- 'uri' => 'http://service.ws.um.carbon.wso2.org',
- 'soapaction' => ''
- ));
- }
-
- /**
- * Function to add user claim value
- *
- * @param AddUserClaimValue $parameters
- * @return void
- */
- public function addUserClaimValue(AddUserClaimValue $parameters) {
- return $this->__soapCall('addUserClaimValue', array($parameters), array(
- 'uri' => 'http://service.ws.um.carbon.wso2.org',
- 'soapaction' => ''
- ));
- }
-
- /**
- * Function to get the profile names
- *
- * @param GetProfileNames $parameters
- * @return GetProfileNamesResponse
- */
- public function getProfileNames(GetProfileNames $parameters) {
- return $this->__soapCall('getProfileNames', array($parameters), array(
- 'uri' => 'http://service.ws.um.carbon.wso2.org',
- 'soapaction' => ''
- ));
- }
-
-}
-
-?>
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/3ca02155/workbench/airavata/wsis/src/Airavata/Wsis/Wsis.php
----------------------------------------------------------------------
diff --git a/workbench/airavata/wsis/src/Airavata/Wsis/Wsis.php b/workbench/airavata/wsis/src/Airavata/Wsis/Wsis.php
deleted file mode 100755
index e4cbb6e..0000000
--- a/workbench/airavata/wsis/src/Airavata/Wsis/Wsis.php
+++ /dev/null
@@ -1,280 +0,0 @@
-<?php
-
-namespace Airavata\Wsis;
-
-use Illuminate\Support\Facades\Config;
-use Airavata\Wsis\Stubs\UserStoreManager;
-
-class Wsis {
-
- /**
- * @var UserStoreManager
- * @access private
- */
- private $userStoreManager;
-
- /**
- * @var string
- * @access private
- */
- private $server;
-
- /**
- * @var string
- * @access private
- */
- private $service_url;
-
-
- /**
- * Constructor
- *
- * @param string $admin_username
- * @param string $admin_password
- * @param string $server
- * @param string $service_url
- * @param string $cafile_path
- * @param bool $verify_peer
- * @param bool $allow_selfsigned_cer
- * @throws Exception
- */
- public function __construct($admin_username, $admin_password = null, $server,
- $service_url,$cafile_path, $verify_peer, $allow_selfsigned_cert) {
-
- $context = stream_context_create(array(
- 'ssl' => array(
- 'verify_peer' => $verify_peer,
- "allow_self_signed"=> $allow_selfsigned_cert,
- 'cafile' => $cafile_path,
- 'CN_match' => $server,
- )
- ));
-
- $parameters = array(
- 'login' => $admin_username,
- 'password' => $admin_password,
- 'stream_context' => $context,
- 'trace' => 1,
- 'features' => SOAP_WAIT_ONE_WAY_CALLS
- );
-
- $this->server = $server;
- $this->service_url = $service_url;
-
- try {
- $this->userStoreManager = new UserStoreManager($service_url, $parameters);
- } catch (Exception $ex) {
- print_r( $ex); exit;
- throw new Exception("Unable to instantiate client", 0, $ex);
- }
- }
-
-
- /**
- * Function to add new user
- *
- * @param string $userName
- * @param string $password
- * @return void
- * @throws Exception
- */
- public function addUser($userName, $password, $fullName) {
- try {
- $this->userStoreManager->addUser($userName, $password, $fullName);
- } catch (Exception $ex) {
- throw new Exception("Unable to add new user", 0, $ex);
- }
- }
-
- /**
- * Function to delete existing user
- *
- * @param string $username
- * @return void
- * @throws Exception
- */
- public function deleteUser($username) {
- try {
- $this->userStoreManager->deleteUser($username);
- } catch (Exception $ex) {
- throw new Exception("Unable to delete user", 0, $ex);
- }
- }
-
-
- /**
- * Function to authenticate user
- *
- * @param string $username
- * @param string $password
- * @return boolean
- * @throws Exception
- */
- public function authenticate($username, $password){
- try {
- return $this->userStoreManager->authenticate($username, $password);
- } catch (Exception $ex) {
- var_dump( $ex); exit;
- throw new Exception("Unable to authenticate user", 0, $ex);
- }
- }
-
- /**
- * Function to check whether username exists
- *
- * @param string $username
- * @return boolean
- * @throws Exception
- */
- public function username_exists($username){
- try {
- return $this->userStoreManager->isExistingUser($username);
- } catch (Exception $ex) {
- throw new Exception("Unable to verify username exists", 0, $ex);
- }
- }
-
- /**
- * Function to check whether a role is existing
- *
- * @param string $roleName
- * @return IsExistingRoleResponse
- */
- public function is_existing_role( $roleName){
- try {
- return $this->userStoreManager->isExistingRole( $roleName);
- } catch (Exception $ex) {
- throw new Exception("Unable to check if the role exists", 0, $ex);
- }
- }
-
- /**
- * Function to add new role by providing the role name.
- *
- * @param string $roleName
- */
- public function add_role($roleName){
- try {
- return $this->userStoreManager->addRole( $roleName);
- } catch (Exception $ex) {
- throw new Exception("Unable to add this role", 0, $ex);
- }
- }
-
- /**
- * Function to delete existing role
- *
- * @param string $roleName
- * @return void
- * @throws Exception
- */
- public function delete_role($roleName) {
- try {
- $this->userStoreManager->deleteRole($roleName);
- } catch (Exception $ex) {
- var_dump( $ex); exit;
-
- throw new Exception("Unable to delete role", 0, $ex);
- }
- }
-
- /**
- * Function to get the list of all existing roles
- *
- * @return roles list
- */
- public function get_all_roles(){
- try {
- return $this->userStoreManager->getRoleNames();
- } catch (Exception $ex) {
- throw new Exception("Unable to get all roles", 0, $ex);
- }
- }
-
- /**
- * Function to get role of a user
- *
- * @return user role
- */
- public function get_user_roles( $username){
- try {
- return $this->userStoreManager->getRoleListOfUser( $username);
- } catch (Exception $ex) {
- throw new Exception("Unable to get User roles.", 0, $ex);
- }
- }
-
- /**
- * Function to get the user list of role
- *
- * @param GetUserListOfRole $parameters
- * @return GetUserListOfRoleResponse
- */
- public function get_userlist_of_role( $role){
- try {
- return $this->userStoreManager->getUserListOfRole( $role);
- } catch (Exception $ex) {
- var_dump( $ex); exit;
- throw new Exception("Unable to get user list of roles.", 0, $ex);
- }
- }
-
- /**
- * Function to update role list of user
- *
- * @param UpdateRoleListOfUser $parameters
- * @return void
- */
- public function update_user_roles( $username, $roles){
- try {
- return $this->userStoreManager->updateRoleListOfUser( $username, $roles);
- } catch (Exception $ex) {
- throw new Exception("Unable to update role of the user.", 0, $ex);
- }
- }
-
- /**
- * Function to list users
- *
- * @param void
- * @return void
- */
- public function list_users(){
- try {
- return $this->userStoreManager->listUsers();
- } catch (Exception $ex) {
- var_dump( $ex->debug_message);
- throw new Exception("Unable to list users.", 0, $ex);
- }
- }
-
- /**
- * Function to get the tenant id
- *
- * @param GetTenantId $parameters
- * @return GetTenantIdResponse
- */
- public function get_tenant_id(){
- try {
- return $this->userStoreManager->getTenantId();
- } catch (Exception $ex) {
- var_dump( $ex->debug_message);
- throw new Exception("Unable to get the tenant Id.", 0, $ex);
- }
- }
-
- /**
- * Function create a new Tenant
- *
- * @param Tenant $parameters
- * @return void
- */
- public function create_tenant( $inputs){
- try {
- return $this->userStoreManager->createTenant( $inputs);
- } catch (Exception $ex) {
- var_dump( $ex);
- throw new Exception("Unable to create Tenant.", 0, $ex);
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/3ca02155/workbench/airavata/wsis/src/Airavata/Wsis/WsisServiceProvider.php
----------------------------------------------------------------------
diff --git a/workbench/airavata/wsis/src/Airavata/Wsis/WsisServiceProvider.php b/workbench/airavata/wsis/src/Airavata/Wsis/WsisServiceProvider.php
deleted file mode 100755
index e5a2cf4..0000000
--- a/workbench/airavata/wsis/src/Airavata/Wsis/WsisServiceProvider.php
+++ /dev/null
@@ -1,64 +0,0 @@
-<?php namespace Airavata\Wsis;
-
-use Illuminate\Support\ServiceProvider;
-use Illuminate\Support\Facades\Config;
-
-class WsisServiceProvider 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/wsis');
- }
-
- /**
- * Register the service provider.
- *
- * @return void
- */
- public function register()
- {
- //registering service provider
- $this->app['wsis'] = $this->app->share(function($app)
- {
- return new Wsis(
- Config::get('wsis::admin-username'),
- Config::get('wsis::admin-password'),
- Config::get('wsis::server'),
- Config::get('wsis::service-url'),
- Config::get('wsis::cafile-path'),
- Config::get('wsis::verify-peer'),
- Config::get('wsis::allow-selfsigned-cert')
- );
- });
-
- //registering alis
- $this->app->booting(function()
- {
- $loader = \Illuminate\Foundation\AliasLoader::getInstance();
- $loader->alias('WSIS', 'Airavata\Wsis\Facades\Wsis');
- });
- }
-
- /**
- * Get the services provided by the provider.
- *
- * @return array
- */
- public function provides()
- {
- return array('wsis');
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/3ca02155/workbench/airavata/wsis/src/config/config.php
----------------------------------------------------------------------
diff --git a/workbench/airavata/wsis/src/config/config.php b/workbench/airavata/wsis/src/config/config.php
deleted file mode 100644
index 69f61cf..0000000
--- a/workbench/airavata/wsis/src/config/config.php
+++ /dev/null
@@ -1,52 +0,0 @@
-<?php
-return array(
- /**
- * Admin Role Name
- */
- 'admin-role-name' => 'admin',
-
- /**
- * Gateway user role
- */
- 'gateway-admin' => 'Internal/everyone',
-
- /**
- * Tenant admin's username
- */
- 'admin-username' => 'admin-username',
-
- /**
- * Tenant admin's password
- */
- 'admin-password' => 'admin-password',
-
- /**
- * Identity server domain
- */
- 'server' => 'idp.scigap.org',
-
- /**
- * Identity server web services endpoint
- */
- 'service-url' => 'https://idp.scigap.org:7443/services/',
-
- /**
- * Gateway domain name
- */
- 'gateway-id' => 'default',
-
- /**
- * Path to the server certificate file
- */
- 'cafile-path' => app_path() . '/resources/security/idp_scigap_org.pem',
-
- /**
- * Enable HTTPS server verification
- */
- 'verify-peer' => true,
-
- /**
- * Allow self signed server certificates
- */
- 'allow-self-signed' => false
-);
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/3ca02155/workbench/airavata/wsis/tests/.gitkeep
----------------------------------------------------------------------
diff --git a/workbench/airavata/wsis/tests/.gitkeep b/workbench/airavata/wsis/tests/.gitkeep
deleted file mode 100755
index e69de29..0000000
[7/8] airavata-php-gateway git commit: Adding missing files
Posted by sm...@apache.org.
Adding missing files
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/01d2420d
Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/01d2420d
Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/01d2420d
Branch: refs/heads/master
Commit: 01d2420de3f349b1f6f1c6888fed089fa026149d
Parents: e1a1024
Author: Supun Nakandala <su...@gmail.com>
Authored: Sat May 9 14:17:17 2015 +0530
Committer: Supun Nakandala <su...@gmail.com>
Committed: Sat May 9 14:17:17 2015 +0530
----------------------------------------------------------------------
app/config/pga_config.php | 85 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 85 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/01d2420d/app/config/pga_config.php
----------------------------------------------------------------------
diff --git a/app/config/pga_config.php b/app/config/pga_config.php
new file mode 100644
index 0000000..146b236
--- /dev/null
+++ b/app/config/pga_config.php
@@ -0,0 +1,85 @@
+<?php
+return array(
+ /**
+ * *****************************************************************
+ * These are WSO2 Identity Server Related Configurations
+ * *****************************************************************
+ */
+
+ 'wsis' => [
+
+ /**
+ * Admin Role Name
+ */
+ 'admin-role-name' => 'admin',
+
+ /**
+ * Gateway user role
+ */
+ 'gateway-admin' => 'Internal/everyone',
+
+ /**
+ * Tenant admin's username
+ */
+ 'admin-username' => 'test@testphprg.scigap.org',
+
+ /**
+ * Tenant admin's password
+ */
+ 'admin-password' => 'testadmin@scigap.org',
+
+ /**
+ * Identity server domain
+ */
+ 'server' => 'idp.scigap.org',
+
+ /**
+ * Identity server web services endpoint
+ */
+ 'service-url' => 'https://idp.scigap.org:7443/services/',
+
+ /**
+ * Gateway domain name
+ */
+ 'gateway-id' => 'default',
+
+ /**
+ * Path to the server certificate file
+ */
+ 'cafile-path' => app_path() . '/resources/security/idp_scigap_org.pem',
+
+ /**
+ * Enable HTTPS server verification
+ */
+ 'verify-peer' => true,
+
+ /**
+ * Allow self signed server certificates
+ */
+ 'allow-self-signed-cert' => false
+ ],
+
+
+ /**
+ * *****************************************************************
+ * These are Airavata Related Configurations
+ * *****************************************************************
+ */
+ 'airavata' => [
+ /**
+ * Airavata API server location
+ */
+ 'airavata-server' => 'gw111.iu.xsede.org',
+
+ /**
+ * Airavata API server port
+ */
+ 'airavata-port' => '9930',
+
+ /**
+ * Airavata API server thrift communication timeout
+ */
+ 'airavata-timeout' => '1000000'
+ ]
+
+);
\ No newline at end of file
[2/8] airavata-php-gateway git commit: wrapping Airavata and WSIS
code as laravel library component and service providers
Posted by sm...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/3ca02155/app/libraries/utilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/utilities.php b/app/libraries/utilities.php
deleted file mode 100644
index 0d428d9..0000000
--- a/app/libraries/utilities.php
+++ /dev/null
@@ -1,2337 +0,0 @@
-<?php
-
-//Thrift classes - loaded from Vendor/Thrift
-use Thrift\Transport\TTransport;
-use Thrift\Exception\TException;
-use Thrift\Exception\TTransportException;
-use Thrift\Factory\TStringFuncFactory;
-use Thrift\Protocol\TBinaryProtocol;
-use Thrift\Transport\TSocket;
-
-//Airavata classes - loaded from app/libraries/Airavata
-use Airavata\API\AiravataClient;
-use Airavata\API\Error\InvalidRequestException;
-use Airavata\API\Error\AiravataClientException;
-use Airavata\API\Error\AiravataSystemException;
-use Airavata\API\Error\ExperimentNotFoundException;
-use Airavata\Model\Workspace\Experiment\ComputationalResourceScheduling;
-use Airavata\Model\AppCatalog\AppInterface\InputDataObjectType;
-use Airavata\Model\Workspace\Experiment\UserConfigurationData;
-use Airavata\Model\Workspace\Experiment\AdvancedOutputDataHandling;
-use Airavata\Model\Workspace\Experiment\Experiment;
-use Airavata\Model\Workspace\Experiment\ExperimentState;
-use Airavata\Model\AppCatalog\AppInterface\DataType;
-use Airavata\Model\Workspace\Project;
-use Airavata\Model\Workspace\Experiment\JobState;
-use Airavata\Model\AppCatalog\ComputeResource\JobSubmissionInterface;
-use Airavata\Model\AppCatalog\ComputeResource\JobSubmissionProtocol;
-
-
-
-class Utilities{
-/**
- * Basic utility functions
- */
-
-/*
-
-************* IMPORTANT ************
-
-READ :: ALL CONSTANTS ARE NOW BEING CALLED FROM app/models/Constant.php.
-
-************* IMPORTANT ************
-*/
-private $tokenFilePath = 'tokens.xml';
-private $tokenFile = null;
-
-private $sshUser;
-private $hostName;
-private static $pathConstant;
-private static $experimentPath;
-private static $experimentDataPathAbsolute;
-
-function __construct(){
- $this->sshUser = "root";
- $this->hostName = $_SERVER['SERVER_NAME'];
-
- self::$experimentDataPathAbsolute = base_path() . Constant::EXPERIMENT_DATA_ROOT;
- self::$pathConstant = 'file://'.$this->sshUser.'@'.$this->hostName.':' . self::$experimentDataPathAbsolute;
- self::$experimentPath = null;
-}
-
-/**
- * Print success message
- * @param $message
- */
-public static function print_success_message($message)
-{
- echo '<div class="alert alert-success">' . $message . '</div>';
-}
-
-/**
- * Print warning message
- * @param $message
- */
-public static function print_warning_message($message)
-{
- echo '<div class="alert alert-warning">' . $message . '</div>';
-}
-
-/**
- * Print error message
- * @param $message
- */
-public static function print_error_message($message)
-{
- echo '<div class="alert alert-danger">' . $message . '</div>';
-}
-
-/**
- * Print info message
- * @param $message
- */
-public static function print_info_message($message)
-{
- echo '<div class="alert alert-info">' . $message . '</div>';
-}
-
-/**
- * Redirect to the given url
- * @param $url
- */
-public static function redirect($url)
-{
- echo '<meta http-equiv="Refresh" content="0; URL=' . $url . '">';
-}
-
-/**
- * Return true if the form has been submitted
- * @return bool
- */
-public static function form_submitted()
-{
- return isset($_POST['Submit']);
-}
-
-/**
- * Compare the submitted credentials with those stored in the database
- * @param $username
- * @param $password
- * @return bool
- */
-public static function id_matches_db($username, $password)
-{
- $idStore = new WSISUtilities();
-
- try
- {
- $idStore->connect();
- }
- catch (Exception $e)
- {
- Utilities::print_error_message('<p>Error connecting to ID store.
- Please try again later or report a bug using the link in the Help menu</p>' .
- '<p>' . $e->getMessage() . '</p>');
- }
- //checking user roles.
- //var_dump( $idStore->updateRoleListOfUser( $username, array( "new"=>array("admin"), "deleted"=>array() ) ) );
- //var_dump($idStore->getRoleListOfUser( $username) ); exit;
- //var_dump( $idStore->authenticate($username, $password)); exit;
- if($idStore->authenticate($username, $password))
- {
- //checking if user is an Admin and saving in Session.
- $app_config = Utilities::read_config();
-
- if( in_array( $app_config["admin-role"], (array)$idStore->getRoleListOfUser( $username)))
- {
- Session::put("admin", true);
- }
- return true;
- }else{
- return false;
- }
-}
-
-
-/**
- * Store username in session variables
- * @param $username
- */
-public static function store_id_in_session($username)
-{
- Session::put('username', $username );
- Session::put('loggedin', true);
-}
-
-/**
- * Return true if the username stored in the session
- * @return bool
- */
-public static function id_in_session()
-{
- if( Session::has("username") && Session::has('loggedin') )
- return true;
- else
- return false;
-}
-
-/**
- * Verify if the user is already logged in. If not, redirect to the home page.
- */
-public static function verify_login()
-{
- if (Utilities::id_in_session())
- {
- return true;
- }
- else
- {
- Utilities::print_error_message('User is not logged in!');
- return false;
- }
-}
-
-/**
- * Connect to the ID store
- */
-public static function connect_to_id_store()
-{
- global $idStore;
- $app_config = Utilities::read_config();
-
- switch ($app_config["user-store"])
- {
- case 'WSO2':
- $idStore = new WSISUtilities(); // WS02 Identity Server
- break;
- case 'XML':
- $idStore = new XmlIdUtilities(); // XML user database
- break;
- }
-
- try
- {
- $idStore->connect();
- }
- catch (Exception $e)
- {
- Utilities::print_error_message('<p>Error connecting to ID store.
- Please try again later or report a bug using the link in the Help menu</p>' .
- '<p>' . $e->getMessage() . '</p>');
- }
-}
-
-/**
- * Return an Airavata client
- * @return AiravataClient
- */
-public static function get_airavata_client()
-{
- try
- {
- $app_config = Utilities::read_config();
- $transport = new TSocket( $app_config["airavata-server"], $app_config["airavata-port"]);
- $transport->setRecvTimeout( $app_config["airavata-timeout"]);
- $transport->setSendTimeout( $app_config["airavata-timeout"]);
-
- $protocol = new TBinaryProtocol($transport);
- $transport->open();
-
- $client = new AiravataClient($protocol);
-
- if( is_object( $client))
- return $client;
- else
- return Redirect::to("airavata/down");
- }
- catch (Exception $e)
- {
- /*Utilities::print_error_message('<p>There was a problem connecting to Airavata.
- Please try again later or submit a bug report using the link in the Help menu.</p>' .
- '<p>' . $e->getMessage() . '</p>');
- */
-
- }
-}
-
-
-
-/**
- * Launch the experiment with the given ID
- * @param $expId
- */
-public static function launch_experiment($expId)
-{
- $airavataclient = Session::get("airavataClient");
- //global $tokenFilePath;
- try
- {
- /* temporarily using hard-coded token
- open_tokens_file($tokenFilePath);
-
- $communityToken = $tokenFile->tokenId;
-
-
- $token = isset($_SESSION['tokenId'])? $_SESSION['tokenId'] : $communityToken;
-
- $airavataclient->launchExperiment($expId, $token);
-
- $tokenString = isset($_SESSION['tokenId'])? 'personal' : 'community';
-
- Utilities::print_success_message('Experiment launched using ' . $tokenString . ' allocation!');
- */
-
- $app_config = Utilities::read_config();
- $hardCodedToken = $app_config['credential-store-token'];
- $airavataclient->launchExperiment($expId, $hardCodedToken);
-
- /*
- Utilities::print_success_message('Experiment launched!');
- Utilities::print_success_message("<p>Experiment launched!</p>" .
- '<p>You will be redirected to the summary page shortly, or you can
- <a href="experiment_summary.php?expId=' . $expId . '">go directly</a> to the experiment summary page.</p>');
- redirect('experiment_summary.php?expId=' . $expId);
- */
- }
- catch (InvalidRequestException $ire)
- {
- Utilities::print_error_message('<p>There was a problem launching the experiment.
- Please try again later or submit a bug report using the link in the Help menu.</p>' .
- '<p>InvalidRequestException: ' . $ire->getMessage() . '</p>');
- }
- catch (ExperimentNotFoundException $enf)
- {
- Utilities::print_error_message('<p>There was a problem launching the experiment.
- Please try again later or submit a bug report using the link in the Help menu.</p>' .
- '<p>ExperimentNotFoundException: ' . $enf->getMessage() . '</p>');
- }
- catch (AiravataClientException $ace)
- {
- Utilities::print_error_message('<p>There was a problem launching the experiment.
- Please try again later or submit a bug report using the link in the Help menu.</p>' .
- '<p>AiravataClientException: ' . $ace->getMessage() . '</p>');
- }
- catch (AiravataSystemException $ase)
- {
- Utilities::print_error_message('<p>There was a problem launching the experiment.
- Please try again later or submit a bug report using the link in the Help menu.</p>' .
- '<p>AiravataSystemException: ' . $ase->getMessage() . '</p>');
- }
- catch (Exception $e)
- {
- Utilities::print_error_message('<p>There was a problem launching the experiment.
- Please try again later or submit a bug report using the link in the Help menu.</p>' .
- '<p>Exception: ' . $e->getMessage() . '</p>');
- }
-}
-
-/**
- * Get all projects owned by the given user
- * @param $username
- * @return null
- */
-public static function get_all_user_projects($gatewayId, $username)
-{
- $airavataclient = Session::get("airavataClient");
- $userProjects = null;
-
- try
- {
- $userProjects = $airavataclient->getAllUserProjects($gatewayId, $username);
- //var_dump( $userProjects); exit;
- }
- catch (InvalidRequestException $ire)
- {
- Utilities::print_error_message('<p>There was a problem getting the user\'s projects.
- Please try again later or submit a bug report using the link in the Help menu.</p>' .
- '<p>InvalidRequestException: ' . $ire->getMessage(). '</p>');
- }
- catch (AiravataClientException $ace)
- {
- Utilities::print_error_message('<p>There was a problem getting the user\'s projects.
- Please try again later or submit a bug report using the link in the Help menu.</p>' .
- '<p>Airavata Client Exception: ' . $ace->getMessage(). '</p>');
- }
- catch (AiravataSystemException $ase)
- {
- if ($ase->airavataErrorType == 2) // 2 = INTERNAL_ERROR
- {
- Utilities::print_warning_message('<p>You must create a project before you can create an experiment.
- Click <a href="' . URL::to('/') . '/project/create">here</a> to create a project.</p>');
- }
- else
- {
- Utilities::print_error_message('<p>There was a problem getting the user\'s projects.
- Please try again later or submit a bug report using the link in the Help menu.</p>' .
- '<p>AiravataSystemException: ' . $ase->getMessage() . '</p>');
- }
- }
-
- return $userProjects;
-}
-
-
-/**
- * Get all available applications
- * @return null
- */
-public static function get_all_applications()
-{
- $airavataclient = Session::get("airavataClient");
- $applications = null;
-
- try
- {
- $applications = $airavataclient->getAllApplicationInterfaceNames( Session::get("gateway_id"));
- }
- catch (InvalidRequestException $ire)
- {
- Utilities::print_error_message('<p>There was a problem getting all applications.
- Please try again later or submit a bug report using the link in the Help menu.</p>' .
- '<p>InvalidRequestException: ' . $ire->getMessage() . '</p>');
- }
- catch (AiravataClientException $ace)
- {
- Utilities::print_error_message('<p>There was a problem getting all applications.
- Please try again later or submit a bug report using the link in the Help menu.</p>' .
- '<p>Airavata Client Exception: ' . $ace->getMessage() . '</p>');
- }
- catch (AiravataSystemException $ase)
- {
- Utilities::print_warning_message('<p>You must create an application module, interface and deployment space before you can create an experiment.
- Click <a href="' . URL::to('/') . '/app/module">here</a> to create an application.</p>');
- /*
- Utilities::print_error_message('<p>There was a problem getting all applications.
- Please try again later or submit a bug report using the link in the Help menu.</p>' .
- '<p>Airavata System Exception: ' . $ase->getMessage() . '</p>');
- */
- }
-
- if( count( $applications) == 0)
- Utilities::print_warning_message('<p>You must create an application module, interface and deployment space before you can create an experiment.
- Click <a href="' . URL::to('/') . '/app/module">here</a> to create an application.</p>');
-
-
- return $applications;
-}
-
-
-/**
- * Get the interface for the application with the given ID
- * @param $id
- * @return null
- */
-public static function get_application_interface($id)
-{
- $airavataclient = Session::get("airavataClient");
- $applicationInterface = null;
-
- try
- {
- $applicationInterface = $airavataclient->getApplicationInterface($id);
- }
- catch (InvalidRequestException $ire)
- {
- Utilities::print_error_message('<p>There was a problem getting the application interface.
- Please try again later or submit a bug report using the link in the Help menu.</p>' .
- '<p>InvalidRequestException: ' . $ire->getMessage(). '</p>');
- }
- catch (AiravataClientException $ace)
- {
- Utilities::print_error_message('<p>There was a problem getting the application interface.
- Please try again later or submit a bug report using the link in the Help menu.</p>' .
- '<p>Airavata Client Exception: ' . $ace->getMessage() . '</p>');
- }
- catch (AiravataSystemException $ase)
- {
- Utilities::print_error_message('<p>There was a problem getting the application interface.
- Please try again later or submit a bug report using the link in the Help menu.</p>' .
- '<p>Airavata System Exception: ' . $ase->getMessage() . '</p>');
- }
-
- return $applicationInterface;
-}
-
-
-/**
- * Get a list of compute resources available for the given application ID
- * @param $id
- * @return null
- */
-public static function get_available_app_interface_compute_resources($id)
-{
- $airavataclient = Session::get("airavataClient");
- $computeResources = null;
-
- try
- {
- $computeResources = $airavataclient->getAvailableAppInterfaceComputeResources($id);
- }
- catch (InvalidRequestException $ire)
- {
- Utilities::print_error_message('<p>There was a problem getting compute resources.
- Please try again later or submit a bug report using the link in the Help menu.</p>' .
- '<p>InvalidRequestException: ' . $ire->getMessage() . '</p>');
- }
- catch (AiravataClientException $ace)
- {
- Utilities::print_error_message('<p>There was a problem getting compute resources.
- Please try again later or submit a bug report using the link in the Help menu.</p>' .
- '<p>Airavata Client Exception: ' . $ace->getMessage() . '</p>');
- }
- catch (AiravataSystemException $ase)
- {
- Utilities::print_error_message('<p>There was a problem getting compute resources.
- Please try again later or submit a bug report using the link in the Help menu.</p>' .
- '<p>Airavata System Exception: ' . $ase->getMessage() . '</p>');
- }
-
- return $computeResources;
-}
-
-
-/**
- * Get the ComputeResourceDescription with the given ID
- * @param $id
- * @return null
- */
-public static function get_compute_resource($id)
-{
- $airavataclient = Session::get("airavataClient");
- $computeResource = null;
-
- try
- {
- $computeResource = $airavataclient->getComputeResource($id);
- }
- catch (InvalidRequestException $ire)
- {
- Utilities::print_error_message('<p>There was a problem getting the compute resource.
- Please try again later or submit a bug report using the link in the Help menu.</p>' .
- '<p>InvalidRequestException: ' . $ire->getMessage() . '</p>');
- }
- catch (AiravataClientException $ace)
- {
- Utilities::print_error_message('<p>There was a problem getting the compute resource.
- Please try again later or submit a bug report using the link in the Help menu.</p>' .
- '<p>Airavata Client Exception: ' . $ace->getMessage() . '</p>');
- }
- catch (AiravataSystemException $ase)
- {
- Utilities::print_error_message('<p>There was a problem getting the compute resource.
- Please try again later or submit a bug report using the link in the Help menu.</p>' .
- '<p>Airavata System Exception: ' . $ase->getMessage() . '</p>');
- }
-
- return $computeResource;
-}
-
-
-/**
- * List the experiment's input files
- * @param $experiment
- */
-public static function list_input_files($experiment)
-{
- $applicationInputs = Utilities::get_application_inputs($experiment->applicationId);
-
- $experimentInputs = $experiment->experimentInputs;
-
-
- //showing experiment inputs in the order defined by the admins.
- $order = array();
- foreach ($experimentInputs as $index => $input)
- {
- $order[$index] = $input->inputOrder;
- }
- array_multisort($order, SORT_ASC, $experimentInputs);
-
- foreach ($experimentInputs as $input)
- {
- $matchingAppInput = null;
-
- foreach($applicationInputs as $applicationInput)
- {
- if ($input->name == $applicationInput->name)
- {
- $matchingAppInput = $applicationInput;
- }
- }
- //var_dump($matchingAppInput);
-
- if ($matchingAppInput->type == DataType::URI)
- {
- $explode = explode('/', $input->value);
- echo '<p><a target="_blank"
- href="' . URL::to("/") . "/../../" . Constant::EXPERIMENT_DATA_ROOT . $explode[sizeof($explode)-2] . '/' . $explode[sizeof($explode)-1] . '">' .
- $explode[sizeof($explode)-1] . '
- <span class="glyphicon glyphicon-new-window"></span></a></p>';
- }
- elseif ($matchingAppInput->type == DataType::STRING)
- {
- echo '<p>' . $input->name . ': ' . $input->value . '</p>';
- }
- }
-}
-
-
-/**
- * Get a list of the inputs for the application with the given ID
- * @param $id
- * @return null
- */
-public static function get_application_inputs($id)
-{
- $airavataclient = Session::get("airavataClient");
- $inputs = null;
-
- try
- {
- $inputs = $airavataclient->getApplicationInputs($id);
- }
- catch (InvalidRequestException $ire)
- {
- Utilities::print_error_message('<p>There was a problem getting application inputs.
- Please try again later or submit a bug report using the link in the Help menu.</p>' .
- '<p>InvalidRequestException: ' . $ire->getMessage() . '</p>');
- }
- catch (AiravataClientException $ace)
- {
- Utilities::print_error_message('<p>There was a problem getting application inputs.
- Please try again later or submit a bug report using the link in the Help menu.</p>' .
- '<p>Airavata Client Exception: ' . $ace->getMessage() . '</p>');
- }
- catch (AiravataSystemException $ase)
- {
- Utilities::print_error_message('<p>There was a problem getting application inputs.
- Please try again later or submit a bug report using the link in the Help menu.</p>' .
- '<p>Airavata System Exception: ' . $ase->getMessage() . '</p>');
- }
-
- return $inputs;
-}
-
-
-/**
- * Get a list of the outputs for the application with the given ID
- * @param $id
- * @return null
- */
-public static function get_application_outputs($id)
-{
- $airavataclient = Session::get("airavataClient");
- $outputs = null;
-
- try
- {
- $outputs = $airavataclient->getApplicationOutputs($id);
- }
- catch (InvalidRequestException $ire)
- {
- Utilities::print_error_message('<p>There was a problem getting application outputs.
- Please try again later or submit a bug report using the link in the Help menu.</p>' .
- '<p>InvalidRequestException: ' . $ire->getMessage() . '</p>');
- }
- catch (AiravataClientException $ace)
- {
- Utilities::print_error_message('<p>There was a problem getting application outputs.
- Please try again later or submit a bug report using the link in the Help menu.</p>' .
- '<p>Airavata Client Exception: ' . $ace->getMessage() . '</p>');
- }
- catch (AiravataSystemException $ase)
- {
- Utilities::print_error_message('<p>There was a problem getting application outputs.
- Please try again later or submit a bug report using the link in the Help menu.</p>' .
- '<p>Airavata System Exception: ' . $ase->getMessage() . '</p>');
- }
-
- return $outputs;
-}
-
-
-/**
- * Get the experiment with the given ID
- * @param $expId
- * @return null
- */
-public static function get_experiment($expId)
-{
- $airavataclient = Session::get("airavataClient");
-
- try
- {
- return $airavataclient->getExperiment($expId);
- }
- catch (InvalidRequestException $ire)
- {
- Utilities::print_error_message('<p>There was a problem getting the experiment.
- Please try again later or submit a bug report using the link in the Help menu.</p>' .
- '<p>InvalidRequestException: ' . $ire->getMessage() . '</p>');
- }
- catch (ExperimentNotFoundException $enf)
- {
- Utilities::print_error_message('<p>There was a problem getting the experiment.
- Please try again later or submit a bug report using the link in the Help menu.</p>' .
- '<p>ExperimentNotFoundException: ' . $enf->getMessage() . '</p>');
- }
- catch (AiravataClientException $ace)
- {
- Utilities::print_error_message('<p>There was a problem getting the experiment.
- Please try again later or submit a bug report using the link in the Help menu.</p>' .
- '<p>AiravataClientException: ' . $ace->getMessage() . '</p>');
- }
- catch (AiravataSystemException $ase)
- {
- Utilities::print_error_message('<p>There was a problem getting the experiment.
- Please try again later or submit a bug report using the link in the Help menu.</p>' .
- '<p>AiravataSystemException: ' . $ase->getMessage() . '</p>');
- }
- catch (TTransportException $tte)
- {
- Utilities::print_error_message('<p>There was a problem getting the experiment.
- Please try again later or submit a bug report using the link in the Help menu.</p>' .
- '<p>TTransportException: ' . $tte->getMessage() . '</p>');
- }
- catch (Exception $e)
- {
- Utilities::print_error_message('<p>There was a problem getting the experiment.
- Please try again later or submit a bug report using the link in the Help menu.</p>' .
- '<p>Exception: ' . $e->getMessage() . '</p>');
- }
-
-}
-
-/**
- * Get the project with the given ID
- * @param $projectId
- * @return null
- */
-public static function get_project($projectId)
-{
- $airavataclient = Session::get("airavataClient");
-
- try
- {
- return $airavataclient->getProject($projectId);
- }
- catch (InvalidRequestException $ire)
- {
- Utilities::print_error_message('<p>There was a problem getting the project.
- Please try again later or submit a bug report using the link in the Help menu.</p>' .
- '<p>InvalidRequestException: ' . $ire->getMessage() . '</p>');
- }
- catch (AiravataClientException $ace)
- {
- Utilities::print_error_message('<p>There was a problem getting the project.
- Please try again later or submit a bug report using the link in the Help menu.</p>' .
- '<p>AiravataClientException: ' . $ace->getMessage() . '</p>');
- }
- catch (AiravataSystemException $ase)
- {
- Utilities::print_error_message('<p>There was a problem getting the project.
- Please try again later or submit a bug report using the link in the Help menu.</p>' .
- '<p>AiravataSystemException!<br><br>' . $ase->getMessage() . '</p>');
- }
-
-}
-
-
-/**
- * Create and configure a new Experiment
- * @return Experiment
- */
-public static function assemble_experiment()
-{
- $utility = new Utilities();
- $experimentInputs = array();
- $app_config = Utilities::read_config();
-
- $scheduling = new ComputationalResourceScheduling();
- $scheduling->totalCPUCount = $_POST['cpu-count'];
- $scheduling->nodeCount = $_POST['node-count'];
- $scheduling->queueName = $_POST['queue-name'];
- $scheduling->wallTimeLimit = $_POST['wall-time'];
- $scheduling->totalPhysicalMemory = $_POST['total-physical-memory'];
- $scheduling->resourceHostId = $_POST['compute-resource'];
-
- $userConfigData = new UserConfigurationData();
- $userConfigData->computationalResourceScheduling = $scheduling;
- if( isset( $_POST["userDN"]) )
- $userConfigData->userDN = $_POST["userDN"];
-
- $applicationInputs = Utilities::get_application_inputs($_POST['application']);
- $experimentInputs = Utilities::process_inputs($applicationInputs, $experimentInputs);
-
- if( Utilities::$experimentPath == null){
- Utilities::create_experiment_folder_path();
- }
-
- $advHandling = new AdvancedOutputDataHandling();
-
- $advHandling->outputDataDir = str_replace( base_path() . Constant::EXPERIMENT_DATA_ROOT, Utilities::$pathConstant , Utilities::$experimentPath);
- $userConfigData->advanceOutputDataHandling = $advHandling;
-
- //TODO: replace constructor with a call to airvata to get a prepopulated experiment template
- $experiment = new Experiment();
-
- // required
- $experiment->projectID = $_POST['project'];
- $experiment->userName = Session::get( 'username');
- $experiment->name = $_POST['experiment-name'];
-
- // optional
- $experiment->description = $_POST['experiment-description'];
- $experiment->applicationId = $_POST['application'];
- $experiment->userConfigurationData = $userConfigData;
- $experiment->experimentInputs = $experimentInputs;
- if( isset( $_POST["enableEmailNotification"]))
- {
- $experiment->enableEmailNotification = intval( $_POST["enableEmailNotification"] );
- $experiment->emailAddresses = array_unique( array_filter( $_POST["emailAddresses"], "trim") );
- }
-
- // adding default experiment outputs for now till prepoulated experiment template is not implemented.
- $experiment->experimentOutputs = Utilities::get_application_outputs( $_POST["application"]);
-
- if ($experimentInputs)
- {
- return $experiment;
- }
-}
-
-/**
- * @param $applicationInputs
- * @param $experimentInputs
- * @internal param $environmentPath
- * @return array
- */
-public static function process_inputs($applicationInputs, $experimentInputs)
-{
- $utility = new Utilities();
- $experimentAssemblySuccessful = true;
- $newExperimentInputs = array();
-
- //var_dump($_FILES);
-
- if (sizeof($_FILES) > 0)
- {
- if (Utilities::file_upload_successful())
- {
- // construct unique path
- Utilities::create_experiment_folder_path();
- }
- else
- {
- $experimentAssemblySuccessful = false;
- }
- }
-
- //sending application inputs in the order defined by the admins.
- $order = array();
- foreach ($applicationInputs as $index => $input)
- {
- $order[$index] = $input->inputOrder;
- }
- array_multisort($order, SORT_ASC, $applicationInputs);
-
- foreach ($applicationInputs as $applicationInput)
- {
- $experimentInput = new InputDataObjectType();
- $experimentInput = $applicationInput;
- //$experimentInput->name = $applicationInput->name;
- //$experimentInput->metaData = $applicationInput->metaData;
-
-
- //$experimentInput->type = $applicationInput->type;
- //$experimentInput->type = DataType::STRING;
-
-
- if(($applicationInput->type == DataType::STRING) ||
- ($applicationInput->type == DataType::INTEGER) ||
- ($applicationInput->type == DataType::FLOAT))
- {
- if (isset($_POST[$applicationInput->name]) && (trim($_POST[$applicationInput->name]) != ''))
- {
- $experimentInput->value = $_POST[$applicationInput->name];
- $experimentInput->type = $applicationInput->type;
-
- }
- else // use previous value
- {
- $index = -1;
- for ($i = 0; $i < sizeof($experimentInputs); $i++)
- {
- if ($experimentInputs[$i]->name == $applicationInput->name)
- {
- $index = $i;
- }
- }
-
- if ($index >= 0)
- {
- $experimentInput->value = $experimentInputs[$index]->value;
- $experimentInput->type = $applicationInput->type;
- }
- }
- }
- elseif ($applicationInput->type == DataType::URI)
- {
- //var_dump($_FILES[$applicationInput->name]->name);
- if ($_FILES[$applicationInput->name]['name'])
- {
- $file = $_FILES[$applicationInput->name];
-
-
- //
- // move file to experiment data directory
- //
- $filePath = Utilities::$experimentPath . $file['name'];
-
- // check if file already exists
- if (is_file($filePath))
- {
- unlink($filePath);
-
- Utilities::print_warning_message('Uploaded file already exists! Overwriting...');
- }
-
- $moveFile = move_uploaded_file($file['tmp_name'], $filePath);
-
- if ($moveFile)
- {
- Utilities::print_success_message('Upload: ' . $file['name'] . '<br>' .
- 'Type: ' . $file['type'] . '<br>' .
- 'Size: ' . ($file['size']/1024) . ' kB');//<br>' .
- //'Stored in: ' . $experimentPath . $file['name']);
- }
- else
- {
- Utilities::print_error_message('<p>Error moving uploaded file ' . $file['name'] . '!
- Please try again later or report a bug using the link in the Help menu.</p>');
- $experimentAssemblySuccessful = false;
- }
-
- $experimentInput->value = str_replace(base_path() . Constant::EXPERIMENT_DATA_ROOT, Utilities::$pathConstant , $filePath);
- $experimentInput->type = $applicationInput->type;
-
- }
- else
- {
- $index = -1;
- for ($i = 0; $i < sizeof($experimentInputs); $i++)
- {
- if ($experimentInputs[$i]->name == $applicationInput->name)
- {
- $index = $i;
- }
- }
-
- if ($index >= 0)
- {
- $experimentInput->value = $experimentInputs[$index]->value;
- $experimentInput->type = $applicationInput->type;
- }
- }
-
- }
- else
- {
- Utilities::print_error_message('I cannot accept this input type yet!');
- }
-
-
-
-
-
-
-
- //$experimentInputs[] = $experimentInput;
- /*
- $index = -1;
- for ($i = 0; $i < sizeof($experimentInputs); $i++)
- {
- if ($experimentInputs[$i]->key == $experimentInput->key)
- {
- $index = $i;
- }
- }
-
- if ($index >= 0)
- {
- unset($experimentInputs[$index]);
- }
- */
- //$experimentInputs[] = $experimentInput;
-
-
-
-
-
- $newExperimentInputs[] = $experimentInput;
-
-
- }
-
- if ($experimentAssemblySuccessful)
- {
- return $newExperimentInputs;
- }
- else
- {
- return false;
- }
-
-}
-
-
-public static function create_experiment_folder_path()
-{
- do
- {
- Utilities::$experimentPath = base_path() . Constant::EXPERIMENT_DATA_ROOT . str_replace(' ', '', Session::get('username') ) . md5(rand() * time()) . '/';
- }
- while (is_dir( Utilities::$experimentPath)); // if dir already exists, try again
- // create upload directory
- if (!mkdir( Utilities::$experimentPath))
- {
- Utilities::print_error_message('<p>Error creating upload directory!
- Please try again later or report a bug using the link in the Help menu.</p>');
- $experimentAssemblySuccessful = false;
- }
-}
-
-/**
- * Check the uploaded files for errors
- */
-public static function file_upload_successful()
-{
- $uploadSuccessful = true;
-
- foreach ($_FILES as $file)
- {
- //var_dump($file);
- if($file['name'])
- {
- if ($file['error'] > 0)
- {
- $uploadSuccessful = false;
- Utilities::print_error_message('<p>Error uploading file ' . $file['name'] . ' !
- Please try again later or report a bug using the link in the Help menu.');
- }/*
- elseif ($file['type'] != 'text/plain')
- {
- $uploadSuccessful = false;
- Utilities::print_error_message('Uploaded file ' . $file['name'] . ' type not supported!');
- }
- elseif (($file['size'] / 1024) > 20)
- {
- $uploadSuccessful = false;
- Utilities::print_error_message('Uploaded file ' . $file['name'] . ' must be smaller than 10 MB!');
- }*/
- }
-
-
- }
-
- return $uploadSuccessful;
-}
-
-
-/**
- * Update the experiment with the given ID
- * @param $expId
- * @param $updatedExperiment
- */
-public static function update_experiment($expId, $updatedExperiment)
-{
- $airavataclient = Session::get("airavataClient");
-
- try
- {
- $airavataclient->updateExperiment($expId, $updatedExperiment);
-
- /*
- Utilities::print_success_message("<p>Experiment updated!</p>" .
- '<p>Click
- <a href="' . URL::to('/') . '/experiment/summary?expId=' . $expId . '">here</a> to visit the experiment summary page.</p>');
- */
- }
- catch (InvalidRequestException $ire)
- {
- Utilities::print_error_message('<p>There was a problem updating the experiment.
- Please try again later or submit a bug report using the link in the Help menu.</p>' .
- '<p>InvalidRequestException: ' . $ire->getMessage() . '</p>');
- }
- catch (ExperimentNotFoundException $enf)
- {
- Utilities::print_error_message('<p>There was a problem updating the experiment.
- Please try again later or submit a bug report using the link in the Help menu.</p>' .
- '<p>ExperimentNotFoundException: ' . $enf->getMessage() . '</p>');
- }
- catch (AiravataClientException $ace)
- {
- Utilities::print_error_message('<p>There was a problem updating the experiment.
- Please try again later or submit a bug report using the link in the Help menu.</p>' .
- '<p>AiravataClientException: ' . $ace->getMessage() . '</p>');
- }
- catch (AiravataSystemException $ase)
- {
- Utilities::print_error_message('<p>There was a problem updating the experiment.
- Please try again later or submit a bug report using the link in the Help menu.</p>' .
- '<p>AiravataSystemException: ' . $ase->getMessage() . '</p>');
- }
-
-}
-
-
-/**
- * Clone the experiment with the given ID
- * @param $expId
- */
-public static function clone_experiment($expId)
-{
- $airavataclient = Session::get("airavataClient");
-
- try
- {
- //create new experiment to receive the clone
- $experiment = $airavataclient->getExperiment($expId);
-
- $cloneId = $airavataclient->cloneExperiment($expId, 'Clone of ' . $experiment->name);
-
- Utilities::print_success_message("<p>Experiment cloned!</p>" .
- '<p>You will be redirected to the edit page shortly, or you can
- <a href="edit_experiment.php?expId=' . $cloneId . '">go directly</a> to the edit experiment page.</p>');
- //redirect('edit_experiment.php?expId=' . $cloneId);
- return $cloneId;
- }
- catch (InvalidRequestException $ire)
- {
- Utilities::print_error_message('<p>There was a problem cloning the experiment.
- Please try again later or submit a bug report using the link in the Help menu.</p>' .
- '<p>InvalidRequestException: ' . $ire->getMessage() . '</p>');
- }
- catch (ExperimentNotFoundException $enf)
- {
- Utilities::print_error_message('<p>There was a problem cloning the experiment.
- Please try again later or submit a bug report using the link in the Help menu.</p>' .
- '<p>ExperimentNotFoundException: ' . $enf->getMessage() . '</p>');
- }
- catch (AiravataClientException $ace)
- {
- Utilities::print_error_message('<p>There was a problem cloning the experiment.
- Please try again later or submit a bug report using the link in the Help menu.</p>' .
- '<p>AiravataClientException: ' . $ace->getMessage() . '</p>');
- }
- catch (AiravataSystemException $ase)
- {
- Utilities::print_error_message('<p>There was a problem cloning the experiment.
- Please try again later or submit a bug report using the link in the Help menu.</p>' .
- '<p>AiravataSystemException: ' . $ase->getMessage() . '</p>');
- }
- catch (TTransportException $tte)
- {
- Utilities::print_error_message('<p>There was a problem cloning the experiment.
- Please try again later or submit a bug report using the link in the Help menu.</p>' .
- '<p>TTransportException: ' . $tte->getMessage() . '</p>');
- }
-}
-
-/**
- * Cancel the experiment with the given ID
- * @param $expId
- */
-public static function cancel_experiment($expId)
-{
- $airavataclient = Session::get("airavataClient");
- $app_config = Utilities::read_config();
-
-
-
- try
- {
- $airavataclient->terminateExperiment($expId, $app_config["credential-store-token"]);
-
- Utilities::print_success_message("Experiment canceled!");
- }
- catch (InvalidRequestException $ire)
- {
- Utilities::print_error_message('<p>There was a problem canceling the experiment.
- Please try again later or submit a bug report using the link in the Help menu.</p>' .
- '<p>InvalidRequestException: ' . $ire->getMessage() . '</p>');
- }
- catch (ExperimentNotFoundException $enf)
- {
- Utilities::print_error_message('<p>There was a problem canceling the experiment.
- Please try again later or submit a bug report using the link in the Help menu.</p>' .
- '<p>ExperimentNotFoundException: ' . $enf->getMessage() . '</p>');
- }
- catch (AiravataClientException $ace)
- {
- Utilities::print_error_message('<p>There was a problem canceling the experiment.
- Please try again later or submit a bug report using the link in the Help menu.</p>' .
- '<p>AiravataClientException: ' . $ace->getMessage() . '</p>');
- }
- catch (AiravataSystemException $ase)
- {
- Utilities::print_error_message('<p>There was a problem canceling the experiment.
- Please try again later or submit a bug report using the link in the Help menu.</p>' .
- '<p>AiravataSystemException: ' . $ase->getMessage() . '</p>');
- }
- catch (TTransportException $tte)
- {
- Utilities::print_error_message('<p>There was a problem canceling the experiment.
- Please try again later or submit a bug report using the link in the Help menu.</p>' .
- '<p>TTransportException: ' . $tte->getMessage() . '</p>');
- }
- catch (Exception $e)
- {
- Utilities::print_error_message('<p>There was a problem canceling the experiment.
- Please try again later or submit a bug report using the link in the Help menu.</p>' .
- '<p>Exception: ' . $e->getMessage() . '</p>');
- }
-}
-
-
-/**
- * Create a select input and populate it with project options from the database
- */
-public static function create_project_select($projectId = null, $editable = true)
-{
- $editable? $disabled = '' : $disabled = 'disabled';
- $userProjects = Utilities::get_all_user_projects( Session::get("gateway_id"), Session::get('username') );
-
- echo '<select class="form-control" name="project" id="project" required ' . $disabled . '>';
- if (sizeof($userProjects) > 0)
- {
- foreach ($userProjects as $project)
- {
- if ($project->projectID == $projectId)
- {
- $selected = 'selected';
- }
- else
- {
- $selected = '';
- }
-
- echo '<option value="' . $project->projectID . '" ' . $selected . '>' . $project->name . '</option>';
- }
- }
- echo '</select>';
- if( sizeof($userProjects) == 0 )
- {
- Utilities::print_warning_message('<p>You must create a project before you can create an experiment.
- Click <a href="' . URL::to('/') . '/project/create">here</a> to create a project.</p>');
- }
-}
-
-
-/**
- * Create a select input and populate it with applications options
- * @param null $id
- * @param bool $editable
- */
-public static function create_application_select($id = null, $editable = true)
-{
- $disabled = $editable? '' : 'disabled';
-
- $applicationIds = Utilities::get_all_applications();
-
- echo '<select class="form-control" name="application" id="application" required ' . $disabled . '>';
-
- if( count( $applicationIds))
- {
- foreach ( (array) $applicationIds as $applicationId => $applicationName)
- {
- $selected = ($applicationId == $id) ? 'selected' : '';
-
- echo '<option value="' . $applicationId . '" ' . $selected . '>' . $applicationName . '</option>';
- }
- }
-
- echo '</select>';
-}
-
-
-/**
- * Create a select input and populate it with compute resources
- * available for the given application ID
- * @param $applicationId
- * @param $resourceHostId
- */
-public static function create_compute_resources_select($applicationId, $resourceHostId)
-{
- $computeResources = Utilities::get_available_app_interface_compute_resources($applicationId);
-
- if( count( $computeResources) > 0)
- {
- echo '<select class="form-control" name="compute-resource" id="compute-resource">';
- foreach ($computeResources as $id => $name)
- {
- $selected = ($resourceHostId == $id)? ' selected' : '';
-
- echo '<option value="' . $id . '"' . $selected . '>' .
- $name . '</option>';
-
- }
-
- echo '</select>';
- }
- else
- {
- echo "<h4>No Compute Resources exist at the moment.";
- }
-
-}
-
-
-/**
- * Create form inputs to accept the inputs to the given application
- * @param $id
- * @param $isRequired
- * @internal param $required
- */
-public static function create_inputs($id, $isRequired)
-{
- $inputs = Utilities::get_application_inputs($id);
-
- $required = $isRequired? ' required' : '';
-
- //var_dump( $inputs); echo "<br/>after sort<br/>";
- //arranging inputs in ascending order.
- foreach ($inputs as $index => $input)
- {
- $order[$index] = $input->inputOrder;
- }
- array_multisort($order, SORT_ASC, $inputs);
- //var_dump( $inputs); exit;
- foreach ($inputs as $input)
- {
- switch ($input->type)
- {
- case DataType::STRING:
- echo '<div class="form-group">
- <label for="experiment-input">' . $input->name . '</label>
- <input value="' . $input->value . '" type="text" class="form-control" name="' . $input->name .
- '" id="' . $input->name .
- '" placeholder="' . $input->userFriendlyDescription . '"' . $required . '>
- </div>';
- break;
- case DataType::INTEGER:
- echo '<div class="form-group">
- <label for="experiment-input">' . $input->name . '</label>
- <input value="' . $input->value . '" type="number" class="form-control" name="' . $input->name .
- '" id="' . $input->name .
- '" placeholder="' . $input->userFriendlyDescription . '"' . $required . '>
- </div>';
- break;
- case DataType::FLOAT:
- echo '<div class="form-group">
- <label for="experiment-input">' . $input->name . '</label>
- <input value="' . $input->value . '" type="number" step="0.01" class="form-control" name="' . $input->name .
- '" id="' . $input->name .
- '" placeholder="' . $input->userFriendlyDescription . '"' . $required . '>
- </div>';
- break;
- case DataType::URI:
- echo '<div class="form-group">
- <label for="experiment-input">' . $input->name . '</label>
- <input class="file-input" type="file" name="' . $input->name .
- '" id="' . $input->name . '" ' . $required . '>
- <p class="help-block">' . $input->userFriendlyDescription . '</p>
- </div>';
- break;
- default:
- Utilities::print_error_message('Input data type not supported!
- Please file a bug report using the link in the Help menu.');
- break;
- }
- }
-}
-
-
-/**
- * Create navigation bar
- * Used for all pages
- */
-public static function create_nav_bar()
-{
- $menus = array();
-/*
- if( Session::has('loggedin'))
- {
- $menus = array
- (
- 'Project' => array
- (
- array('label' => 'Create Project', 'url' => URL::to('/') . '/project/create'),
- array('label' => 'Search Projects', 'url' => URL::to('/') . '/project/search')
- ),
- 'Experiment' => array
- (
- array('label' => 'Create Experiment', 'url' => URL::to('/') . '/experiment/create'),
- array('label' => 'Search Experiments', 'url' => URL::to('/') . '/experiment/search')
- ),
- 'Compute Resource' => array
- (
- array('label' => 'Register', 'url' => URL::to('/') . '/cr/create'),
- array('label' => 'Browse', 'url' => URL::to('/') . '/cr/browse')
- ),
- 'App Catalog' => array
- (
- array('label' => 'Module', 'url' => URL::to('/') . '/app/module'),
- array('label' => 'Interface', 'url' => URL::to('/') . '/app/interface'),
- array('label' => 'Deployment', 'url' => URL::to('/') . '/app/deployment')
- ),
- 'Help' => array
- (
- array('label' => 'Report Issue', 'url' => '#'),
- array('label' => 'Request Feature', 'url' => '#')
- )
- );
- }
-*/
- if( Session::has('loggedin'))
- {
- $menus = array
- (
- 'Project' => array
- (
- array('label' => 'Create', 'url' => URL::to('/') . '/project/create', "nav-active" => "project"),
- array('label' => 'Search', 'url' => URL::to('/') . '/project/search', "nav-active"=> "project"),
- array('label' => 'Browse', 'url' => URL::to('/') . '/project/browse', "nav-active" => "project")
- ),
- 'Experiment' => array
- (
- array('label' => 'Create', 'url' => URL::to('/') . '/experiment/create', "nav-active" => "experiment"),
- array('label' => 'Search', 'url' => URL::to('/') . '/experiment/search', "nav-active" => "experiment"),
- array('label' => 'Browse', 'url' => URL::to('/') . '/experiment/browse', "nav-active" => "experiment")
- )
- );
-
- if( Session::has("admin"))
- {
- $menus['Compute Resource'] = array
- (
- array('label' => 'Register', 'url' => URL::to('/') . '/cr/create', "nav-active" => "compute-resource"),
- array('label' => 'Browse', 'url' => URL::to('/') . '/cr/browse', "nav-active" => "compute-resource")
- );
- $menus['App Catalog'] = array
- (
- array('label' => 'Module', 'url' => URL::to('/') . '/app/module', "nav-active" => "app-catalog"),
- array('label' => 'Interface', 'url' => URL::to('/') . '/app/interface', "nav-active" => "app-catalog"),
- array('label' => 'Deployment', 'url' => URL::to('/') . '/app/deployment', "nav-active" => "app-catalog")
- );
- /*
- $menus['Gateway Profile'] = array
- (
-
- array('label' => 'Register', 'url' => URL::to('/') . '/gp/create', "nav-active" => "gateway-profile"),
- array('label' => 'Browse', 'url' => URL::to('/') . '/gp/browse', "nav-active" => "gateway-profile")
- );
- */
-
- }
-
- $menus['Help'] = array
- (
- array('label' => 'Report Issue', 'url' => '#', "nav-active", ""),
- array('label' => 'Request Feature', 'url' => '#', "nav-active", "")
- );
- }
-
- $selfExplode = explode('/', $_SERVER['PHP_SELF']);
-
-
-
- // nav bar and left-aligned content
-
- echo '<nav class="navbar navbar-inverse navbar-static-top" role="navigation">
- <div class="container-fluid">
- <!-- Brand and toggle get grouped for better mobile display -->
- <div class="navbar-header">
- <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
- <span class="sr-only">Toggle navigation</span>
- <span class="icon-bar"></span>
- <span class="icon-bar"></span>
- <span class="icon-bar"></span>
- </button>
- <a class="navbar-brand" href="' . URL::to('home') . '" title="PHP Gateway with Airavata">PGA</a>
- </div>
-
- <!-- Collect the nav links, forms, and other content for toggling -->
- <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
- <ul class="nav navbar-nav">';
-
-
- foreach ($menus as $label => $options)
- {
- Session::has('loggedin') ? $disabled = '' : $disabled = ' class="disabled"';
-
- $active = "";
- if( Session::has("nav-active") && isset( $options[0]['nav-active'] ) )
- {
- if( $options[0]['nav-active'] == Session::get("nav-active"))
- $active = " active ";
- }
- echo '<li class="dropdown ' . $active . '">
- <a href="#" class="dropdown-toggle" data-toggle="dropdown">' . $label . '<span class="caret"></span></a>
- <ul class="dropdown-menu" role="menu">';
-
- if( Session::has('loggedin'))
- {
- foreach ($options as $option)
- {
- $id = strtolower(str_replace(' ', '-', $option['label']));
-
- echo '<li' . $disabled . '><a href="' . $option['url'] . '" id=' . $id . '>' . $option['label'] . '</a></li>';
- }
- }
-
- echo '</ul>
- </li>';
- }
-
-
- echo '</ul>
-
- <ul class="nav navbar-nav navbar-right">';
-
- // right-aligned content
-
- if ( Session::has('loggedin') )
- {
- $active = "";
- if( Session::has("nav-active") )
- {
- if( "user-console" == Session::get("nav-active"))
- $active = " active ";
- }
- if( Session::has("admin"))
- echo '<li><a href="' . URL::to("/") . '/admin/dashboard"><span class="glyphicon glyphicon-user"></span> Dashboard</a></li>';
- else
- echo '<li><a href="' . URL::to("/") . '/user/profile"><span class="glyphicon glyphicon-user"></span> Profile</a></li>';
-
- echo '<li class="dropdown ' . $active . '">
-
- <a href="#" class="dropdown-toggle" data-toggle="dropdown">' . Session::get("username") . ' <span class="caret"></span></a>';
- echo '<ul class="dropdown-menu" role="menu">';
-
- echo '<li><a href="' . URL::to('/') . '/logout"><span class="glyphicon glyphicon-log-out"></span> Log out</a></li>';
- echo '</ul></li></ul>';
- }
- else
- {
- echo '<li><a href="' . URL::to('/') . '/create"><span class="glyphicon glyphicon-user"></span> Create account</a></li>';
- echo '<li><a href="' . URL::to('/') . '/login"><span class="glyphicon glyphicon-log-in"></span> Log in</a></li>';
- echo '</ul>';
-
- }
-
- echo '</div><!-- /.navbar-collapse -->
- </div><!-- /.container-fluid -->
- </nav>';
-}
-
-/**
-* Add attributes to the HTTP header.
-*/
-public static function create_http_header()
-{
- header( 'Cache-Control: no-store, no-cache, must-revalidate' );
- header( 'Cache-Control: post-check=0, pre-check=0', false );
- header( 'Pragma: no-cache' );
-}
-
-/**
- * Open the XML file containing the community token
- * @param $tokenFilePath
- * @throws Exception
- */
-public static function open_tokens_file($tokenFilePath)
-{
- if (file_exists( $tokenFilePath ))
- {
- $tokenFile = simplexml_load_file( $tokenFilePath );
- }
- else
- {
- throw new Exception('Error: Cannot connect to tokens database!');
- }
-
-
- if (!$tokenFile)
- {
- throw new Exception('Error: Cannot open tokens database!');
- }
-}
-
-
-/**
- * Write the new token to the XML file
- * @param $tokenId
- */
-public static function write_new_token($tokenId)
-{ // write new tokenId to tokens file
- $tokenFile->tokenId = $tokenId;
-
- //Format XML to save indented tree rather than one line
- $dom = new DOMDocument('1.0');
- $dom->preserveWhiteSpace = false;
- $dom->formatOutput = true;
- $dom->loadXML( $tokenFile->asXML());
- $dom->save( $tokenFilePath );
-}
-
-
-//moved from create project view.
-
-public static function create_project()
-{
-
- $airavataclient = Session::get("airavataClient");
-
- $project = new Project();
- $project->owner = Session::get('username');
- $project->name = $_POST['project-name'];
- $project->description = $_POST['project-description'];
-
-
- $projectId = null;
-
- try
- {
- $projectId = $airavataclient->createProject( Session::get("gateway_id"), $project);
-
- if ($projectId)
- {
- Utilities::print_success_message("<p>Project {$_POST['project-name']} created!</p>" .
- '<p>You will be redirected to the summary page shortly, or you can
- <a href="project/summary?projId=' . $projectId . '">go directly</a> to the project summary page.</p>');
- }
- else
- {
- Utilities::print_error_message("Error creating project {$_POST['project-name']}!");
- }
- }
- catch (InvalidRequestException $ire)
- {
- Utilities::print_error_message('InvalidRequestException!<br><br>' . $ire->getMessage());
- }
- catch (AiravataClientException $ace)
- {
- Utilities::print_error_message('AiravataClientException!<br><br>' . $ace->getMessage());
- }
- catch (AiravataSystemException $ase)
- {
- Utilities::print_error_message('AiravataSystemException!<br><br>' . $ase->getMessage());
- }
-
- return $projectId;
-}
-
-/**
- * Get experiments in project
- * @param $projectId
- * @return array|null
- */
-public static function get_experiments_in_project($projectId)
-{
- $airavataclient = Session::get("airavataClient");
-
- $experiments = array();
-
- try
- {
- $experiments = $airavataclient->getAllExperimentsInProject($projectId);
- }
- catch (InvalidRequestException $ire)
- {
- Utilities::print_error_message('InvalidRequestException!<br><br>' . $ire->getMessage());
- }
- catch (AiravataClientException $ace)
- {
- Utilities::print_error_message('AiravataClientException!<br><br>' . $ace->getMessage());
- }
- catch (AiravataSystemException $ase)
- {
- Utilities::print_error_message('AiravataSystemException!<br><br>' . $ase->getMessage());
- }
- catch (TTransportException $tte)
- {
- Utilities::print_error_message('TTransportException!<br><br>' . $tte->getMessage());
- }
-
- return $experiments;
-}
-
-public static function update_project($projectId, $projectDetails)
-{
- $airavataclient = Session::get("airavataClient");
-
- $updatedProject = new Project();
- $updatedProject->owner = $projectDetails["owner"];
- $updatedProject->name = $projectDetails["name"];
- $updatedProject->description = $projectDetails["description"];
-
- try
- {
- $airavataclient->updateProject($projectId, $updatedProject);
-
- //Utilities::print_success_message('Project updated! Click <a href="project_summary.php?projId=' . $projectId . '">here</a> to view the project summary.');
- }
- catch (InvalidRequestException $ire)
- {
- Utilities::print_error_message('InvalidRequestException!<br><br>' . $ire->getMessage());
- }
- catch (ProjectNotFoundException $pnfe)
- {
- Utilities::print_error_message('ProjectNotFoundException!<br><br>' . $pnfe->getMessage());
- }
- catch (AiravataClientException $ace)
- {
- Utilities::print_error_message('AiravataClientException!<br><br>' . $ace->getMessage());
- }
- catch (AiravataSystemException $ase)
- {
- Utilities::print_error_message('AiravataSystemException!<br><br>' . $ase->getMessage());
- }
-}
-
-
-/**
- * Create a new experiment from the values submitted in the form
- * @return null
- */
-public static function create_experiment()
-{
- $airavataclient = Session::get("airavataClient");
-
- $experiment = Utilities::assemble_experiment();
- $expId = null;
-
- try
- {
- if($experiment)
- {
- $expId = $airavataclient->createExperiment( Session::get("gateway_id"), $experiment);
- }
-
- if ($expId)
- {
- /*
- Utilities::print_success_message("Experiment {$_POST['experiment-name']} created!" .
- ' <a href="experiment_summary.php?expId=' . $expId . '">Go to experiment summary page</a>');
- */
- }
- else
- {
- Utilities::print_error_message("Error creating experiment {$_POST['experiment-name']}!");
- }
- }
- catch (InvalidRequestException $ire)
- {
- Utilities::print_error_message('InvalidRequestException!<br><br>' . $ire->getMessage());
- }
- catch (AiravataClientException $ace)
- {
- Utilities::print_error_message('AiravataClientException!<br><br>' . $ace->getMessage());
- }
- catch (AiravataSystemException $ase)
- {
- Utilities::print_error_message('AiravataSystemException!<br><br>' . $ase->getMessage());
- }
-
- return $expId;
-}
-
-/*
- * Required in Experiment Sumamry page.
- *
-*/
-
-public static function list_output_files($experiment, $expStatus)
-{
-
- $expStatusVal = array_search($expStatus, ExperimentState::$__names);
-
- if($expStatusVal == ExperimentState::COMPLETED )
- {
- $utility = new Utilities();
- $experimentOutputs = $experiment->experimentOutputs;
-
- foreach ((array)$experimentOutputs as $output)
- {
- if ($output->type == DataType::URI || $output->type == DataType::STDOUT || $output->type == DataType::STDERR )
- {
- $explode = explode('/', $output->value);
- //echo '<p>' . $output->key . ': <a href="' . $output->value . '">' . $output->value . '</a></p>';
- $outputPath = str_replace(Utilities::$experimentDataPathAbsolute, Constant::EXPERIMENT_DATA_ROOT, $output->value);
- $outputPathArray = explode("/", $outputPath);
-
- echo '<p>' . $output->name . ' : ' . '<a target="_blank"
- href="' . URL::to("/") . "/.." . str_replace(Utilities::$experimentDataPathAbsolute, Constant::EXPERIMENT_DATA_ROOT, $output->value) . '">' .
- $outputPathArray[ sizeof( $outputPathArray) - 1] . ' <span class="glyphicon glyphicon-new-window"></span></a></p>';
- }
- elseif ($output->type == DataType::STRING)
- {
- echo '<p>' . $output->value . '</p>';
- }
- }
- }
- else
- echo "Experiment hasn't completed. Experiment Status is : " . $expStatus;
-}
-
-public static function get_experiment_values( $experiment, $project, $forSearch = false)
-{
- $airavataclient = Session::get("airavataClient");
- //var_dump( $experiment); exit;
- $expVal = array();
- $expVal["experimentStatusString"] = "";
- $expVal["experimentTimeOfStateChange"] = "";
- $expVal["experimentCreationTime"] = "";
-
- if( $experiment->experimentStatus != null)
- {
- $experimentStatus = $experiment->experimentStatus;
- $experimentState = $experimentStatus->experimentState;
- $experimentStatusString = ExperimentState::$__names[$experimentState];
- $expVal["experimentStatusString"] = $experimentStatusString;
- $expVal["experimentTimeOfStateChange"] = date('Y-m-d H:i:s', $experimentStatus->timeOfStateChange/1000); // divide by 1000 since timeOfStateChange is in ms
- $expVal["experimentCreationTime"] = date('Y-m-d H:i:s', $experiment->creationTime/1000); // divide by 1000 since creationTime is in ms
- }
- $jobStatus = $airavataclient->getJobStatuses($experiment->experimentID);
-
- if ($jobStatus)
- {
- $jobName = array_keys($jobStatus);
- $jobState = JobState::$__names[$jobStatus[$jobName[0]]->jobState];
- }
- else
- {
- $jobState = null;
- }
-
- $expVal["jobState"] = $jobState;
-
- if(! $forSearch)
- {
- $userConfigData = $experiment->userConfigurationData;
- $scheduling = $userConfigData->computationalResourceScheduling;
- $expVal['scheduling'] = $scheduling;
- $expVal["computeResource"] = Utilities::get_compute_resource($scheduling->resourceHostId);
- }
- $expVal["applicationInterface"] = Utilities::get_application_interface($experiment->applicationId);
-
-
- switch ($experimentStatusString)
- {
- case 'CREATED':
- case 'VALIDATED':
- case 'SCHEDULED':
- case 'CANCELED':
- case 'FAILED':
- $expVal["editable"] = true;
- break;
- default:
- $expVal["editable"] = false;
- break;
- }
-
- switch ($experimentStatusString)
- {
- case 'CREATED':
- case 'VALIDATED':
- case 'SCHEDULED':
- case 'LAUNCHED':
- case 'EXECUTING':
- $expVal["cancelable"] = true;
- break;
- default:
- $expVal["cancelable"] = false;
- break;
- }
-
- return $expVal;
-
-}
-
- public static function get_all_user_projects_with_pagination($limit, $offset)
- {
- $airavataclient = Session::get("airavataClient");;
-
- $projects = array();
-
- try
- {
- $projects = $airavataclient->getAllUserProjectsWithPagination( Session::get("gateway_id"),
- Session::get("username"), $limit, $offset);
- }
- catch (InvalidRequestException $ire)
- {
- Utilities::print_error_message('InvalidRequestException!<br><br>' . $ire->getMessage());
- }
- catch (AiravataClientException $ace)
- {
- Utilities::print_error_message('AiravataClientException!<br><br>' . $ace->getMessage());
- }
- catch (AiravataSystemException $ase)
- {
- if ($ase->airavataErrorType == 2) // 2 = INTERNAL_ERROR
- {
- Utilities::print_info_message('<p>You have not created any projects yet, so no results will be returned!</p>
- <p>Click <a href="create_project.php">here</a> to create a new project.</p>');
- }
- else
- {
- Utilities::print_error_message('There was a problem with Airavata. Please try again later, or report a bug using the link in the Help menu.');
- //print_error_message('AiravataSystemException!<br><br>' . $ase->airavataErrorType . ': ' . $ase->getMessage());
- }
- }
- catch (TTransportException $tte)
- {
- Utilities::print_error_message('TTransportException!<br><br>' . $tte->getMessage());
- }
-
- return $projects;
- }
-
-
-
- public static function get_projsearch_results_with_pagination( $searchKey, $searchValue, $limit, $offset)
- {
- $airavataclient = Session::get("airavataClient");
-
- $projects = array();
-
- try
- {
- switch ( $searchKey)
- {
- case 'project-name':
- $projects = $airavataclient->searchProjectsByProjectNameWithPagination( Session::get("gateway_id"),
- Session::get("username"), $searchValue, $limit, $offset);
- break;
- case 'project-description':
- $projects = $airavataclient->searchProjectsByProjectDescWithPagination( Session::get("gateway_id"),
- Session::get("username"), $searchValue, $limit, $offset);
- break;
- }
- }
- catch (InvalidRequestException $ire)
- {
- Utilities::print_error_message('InvalidRequestException!<br><br>' . $ire->getMessage());
- }
- catch (AiravataClientException $ace)
- {
- Utilities::print_error_message('AiravataClientException!<br><br>' . $ace->getMessage());
- }
- catch (AiravataSystemException $ase)
- {
- if ($ase->airavataErrorType == 2) // 2 = INTERNAL_ERROR
- {
- Utilities::print_info_message('<p>You have not created any projects yet, so no results will be returned!</p>
- <p>Click <a href="create_project.php">here</a> to create a new project.</p>');
- }
- else
- {
- Utilities::print_error_message('There was a problem with Airavata. Please try again later, or report a bug using the link in the Help menu.');
- //print_error_message('AiravataSystemException!<br><br>' . $ase->airavataErrorType . ': ' . $ase->getMessage());
- }
- }
- catch (TTransportException $tte)
- {
- Utilities::print_error_message('TTransportException!<br><br>' . $tte->getMessage());
- }
-
- return $projects;
- }
-
-
-public static function get_projsearch_results( $searchKey, $searchValue)
-{
- $airavataclient = Session::get("airavataClient");;
-
- $projects = array();
-
- try
- {
- switch ( $searchKey)
- {
- case 'project-name':
- $projects = $airavataclient->searchProjectsByProjectName( Session::get("gateway_id"), Session::get("username"), $searchValue);
- break;
- case 'project-description':
- $projects = $airavataclient->searchProjectsByProjectDesc( Session::get("gateway_id"), Session::get("username"), $searchValue);
- break;
- }
- }
- catch (InvalidRequestException $ire)
- {
- Utilities::print_error_message('InvalidRequestException!<br><br>' . $ire->getMessage());
- }
- catch (AiravataClientException $ace)
- {
- Utilities::print_error_message('AiravataClientException!<br><br>' . $ace->getMessage());
- }
- catch (AiravataSystemException $ase)
- {
- if ($ase->airavataErrorType == 2) // 2 = INTERNAL_ERROR
- {
- Utilities::print_info_message('<p>You have not created any projects yet, so no results will be returned!</p>
- <p>Click <a href="create_project.php">here</a> to create a new project.</p>');
- }
- else
- {
- Utilities::print_error_message('There was a problem with Airavata. Please try again later, or report a bug using the link in the Help menu.');
- //print_error_message('AiravataSystemException!<br><br>' . $ase->airavataErrorType . ': ' . $ase->getMessage());
- }
- }
- catch (TTransportException $tte)
- {
- Utilities::print_error_message('TTransportException!<br><br>' . $tte->getMessage());
- }
-
- return $projects;
-}
-
-
-/**
- * Create options for the search key select input
- * @param $values
- * @param $labels
- * @param $disabled
- */
-public static function create_options($values, $labels, $disabled)
-{
- for ($i = 0; $i < sizeof($values); $i++)
- {
- $selected = '';
-
- // if option was previously selected, mark it as selected
- if (isset($_POST['search-key']))
- {
- if ($values[$i] == $_POST['search-key'])
- {
- $selected = 'selected';
- }
- }
-
- echo '<option value="' . $values[$i] . '" ' . $disabled[$i] . ' ' . $selected . '>' . $labels[$i] . '</option>';
- }
-}
-
- /**
- * Get results of the user's search of experiments with pagination
- * @return array|null
- */
- public static function get_expsearch_results_with_pagination( $inputs, $limit, $offset)
- {
- $airavataclient = Session::get("airavataClient");
- $experiments = array();
-
- try
- {
- switch ( $inputs["search-key"])
- {
- case 'experiment-name':
- $experiments = $airavataclient->searchExperimentsByNameWithPagination(
- Session::get('gateway_id'), Session::get('username'), $inputs["search-value"], $limit, $offset);
- break;
- case 'experiment-description':
- $experiments = $airavataclient->searchExperimentsByDescWithPagination(
- Session::get('gateway_id'), Session::get('username'), $inputs["search-value"], $limit, $offset);
- break;
- case 'application':
- $experiments = $airavataclient->searchExperimentsByApplicationWithPagination(
- Session::get('gateway_id'), Session::get('username'), $inputs["search-value"], $limit, $offset);
- break;
- case 'creation-time':
- $experiments = $airavataclient->searchExperimentsByCreationTimeWithPagination(
- Session::get('gateway_id'), Session::get('username'), strtotime( $inputs["from-date"])*1000,
- strtotime( $inputs["to-date"])*1000 , $limit, $offset);
- break;
- case '':
- }
- }
- catch (InvalidRequestException $ire)
- {
- Utilities::print_error_message('InvalidRequestException!<br><br>' . $ire->getMessage());
- }
- catch (AiravataClientException $ace)
- {
- Utilities::print_error_message('AiravataClientException!<br><br>' . $ace->getMessage());
- }
- catch (AiravataSystemException $ase)
- {
- if ($ase->airavataErrorType == 2) // 2 = INTERNAL_ERROR
- {
- Utilities::print_info_message('<p>You have not created any experiments yet, so no results will be returned!</p>
- <p>Click <a href="create_experiment.php">here</a> to create an experiment, or
- <a href="create_project.php">here</a> to create a new project.</p>');
- }
- else
- {
- Utilities::print_error_message('There was a problem with Airavata. Please try again later or report a bug using the link in the Help menu.');
- //print_error_message('AiravataSystemException!<br><br>' . $ase->airavataErrorType . ': ' . $ase->getMessage());
- }
- }
- catch (TTransportException $tte)
- {
- Utilities::print_error_message('TTransportException!<br><br>' . $tte->getMessage());
- }
-
- //get values of all experiments
- $expContainer = array();
- $expNum = 0;
- foreach( $experiments as $experiment)
- {
- $expValue = Utilities::get_experiment_values( $experiment, Utilities::get_project($experiment->projectID), true );
- $expContainer[$expNum]['experiment'] = $experiment;
- if( $expValue["experimentStatusString"] == "FAILED")
- $expValue["editable"] = false;
- $expContainer[$expNum]['expValue'] = $expValue;
- $expNum++;
- }
-
- return $expContainer;
- }
-
- /**
- * Get results of the user's search of experiments
- * @return array|null
- */
-public static function get_expsearch_results( $inputs)
-{
- $airavataclient = Session::get("airavataClient");
- $experiments = array();
-
- try
- {
- switch ( $inputs["search-key"])
- {
- case 'experiment-name':
- $experiments = $airavataclient->searchExperimentsByName(Session::get('gateway_id'), Session::get('username'), $inputs["search-value"]);
- break;
- case 'experiment-description':
- $experiments = $airavataclient->searchExperimentsByDesc(Session::get('gateway_id'), Session::get('username'), $inputs["search-value"]);
- break;
- case 'application':
- $experiments = $airavataclient->searchExperimentsByApplication(Session::get('gateway_id'), Session::get('username'), $inputs["search-value"]);
- break;
- case 'creation-time':
- $experiments = $airavataclient->searchExperimentsByCreationTime(Session::get('gateway_id'), Session::get('username'), strtotime( $inputs["from-date"])*1000, strtotime( $inputs["to-date"])*1000 );
- break;
- case '':
- }
- }
- catch (InvalidRequestException $ire)
- {
- Utilities::print_error_message('InvalidRequestException!<br><br>' . $ire->getMessage());
- }
- catch (AiravataClientException $ace)
- {
- Utilities::print_error_message('AiravataClientException!<br><br>' . $ace->getMessage());
- }
- catch (AiravataSystemException $ase)
- {
- if ($ase->airavataErrorType == 2) // 2 = INTERNAL_ERROR
- {
- Utilities::print_info_message('<p>You have not created any experiments yet, so no results will be returned!</p>
- <p>Click <a href="create_experiment.php">here</a> to create an experiment, or
- <a href="create_project.php">here</a> to create a new project.</p>');
- }
- else
- {
- Utilities::print_error_message('There was a problem with Airavata. Please try again later or report a bug using the link in the Help menu.');
- //print_error_message('AiravataSystemException!<br><br>' . $ase->airavataErrorType . ': ' . $ase->getMessage());
- }
- }
- catch (TTransportException $tte)
- {
- Utilities::print_error_message('TTransportException!<br><br>' . $tte->getMessage());
- }
-
- //get values of all experiments
- $expContainer = array();
- $expNum = 0;
- foreach( $experiments as $experiment)
- {
- $expValue = Utilities::get_experiment_values( $experiment, Utilities::get_project($experiment->projectID), true );
- $expContainer[$expNum]['experiment'] = $experiment;
- if( $expValue["experimentStatusString"] == "FAILED")
- $expValue["editable"] = false;
- $expContainer[$expNum]['expValue'] = $expValue;
- $expNum++;
- }
-
- return $expContainer;
-}
-
- /**
- * Get results of the user's all experiments with pagination.
- * Results are ordered creation time DESC
- * @return array|null
- */
- public static function get_all_user_experiments_with_pagination($limit, $offset)
- {
- $airavataclient = Session::get("airavataClient");
- $experiments = array();
-
- try
- {
- $experiments = $airavataclient->getAllUserExperimentsWithPagination(
- Session::get('gateway_id'), Session::get('username'), $limit, $offset
- );
- }
- catch (InvalidRequestException $ire)
- {
- Utilities::print_error_message('InvalidRequestException!<br><br>' . $ire->getMessage());
- }
- catch (AiravataClientException $ace)
- {
- Utilities::print_error_message('AiravataClientException!<br><br>' . $ace->getMessage());
- }
- catch (AiravataSystemException $ase)
- {
- if ($ase->airavataErrorType == 2) // 2 = INTERNAL_ERROR
- {
- Utilities::print_info_message('<p>You have not created any experiments yet, so no results will be returned!</p>
- <p>Click <a href="create_experiment.php">here</a> to create an experiment, or
- <a href="create_project.php">here</a> to create a new project.</p>');
- }
- else
- {
- Utilities::print_error_message('There was a problem with Airavata. Please try again later or report a bug using the link in the Help menu.');
- //print_error_message('AiravataSystemException!<br><br>' . $ase->airavataErrorType . ': ' . $ase->getMessage());
- }
- }
- catch (TTransportException $tte)
- {
- Utilities::print_error_message('TTransportException!<br><br>' . $tte->getMessage());
- }
-
- //get values of all experiments
- $expContainer = array();
- $expNum = 0;
- foreach( $experiments as $experiment)
- {
- $expValue = Utilities::get_experiment_values( $experiment, Utilities::get_project($experiment->projectID), true );
- $expContainer[$expNum]['experiment'] = $experiment;
- if( $expValue["experimentStatusString"] == "FAILED")
- $expValue["editable"] = false;
- $expContainer[$expNum]['expValue'] = $expValue;
- $expNum++;
- }
-
- return $expContainer;
- }
-
-public static function getExpStates(){
- return ExperimentState::$__names;
-}
-
-
-public static function apply_changes_to_experiment($experiment, $input)
-{
- $experiment->name = $input['experiment-name'];
- $experiment->description = rtrim($input['experiment-description']);
- $experiment->projectID = $input['project'];
- //$experiment->applicationId = $_POST['application'];
-
- $userConfigDataUpdated = $experiment->userConfigurationData;
- $schedulingUpdated = $userConfigDataUpdated->computationalResourceScheduling;
-
- $schedulingUpdated->resourceHostId = $input['compute-resource'];
- $schedulingUpdated->nodeCount = $input['node-count'];
- $schedulingUpdated->queueName = $_POST['queue-name'];
- $schedulingUpdated->totalCPUCount = $input['cpu-count'];
- //$schedulingUpdated->numberOfThreads = $input['threads'];
- $schedulingUpdated->wallTimeLimit = $input['wall-time'];
- //$schedulingUpdated->totalPhysicalMemory = $input['memory'];
-
- /*
- switch ($_POST['compute-resource'])
- {
- case 'trestles.sdsc.edu':
- $schedulingUpdated->ComputationalProjectAccount = 'sds128';
- break;
- case 'stampede.tacc.xsede.org':
- case 'lonestar.tacc.utexas.edu':
- $schedulingUpdated->ComputationalProjectAccount = 'TG-STA110014S';
- break;
- default:
- $schedulingUpdated->ComputationalProjectAccount = 'admin';
- }
- */
-
- $userConfigDataUpdated->computationalResourceScheduling = $schedulingUpdated;
- if( isset( $input["userDN"]) )
- $userConfigDataUpdated->userDN = $input["userDN"];
-
- $experiment->userConfigurationData = $userConfigDataUpdated;
-
- $applicationInputs = Utilities::get_application_inputs($experiment->applicationId);
-
- $experimentInputs = $experiment->experimentInputs; // get current inputs
- //var_dump($experimentInputs);
- $experimentInputs = Utilities::process_inputs($applicationInputs, $experimentInputs); // get new inputs
- //var_dump($experimentInputs);
-
- if ($experimentInputs)
- {
- $experiment->experimentInputs = $experimentInputs;
- //var_dump($experiment);
- return $experiment;
- }
-}
-
-public static function read_config( $fileName = null){
- $wsis_config = null;
-
- if( $fileName == null)
- $fileName = "app_config.ini";
- try {
- if (file_exists( app_path() . "/config/" . $fileName ) ) {
-
- try
- {
- $wsis_config = parse_ini_file( app_path() . "/config/" . $fileName );
- }
-
- catch( \Exception $e)
- {
- print_r( $e); exit;
- }
- }
- else
- {
- throw new Exception("Error: Cannot open file!");
- }
-
- if (!$wsis_config)
- {
- throw new Exception('Error: Unable to read the file!');
- }
- }catch (Exception $e) {
- throw new Exception('Unable to instantiate the client. Try editing the file.', 0, NULL);
- }
- return $wsis_config;
-
-}
-
-public static function get_job_details( $experimentId){
- $airavataclient = Session::get("airavataClient");
- return $airavataclient->getJobDetails( $experimentId);
-}
-
-public static function get_transfer_details( $experimentId){
- $airavataclient = Session::get("airavataClient");
- return $airavataclient->getDataTransferDetails( $experimentId);
-}
-
-}
-
-?>
[3/8] airavata-php-gateway git commit: wrapping Airavata and WSIS
code as laravel library component and service providers
Posted by sm...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/3ca02155/app/libraries/Wsis/Wsis.php
----------------------------------------------------------------------
diff --git a/app/libraries/Wsis/Wsis.php b/app/libraries/Wsis/Wsis.php
new file mode 100755
index 0000000..ede9774
--- /dev/null
+++ b/app/libraries/Wsis/Wsis.php
@@ -0,0 +1,280 @@
+<?php
+
+namespace Wsis;
+
+use Illuminate\Support\Facades\Config;
+use Wsis\Stubs\UserStoreManager;
+
+class Wsis {
+
+ /**
+ * @var UserStoreManager
+ * @access private
+ */
+ private $userStoreManager;
+
+ /**
+ * @var string
+ * @access private
+ */
+ private $server;
+
+ /**
+ * @var string
+ * @access private
+ */
+ private $service_url;
+
+
+ /**
+ * Constructor
+ *
+ * @param string $admin_username
+ * @param string $admin_password
+ * @param string $server
+ * @param string $service_url
+ * @param string $cafile_path
+ * @param bool $verify_peer
+ * @param bool $allow_selfsigned_cer
+ * @throws Exception
+ */
+ public function __construct($admin_username, $admin_password = null, $server,
+ $service_url,$cafile_path, $verify_peer, $allow_selfsigned_cert) {
+
+ $context = stream_context_create(array(
+ 'ssl' => array(
+ 'verify_peer' => $verify_peer,
+ "allow_self_signed"=> $allow_selfsigned_cert,
+ 'cafile' => $cafile_path,
+ 'CN_match' => $server,
+ )
+ ));
+
+ $parameters = array(
+ 'login' => $admin_username,
+ 'password' => $admin_password,
+ 'stream_context' => $context,
+ 'trace' => 1,
+ 'features' => SOAP_WAIT_ONE_WAY_CALLS
+ );
+
+ $this->server = $server;
+ $this->service_url = $service_url;
+
+ try {
+ $this->userStoreManager = new UserStoreManager($service_url, $parameters);
+ } catch (Exception $ex) {
+ print_r( $ex); exit;
+ throw new Exception("Unable to instantiate client", 0, $ex);
+ }
+ }
+
+
+ /**
+ * Function to add new user
+ *
+ * @param string $userName
+ * @param string $password
+ * @return void
+ * @throws Exception
+ */
+ public function addUser($userName, $password, $fullName) {
+ try {
+ $this->userStoreManager->addUser($userName, $password, $fullName);
+ } catch (Exception $ex) {
+ throw new Exception("Unable to add new user", 0, $ex);
+ }
+ }
+
+ /**
+ * Function to delete existing user
+ *
+ * @param string $username
+ * @return void
+ * @throws Exception
+ */
+ public function deleteUser($username) {
+ try {
+ $this->userStoreManager->deleteUser($username);
+ } catch (Exception $ex) {
+ throw new Exception("Unable to delete user", 0, $ex);
+ }
+ }
+
+
+ /**
+ * Function to authenticate user
+ *
+ * @param string $username
+ * @param string $password
+ * @return boolean
+ * @throws Exception
+ */
+ public function authenticate($username, $password){
+ try {
+ return $this->userStoreManager->authenticate($username, $password);
+ } catch (Exception $ex) {
+ var_dump( $ex); exit;
+ throw new Exception("Unable to authenticate user", 0, $ex);
+ }
+ }
+
+ /**
+ * Function to check whether username exists
+ *
+ * @param string $username
+ * @return boolean
+ * @throws Exception
+ */
+ public function username_exists($username){
+ try {
+ return $this->userStoreManager->isExistingUser($username);
+ } catch (Exception $ex) {
+ throw new Exception("Unable to verify username exists", 0, $ex);
+ }
+ }
+
+ /**
+ * Function to check whether a role is existing
+ *
+ * @param string $roleName
+ * @return IsExistingRoleResponse
+ */
+ public function is_existing_role( $roleName){
+ try {
+ return $this->userStoreManager->isExistingRole( $roleName);
+ } catch (Exception $ex) {
+ throw new Exception("Unable to check if the role exists", 0, $ex);
+ }
+ }
+
+ /**
+ * Function to add new role by providing the role name.
+ *
+ * @param string $roleName
+ */
+ public function add_role($roleName){
+ try {
+ return $this->userStoreManager->addRole( $roleName);
+ } catch (Exception $ex) {
+ throw new Exception("Unable to add this role", 0, $ex);
+ }
+ }
+
+ /**
+ * Function to delete existing role
+ *
+ * @param string $roleName
+ * @return void
+ * @throws Exception
+ */
+ public function delete_role($roleName) {
+ try {
+ $this->userStoreManager->deleteRole($roleName);
+ } catch (Exception $ex) {
+ var_dump( $ex); exit;
+
+ throw new Exception("Unable to delete role", 0, $ex);
+ }
+ }
+
+ /**
+ * Function to get the list of all existing roles
+ *
+ * @return roles list
+ */
+ public function get_all_roles(){
+ try {
+ return $this->userStoreManager->getRoleNames();
+ } catch (Exception $ex) {
+ throw new Exception("Unable to get all roles", 0, $ex);
+ }
+ }
+
+ /**
+ * Function to get role of a user
+ *
+ * @return user role
+ */
+ public function get_user_roles( $username){
+ try {
+ return $this->userStoreManager->getRoleListOfUser( $username);
+ } catch (Exception $ex) {
+ throw new Exception("Unable to get User roles.", 0, $ex);
+ }
+ }
+
+ /**
+ * Function to get the user list of role
+ *
+ * @param GetUserListOfRole $parameters
+ * @return GetUserListOfRoleResponse
+ */
+ public function get_userlist_of_role( $role){
+ try {
+ return $this->userStoreManager->getUserListOfRole( $role);
+ } catch (Exception $ex) {
+ var_dump( $ex); exit;
+ throw new Exception("Unable to get user list of roles.", 0, $ex);
+ }
+ }
+
+ /**
+ * Function to update role list of user
+ *
+ * @param UpdateRoleListOfUser $parameters
+ * @return void
+ */
+ public function update_user_roles( $username, $roles){
+ try {
+ return $this->userStoreManager->updateRoleListOfUser( $username, $roles);
+ } catch (Exception $ex) {
+ throw new Exception("Unable to update role of the user.", 0, $ex);
+ }
+ }
+
+ /**
+ * Function to list users
+ *
+ * @param void
+ * @return void
+ */
+ public function list_users(){
+ try {
+ return $this->userStoreManager->listUsers();
+ } catch (Exception $ex) {
+ var_dump( $ex->debug_message);
+ throw new Exception("Unable to list users.", 0, $ex);
+ }
+ }
+
+ /**
+ * Function to get the tenant id
+ *
+ * @param GetTenantId $parameters
+ * @return GetTenantIdResponse
+ */
+ public function get_tenant_id(){
+ try {
+ return $this->userStoreManager->getTenantId();
+ } catch (Exception $ex) {
+ var_dump( $ex->debug_message);
+ throw new Exception("Unable to get the tenant Id.", 0, $ex);
+ }
+ }
+
+ /**
+ * Function create a new Tenant
+ *
+ * @param Tenant $parameters
+ * @return void
+ */
+ public function create_tenant( $inputs){
+ try {
+ return $this->userStoreManager->createTenant( $inputs);
+ } catch (Exception $ex) {
+ var_dump( $ex);
+ throw new Exception("Unable to create Tenant.", 0, $ex);
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/3ca02155/app/libraries/Wsis/WsisServiceProvider.php
----------------------------------------------------------------------
diff --git a/app/libraries/Wsis/WsisServiceProvider.php b/app/libraries/Wsis/WsisServiceProvider.php
new file mode 100755
index 0000000..b3533a4
--- /dev/null
+++ b/app/libraries/Wsis/WsisServiceProvider.php
@@ -0,0 +1,64 @@
+<?php namespace Wsis;
+
+use Illuminate\Support\ServiceProvider;
+use Illuminate\Support\Facades\Config;
+
+class WsisServiceProvider 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('wsis/wsis');
+ }
+
+ /**
+ * Register the service provider.
+ *
+ * @return void
+ */
+ public function register()
+ {
+ //registering service provider
+ $this->app['wsis'] = $this->app->share(function($app)
+ {
+ return new Wsis(
+ Config::get('pga_config.wsis')['admin-username'],
+ Config::get('pga_config.wsis')['admin-password'],
+ Config::get('pga_config.wsis')['server'],
+ Config::get('pga_config.wsis')['service-url'],
+ Config::get('pga_config.wsis')['cafile-path'],
+ Config::get('pga_config.wsis')['verify-peer'],
+ Config::get('pga_config.wsis')['allow-self-signed-cert']
+ );
+ });
+
+ //registering alis
+ $this->app->booting(function()
+ {
+ $loader = \Illuminate\Foundation\AliasLoader::getInstance();
+ $loader->alias('WSIS', 'Wsis\Facades\Wsis');
+ });
+ }
+
+ /**
+ * Get the services provided by the provider.
+ *
+ * @return array
+ */
+ public function provides()
+ {
+ return array('wsis');
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/3ca02155/app/libraries/XmlIdUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/XmlIdUtilities.php b/app/libraries/XmlIdUtilities.php
new file mode 100755
index 0000000..5580796
--- /dev/null
+++ b/app/libraries/XmlIdUtilities.php
@@ -0,0 +1,292 @@
+<?php
+/**
+ * Utilities for ID management with an XML file
+ */
+
+class XmlIdUtilities implements IdUtilities
+{
+ const DB_PATH = 'users.xml';
+
+ /**
+ * Connect to the user database.
+ * @return mixed|void
+ */
+ public function connect()
+ {
+ global $db;
+
+
+ try
+ {
+ if (file_exists(self::DB_PATH))
+ {
+ $db = simplexml_load_file(self::DB_PATH);
+ }
+ else
+ {
+ throw new Exception("Error: Cannot connect to database!");
+ }
+
+
+ if (!$db)
+ {
+ throw new Exception('Error: Cannot open database!');
+ }
+ }
+ catch (Exception $e)
+ {
+ echo '<div>' . $e->getMessage() . '</div>';
+ }
+ }
+
+ /**
+ * Return true if the given username exists in the database.
+ * @param $username
+ * @return bool
+ */
+ public function username_exists($username)
+ {
+ global $db;
+
+ foreach($db->xpath('//username') as $db_username)
+ {
+ if ($db_username == $username)
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Authenticate the user given username and password.
+ * @param $username
+ * @param $password
+ * @return int|mixed
+ */
+ public function authenticate($username, $password)
+ {
+ global $db;
+
+ $hashed_password = md5($password);
+
+ $user = $db->xpath('//user[username="' . $username . '"]');
+
+ if (sizeof($user) == 1)
+ {
+ return $user[0]->password_hash == $hashed_password;
+ }
+ elseif(sizeof($user) == 0)
+ {
+ return -1;
+ }
+ else // duplicate users in database
+ {
+ return -2;
+ }
+ }
+
+ /**
+ * Add a new user to the database.
+ * @param $username
+ * @param $password
+ * @return mixed|void
+ */
+ public function add_user($username, $password, $first_name, $last_name, $email, $organization,
+ $address, $country,$telephone, $mobile, $im, $url)
+ {
+ global $db;
+
+ $users = $db->xpath('//users');
+
+ $user = $users[0]->addChild('user');
+
+ $user->addChild('username', $username);
+ $user->addChild('password_hash', md5($password));
+
+ //Format XML to save indented tree rather than one line
+ $dom = new DOMDocument('1.0');
+ $dom->preserveWhiteSpace = false;
+ $dom->formatOutput = true;
+ $dom->loadXML($db->asXML());
+ $dom->save('users.xml');
+ }
+
+ /**
+ * Get the user profile
+ * @param $username
+ * @return mixed|void
+ */
+ public function get_user_profile($username)
+ {
+ // TODO: Implement get_user_profile() method.
+ }
+
+ /**
+ * Update the user profile
+ *
+ * @param $username
+ * @param $first_name
+ * @param $last_name
+ * @param $email
+ * @param $organization
+ * @param $address
+ * @param $country
+ * @param $telephone
+ * @param $mobile
+ * @param $im
+ * @param $url
+ * @return mixed
+ */
+ public function update_user_profile($username, $first_name, $last_name, $email, $organization, $address,
+ $country, $telephone, $mobile, $im, $url)
+ {
+ // TODO: Implement update_user_profile() method.
+ }
+
+ /**
+ * Function to update user password
+ *
+ * @param $username
+ * @param $current_password
+ * @param $new_password
+ * @return mixed
+ */
+ public function change_password($username, $current_password, $new_password)
+ {
+ // TODO: Implement change_password() method.
+ }
+
+ /**
+ * Function to remove an existing user
+ *
+ * @param $username
+ * @return void
+ */
+ public function remove_user($username)
+ {
+ // TODO: Implement remove_user() method.
+ }
+
+ /**
+ * Function to check whether a user has permission for a particular permission string(api method).
+ *
+ * @param $username
+ * @param $permission_string
+ * @return bool
+ */
+ public function checkPermissionForUser($username, $permission_string)
+ {
+ // TODO: Implement checkPermissionForUser() method.
+ }
+
+ /**
+ * Function to get all the permissions that a particular user has.
+ *
+ * @param $username
+ * @return mixed
+ */
+ public function getUserPermissions($username)
+ {
+ // TODO: Implement getUserPermissions() method.
+ }
+
+ /**
+ * Function to get the entire list of roles in the application
+ *
+ * @return mixed
+ */
+ public function getRoleList()
+ {
+ // TODO: Implement getRoleList() method.
+ }
+
+ /**
+ * Function to get the role list of a user
+ *
+ * @param $username
+ * @return mixed
+ */
+ public function getRoleListOfUser($username)
+ {
+ // TODO: Implement getRoleListOfUser() method.
+ }
+
+ /**
+ * Function to get the user list of a particular role
+ *
+ * @param $role
+ * @return mixed
+ */
+ public function getUserListOfRole($role)
+ {
+ // TODO: Implement getUserListOfRole() method.
+ }
+
+ /**
+ * Function to add a role to a user
+ *
+ * @param $username
+ * @param $role
+ * @return void
+ */
+ public function addUserToRole($username, $role)
+ {
+ // TODO: Implement addUserToRole() method.
+ }
+
+ /**
+ * Function to role from user
+ *
+ * @param $username
+ * @param $role
+ * @return void
+ */
+ public function removeUserFromRole($username, $role)
+ {
+ // TODO: Implement removeUserFromRole() method.
+ }
+
+ /**
+ * Function to get the entire list of roles in the application
+ *
+ * @return mixed
+ */
+ public function getRoleNames()
+ {
+ // TODO: Implement getRoleNames() method.
+ }
+
+ /**
+ * Function to check whether a role is existing
+ *
+ * @param string $roleName
+ * @return IsExistingRoleResponse
+ */
+ public function isExistingRole($roleName)
+ {
+ // TODO: Implement isExistingRole() method.
+ }
+
+ /**
+ * Function to add new role by providing the role name.
+ *
+ * @param string $roleName
+ */
+ public function addRole($roleName)
+ {
+ // TODO: Implement addRole() method.
+ }
+
+ /**
+ * Function to update role list of user
+ *
+ * @param UpdateRoleListOfUser $parameters
+ * @return void
+ */
+ public function updateRoleListOfUser($username, $roles)
+ {
+ // TODO: Implement updateRoleListOfUser() method.
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/3ca02155/app/libraries/id_utilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/id_utilities.php b/app/libraries/id_utilities.php
deleted file mode 100755
index 9db7450..0000000
--- a/app/libraries/id_utilities.php
+++ /dev/null
@@ -1,172 +0,0 @@
-<?php
-/**
- * Interface for ID management
- */
-
-interface IdUtilities
-{
- /**
- * Connect to the user database.
- * @return mixed|void
- */
- public function connect();
-
- /**
- * Return true if the given username exists in the database.
- * @param $username
- * @return bool
- */
- public function username_exists($username);
-
- /**
- * Authenticate user given username and password.
- * @param $username
- * @param $password
- * @return int|mixed
- */
- public function authenticate($username, $password);
-
- /**
- * Create new user
- *
- * @param $username
- * @param $password
- * @param $first_name
- * @param $last_name
- * @param $email
- * @param $organization
- * @param $address
- * @param $country
- * @param $telephone
- * @param $mobile
- * @param $im
- * @param $url
- * @return mixed
- */
- public function add_user($username, $password, $first_name, $last_name, $email, $organization,
- $address, $country,$telephone, $mobile, $im, $url);
-
- /**
- * Function to remove an existing user
- *
- * @param $username
- * @return void
- */
- public function remove_user($username);
-
- /**
- * Get the user profile
- * @param $username
- * @return mixed|void
- */
- public function get_user_profile($username);
-
- /**
- * Update the user profile
- *
- * @param $username
- * @param $first_name
- * @param $last_name
- * @param $email
- * @param $organization
- * @param $address
- * @param $country
- * @param $telephone
- * @param $mobile
- * @param $im
- * @param $url
- * @return mixed
- */
- public function update_user_profile($username, $first_name, $last_name, $email, $organization, $address,
- $country, $telephone, $mobile, $im, $url);
-
- /**
- * Function to update user password
- *
- * @param $username
- * @param $current_password
- * @param $new_password
- * @return mixed
- */
- public function change_password($username, $current_password, $new_password);
-
- /**
- * Function to check whether a user has permission for a particular permission string(api method).
- *
- * @param $username
- * @param $permission_string
- * @return bool
- */
- public function checkPermissionForUser($username, $permission_string);
-
- /**
- * Function to get all the permissions that a particular user has.
- *
- * @param $username
- * @return mixed
- */
- public function getUserPermissions($username);
-
- /**
- * Function to get the entire list of roles in the application
- *
- * @return mixed
- */
- public function getRoleNames();
-
- /**
- * Function to check whether a role is existing
- *
- * @param string $roleName
- * @return IsExistingRoleResponse
- */
- public function isExistingRole( $roleName);
-
- /**
- * Function to add new role by providing the role name.
- *
- * @param string $roleName
- */
- public function addRole($roleName);
-
- /**
- * Function to get the role list of a user
- *
- * @param $username
- * @return mixed
- */
- public function getRoleListOfUser($username);
- /**
- * Function to update role list of user
- *
- * @param UpdateRoleListOfUser $parameters
- * @return void
- */
- public function updateRoleListOfUser( $username, $roles);
-
- /**
- * Function to get the user list of a particular role
- *
- * @param $role
- * @return mixed
- */
- public function getUserListOfRole($role);
-
- /**
- * Function to add a role to a user
- *
- * @param $username
- * @param $role
- * @return void
- */
- public function addUserToRole($username, $role);
-
- /**
- * Function to role from user
- *
- * @param $username
- * @param $role
- * @return void
- */
- public function removeUserFromRole($username, $role);
-}
\ No newline at end of file
[8/8] airavata-php-gateway git commit: Correcting the wrong API
method invocation in Wsis.php
Posted by sm...@apache.org.
Correcting the wrong API method invocation in Wsis.php
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/c1174e1e
Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/c1174e1e
Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/c1174e1e
Branch: refs/heads/master
Commit: c1174e1e7716c8fa1d11406bb77edfa7c6791857
Parents: 01d2420
Author: Supun Nakandala <su...@gmail.com>
Authored: Sat May 9 14:27:15 2015 +0530
Committer: Supun Nakandala <su...@gmail.com>
Committed: Sat May 9 14:27:15 2015 +0530
----------------------------------------------------------------------
app/libraries/Wsis/Wsis.php | 33 +++++++++++++++++++++++++--------
1 file changed, 25 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/c1174e1e/app/libraries/Wsis/Wsis.php
----------------------------------------------------------------------
diff --git a/app/libraries/Wsis/Wsis.php b/app/libraries/Wsis/Wsis.php
index ede9774..2588012 100755
--- a/app/libraries/Wsis/Wsis.php
+++ b/app/libraries/Wsis/Wsis.php
@@ -2,8 +2,8 @@
namespace Wsis;
-use Illuminate\Support\Facades\Config;
use Wsis\Stubs\UserStoreManager;
+use Wsis\Stubs\TenantManager;
class Wsis {
@@ -14,6 +14,12 @@ class Wsis {
private $userStoreManager;
/**
+ * @var
+ * @access private
+ */
+ private $tenantManager;
+
+ /**
* @var string
* @access private
*/
@@ -63,6 +69,7 @@ class Wsis {
try {
$this->userStoreManager = new UserStoreManager($service_url, $parameters);
+ $this->tenantManager = new TenantManager($service_url, $parameters);
} catch (Exception $ex) {
print_r( $ex); exit;
throw new Exception("Unable to instantiate client", 0, $ex);
@@ -265,16 +272,26 @@ class Wsis {
/**
* Function create a new Tenant
- *
- * @param Tenant $parameters
- * @return void
+ * @param $active
+ * @param $adminUsername
+ * @param $adminPassword
+ * @param $email
+ * @param $firstName
+ * @param $lastName
+ * @param $tenantDomain
+ * @throws Exception
*/
- public function create_tenant( $inputs){
+ public function create_tenant($active, $adminUsername, $adminPassword, $email,
+ $firstName, $lastName, $tenantDomain){
try {
- return $this->userStoreManager->createTenant( $inputs);
+ return $this->tenantManager->addTenant($active, $adminUsername, $adminPassword, $email,
+ $firstName, $lastName, $tenantDomain);
} catch (Exception $ex) {
- var_dump( $ex);
- throw new Exception("Unable to create Tenant.", 0, $ex);
+ /**
+ * Fixme - There is an issue in the Remote IS which throws an exception when called this method
+ * But the tenant creation works. Therefore ignores the exception for the moment.
+ */
+ //throw new Exception("Unable to create Tenant.", 0, $ex);
}
}
}
\ No newline at end of file
[4/8] airavata-php-gateway git commit: wrapping Airavata and WSIS
code as laravel library component and service providers
Posted by sm...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/3ca02155/app/libraries/Wsis/Stubs/AuthenticationAdminStub.php
----------------------------------------------------------------------
diff --git a/app/libraries/Wsis/Stubs/AuthenticationAdminStub.php b/app/libraries/Wsis/Stubs/AuthenticationAdminStub.php
new file mode 100644
index 0000000..00a1f02
--- /dev/null
+++ b/app/libraries/Wsis/Stubs/AuthenticationAdminStub.php
@@ -0,0 +1,1016 @@
+<?php
+namespace Wsis\Stubs;
+use SoapClient;
+
+class TransactionConfiguration {
+ public $transactionManager; // anyType
+ public $transactionTimeout; // int
+ public $userTransaction; // anyType
+}
+
+class AbstractPolicyOperator {
+ public $empty; // boolean
+ public $firstPolicyComponent; // PolicyComponent
+ public $policyComponents; // anyType
+}
+
+class PolicyComponent {
+ public $type; // short
+}
+
+class All {
+ public $assertions; // anyType
+ public $type; // short
+}
+
+class Policy {
+ public $alternatives; // Iterator
+ public $attributes; // Map
+ public $id; // string
+ public $name; // string
+ public $type; // short
+}
+
+class Enum {
+ public $value; // string
+}
+
+class ThreadFactory {
+}
+
+class XmlSchemaObject {
+ public $lineNumber; // int
+ public $linePosition; // int
+ public $metaInfoMap; // Map
+ public $sourceURI; // string
+}
+
+class XmlSchemaAnnotated {
+ public $annotation; // XmlSchemaAnnotation
+ public $id; // string
+ public $unhandledAttributes; // Attr
+}
+
+class XmlSchemaAnnotation {
+ public $items; // XmlSchemaObjectCollection
+}
+
+class XmlSchemaObjectCollection {
+ public $count; // int
+ public $iterator; // Iterator
+}
+
+class XmlSchemaParticle {
+ public $maxOccurs; // long
+ public $minOccurs; // long
+}
+
+class XmlSchemaElement {
+ public $QName; // anyType
+ public $abstract; // boolean
+ public $block; // XmlSchemaDerivationMethod
+ public $blockResolved; // XmlSchemaDerivationMethod
+ public $constraints; // XmlSchemaObjectCollection
+ public $defaultValue; // string
+ public $elementType; // anyType
+ public $final; // XmlSchemaDerivationMethod
+ public $fixedValue; // string
+ public $form; // XmlSchemaForm
+ public $name; // string
+ public $nillable; // boolean
+ public $refName; // anyType
+ public $schemaType; // XmlSchemaType
+ public $schemaTypeName; // anyType
+ public $substitutionGroup; // anyType
+ public $type; // XmlSchemaType
+}
+
+class XmlSchemaDerivationMethod {
+ public $values; // string
+}
+
+class XmlSchemaForm {
+ public $values; // string
+}
+
+class XmlSchemaType {
+ public $QName; // anyType
+ public $baseSchemaType; // anyType
+ public $baseSchemaTypeName; // anyType
+ public $dataType; // XmlSchemaDatatype
+ public $deriveBy; // XmlSchemaDerivationMethod
+ public $final; // XmlSchemaDerivationMethod
+ public $finalResolved; // XmlSchemaDerivationMethod
+ public $mixed; // boolean
+ public $name; // string
+}
+
+class XmlSchemaDatatype {
+}
+
+class TargetResolver {
+}
+
+class LifecycleManager {
+}
+
+class SOAPEnvelope {
+ public $SOAPBodyFirstElementLocalName; // string
+ public $SOAPBodyFirstElementNS; // OMNamespace
+ public $body; // SOAPBody
+ public $header; // SOAPHeader
+ public $version; // SOAPVersion
+}
+
+class SOAPBody {
+ public $fault; // SOAPFault
+ public $firstElementLocalName; // string
+ public $firstElementNS; // OMNamespace
+}
+
+class SOAPFault {
+ public $code; // SOAPFaultCode
+ public $detail; // SOAPFaultDetail
+ public $exception; // anyType
+ public $node; // SOAPFaultNode
+ public $reason; // SOAPFaultReason
+ public $role; // SOAPFaultRole
+}
+
+class SOAPFaultCode {
+}
+
+class SOAPFaultDetail {
+ public $allDetailEntries; // Iterator
+}
+
+class SOAPFaultNode {
+ public $nodeValue; // string
+}
+
+class SOAPFaultReason {
+ public $allSoapTexts; // anyType
+ public $firstSOAPText; // SOAPFaultText
+}
+
+class SOAPFaultText {
+ public $lang; // string
+}
+
+class SOAPFaultRole {
+ public $roleValue; // string
+}
+
+class SOAPHeader {
+}
+
+class SOAPVersion {
+ public $encodingURI; // string
+ public $envelopeURI; // string
+ public $faultCodeQName; // anyType
+ public $faultDetailQName; // anyType
+ public $faultReasonQName; // anyType
+ public $faultRoleQName; // anyType
+ public $mustUnderstandFaultCode; // anyType
+ public $nextRoleURI; // string
+ public $receiverFaultCode; // anyType
+ public $roleAttributeQName; // anyType
+ public $senderFaultCode; // anyType
+}
+
+class Attachments {
+ public $SOAPPartContentID; // string
+ public $SOAPPartContentType; // string
+ public $SOAPPartInputStream; // InputStream
+ public $allContentIDs; // string
+ public $attachmentSpecType; // string
+ public $contentIDList; // anyType
+ public $contentIDSet; // Set
+ public $contentLength; // long
+ public $incomingAttachmentStreams; // IncomingAttachmentStreams
+ public $incomingAttachmentsAsSingleStream; // InputStream
+ public $lifecycleManager; // LifecycleManager
+ public $map; // Map
+}
+
+class IncomingAttachmentStreams {
+ public $nextStream; // IncomingAttachmentInputStream
+ public $readyToGetNextStream; // boolean
+}
+
+class IncomingAttachmentInputStream {
+ public $contentId; // string
+ public $contentLocation; // string
+ public $contentType; // string
+ public $headers; // Map
+}
+
+class AuthenticationException {
+ public $uiErrorCode; // string
+}
+
+class TransportListener {
+}
+
+class TransportSender {
+}
+
+class Attr {
+ public $id; // boolean
+ public $name; // string
+ public $ownerElement; // Element
+ public $schemaTypeInfo; // TypeInfo
+ public $specified; // boolean
+ public $value; // string
+}
+
+class Element {
+ public $schemaTypeInfo; // TypeInfo
+ public $tagName; // string
+}
+
+class TypeInfo {
+ public $typeName; // string
+ public $typeNamespace; // string
+}
+
+class Options {
+ public $action; // string
+ public $callTransportCleanup; // boolean
+ public $exceptionToBeThrownOnSOAPFault; // boolean
+ public $faultTo; // EndpointReference
+ public $from; // EndpointReference
+ public $listener; // TransportListener
+ public $logCorrelationIDString; // string
+ public $manageSession; // boolean
+ public $messageId; // string
+ public $parent; // Options
+ public $password; // string
+ public $properties; // string
+ public $relatesTo; // RelatesTo
+ public $relationships; // RelatesTo
+ public $replyTo; // EndpointReference
+ public $soapVersionURI; // string
+ public $timeOutInMilliSeconds; // long
+ public $to; // EndpointReference
+ public $transportIn; // TransportInDescription
+ public $transportInProtocol; // string
+ public $transportOut; // TransportOutDescription
+ public $useSeparateListener; // boolean
+ public $userName; // string
+}
+
+class Set {
+ public $empty; // boolean
+}
+
+class Map {
+ public $empty; // boolean
+}
+
+class Iterator {
+}
+
+class LinkedList {
+ public $first; // anyType
+ public $last; // anyType
+}
+
+class LinkedHashMap {
+}
+
+class InputStream {
+}
+
+class NodeManager {
+ public $configurationContext; // ConfigurationContext
+}
+
+class AxisMessage {
+ public $axisOperation; // AxisOperation
+ public $direction; // string
+ public $effectivePolicy; // Policy
+ public $elementQName; // anyType
+ public $extensibilityAttributes; // anyType
+ public $key; // anyType
+ public $messageFlow; // anyType
+ public $messagePartName; // string
+ public $modulerefs; // string
+ public $name; // string
+ public $partName; // string
+ public $policyUpdated; // boolean
+ public $schemaElement; // XmlSchemaElement
+ public $soapHeaders; // anyType
+ public $wrapped; // boolean
+}
+
+class AxisOperation {
+ public $WSAMappingList; // anyType
+ public $axisService; // AxisService
+ public $axisSpecificMEPConstant; // int
+ public $controlOperation; // boolean
+ public $faultAction; // string
+ public $faultActionNames; // string
+ public $faultMessages; // anyType
+ public $inputAction; // string
+ public $key; // anyType
+ public $messageExchangePattern; // string
+ public $messageReceiver; // MessageReceiver
+ public $messages; // Iterator
+ public $moduleRefs; // anyType
+ public $name; // anyType
+ public $outputAction; // string
+ public $phasesInFaultFlow; // anyType
+ public $phasesOutFaultFlow; // anyType
+ public $phasesOutFlow; // anyType
+ public $remainingPhasesInFlow; // anyType
+ public $soapAction; // string
+ public $style; // string
+ public $wsamappingList; // string
+}
+
+class AxisService {
+ public $EPRs; // string
+ public $WSAddressingFlag; // string
+ public $active; // boolean
+ public $axisServiceGroup; // AxisServiceGroup
+ public $bindingName; // string
+ public $classLoader; // anyType
+ public $clientSide; // boolean
+ public $controlOperations; // anyType
+ public $customSchemaNamePrefix; // string
+ public $customSchemaNameSuffix; // string
+ public $customWsdl; // boolean
+ public $elementFormDefault; // boolean
+ public $enableAllTransports; // boolean
+ public $endpointName; // string
+ public $endpointURL; // string
+ public $endpoints; // Map
+ public $excludeInfo; // ExcludeInfo
+ public $exposedTransports; // string
+ public $fileName; // URL
+ public $importedNamespaces; // anyType
+ public $key; // anyType
+ public $lastUpdate; // long
+ public $lastupdate; // long
+ public $messageElementQNameToOperationMap; // anyType
+ public $modifyUserWSDLPortAddress; // boolean
+ public $modules; // anyType
+ public $name; // string
+ public $nameSpacesMap; // Map
+ public $namespaceMap; // Map
+ public $objectSupplier; // ObjectSupplier
+ public $operations; // Iterator
+ public $operationsNameList; // anyType
+ public $p2nMap; // Map
+ public $parent; // AxisServiceGroup
+ public $portTypeName; // string
+ public $publishedOperations; // anyType
+ public $schemaLocationsAdjusted; // boolean
+ public $schemaMappingTable; // Map
+ public $schemaTargetNamespace; // string
+ public $schemaTargetNamespacePrefix; // string
+ public $schematargetNamespace; // string
+ public $schematargetNamespacePrefix; // string
+ public $scope; // string
+ public $serviceDescription; // string
+ public $serviceLifeCycle; // ServiceLifeCycle
+ public $setEndpointsToAllUsedBindings; // boolean
+ public $soapNsUri; // string
+ public $targetNamespace; // string
+ public $targetNamespacePrefix; // string
+ public $typeTable; // TypeTable
+ public $useDefaultChains; // boolean
+ public $useUserWSDL; // boolean
+ public $wsdlFound; // boolean
+}
+
+class AxisServiceGroup {
+ public $axisDescription; // AxisConfiguration
+ public $foundWebResources; // boolean
+ public $key; // anyType
+ public $moduleRefs; // anyType
+ public $serviceGroupClassLoader; // anyType
+ public $serviceGroupName; // string
+ public $services; // Iterator
+}
+
+class TransportInDescription {
+ public $faultFlow; // Flow
+ public $faultPhase; // Phase
+ public $inFlow; // Flow
+ public $inPhase; // Phase
+ public $name; // string
+ public $parameters; // anyType
+ public $receiver; // TransportListener
+}
+
+class Flow {
+ public $handlerCount; // int
+}
+
+class HandlerDescription {
+ public $className; // string
+ public $handler; // Handler
+ public $name; // string
+ public $parameters; // anyType
+ public $parent; // ParameterInclude
+ public $rules; // PhaseRule
+}
+
+class ParameterInclude {
+ public $parameters; // anyType
+}
+
+class PhaseRule {
+ public $after; // string
+ public $before; // string
+ public $phaseFirst; // boolean
+ public $phaseLast; // boolean
+ public $phaseName; // string
+}
+
+class TransportOutDescription {
+ public $faultFlow; // Flow
+ public $faultPhase; // Phase
+ public $name; // string
+ public $outFlow; // Flow
+ public $outPhase; // Phase
+ public $parameters; // anyType
+ public $sender; // TransportSender
+}
+
+class OMNamespace {
+ public $name; // string
+ public $namespaceURI; // string
+ public $prefix; // string
+}
+
+class loginWithRememberMeCookie {
+ public $cookie; // string
+}
+
+class loginWithRememberMeCookieResponse {
+ public $return; // boolean
+}
+
+class AuthenticationAdminAuthenticationException {
+ public $AuthenticationException; // AuthenticationException
+}
+
+class logout {
+}
+
+class login {
+ public $username; // string
+ public $password; // string
+ public $remoteAddress; // string
+}
+
+class loginResponse {
+ public $return; // boolean
+}
+
+class loginWithRememberMeOption {
+ public $username; // string
+ public $password; // string
+ public $remoteAddress; // string
+}
+
+class loginWithRememberMeOptionResponse {
+ public $return; // RememberMeData
+}
+
+class getAuthenticatorName {
+}
+
+class getAuthenticatorNameResponse {
+ public $return; // string
+}
+
+class authenticateWithRememberMe {
+ public $messageContext; // MessageContext
+}
+
+class authenticateWithRememberMeResponse {
+ public $return; // boolean
+}
+
+class isDisabled {
+}
+
+class isDisabledResponse {
+ public $return; // boolean
+}
+
+class getPriority {
+}
+
+class getPriorityResponse {
+ public $return; // int
+}
+
+class MessageContext {
+ public $FLOW; // int
+ public $SOAP11; // boolean
+ public $WSAAction; // string
+ public $WSAMessageId; // string
+ public $attachmentMap; // Attachments
+ public $axisMessage; // AxisMessage
+ public $axisOperation; // AxisOperation
+ public $axisService; // AxisService
+ public $axisServiceGroup; // AxisServiceGroup
+ public $configurationContext; // ConfigurationContext
+ public $currentHandlerIndex; // int
+ public $currentPhaseIndex; // int
+ public $doingMTOM; // boolean
+ public $doingREST; // boolean
+ public $doingSwA; // boolean
+ public $effectivePolicy; // Policy
+ public $envelope; // SOAPEnvelope
+ public $executedPhases; // Iterator
+ public $executedPhasesExplicit; // LinkedList
+ public $executionChain; // anyType
+ public $failureReason; // anyType
+ public $fault; // boolean
+ public $faultTo; // EndpointReference
+ public $from; // EndpointReference
+ public $headerPresent; // boolean
+ public $inboundContentLength; // long
+ public $incomingTransportName; // string
+ public $isSOAP11Explicit; // boolean
+ public $logCorrelationID; // string
+ public $logIDString; // string
+ public $messageID; // string
+ public $newThreadRequired; // boolean
+ public $operationContext; // OperationContext
+ public $options; // Options
+ public $optionsExplicit; // Options
+ public $outputWritten; // boolean
+ public $paused; // boolean
+ public $processingFault; // boolean
+ public $properties; // Map
+ public $relatesTo; // RelatesTo
+ public $relationships; // RelatesTo
+ public $replyTo; // EndpointReference
+ public $responseWritten; // boolean
+ public $rootContext; // ConfigurationContext
+ public $selfManagedDataMapExplicit; // LinkedHashMap
+ public $serverSide; // boolean
+ public $serviceContext; // ServiceContext
+ public $serviceContextID; // string
+ public $serviceGroupContext; // ServiceGroupContext
+ public $serviceGroupContextId; // string
+ public $sessionContext; // SessionContext
+ public $soapAction; // string
+ public $to; // EndpointReference
+ public $transportIn; // TransportInDescription
+ public $transportOut; // TransportOutDescription
+}
+
+class ConfigurationContext {
+ public $anyOperationContextRegistered; // boolean
+ public $axisConfiguration; // AxisConfiguration
+ public $contextRoot; // string
+ public $listenerManager; // ListenerManager
+ public $rootContext; // ConfigurationContext
+ public $serviceContextPath; // string
+ public $serviceGroupContextIDs; // string
+ public $serviceGroupContextTimeoutInterval; // long
+ public $serviceGroupContextTimoutInterval; // long
+ public $serviceGroupContexts; // anyType
+ public $servicePath; // string
+ public $threadPool; // ThreadFactory
+ public $transportManager; // ListenerManager
+}
+
+class OperationContext {
+ public $axisOperation; // AxisOperation
+ public $complete; // boolean
+ public $configurationContext; // ConfigurationContext
+ public $key; // string
+ public $logCorrelationIDString; // string
+ public $messageContexts; // string
+ public $operationName; // string
+ public $rootContext; // ConfigurationContext
+ public $serviceContext; // ServiceContext
+ public $serviceGroupName; // string
+ public $serviceName; // string
+}
+
+class ServiceContext {
+ public $axisService; // AxisService
+ public $cachingOperationContext; // boolean
+ public $configurationContext; // ConfigurationContext
+ public $groupName; // string
+ public $lastOperationContext; // OperationContext
+ public $logCorrelationIDString; // string
+ public $myEPR; // EndpointReference
+ public $name; // string
+ public $rootContext; // ConfigurationContext
+ public $serviceGroupContext; // ServiceGroupContext
+ public $targetEPR; // EndpointReference
+}
+
+class ServiceGroupContext {
+ public $description; // AxisServiceGroup
+ public $id; // string
+ public $rootContext; // ConfigurationContext
+ public $serviceContexts; // Iterator
+}
+
+class SessionContext {
+ public $cookieID; // string
+ public $lastTouchedTime; // long
+ public $rootContext; // ConfigurationContext
+ public $serviceGroupContext; // Iterator
+}
+
+class PhasesInfo {
+ public $INPhases; // anyType
+ public $IN_FaultPhases; // anyType
+ public $OUTPhases; // anyType
+ public $OUT_FaultPhases; // anyType
+ public $globalInFaultPhases; // anyType
+ public $globalInflow; // anyType
+ public $globalOutPhaseList; // anyType
+ public $operationInFaultPhases; // anyType
+ public $operationInPhases; // anyType
+ public $operationOutFaultPhases; // anyType
+ public $operationOutPhases; // anyType
+ public $operationPhases; // AxisOperation
+ public $outFaultPhaseList; // anyType
+}
+
+class ExcludeInfo {
+}
+
+class URL {
+ public $authority; // string
+ public $content; // anyType
+ public $defaultPort; // int
+ public $file; // string
+ public $host; // string
+ public $path; // string
+ public $port; // int
+ public $protocol; // string
+ public $query; // string
+ public $ref; // string
+ public $userInfo; // string
+}
+
+class EndpointReference {
+ public $WSAddressingAnonymous; // boolean
+ public $address; // string
+ public $addressAttributes; // anyType
+ public $allReferenceParameters; // Map
+ public $attributes; // anyType
+ public $extensibleElements; // anyType
+ public $logCorrelationIDString; // string
+ public $metaData; // anyType
+ public $metadataAttributes; // anyType
+ public $name; // string
+ public $referenceParameters; // anyType
+}
+
+class RelatesTo {
+ public $extensibilityAttributes; // anyType
+ public $relationshipType; // string
+ public $value; // string
+}
+
+class SecretResolver {
+ public $initialized; // boolean
+}
+
+class AxisConfiguration {
+ public $childFirstClassLoading; // boolean
+ public $clusteringAgent; // ClusteringAgent
+ public $configurator; // AxisConfigurator
+ public $faultyModules; // string
+ public $faultyServices; // string
+ public $faultyServicesDuetoModules; // Map
+ public $globalModules; // anyType
+ public $globalOutPhase; // anyType
+ public $inFaultFlowPhases; // anyType
+ public $inFaultPhases; // anyType
+ public $inFlowPhases; // anyType
+ public $inPhasesUptoAndIncludingPostDispatch; // anyType
+ public $key; // anyType
+ public $localPolicyAssertions; // anyType
+ public $moduleClassLoader; // anyType
+ public $modules; // anyType
+ public $observersList; // anyType
+ public $outFaultFlowPhases; // anyType
+ public $outFaultPhases; // anyType
+ public $outFlowPhases; // anyType
+ public $phasesInfo; // PhasesInfo
+ public $repository; // URL
+ public $secretResolver; // SecretResolver
+ public $serviceClassLoader; // anyType
+ public $serviceGroups; // Iterator
+ public $services; // anyType
+ public $start; // boolean
+ public $systemClassLoader; // anyType
+ public $targetResolverChain; // TargetResolver
+ public $transactionConfig; // TransactionConfiguration
+ public $transactionConfiguration; // TransactionConfiguration
+ public $transportsIn; // string
+ public $transportsOut; // string
+}
+
+class ListenerManager {
+ public $configctx; // ConfigurationContext
+ public $shutdownHookRequired; // boolean
+ public $stopped; // boolean
+}
+
+class AxisConfigurator {
+ public $axisConfiguration; // AxisConfiguration
+}
+
+class ObjectSupplier {
+}
+
+class ServiceLifeCycle {
+}
+
+class MessageReceiver {
+}
+
+class Phase {
+ public $handlerCount; // int
+ public $handlerDesc; // HandlerDescription
+ public $handlers; // anyType
+ public $name; // string
+ public $phaseFirst; // Handler
+ public $phaseLast; // Handler
+ public $phaseName; // string
+}
+
+class Handler {
+ public $handlerDesc; // HandlerDescription
+ public $name; // string
+}
+
+class StateManager {
+ public $configurationContext; // ConfigurationContext
+ public $replicationExcludePatterns; // Map
+}
+
+class RememberMeData {
+ public $authenticated; // boolean
+ public $maxAge; // int
+ public $value; // string
+}
+
+class ClusteringAgent {
+ public $aliveMemberCount; // int
+ public $configurationContext; // ConfigurationContext
+ public $coordinator; // boolean
+ public $domains; // Set
+ public $members; // anyType
+ public $nodeManager; // NodeManager
+ public $stateManager; // StateManager
+}
+
+class TypeTable {
+ public $complexSchemaMap; // Map
+}
+
+
+/**
+ * AuthenticationAdmin class
+ *
+ *
+ *
+ * @author {author}
+ * @copyright {copyright}
+ * @package {package}
+ */
+class AuthenticationAdminStub extends SoapClient {
+
+ private static $classmap = array(
+ 'TransactionConfiguration' => 'TransactionConfiguration',
+ 'AbstractPolicyOperator' => 'AbstractPolicyOperator',
+ 'PolicyComponent' => 'PolicyComponent',
+ 'All' => 'All',
+ 'Policy' => 'Policy',
+ 'Enum' => 'Enum',
+ 'ThreadFactory' => 'ThreadFactory',
+ 'XmlSchemaObject' => 'XmlSchemaObject',
+ 'XmlSchemaAnnotated' => 'XmlSchemaAnnotated',
+ 'XmlSchemaAnnotation' => 'XmlSchemaAnnotation',
+ 'XmlSchemaObjectCollection' => 'XmlSchemaObjectCollection',
+ 'XmlSchemaParticle' => 'XmlSchemaParticle',
+ 'XmlSchemaElement' => 'XmlSchemaElement',
+ 'XmlSchemaDerivationMethod' => 'XmlSchemaDerivationMethod',
+ 'XmlSchemaForm' => 'XmlSchemaForm',
+ 'XmlSchemaType' => 'XmlSchemaType',
+ 'XmlSchemaDatatype' => 'XmlSchemaDatatype',
+ 'TargetResolver' => 'TargetResolver',
+ 'LifecycleManager' => 'LifecycleManager',
+ 'SOAPEnvelope' => 'SOAPEnvelope',
+ 'SOAPBody' => 'SOAPBody',
+ 'SOAPFault' => 'SOAPFault',
+ 'SOAPFaultCode' => 'SOAPFaultCode',
+ 'SOAPFaultDetail' => 'SOAPFaultDetail',
+ 'SOAPFaultNode' => 'SOAPFaultNode',
+ 'SOAPFaultReason' => 'SOAPFaultReason',
+ 'SOAPFaultText' => 'SOAPFaultText',
+ 'SOAPFaultRole' => 'SOAPFaultRole',
+ 'SOAPHeader' => 'SOAPHeader',
+ 'SOAPVersion' => 'SOAPVersion',
+ 'Attachments' => 'Attachments',
+ 'IncomingAttachmentStreams' => 'IncomingAttachmentStreams',
+ 'IncomingAttachmentInputStream' => 'IncomingAttachmentInputStream',
+ 'AuthenticationException' => 'AuthenticationException',
+ 'TransportListener' => 'TransportListener',
+ 'TransportSender' => 'TransportSender',
+ 'Attr' => 'Attr',
+ 'Element' => 'Element',
+ 'TypeInfo' => 'TypeInfo',
+ 'Options' => 'Options',
+ 'Set' => 'Set',
+ 'Map' => 'Map',
+ 'Iterator' => 'Iterator',
+ 'LinkedList' => 'LinkedList',
+ 'LinkedHashMap' => 'LinkedHashMap',
+ 'InputStream' => 'InputStream',
+ 'NodeManager' => 'NodeManager',
+ 'AxisMessage' => 'AxisMessage',
+ 'AxisOperation' => 'AxisOperation',
+ 'AxisService' => 'AxisService',
+ 'AxisServiceGroup' => 'AxisServiceGroup',
+ 'TransportInDescription' => 'TransportInDescription',
+ 'Flow' => 'Flow',
+ 'HandlerDescription' => 'HandlerDescription',
+ 'ParameterInclude' => 'ParameterInclude',
+ 'PhaseRule' => 'PhaseRule',
+ 'TransportOutDescription' => 'TransportOutDescription',
+ 'OMNamespace' => 'OMNamespace',
+ 'loginWithRememberMeCookie' => 'loginWithRememberMeCookie',
+ 'loginWithRememberMeCookieResponse' => 'loginWithRememberMeCookieResponse',
+ 'AuthenticationAdminAuthenticationException' => 'AuthenticationAdminAuthenticationException',
+ 'logout' => 'logout',
+ 'login' => 'login',
+ 'loginResponse' => 'loginResponse',
+ 'loginWithRememberMeOption' => 'loginWithRememberMeOption',
+ 'loginWithRememberMeOptionResponse' => 'loginWithRememberMeOptionResponse',
+ 'getAuthenticatorName' => 'getAuthenticatorName',
+ 'getAuthenticatorNameResponse' => 'getAuthenticatorNameResponse',
+ 'authenticateWithRememberMe' => 'authenticateWithRememberMe',
+ 'authenticateWithRememberMeResponse' => 'authenticateWithRememberMeResponse',
+ 'isDisabled' => 'isDisabled',
+ 'isDisabledResponse' => 'isDisabledResponse',
+ 'getPriority' => 'getPriority',
+ 'getPriorityResponse' => 'getPriorityResponse',
+ 'MessageContext' => 'MessageContext',
+ 'ConfigurationContext' => 'ConfigurationContext',
+ 'OperationContext' => 'OperationContext',
+ 'ServiceContext' => 'ServiceContext',
+ 'ServiceGroupContext' => 'ServiceGroupContext',
+ 'SessionContext' => 'SessionContext',
+ 'PhasesInfo' => 'PhasesInfo',
+ 'ExcludeInfo' => 'ExcludeInfo',
+ 'URL' => 'URL',
+ 'EndpointReference' => 'EndpointReference',
+ 'RelatesTo' => 'RelatesTo',
+ 'SecretResolver' => 'SecretResolver',
+ 'AxisConfiguration' => 'AxisConfiguration',
+ 'ListenerManager' => 'ListenerManager',
+ 'AxisConfigurator' => 'AxisConfigurator',
+ 'ObjectSupplier' => 'ObjectSupplier',
+ 'ServiceLifeCycle' => 'ServiceLifeCycle',
+ 'MessageReceiver' => 'MessageReceiver',
+ 'Phase' => 'Phase',
+ 'Handler' => 'Handler',
+ 'StateManager' => 'StateManager',
+ 'RememberMeData' => 'RememberMeData',
+ 'ClusteringAgent' => 'ClusteringAgent',
+ 'TypeTable' => 'TypeTable',
+ );
+
+ public function AuthenticationAdminStub($wsdl = "AuthenticationAdmin.xml", $options = array()) {
+ foreach(self::$classmap as $key => $value) {
+ if(!isset($options['classmap'][$key])) {
+ $options['classmap'][$key] = $value;
+ }
+ }
+ parent::__construct($wsdl, $options);
+ }
+
+ /**
+ *
+ *
+ * @param logout $parameters
+ * @return void
+ */
+ public function logout(logout $parameters) {
+ return $this->__soapCall('logout', array($parameters), array(
+ 'uri' => 'http://authentication.services.core.carbon.wso2.org',
+ 'soapaction' => ''
+ )
+ );
+ }
+
+ /**
+ *
+ *
+ * @param loginWithRememberMeCookie $parameters
+ * @return loginWithRememberMeCookieResponse
+ */
+ public function loginWithRememberMeCookie(loginWithRememberMeCookie $parameters) {
+ return $this->__soapCall('loginWithRememberMeCookie', array($parameters), array(
+ 'uri' => 'http://authentication.services.core.carbon.wso2.org',
+ 'soapaction' => ''
+ )
+ );
+ }
+
+ /**
+ *
+ *
+ * @param authenticateWithRememberMe $parameters
+ * @return authenticateWithRememberMeResponse
+ */
+ public function authenticateWithRememberMe(authenticateWithRememberMe $parameters) {
+ return $this->__soapCall('authenticateWithRememberMe', array($parameters), array(
+ 'uri' => 'http://authentication.services.core.carbon.wso2.org',
+ 'soapaction' => ''
+ )
+ );
+ }
+
+ /**
+ *
+ *
+ * @param getAuthenticatorName $parameters
+ * @return getAuthenticatorNameResponse
+ */
+ public function getAuthenticatorName(getAuthenticatorName $parameters) {
+ return $this->__soapCall('getAuthenticatorName', array($parameters), array(
+ 'uri' => 'http://authentication.services.core.carbon.wso2.org',
+ 'soapaction' => ''
+ )
+ );
+ }
+
+ /**
+ *
+ *
+ * @param login $parameters
+ * @return loginResponse
+ */
+ public function login(login $parameters) {
+ return $this->__soapCall('login', array($parameters), array(
+ 'uri' => 'http://authentication.services.core.carbon.wso2.org',
+ 'soapaction' => ''
+ )
+ );
+ }
+
+ /**
+ *
+ *
+ * @param loginWithRememberMeOption $parameters
+ * @return loginWithRememberMeOptionResponse
+ */
+ public function loginWithRememberMeOption(loginWithRememberMeOption $parameters) {
+ return $this->__soapCall('loginWithRememberMeOption', array($parameters), array(
+ 'uri' => 'http://authentication.services.core.carbon.wso2.org',
+ 'soapaction' => ''
+ )
+ );
+ }
+
+ /**
+ *
+ *
+ * @param isDisabled $parameters
+ * @return isDisabledResponse
+ */
+ public function isDisabled(isDisabled $parameters) {
+ return $this->__soapCall('isDisabled', array($parameters), array(
+ 'uri' => 'http://authentication.services.core.carbon.wso2.org',
+ 'soapaction' => ''
+ )
+ );
+ }
+
+ /**
+ *
+ *
+ * @param getPriority $parameters
+ * @return getPriorityResponse
+ */
+ public function getPriority(getPriority $parameters) {
+ return $this->__soapCall('getPriority', array($parameters), array(
+ 'uri' => 'http://authentication.services.core.carbon.wso2.org',
+ 'soapaction' => ''
+ )
+ );
+ }
+}
+
+?>
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/3ca02155/app/libraries/Wsis/Stubs/TenantManager.php
----------------------------------------------------------------------
diff --git a/app/libraries/Wsis/Stubs/TenantManager.php b/app/libraries/Wsis/Stubs/TenantManager.php
new file mode 100755
index 0000000..26b109b
--- /dev/null
+++ b/app/libraries/Wsis/Stubs/TenantManager.php
@@ -0,0 +1,139 @@
+<?php
+namespace Wsis\Stubs;
+
+use Wsis\Stubs\TenantMgtAdminStub;
+
+/**
+ * TenantManager class
+ *
+ * This class provide an easy to use interface for
+ * WSO2 IS 5.0.0 TenantMgtAdmin service.
+ */
+class TenantManager {
+ /**
+ * @var TenantMgtAdminStub $serviceStub
+ * @access private
+ */
+ private $serviceStub;
+
+ public function __construct($server_url, $options) {
+ $this->serviceStub = new TenantMgtAdminStub(
+ $server_url . "TenantMgtAdminService?wsdl", $options
+ );
+ }
+
+ /**
+ * Function to get the soap client
+ *
+ * @return SoapClient
+ */
+ public function getSoapClient(){
+ return $this->serviceStub;
+ }
+
+ /**
+ * Method to retrieve all tenant information. Some tenant information
+ * such as admin name are not returned by wso2 IS
+ * @return mixed
+ */
+ public function retrieveTenants(){
+ $parameters = new retrieveTenants();
+ return $this->serviceStub->retrieveTenants($parameters)->return;
+ }
+
+ /**
+ * Method to get tenant information giving tenant domain
+ * @param $domain domain of the tenant
+ * @return mixed
+ */
+ public function getTenant($domain){
+ $parameters = new getTenant();
+ $parameters->tenantDomain = $domain;
+ return $this->serviceStub->getTenant($parameters)->return;
+ }
+
+ /**
+ * Method to create a new tenant
+ * @param $active whether tenant active or not
+ * @param $adminUsername
+ * @param $adminPassword
+ * @param $email
+ * @param $firstName Admin's first name
+ * @param $lastName Admin's last name
+ * @param $tenantDomain
+ */
+ public function addTenant($active, $adminUsername, $adminPassword, $email,
+ $firstName, $lastName, $tenantDomain){
+ $tenantInfoBean = new TenantInfoBean();
+ $tenantInfoBean->active = $active;
+ $tenantInfoBean->admin = $adminUsername;
+ $tenantInfoBean->adminPassword = $adminPassword;
+ $tenantInfoBean->email = $email;
+ $tenantInfoBean->firstName = $firstName;
+ $tenantInfoBean->lastName = $lastName;
+ $tenantInfoBean->tenantDomain = $tenantDomain;
+
+ $addTenant = new addTenant();
+ $addTenant->tenantInfoBean = $tenantInfoBean;
+ $this->serviceStub->addTenant($addTenant);
+ }
+
+ /**
+ * Method to remove an existing tenant giving tenant domain
+ * @param $tenantDomain
+ */
+ public function deleteTenant($tenantDomain){
+ $parameters = new deleteTenant();
+ $parameters->tenantDomain = $tenantDomain;
+ $this->serviceStub->deleteTenant($parameters);
+ }
+
+ /**
+ * Method to activate a tenant
+ * @param $tenantDomain
+ */
+ public function activateTenant($tenantDomain){
+ $parameters = new activateTenant();
+ $parameters->tenantDomain = $tenantDomain;
+ $this->serviceStub->activateTenant($parameters);
+ }
+
+ /**
+ * Method to deactivate a tenant
+ * @param $tenantDomain
+ */
+ public function deactivateTenant($tenantDomain){
+ $parameters = new deactivateTenant();
+ $parameters->tenantDomain = $tenantDomain;
+ $this->serviceStub->deactivateTenant($parameters);
+ }
+
+ /**
+ * Method to update an existing tenant
+ * @param $tenantId
+ * @param $active
+ * @param $adminUsername
+ * @param $adminPassword
+ * @param $email
+ * @param $firstName
+ * @param $lastName
+ * @param $tenantDomain
+ */
+ public function updateTenant($tenantId, $active, $adminUsername, $adminPassword, $email,
+ $firstName, $lastName, $tenantDomain){
+ $tenantInfoBean = new TenantInfoBean();
+ $tenantInfoBean->tenantId = $tenantId;
+ $tenantInfoBean->active = $active;
+ $tenantInfoBean->admin = $adminUsername;
+ $tenantInfoBean->adminPassword = $adminPassword;
+ $tenantInfoBean->email = $email;
+ $tenantInfoBean->firstName = $firstName;
+ $tenantInfoBean->lastName = $lastName;
+ $tenantInfoBean->tenantDomain = $tenantDomain;
+
+ $updateTenant = new updateTenant();
+ $updateTenant->tenantInfoBean = $tenantInfoBean;
+ $this->serviceStub->updateTenant($updateTenant);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/3ca02155/app/libraries/Wsis/Stubs/TenantMgtAdminStub.php
----------------------------------------------------------------------
diff --git a/app/libraries/Wsis/Stubs/TenantMgtAdminStub.php b/app/libraries/Wsis/Stubs/TenantMgtAdminStub.php
new file mode 100755
index 0000000..cb02705
--- /dev/null
+++ b/app/libraries/Wsis/Stubs/TenantMgtAdminStub.php
@@ -0,0 +1,306 @@
+<?php
+namespace Wsis\Stubs;
+use SoapClient;
+/**
+ * This file contains the DTOs and the method stubs for
+ * WSO2 IS 5.0.0 TenantMgtAdmin service.
+ */
+class TenantMgtAdminServiceException {
+ public $TenantMgtAdminServiceException; // Exception
+}
+
+
+class deleteTenant {
+ public $tenantDomain; // string
+}
+
+class updateTenant {
+ public $tenantInfoBean; // TenantInfoBean
+}
+
+class addTenant {
+ public $tenantInfoBean; // TenantInfoBean
+}
+
+class addTenantResponse {
+ public $return; // string
+}
+
+class activateTenant {
+ public $tenantDomain; // string
+}
+
+class deactivateTenant {
+ public $tenantDomain; // string
+}
+
+class getTenant {
+ public $tenantDomain; // string
+}
+
+class getTenantResponse {
+ public $return; // TenantInfoBean
+}
+
+class retrievePaginatedTenants {
+ public $pageNumber; // int
+}
+
+class retrievePaginatedTenantsResponse {
+ public $return; // PaginatedTenantInfoBean
+}
+
+class retrieveTenants {
+}
+
+class retrieveTenantsResponse {
+ public $return; // TenantInfoBean
+}
+
+class retrievePartialSearchTenants {
+ public $domain; // string
+}
+
+class retrievePartialSearchTenantsResponse {
+ public $return; // TenantInfoBean
+}
+
+class addSkeletonTenant {
+ public $tenantInfoBean; // TenantInfoBean
+}
+
+class addSkeletonTenantResponse {
+ public $return; // string
+}
+
+class retrievePaginatedPartialSearchTenants {
+ public $domain; // string
+ public $pageNumber; // int
+}
+
+class retrievePaginatedPartialSearchTenantsResponse {
+ public $return; // PaginatedTenantInfoBean
+}
+
+class TenantInfoBean {
+ public $active; // boolean
+ public $admin; // string
+ public $adminPassword; // string
+ public $createdDate; // dateTime
+ public $email; // string
+ public $firstname; // string
+ public $lastname; // string
+ public $originatedService; // string
+ public $successKey; // string
+ public $tenantDomain; // string
+ public $tenantId; // int
+ public $usagePlan; // string
+}
+
+class PaginatedTenantInfoBean {
+ public $numberOfPages; // int
+ public $tenantInfoBeans; // TenantInfoBean
+}
+
+
+/**
+ * TenantMgtAdminStub class
+ *
+ *
+ *
+ * @author {author}
+ * @copyright {copyright}
+ * @package {package}
+ */
+class TenantMgtAdminStub extends SoapClient {
+
+ private static $classmap = array(
+ 'TenantMgtAdminServiceException' => 'TenantMgtAdminServiceException',
+ 'deleteTenant' => 'deleteTenant',
+ 'updateTenant' => 'updateTenant',
+ 'addTenant' => 'addTenant',
+ 'addTenantResponse' => 'addTenantResponse',
+ 'activateTenant' => 'activateTenant',
+ 'deactivateTenant' => 'deactivateTenant',
+ 'getTenant' => 'getTenant',
+ 'getTenantResponse' => 'getTenantResponse',
+ 'retrievePaginatedTenants' => 'retrievePaginatedTenants',
+ 'retrievePaginatedTenantsResponse' => 'retrievePaginatedTenantsResponse',
+ 'retrieveTenants' => 'retrieveTenants',
+ 'retrieveTenantsResponse' => 'retrieveTenantsResponse',
+ 'retrievePartialSearchTenants' => 'retrievePartialSearchTenants',
+ 'retrievePartialSearchTenantsResponse' => 'retrievePartialSearchTenantsResponse',
+ 'addSkeletonTenant' => 'addSkeletonTenant',
+ 'addSkeletonTenantResponse' => 'addSkeletonTenantResponse',
+ 'retrievePaginatedPartialSearchTenants' => 'retrievePaginatedPartialSearchTenants',
+ 'retrievePaginatedPartialSearchTenantsResponse' => 'retrievePaginatedPartialSearchTenantsResponse',
+ 'TenantInfoBean' => 'TenantInfoBean',
+ 'PaginatedTenantInfoBean' => 'PaginatedTenantInfoBean',
+ );
+
+ public function TenantMgtAdminStub($wsdl, $options = array()) {
+ foreach(self::$classmap as $key => $value) {
+ if(!isset($options['classmap'][$key])) {
+ $options['classmap'][$key] = $value;
+ }
+ }
+ parent::__construct($wsdl, $options);
+ }
+
+ /**
+ *
+ *
+ * @param retrieveTenants $parameters
+ * @return retrieveTenantsResponse
+ */
+ public function retrieveTenants(retrieveTenants $parameters) {
+ return $this->__soapCall('retrieveTenants', array($parameters), array(
+ 'uri' => 'http://services.mgt.tenant.carbon.wso2.org',
+ 'soapaction' => ''
+ )
+ );
+ }
+
+ /**
+ *
+ *
+ * @param getTenant $parameters
+ * @return getTenantResponse
+ */
+ public function getTenant(getTenant $parameters) {
+ return $this->__soapCall('getTenant', array($parameters), array(
+ 'uri' => 'http://services.mgt.tenant.carbon.wso2.org',
+ 'soapaction' => ''
+ )
+ );
+ }
+
+ /**
+ *
+ *
+ * @param deactivateTenant $parameters
+ * @return void
+ */
+ public function deactivateTenant(deactivateTenant $parameters) {
+ return $this->__soapCall('deactivateTenant', array($parameters), array(
+ 'uri' => 'http://services.mgt.tenant.carbon.wso2.org',
+ 'soapaction' => ''
+ )
+ );
+ }
+
+ /**
+ *
+ *
+ * @param retrievePartialSearchTenants $parameters
+ * @return retrievePartialSearchTenantsResponse
+ */
+ public function retrievePartialSearchTenants(retrievePartialSearchTenants $parameters) {
+ return $this->__soapCall('retrievePartialSearchTenants', array($parameters), array(
+ 'uri' => 'http://services.mgt.tenant.carbon.wso2.org',
+ 'soapaction' => ''
+ )
+ );
+ }
+
+ /**
+ *
+ *
+ * @param retrievePaginatedTenants $parameters
+ * @return retrievePaginatedTenantsResponse
+ */
+ public function retrievePaginatedTenants(retrievePaginatedTenants $parameters) {
+ return $this->__soapCall('retrievePaginatedTenants', array($parameters), array(
+ 'uri' => 'http://services.mgt.tenant.carbon.wso2.org',
+ 'soapaction' => ''
+ )
+ );
+ }
+
+ /**
+ *
+ *
+ * @param updateTenant $parameters
+ * @return void
+ */
+ public function updateTenant(updateTenant $parameters) {
+ return $this->__soapCall('updateTenant', array($parameters), array(
+ 'uri' => 'http://services.mgt.tenant.carbon.wso2.org',
+ 'soapaction' => ''
+ )
+ );
+ }
+
+ /**
+ *
+ *
+ * @param addSkeletonTenant $parameters
+ * @return addSkeletonTenantResponse
+ */
+ public function addSkeletonTenant(addSkeletonTenant $parameters) {
+ return $this->__soapCall('addSkeletonTenant', array($parameters), array(
+ 'uri' => 'http://services.mgt.tenant.carbon.wso2.org',
+ 'soapaction' => ''
+ )
+ );
+ }
+
+ /**
+ *
+ *
+ * @param addTenant $parameters
+ * @return addTenantResponse
+ */
+ public function addTenant(addTenant $parameters) {
+ return $this->__soapCall('addTenant', array($parameters), array(
+ 'uri' => 'http://services.mgt.tenant.carbon.wso2.org',
+ 'soapaction' => ''
+ )
+ );
+ }
+
+ /**
+ *
+ *
+ * @param retrievePaginatedPartialSearchTenants $parameters
+ * @return retrievePaginatedPartialSearchTenantsResponse
+ */
+ public function retrievePaginatedPartialSearchTenants(retrievePaginatedPartialSearchTenants $parameters) {
+ return $this->__soapCall('retrievePaginatedPartialSearchTenants', array($parameters), array(
+ 'uri' => 'http://services.mgt.tenant.carbon.wso2.org',
+ 'soapaction' => ''
+ )
+ );
+ }
+
+ /**
+ *
+ *
+ * @param activateTenant $parameters
+ * @return void
+ */
+ public function activateTenant(activateTenant $parameters) {
+ return $this->__soapCall('activateTenant', array($parameters), array(
+ 'uri' => 'http://services.mgt.tenant.carbon.wso2.org',
+ 'soapaction' => ''
+ )
+ );
+ }
+
+ /**
+ *
+ *
+ * @param deleteTenant $parameters
+ * @return void
+ */
+ public function deleteTenant(deleteTenant $parameters) {
+ return $this->__soapCall('deleteTenant', array($parameters), array(
+ 'uri' => 'http://services.mgt.tenant.carbon.wso2.org',
+ 'soapaction' => ''
+ )
+ );
+ }
+
+}
+
+?>
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/3ca02155/app/libraries/Wsis/Stubs/UserStoreManager.php
----------------------------------------------------------------------
diff --git a/app/libraries/Wsis/Stubs/UserStoreManager.php b/app/libraries/Wsis/Stubs/UserStoreManager.php
new file mode 100755
index 0000000..6fa719d
--- /dev/null
+++ b/app/libraries/Wsis/Stubs/UserStoreManager.php
@@ -0,0 +1,203 @@
+<?php
+namespace Wsis\Stubs;
+
+use Wsis\Stubs\UserStoreManagerStub;
+
+/**
+ * UsersStoreManager class
+ *
+ * This class provide an easy to use interface for
+ * WSO2 IS 5.0.0 RemoteUserStoreManager service.
+ */
+class UserStoreManager {
+ /**
+ * @var RemoteUserManagerStub $serviceStub
+ * @access private
+ */
+ private $serviceStub;
+
+ public function __construct($server_url, $options) {
+ $this->serviceStub = new UserStoreManagerStub(
+ $server_url . "RemoteUserStoreManagerService?wsdl", $options
+ );
+ }
+
+ /**
+ * Function to get the soap client
+ *
+ * @return SoapClient
+ */
+ public function getSoapClient(){
+ return $this->serviceStub;
+ }
+
+ /**
+ * Function to authenticate the user with RemoteUserStoreManager Service
+ * @param type $username
+ * @param type $password
+ */
+ public function authenticate($username, $password){
+ $parameters = new Authenticate();
+ $parameters->userName = $username;
+ $parameters->credential = $password;
+ return $this->serviceStub->authenticate($parameters)->return;
+ }
+
+ /**
+ * Function to add new user by providing username and password
+ *
+ * @param type $userName
+ * @param type $password
+ */
+ public function addUser($userName, $password, $fullName){
+ $parameters = new AddUser();
+ $parameters->userName = $userName;
+ $parameters->credential = $password;
+ $parameters->claims = null;
+ $parameters->profileName = $fullName;
+ $parameters->requirePasswordChange = false;
+ $parameters->roleList = null;
+ $this->serviceStub->addUser($parameters);
+ }
+ /**
+ * Function to delete existing user by providing the username.
+ *
+ * @param string $username
+ */
+ public function deleteUser($username){
+ $parameters = new DeleteUser();
+ $parameters->userName = $username;
+ $this->serviceStub->deleteUser($parameters);
+ }
+
+ /**
+ * Function to check whether a role is existing
+ *
+ * @param string $roleName
+ * @return IsExistingRoleResponse
+ */
+ public function isExistingRole( $roleName) {
+ $parameters = new IsExistingRole();
+ $parameters->roleName = $roleName;
+ $this->serviceStub->isExistingRole( $parameters)->return;
+ }
+ /**
+ * Function to add new role by providing the role name.
+ *
+ * @param string $roleName
+ */
+ public function addRole($roleName){
+ $paramerters = new AddRole();
+ $paramerters->roleName=$roleName;
+ $paramerters->userList=null;
+ $paramerters->permissions=null;
+ $this->serviceStub->addRole($paramerters);
+ }
+
+ /**
+ * Function to delete an existing role
+ *
+ * @param string $roleName
+ */
+ public function deleteRole($roleName){
+ $parameters = new DeleteRole();
+ $parameters->roleName = $roleName;
+ $this->serviceStub->deleteRole($parameters);
+ }
+
+ /**
+ * Function to get a list of users
+ *
+ * @return username list
+ */
+ public function listUsers(){
+ $parameters = new ListUsers();
+ $parameters->filter = "*";
+ $parameters->maxItemLimit = -1;
+
+ return $this->serviceStub->listUsers($parameters)->return;
+ }
+
+ /**
+ * Function get user list
+ *
+ * @param GetUserList $parameters
+ * @return GetUserListResponse
+ */
+ public function getUserList(){
+ $parameters = new GetUserList();
+ }
+
+
+ /**
+ * Function to check whether the given username already exists
+ *
+ * @param string $username
+ * @return boolean
+ */
+ public function isExistingUser($username) {
+ $parameters = new IsExistingUser();
+ $parameters->userName = $username;
+
+ return $this->serviceStub->isExistingUser($parameters)->return;
+ }
+
+ /**
+ * Function to get the list of all existing roles
+ *
+ * @return roles list
+ */
+ public function getRoleNames( $parameters = null){
+ $parameters = new GetRoleNames();
+ return $this->serviceStub->getRoleNames( $parameters)->return;
+ }
+
+ /**
+ * Function to get role of a user
+ *
+ * @return User Role
+ */
+ public function getRoleListOfUser( $username){
+ $parameters = new GetRoleListOfUser();
+ $parameters->userName = $username;
+ return $this->serviceStub->GetRoleListOfUser( $parameters)->return;
+ }
+
+ /**
+ * Function to get the user list of role
+ *
+ * @param GetUserListOfRole $parameters
+ * @return GetUserListOfRoleResponse
+ */
+ public function getUserListOfRole( $roleName){
+ $parameters = new GetUserListOfRole();
+ $parameters->roleName = $roleName;
+ return $this->serviceStub->getUserListOfRole( $parameters);
+ }
+
+ /**
+ * Function to update role list of user
+ *
+ * @param UpdateRoleListOfUser $parameters
+ * @return void
+ */
+ public function updateRoleListOfUser( $username, $roles){
+ $parameters = new UpdateRoleListOfUser();
+ $parameters->userName = $username;
+ $parameters->deletedRoles = $roles["deleted"];
+ $parameters->newRoles = $roles["new"];
+ return $this->serviceStub->updateRoleListOfUser( $parameters);
+ }
+
+ /**
+ * Function to get the tenant id
+ *
+ * @param GetTenantId $parameters
+ * @return GetTenantIdResponse
+ */
+ public function getTenantId(){
+ $parameters = new GetTenantId();
+
+ return $this->serviceStub->getTenantId( $parameters);
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/3ca02155/app/libraries/Wsis/Stubs/UserStoreManagerStub.php
----------------------------------------------------------------------
diff --git a/app/libraries/Wsis/Stubs/UserStoreManagerStub.php b/app/libraries/Wsis/Stubs/UserStoreManagerStub.php
new file mode 100755
index 0000000..d7210b1
--- /dev/null
+++ b/app/libraries/Wsis/Stubs/UserStoreManagerStub.php
@@ -0,0 +1,1570 @@
+<?php
+namespace Wsis\Stubs;
+use SoapClient;
+
+/**
+ * This file contains the DTOs and the method stubs for
+ * WSO2 IS 4.6.0 RemoteUserStoreManger service.
+ */
+
+class ClaimDTO {
+
+ /**
+ * @var string $claimUri
+ * @access public
+ */
+ public $claimUri;
+
+ /**
+ * @var string $description
+ * @access public
+ */
+ public $description;
+
+ /**
+ * @var string $dialectURI
+ * @access public
+ */
+ public $dialectURI;
+
+ /**
+ * @var int $displayOrder
+ * @access public
+ */
+ public $displayOrder;
+
+ /**
+ * @var string $displayTag
+ * @access public
+ */
+ public $displayTag;
+
+ /**
+ * @var string $regEx
+ * @access public
+ */
+ public $regEx;
+
+ /**
+ * @var boolean $required
+ * @access public
+ */
+ public $required;
+
+ /**
+ * @var boolean $supportedByDefault
+ * @access public
+ */
+ public $supportedByDefault;
+
+ /**
+ * @var string $value
+ * @access public
+ */
+ public $value;
+
+}
+
+class PermissionDTO {
+
+ /**
+ * @var string $action
+ * @access public
+ */
+ public $action;
+
+ /**
+ * @var string $resourceId
+ * @access public
+ */
+ public $resourceId;
+
+}
+
+class Tenant {
+
+ /**
+ * @var boolean $active
+ * @access public
+ */
+ public $active;
+
+ /**
+ * @var string $adminFirstName
+ * @access public
+ */
+ public $adminFirstName;
+
+ /**
+ * @var string $adminFullName
+ * @access public
+ */
+ public $adminFullName;
+
+ /**
+ * @var string $adminLastName
+ * @access public
+ */
+ public $adminLastName;
+
+ /**
+ * @var string $adminName
+ * @access public
+ */
+ public $adminName;
+
+ /**
+ * @var string $adminPassword
+ * @access public
+ */
+ public $adminPassword;
+
+ /**
+ * @var string $createdDate YYYY-MM-DD
+ * @access public
+ */
+ public $createdDate;
+
+ /**
+ * @var string $domain
+ * @access public
+ */
+ public $domain;
+
+ /**
+ * @var string $email
+ * @access public
+ */
+ public $email;
+
+ /**
+ * @var int $id
+ * @access public
+ */
+ public $id;
+
+ /**
+ * @var RealmConfiguration $realmConfig
+ * @access public
+ */
+ public $realmConfig;
+
+}
+
+class RealmConfiguration {
+
+ /**
+ * @var string $addAdmin
+ * @access public
+ */
+ public $addAdmin;
+
+ /**
+ * @var string $adminPassword
+ * @access public
+ */
+ public $adminPassword;
+
+ /**
+ * @var string $adminRoleName
+ * @access public
+ */
+ public $adminRoleName;
+
+ /**
+ * @var string $adminUserName
+ * @access public
+ */
+ public $adminUserName;
+
+ /**
+ * @var string $authorizationManagerClass
+ * @access public
+ */
+ public $authorizationManagerClass;
+
+ /**
+ * @var string $authzProperties
+ * @access public
+ */
+ public $authzProperties;
+
+ /**
+ * @var string $description
+ * @access public
+ */
+ public $description;
+
+ /**
+ * @var string $everyOneRoleName
+ * @access public
+ */
+ public $everyOneRoleName;
+
+ /**
+ * @var string $multipleCredentialProps
+ * @access public
+ */
+ public $multipleCredentialProps;
+
+ /**
+ * @var boolean $passwordsExternallyManaged
+ * @access public
+ */
+ public $passwordsExternallyManaged;
+
+ /**
+ * @var string $persistedTimestamp YYYY-MM-DD
+ * @access public
+ */
+ public $persistedTimestamp;
+
+ /**
+ * @var boolean $primary
+ * @access public
+ */
+ public $primary;
+
+ /**
+ * @var string $realmClassName
+ * @access public
+ */
+ public $realmClassName;
+
+ /**
+ * @var string $realmProperties
+ * @access public
+ */
+ public $realmProperties;
+
+ /**
+ * @var RealmConfiguration $secondaryRealmConfig
+ * @access public
+ */
+ public $secondaryRealmConfig;
+
+ /**
+ * @var int $tenantId
+ * @access public
+ */
+ public $tenantId;
+
+ /**
+ * @var string $userStoreClass
+ * @access public
+ */
+ public $userStoreClass;
+
+ /**
+ * @var string $userStoreProperties
+ * @access public
+ */
+ public $userStoreProperties;
+
+}
+
+class ClaimValue {
+
+ /**
+ * @var string $claimURI
+ * @access public
+ */
+ public $claimURI;
+
+ /**
+ * @var string $value
+ * @access public
+ */
+ public $value;
+
+}
+
+class AddUserClaimValues {
+
+ /**
+ * @var string $userName
+ * @access public
+ */
+ public $userName;
+
+ /**
+ * @var ClaimValue $claims
+ * @access public
+ */
+ public $claims;
+
+ /**
+ * @var string $profileName
+ * @access public
+ */
+ public $profileName;
+
+}
+
+class GetUserClaimValuesForClaims {
+
+ /**
+ * @var string $userName
+ * @access public
+ */
+ public $userName;
+
+ /**
+ * @var string $claims
+ * @access public
+ */
+ public $claims;
+
+ /**
+ * @var string $profileName
+ * @access public
+ */
+ public $profileName;
+
+}
+
+class GetUserClaimValuesForClaimsResponse {
+
+ /**
+ * @var ClaimValue $return
+ * @access public
+ */
+ public $return;
+
+}
+
+class GetTenantIdofUser {
+
+ /**
+ * @var string $userName
+ * @access public
+ */
+ public $username;
+
+}
+
+class GetTenantIdofUserResponse {
+
+ /**
+ * @var int $return
+ * @access public
+ */
+ public $return; // int
+
+}
+
+class AddUserClaimValue {
+
+ /**
+ * @var string $userName
+ * @access public
+ */
+ public $userName;
+
+ /**
+ * @var string $claimURI
+ * @access public
+ */
+ public $claimURI;
+
+ /**
+ * @var string $claimValue
+ * @access public
+ */
+ public $claimValue;
+
+ /**
+ * @var string $profileName
+ * @access public
+ */
+ public $profileName;
+
+}
+
+class GetUserClaimValues {
+
+ /**
+ * @var string $userName
+ * @access public
+ */
+ public $userName;
+
+ /**
+ * @var string $profileName
+ * @access public
+ */
+ public $profileName;
+
+}
+
+class GetUserClaimValuesResponse {
+
+ /**
+ * @var ClaimDTO $return
+ * @access public
+ */
+ public $return;
+
+}
+
+class GetTenantId {
+
+}
+
+class GetTenantIdResponse {
+
+ /**
+ * @var int $return
+ * @access public
+ */
+ public $return;
+
+}
+
+class AddUser {
+
+ /**
+ * @var string $userName
+ * @access public
+ */
+ public $userName;
+
+ /**
+ * @var string $credential
+ * @access public
+ */
+ public $credential;
+
+ /**
+ * @var string $roleList
+ * @access public
+ */
+ public $roleList;
+
+ /**
+ * @var ClaimValue $claims
+ * @access public
+ */
+ public $claims;
+
+ /**
+ * @var string $profileName
+ * @access public
+ */
+ public $profileName;
+
+ /**
+ * @var boolean $requiredPasswordChange
+ * @access public
+ */
+ public $requirePasswordChange;
+
+}
+
+class AddRole {
+
+ /**
+ * @var string $roleName
+ * @access public
+ */
+ public $roleName;
+
+ /**
+ * @var string $userList
+ * @access public
+ */
+ public $userList;
+
+ /**
+ * @var PermissionDTO $permissions
+ * @access public
+ */
+ public $permissions;
+
+}
+
+class GetUserList {
+
+ /**
+ * @var string $claimUri
+ * @access public
+ */
+ public $claimUri;
+
+ /**
+ * @var string $claimValue
+ * @access public
+ */
+ public $claimValue;
+
+ /**
+ * @var string $profile
+ * @access public
+ */
+ public $profile;
+
+}
+
+class GetUserListResponse {
+
+ /**
+ * @var string $return
+ * @access public
+ */
+ public $return;
+
+}
+
+class UpdateCredential {
+
+ /**
+ * @var string $userName
+ * @access public
+ */
+ public $userName;
+
+ /**
+ * @var string $newCredential
+ * @access public
+ */
+ public $newCredential;
+
+ /**
+ * @var string $oldCredential
+ * @access public
+ */
+ public $oldCredential;
+
+}
+
+class UpdateUserListOfRole {
+
+ /**
+ * @var string $roleName
+ * @access public
+ */
+ public $roleName;
+
+ /**
+ * @var string $deletedUsers
+ * @access public
+ */
+ public $deletedUsers;
+
+ /**
+ * @var string $newUsers
+ * @access public
+ */
+ public $newUsers;
+
+}
+
+class UpdateRoleListOfUser {
+
+ /**
+ * @var string $userName
+ * @access public
+ */
+ public $userName;
+
+ /**
+ * @var string $deletedRoles
+ * @access public
+ */
+ public $deletedRoles;
+
+ /**
+ * @var string $newRoles
+ * @access public
+ */
+ public $newRoles;
+
+}
+
+class SetUserClaimValue {
+
+ /**
+ * @var string $userName
+ * @access public
+ */
+ public $userName;
+
+ /**
+ * @var string $claimURI
+ * @access public
+ */
+ public $claimURI;
+
+ /**
+ * @var string $claimValue
+ * @access public
+ */
+ public $claimValue;
+
+ /**
+ * @var string $profileName
+ * @access public
+ */
+ public $profileName;
+
+}
+
+class SetUserClaimValues {
+
+ /**
+ * @var string $userName
+ * @access public
+ */
+ public $userName;
+
+ /**
+ * @var ClaimValue $claims
+ * @access public
+ */
+ public $claims;
+
+ /**
+ * @var string $profileName
+ * @access public
+ */
+ public $profileName;
+
+}
+
+class DeleteUserClaimValue {
+
+ /**
+ * @var string $userName
+ * @access public
+ */
+ public $userName;
+
+ /**
+ * @var string $claimURI
+ * @access public
+ */
+ public $claimURI;
+
+ /**
+ * @var string $profileName
+ * @access public
+ */
+ public $profileName;
+
+}
+
+class DeleteUserClaimValues {
+
+ /**
+ * @var string $userName
+ * @access public
+ */
+ public $userName;
+
+ /**
+ * @var string $claims
+ * @access public
+ */
+ public $claims;
+
+ /**
+ * @var string $profileName
+ * @access public
+ */
+ public $profileName;
+
+}
+
+class GetHybridRoles {
+
+}
+
+class GetHybridRolesResponse {
+
+ /**
+ * @var string $return
+ * @access public
+ */
+ public $return;
+
+}
+
+class GetPasswordExpirationTime {
+
+ /**
+ * @var string $username
+ * @access public
+ */
+ public $username;
+
+}
+
+class GetPasswordExpirationTimeResponse {
+
+ /**
+ * @var long $return
+ * @access public
+ */
+ public $return;
+
+}
+
+class UpdateRoleName {
+
+ /**
+ * @var string $roleName
+ * @access public
+ */
+ public $roleName;
+
+ /**
+ * @var string $newRoleName
+ * @access public
+ */
+ public $newRoleName;
+
+}
+
+class ListUsers {
+
+ /**
+ * @var string $filter
+ * @access public
+ */
+ public $filter;
+
+ /**
+ * @var int $maxItemLimit
+ * @access public
+ */
+ public $maxItemLimit;
+
+}
+
+class ListUsersResponse {
+
+ /**
+ * @var string $return
+ * @access public
+ */
+ public $return;
+
+}
+
+class IsExistingUser {
+
+ /**
+ * @var string $userName
+ * @access public
+ */
+ public $userName;
+
+}
+
+class IsExistingUserResponse {
+
+ /**
+ * @var boolean $return
+ * @access public
+ */
+ public $return;
+
+}
+
+class IsExistingRole {
+
+ /**
+ * @var string $roleName
+ * @access public
+ */
+ public $roleName;
+
+}
+
+class IsExistingRoleResponse {
+
+ /**
+ * @var boolean $return
+ * @access public
+ */
+ public $return;
+
+}
+
+class GetRoleNames {
+
+}
+
+class GetRoleNamesResponse {
+
+ /**
+ * @var string $return
+ * @access public
+ */
+ public $return;
+
+}
+
+class GetProfileNames {
+
+ /**
+ * @var string $userName
+ * @access public
+ */
+ public $userName;
+
+}
+
+class GetProfileNamesResponse {
+
+ /**
+ * @var string $return
+ * @access public
+ */
+ public $return;
+
+}
+
+class GetUserListOfRole {
+
+ /**
+ * @var string $roleName
+ * @access public
+ */
+ public $roleName;
+
+}
+
+class GetUserListOfRoleResponse {
+
+ /**
+ * @var string $return
+ * @access public
+ */
+ public $return;
+
+}
+
+class GetUserClaimValue {
+
+ /**
+ * @var string $userName
+ * @access public
+ */
+ public $userName;
+
+ /**
+ * @var string $claim
+ * @access public
+ */
+ public $claim;
+
+ /**
+ * @var string $profileName
+ * @access public
+ */
+ public $profileName;
+
+}
+
+class GetUserClaimValueResponse {
+
+ /**
+ * @var string $return
+ * @access public
+ */
+ public $return;
+
+}
+
+class GetAllProfileNames {
+
+}
+
+class GetAllProfileNamesResponse {
+
+ /**
+ * @var string $return
+ * @access public
+ */
+ public $return;
+
+}
+
+class UpdateCredentialByAdmin {
+
+ /**
+ * @var string $userName
+ * @access public
+ */
+ public $userName;
+
+ /**
+ * @var string $newCredential
+ * @access public
+ */
+ public $newCredential;
+
+}
+
+class DeleteUser {
+
+ /**
+ * @var string $userName
+ * @access public
+ */
+ public $userName;
+
+}
+
+class DeleteRole {
+
+ /**
+ * @var string $roleName
+ * @access public
+ */
+ public $roleName;
+
+}
+
+class GetUserId {
+
+ /**
+ * @var string $username
+ * @access public
+ */
+ public $username;
+
+}
+
+class GetUserIdResponse {
+
+ /**
+ * @var int $return
+ * @access public
+ */
+ public $return;
+
+}
+
+class GetRoleListOfUser {
+
+ /**
+ * @var string $userName
+ * @access public
+ */
+ public $userName;
+
+}
+
+class getRoleListOfUserResponse {
+
+ /**
+ * @var string $return
+ * @access public
+ */
+ public $return;
+
+}
+
+class GetProperties {
+
+ /**
+ * @var Tenant $tenant
+ * @access public
+ */
+ public $tenant;
+
+}
+
+class GetPropertiesResponse {
+
+ /**
+ * @var Array<string> $return
+ * @access public
+ */
+ public $return;
+
+}
+
+class IsReadOnly {
+
+}
+
+class IsReadOnlyResponse {
+
+ /**
+ * @var boolean $return
+ * @access public
+ */
+ public $return;
+
+}
+
+class Authenticate {
+
+ /**
+ * @var string $userName
+ * @access public
+ */
+ public $userName;
+
+ /**
+ * @var string $credential
+ * @access public
+ */
+ public $credential;
+
+}
+
+class AuthenticateResponse {
+
+ /**
+ * @var boolean $return
+ * @access public
+ */
+ public $return;
+
+}
+
+class UserStoreException {
+
+}
+
+/**
+ * UserStoreManagerService class
+ *
+ */
+class UserStoreManagerStub extends SoapClient {
+
+ private static $classmap = array(
+ 'ClaimDTO' => 'ClaimDTO',
+ 'PermissionDTO' => 'PermissionDTO',
+ 'Tenant' => 'Tenant',
+ 'RealmConfiguration' => 'RealmConfiguration',
+ 'ClaimValue' => 'ClaimValue',
+ 'addUserClaimValues' => 'AddUserClaimValues',
+ 'getUserClaimValuesForClaims' => 'GetUserClaimValuesForClaims',
+ 'getUserClaimValuesForClaimsResponse' => 'GetUserClaimValuesForClaimsResponse',
+ 'getTenantIdofUser' => 'GetTenantIdofUser',
+ 'getTenantIdofUserResponse' => 'GetTenantIdofUserResponse',
+ 'addUserClaimValue' => 'AddUserClaimValue',
+ 'getUserClaimValues' => 'GetUserClaimValues',
+ 'getUserClaimValuesResponse' => 'GetUserClaimValuesResponse',
+ 'getTenantId' => 'GetTenantId',
+ 'getTenantIdResponse' => 'GetTenantIdResponse',
+ 'addUser' => 'AddUser',
+ 'addRole' => 'AddRole',
+ 'getUserList' => 'GetUserList',
+ 'getUserListResponse' => 'GetUserListResponse',
+ 'updateCredential' => 'UpdateCredential',
+ 'updateUserListOfRole' => 'UpdateUserListOfRole',
+ 'updateRoleListOfUser' => 'UpdateRoleListOfUser',
+ 'setUserClaimValue' => 'SetUserClaimValue',
+ 'setUserClaimValues' => 'SetUserClaimValues',
+ 'deleteUserClaimValue' => 'DeleteUserClaimValue',
+ 'deleteUserClaimValues' => 'DeleteUserClaimValues',
+ 'getHybridRoles' => 'GetHybridRoles',
+ 'getHybridRolesResponse' => 'GetHybridRolesResponse',
+ 'getPasswordExpirationTime' => 'GetPasswordExpirationTime',
+ 'getPasswordExpirationTimeResponse' => 'GetPasswordExpirationTimeResponse',
+ 'updateRoleName' => 'UpdateRoleName',
+ 'listUsers' => 'ListUsers',
+ 'listUsersResponse' => 'ListUsersResponse',
+ 'isExistingUser' => 'IsExistingUser',
+ 'isExistingUserResponse' => 'IsExistingUserResponse',
+ 'isExistingRole' => 'IsExistingRole',
+ 'isExistingRoleResponse' => 'IsExistingRoleResponse',
+ 'getRoleNames' => 'GetRoleNames',
+ 'getRoleNamesResponse' => 'GetRoleNamesResponse',
+ 'getProfileNames' => 'GetProfileNames',
+ 'getProfileNamesResponse' => 'GetProfileNamesResponse',
+ 'getUserListOfRole' => 'GetUserListOfRole',
+ 'getUserListOfRoleResponse' => 'GetUserListOfRoleResponse',
+ 'getUserClaimValue' => 'GetUserClaimValue',
+ 'getUserClaimValueResponse' => 'GetUserClaimValueResponse',
+ 'getAllProfileNames' => 'GetAllProfileNames',
+ 'getAllProfileNamesResponse' => 'GetAllProfileNamesResponse',
+ 'updateCredentialByAdmin' => 'UpdateCredentialByAdmin',
+ 'deleteUser' => 'DeleteUser',
+ 'deleteRole' => 'DeleteRole',
+ 'getUserId' => 'GetUserId',
+ 'getUserIdResponse' => 'GetUserIdResponse',
+ 'getRoleListOfUser' => 'GetRoleListOfUser',
+ 'getRoleListOfUserResponse' => 'GetRoleListOfUserResponse',
+ 'getProperties' => 'GetProperties',
+ 'getPropertiesResponse' => 'GetPropertiesResponse',
+ 'isReadOnly' => 'IsReadOnly',
+ 'isReadOnlyResponse' => 'IsReadOnlyResponse',
+ 'authenticate' => 'Authenticate',
+ 'authenticateResponse' => 'AuthenticateResponse',
+ 'Tenant' => 'Tenant'
+ );
+
+ public function RemoteUserStoreManagerStub($wsdl, $options = array()) {
+ foreach (self::$classmap as $key => $value) {
+ if (!isset($options['classmap'][$key])) {
+ $options['classmap'][$key] = $value;
+ }
+ }
+ parent::__construct($wsdl, $options);
+ }
+
+ /**
+ * Function to authenticate
+ *
+ * @param Authenticate $parameters
+ * @return AuthenticateResponse
+ */
+ public function authenticate(Authenticate $parameters) {
+ return $this->__soapCall('authenticate', array($parameters), array(
+ 'uri' => 'http://service.ws.um.carbon.wso2.org',
+ 'soapaction' => ''
+ ));
+ }
+
+ /**
+ * Function get user list
+ *
+ * @param GetUserList $parameters
+ * @return GetUserListResponse
+ */
+ public function getUserList(GetUserList $parameters) {
+ return $this->__soapCall('getUserList', array($parameters), array(
+ 'uri' => 'http://service.ws.um.carbon.wso2.org',
+ 'soapaction' => ''
+ ));
+ }
+
+ /**
+ * Function to get the user claim value
+ *
+ * @param GetUserClaimValue $parameters
+ * @return GetUserClaimValueResponse
+ */
+ public function getUserClaimValue(GetUserClaimValue $parameters) {
+ return $this->__soapCall('getUserClaimValue', array($parameters), array(
+ 'uri' => 'http://service.ws.um.carbon.wso2.org',
+ 'soapaction' => ''
+ ));
+ }
+
+ /**
+ * Function to get the user list of role
+ *
+ * @param GetUserListOfRole $parameters
+ * @return GetUserListOfRoleResponse
+ */
+ public function getUserListOfRole(GetUserListOfRole $parameters) {
+ return $this->__soapCall('getUserListOfRole', array($parameters), array(
+ 'uri' => 'http://service.ws.um.carbon.wso2.org',
+ 'soapaction' => ''
+ ));
+ }
+
+ /**
+ * Function to check whether the service is read only
+ *
+ * @param IsReadOnly $parameters
+ * @return IsReadOnlyResponse
+ */
+ public function isReadOnly(IsReadOnly $parameters) {
+ return $this->__soapCall('isReadOnly', array($parameters), array(
+ 'uri' => 'http://service.ws.um.carbon.wso2.org',
+ 'soapaction' => ''
+ ));
+ }
+
+ /**
+ * Function to update the credentials
+ *
+ * @param UpdateCredential $parameters
+ * @return void
+ */
+ public function updateCredential(UpdateCredential $parameters) {
+ return $this->__soapCall('updateCredential', array($parameters), array(
+ 'uri' => 'http://service.ws.um.carbon.wso2.org',
+ 'soapaction' => ''
+ ));
+ }
+
+ /**
+ * Function to set user claim value
+ *
+ * @param SetUserClaimValue $parameters
+ * @return void
+ */
+ public function setUserClaimValue(setUserClaimValue $parameters) {
+ return $this->__soapCall('setUserClaimValue', array($parameters), array(
+ 'uri' => 'http://service.ws.um.carbon.wso2.org',
+ 'soapaction' => ''
+ ));
+ }
+
+ /**
+ * Function to get the claim values for claims
+ *
+ * @param GetUserClaimValuesForClaims $parameters
+ * @return GetUserClaimValuesForClaimsResponse
+ */
+ public function getUserClaimValuesForClaims(GetUserClaimValuesForClaims $parameters) {
+ return $this->__soapCall('getUserClaimValuesForClaims', array($parameters), array(
+ 'uri' => 'http://service.ws.um.carbon.wso2.org',
+ 'soapaction' => ''
+ ));
+ }
+
+ /**
+ * Function to delete user claim values
+ *
+ * @param DeleteUserClaimValues $parameters
+ * @return void
+ */
+ public function deleteUserClaimValues(DeleteUserClaimValues $parameters) {
+ return $this->__soapCall('deleteUserClaimValues', array($parameters), array(
+ 'uri' => 'http://service.ws.um.carbon.wso2.org',
+ 'soapaction' => ''
+ ));
+ }
+
+ /**
+ * Function to delete user claim value
+ *
+ * @param DeleteUserClaimValue $parameters
+ * @return void
+ */
+ public function deleteUserClaimValue(DeleteUserClaimValue $parameters) {
+ return $this->__soapCall('deleteUserClaimValue', array($parameters), array(
+ 'uri' => 'http://service.ws.um.carbon.wso2.org',
+ 'soapaction' => ''
+ ));
+ }
+
+ /**
+ * Function to check whether use is existing
+ *
+ * @param IsExistingUser $parameters
+ * @return IsExistingUserResponse
+ */
+ public function isExistingUser(IsExistingUser $parameters) {
+ return $this->__soapCall('isExistingUser', array($parameters), array(
+ 'uri' => 'http://service.ws.um.carbon.wso2.org',
+ 'soapaction' => ''
+ ));
+ }
+
+ /**
+ * Function to update credential by admin
+ *
+ * @param UpdateCredentialByAdmin $parameters
+ * @return void
+ */
+ public function updateCredentialByAdmin(UpdateCredentialByAdmin $parameters) {
+ return $this->__soapCall('updateCredentialByAdmin', array($parameters), array(
+ 'uri' => 'http://service.ws.um.carbon.wso2.org',
+ 'soapaction' => ''
+ ));
+ }
+
+ /**
+ * Function to get the tenant id
+ *
+ * @param GetTenantId $parameters
+ * @return GetTenantIdResponse
+ */
+ public function getTenantId(GetTenantId $parameters) {
+ return $this->__soapCall('getTenantId', array($parameters), array(
+ 'uri' => 'http://service.ws.um.carbon.wso2.org',
+ 'soapaction' => ''
+ ));
+ }
+
+ /**
+ * Function to get role names
+ *
+ * @param GetRoleNames $parameters
+ * @return GetRoleNamesResponse
+ */
+ public function getRoleNames(GetRoleNames $parameters) {
+ return $this->__soapCall('getRoleNames', array($parameters), array(
+ 'uri' => 'http://service.ws.um.carbon.wso2.org',
+ 'soapaction' => ''
+ ));
+ }
+
+ /**
+ * Funtion to get properties
+ *
+ * @param GetProperties $parameters
+ * @return GetPropertiesResponse
+ */
+ public function getProperties(GetProperties $parameters) {
+ return $this->__soapCall('getProperties', array($parameters), array(
+ 'uri' => 'http://service.ws.um.carbon.wso2.org',
+ 'soapaction' => ''
+ ));
+ }
+
+ /**
+ * Function to get user id
+ *
+ * @param GetUserId $parameters
+ * @return GetUserIdResponse
+ */
+ public function getUserId(GetUserId $parameters) {
+ return $this->__soapCall('getUserId', array($parameters), array(
+ 'uri' => 'http://service.ws.um.carbon.wso2.org',
+ 'soapaction' => ''
+ ));
+ }
+
+ /**
+ * Function to get all the profile names
+ *
+ * @param GetAllProfileNames $parameters
+ * @return GetAllProfileNamesResponse
+ */
+ public function getAllProfileNames(GetAllProfileNames $parameters) {
+ return $this->__soapCall('getAllProfileNames', array($parameters), array(
+ 'uri' => 'http://service.ws.um.carbon.wso2.org',
+ 'soapaction' => ''
+ ));
+ }
+
+ /**
+ * Function to get the password expiration time
+ *
+ * @param GetPasswordExpirationTime $parameters
+ * @return GetPasswordExpirationTimeResponse
+ */
+ public function getPasswordExpirationTime(GetPasswordExpirationTime $parameters) {
+ return $this->__soapCall('getPasswordExpirationTime', array($parameters), array(
+ 'uri' => 'http://service.ws.um.carbon.wso2.org',
+ 'soapaction' => ''
+ ));
+ }
+
+ /**
+ * Function to list users
+ *
+ * @param ListUsers $parameters
+ * @return ListUsersResponse
+ */
+ public function listUsers(ListUsers $parameters) {
+ return $this->__soapCall('listUsers', array($parameters), array(
+ 'uri' => 'http://service.ws.um.carbon.wso2.org',
+ 'soapaction' => ''
+ ));
+ }
+
+ /**
+ * Function to delete role
+ *
+ * @param DeleteRole $parameters
+ * @return void
+ */
+ public function deleteRole(DeleteRole $parameters) {
+ return $this->__soapCall('deleteRole', array($parameters), array(
+ 'uri' => 'http://service.ws.um.carbon.wso2.org',
+ 'soapaction' => ''
+ ));
+ }
+
+ /**
+ * Function to delete user
+ *
+ * @param DeleteUser $parameters
+ * @return void
+ */
+ public function deleteUser(DeleteUser $parameters) {
+ return $this->__soapCall('deleteUser', array($parameters), array(
+ 'uri' => 'http://service.ws.um.carbon.wso2.org',
+ 'soapaction' => ''
+ ));
+ }
+
+ /**
+ * Function get the role list of the user
+ *
+ * @param GetRoleListOfUser $parameters
+ * @return GetRoleListOfUserResponse
+ */
+ public function getRoleListOfUser(GetRoleListOfUser $parameters) {
+ return $this->__soapCall('getRoleListOfUser', array($parameters), array(
+ 'uri' => 'http://service.ws.um.carbon.wso2.org',
+ 'soapaction' => ''
+ ));
+ }
+
+ /**
+ * Function to update the role name
+ *
+ * @param UpdateRoleName $parameters
+ * @return void
+ */
+ public function updateRoleName(UpdateRoleName $parameters) {
+ return $this->__soapCall('updateRoleName', array($parameters), array(
+ 'uri' => 'http://service.ws.um.carbon.wso2.org',
+ 'soapaction' => ''
+ ));
+ }
+
+ /**
+ * Function to check whether a role is existing
+ *
+ * @param IsExistingRole $parameters
+ * @return IsExistingRoleResponse
+ */
+ public function isExistingRole(IsExistingRole $parameters) {
+ return $this->__soapCall('isExistingRole', array($parameters), array(
+ 'uri' => 'http://service.ws.um.carbon.wso2.org',
+ 'soapaction' => ''
+ ));
+ }
+
+ /**
+ * Function to update role list of user
+ *
+ * @param UpdateRoleListOfUser $parameters
+ * @return void
+ */
+ public function updateRoleListOfUser(UpdateRoleListOfUser $parameters) {
+ return $this->__soapCall('updateRoleListOfUser', array($parameters), array(
+ 'uri' => 'http://service.ws.um.carbon.wso2.org',
+ 'soapaction' => ''
+ ));
+ }
+
+ /**
+ * Function to get user claim values
+ *
+ * @param GetUserClaimValues $parameters
+ * @return GetUserClaimValuesResponse
+ */
+ public function getUserClaimValues(GetUserClaimValues $parameters) {
+ return $this->__soapCall('getUserClaimValues', array($parameters), array(
+ 'uri' => 'http://service.ws.um.carbon.wso2.org',
+ 'soapaction' => ''
+ ));
+ }
+
+ /**
+ * Function to get hybrid roles
+ *
+ * @param GetHybridRoles $parameters
+ * @return GetHybridRolesResponse
+ */
+ public function getHybridRoles(GetHybridRoles $parameters) {
+ return $this->__soapCall('getHybridRoles', array($parameters), array(
+ 'uri' => 'http://service.ws.um.carbon.wso2.org',
+ 'soapaction' => ''
+ ));
+ }
+
+ /**
+ * Function to add user claim values
+ *
+ * @param AddUserClaimValues $parameters
+ * @return void
+ */
+ public function addUserClaimValues(AddUserClaimValues $parameters) {
+ return $this->__soapCall('addUserClaimValues', array($parameters), array(
+ 'uri' => 'http://service.ws.um.carbon.wso2.org',
+ 'soapaction' => ''
+ ));
+ }
+
+ /**
+ * Function to add user
+ *
+ * @param AddUser $parameters
+ * @return void
+ */
+ public function addUser(AddUser $parameters) {
+ return $this->__soapCall('addUser', array($parameters), array(
+ 'uri' => 'http://service.ws.um.carbon.wso2.org',
+ 'soapaction' => ''
+ ));
+ }
+
+ /**
+ * Function to add role
+ *
+ * @param AddRole $parameters
+ * @return void
+ */
+ public function addRole(AddRole $parameters) {
+ return $this->__soapCall('addRole', array($parameters), array(
+ 'uri' => 'http://service.ws.um.carbon.wso2.org',
+ 'soapaction' => ''
+ ));
+ }
+
+ /**
+ * Function to update user list of roles
+ *
+ * @param UpdateUserListOfRole $parameters
+ * @return void
+ */
+ public function updateUserListOfRole(UpdateUserListOfRole $parameters) {
+ return $this->__soapCall('updateUserListOfRole', array($parameters), array(
+ 'uri' => 'http://service.ws.um.carbon.wso2.org',
+ 'soapaction' => ''
+ ));
+ }
+
+ /**
+ * Function to get the tenant Id
+ *
+ * @param GetTenantIdofUser $parameters
+ * @return GetTenantIdofUserResponse
+ */
+ public function getTenantIdofUser(GetTenantIdofUser $parameters) {
+ return $this->__soapCall('getTenantIdofUser', array($parameters), array(
+ 'uri' => 'http://service.ws.um.carbon.wso2.org',
+ 'soapaction' => ''
+ ));
+ }
+
+ /**
+ * Function to set user claim values
+ *
+ * @param SetUserClaimValues $parameters
+ * @return void
+ */
+ public function setUserClaimValues(SetUserClaimValues $parameters) {
+ return $this->__soapCall('setUserClaimValues', array($parameters), array(
+ 'uri' => 'http://service.ws.um.carbon.wso2.org',
+ 'soapaction' => ''
+ ));
+ }
+
+ /**
+ * Function to add user claim value
+ *
+ * @param AddUserClaimValue $parameters
+ * @return void
+ */
+ public function addUserClaimValue(AddUserClaimValue $parameters) {
+ return $this->__soapCall('addUserClaimValue', array($parameters), array(
+ 'uri' => 'http://service.ws.um.carbon.wso2.org',
+ 'soapaction' => ''
+ ));
+ }
+
+ /**
+ * Function to get the profile names
+ *
+ * @param GetProfileNames $parameters
+ * @return GetProfileNamesResponse
+ */
+ public function getProfileNames(GetProfileNames $parameters) {
+ return $this->__soapCall('getProfileNames', array($parameters), array(
+ 'uri' => 'http://service.ws.um.carbon.wso2.org',
+ 'soapaction' => ''
+ ));
+ }
+
+}
+
+?>
[6/8] airavata-php-gateway git commit: Adding missing files
Posted by sm...@apache.org.
Adding missing files
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/e1a1024f
Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/e1a1024f
Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/e1a1024f
Branch: refs/heads/master
Commit: e1a1024f372bf485ccaa7e68efd00cb3bd33f44b
Parents: 3ca0215
Author: Supun Nakandala <su...@gmail.com>
Authored: Sat May 9 14:15:37 2015 +0530
Committer: Supun Nakandala <su...@gmail.com>
Committed: Sat May 9 14:15:37 2015 +0530
----------------------------------------------------------------------
.../Airavata/AiravataServiceProvider.php | 80 ++++++++++++++++++++
app/libraries/Airavata/Facades/Airavata.php | 16 ++++
2 files changed, 96 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/e1a1024f/app/libraries/Airavata/AiravataServiceProvider.php
----------------------------------------------------------------------
diff --git a/app/libraries/Airavata/AiravataServiceProvider.php b/app/libraries/Airavata/AiravataServiceProvider.php
new file mode 100755
index 0000000..2ff4db1
--- /dev/null
+++ b/app/libraries/Airavata/AiravataServiceProvider.php
@@ -0,0 +1,80 @@
+<?php namespace Airavata;
+
+use Illuminate\Support\ServiceProvider;
+use Illuminate\Support\Facades\Config;
+use Airavata\API\AiravataClient;
+use Thrift\Transport\TSocket;
+use Thrift\Protocol\TBinaryProtocol;
+
+class AiravataServiceProvider 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/airavata');
+ }
+
+ /**
+ * Register the service provider.
+ *
+ * @return void
+ */
+ public function register()
+ {
+ //registering service provider
+ $this->app['airavata'] = $this->app->share(function($app)
+ {
+ try{
+ $transport = new TSocket(
+ Config::get('pga_config.airavata')['airavata-server'],
+ Config::get('pga_config.airavata')['airavata-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 AiravataClient($protocol);
+
+ }catch (\Exception $ex){
+ var_dump($ex);
+ exit;
+ }
+
+ if( is_object( $client))
+ return $client;
+ else
+ return Redirect::to("airavata/down");
+ });
+
+ //registering alis
+ $this->app->booting(function()
+ {
+ $loader = \Illuminate\Foundation\AliasLoader::getInstance();
+ $loader->alias('Airavata', 'Airavata\Facades\Airavata');
+ });
+ }
+
+ /**
+ * Get the services provided by the provider.
+ *
+ * @return array
+ */
+ public function provides()
+ {
+ return array('airavata');
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/e1a1024f/app/libraries/Airavata/Facades/Airavata.php
----------------------------------------------------------------------
diff --git a/app/libraries/Airavata/Facades/Airavata.php b/app/libraries/Airavata/Facades/Airavata.php
new file mode 100755
index 0000000..1446c2c
--- /dev/null
+++ b/app/libraries/Airavata/Facades/Airavata.php
@@ -0,0 +1,16 @@
+<?php
+
+namespace Airavata\Facades;
+
+use Illuminate\Support\Facades\Facade;
+
+class Airavata extends Facade {
+
+ /**
+ * Get the registered name of the component.
+ *
+ * @return string
+ */
+ protected static function getFacadeAccessor() { return 'airavata'; }
+
+}
\ No newline at end of file
[5/8] airavata-php-gateway git commit: wrapping Airavata and WSIS
code as laravel library component and service providers
Posted by sm...@apache.org.
wrapping Airavata and WSIS code as laravel library component and service providers
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/3ca02155
Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/3ca02155
Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/3ca02155
Branch: refs/heads/master
Commit: 3ca02155c67493ff295638e5fc2a2d74a0f0d4cb
Parents: b70ad13
Author: Supun Nakandala <su...@gmail.com>
Authored: Sat May 9 13:54:23 2015 +0530
Committer: Supun Nakandala <su...@gmail.com>
Committed: Sat May 9 13:54:23 2015 +0530
----------------------------------------------------------------------
app/config/app.php | 6 +-
app/config/packages/airavata/wsis/config.php | 52 -
app/controllers/AccountController.php | 2 +-
app/filters.php | 6 +-
app/libraries/AdminUtilities.php | 3 +-
app/libraries/AiravataClientFactory.php | 23 -
app/libraries/AppUtilities.php | 53 +-
app/libraries/CRUtilities.php | 117 +-
app/libraries/ExpUtilities.php | 53 +-
app/libraries/IdUtilities.php | 172 ++
app/libraries/Utilities.php | 391 ++-
app/libraries/WSISUtilities.php | 318 +++
app/libraries/Wsis/Facades/Wsis.php | 16 +
.../Wsis/Stubs/AuthenticationAdmin.php | 55 +
.../Wsis/Stubs/AuthenticationAdminStub.php | 1016 ++++++++
app/libraries/Wsis/Stubs/TenantManager.php | 139 ++
app/libraries/Wsis/Stubs/TenantMgtAdminStub.php | 306 +++
app/libraries/Wsis/Stubs/UserStoreManager.php | 203 ++
.../Wsis/Stubs/UserStoreManagerStub.php | 1570 ++++++++++++
app/libraries/Wsis/Wsis.php | 280 +++
app/libraries/Wsis/WsisServiceProvider.php | 64 +
app/libraries/XmlIdUtilities.php | 292 +++
app/libraries/id_utilities.php | 172 --
app/libraries/utilities.php | 2337 ------------------
app/libraries/wsis_utilities.php | 320 ---
app/libraries/xml_id_utilities.php | 294 ---
workbench/airavata/wsis/.gitignore | 4 -
workbench/airavata/wsis/.travis.yml | 13 -
workbench/airavata/wsis/composer.json | 20 -
workbench/airavata/wsis/phpunit.xml | 18 -
.../wsis/src/Airavata/Wsis/Facades/Wsis.php | 16 -
.../src/Airavata/Wsis/Stubs/TenantManager.php | 139 --
.../Airavata/Wsis/Stubs/TenantMgtAdminStub.php | 306 ---
.../Airavata/Wsis/Stubs/UserStoreManager.php | 203 --
.../Wsis/Stubs/UserStoreManagerStub.php | 1570 ------------
.../airavata/wsis/src/Airavata/Wsis/Wsis.php | 280 ---
.../src/Airavata/Wsis/WsisServiceProvider.php | 64 -
workbench/airavata/wsis/src/config/config.php | 52 -
workbench/airavata/wsis/tests/.gitkeep | 0
39 files changed, 4787 insertions(+), 6158 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/3ca02155/app/config/app.php
----------------------------------------------------------------------
diff --git a/app/config/app.php b/app/config/app.php
index 1b4c90f..93d1421 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',
- 'Airavata\Wsis\WsisServiceProvider',
+ 'Wsis\WsisServiceProvider',
+ 'Airavata\AiravataServiceProvider',
),
/*
@@ -188,7 +189,8 @@ return array(
'URL' => 'Illuminate\Support\Facades\URL',
'Validator' => 'Illuminate\Support\Facades\Validator',
'View' => 'Illuminate\Support\Facades\View',
- 'WSIS' => 'Airavata\Wsis\Facades\Wsis',
+ 'WSIS' => 'Wsis\Facades\Wsis',
+ 'Airavata' => 'Airavata\Facades\Airavata',
),
);
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/3ca02155/app/config/packages/airavata/wsis/config.php
----------------------------------------------------------------------
diff --git a/app/config/packages/airavata/wsis/config.php b/app/config/packages/airavata/wsis/config.php
deleted file mode 100644
index 9041036..0000000
--- a/app/config/packages/airavata/wsis/config.php
+++ /dev/null
@@ -1,52 +0,0 @@
-<?php
-return array(
- /**
- * Admin Role Name
- */
- 'admin-role-name' => 'admin',
-
- /**
- * Gateway user role
- */
- 'gateway-admin' => 'Internal/everyone',
-
- /**
- * Tenant admin's username
- */
- 'admin-username' => 'test@testphprg.scigap.org',
-
- /**
- * Tenant admin's password
- */
- 'admin-password' => 'testadmin@scigap.org',
-
- /**
- * Identity server domain
- */
- 'server' => 'idp.scigap.org',
-
- /**
- * Identity server web services endpoint
- */
- 'service-url' => 'https://idp.scigap.org:7443/services/',
-
- /**
- * Gateway domain name
- */
- 'gateway-id' => 'default',
-
- /**
- * Path to the server certificate file
- */
- 'cafile-path' => app_path() . '/resources/security/idp_scigap_org.pem',
-
- /**
- * Enable HTTPS server verification
- */
- 'verify-peer' => true,
-
- /**
- * Allow self signed server certificates
- */
- 'allow-self-signed' => false
-);
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/3ca02155/app/controllers/AccountController.php
----------------------------------------------------------------------
diff --git a/app/controllers/AccountController.php b/app/controllers/AccountController.php
index 752c05d..63a87db 100755
--- a/app/controllers/AccountController.php
+++ b/app/controllers/AccountController.php
@@ -80,7 +80,7 @@ class AccountController extends BaseController {
Utilities::store_id_in_session($username);
Utilities::print_success_message('Login successful! You will be redirected to your home page shortly.');
- Session::put("gateway_id", Config::get('wsis::gateway-id'));
+ Session::put("gateway_id", Config::get('pga_config.wsis')['gateway-id']);
//TODO::If this option is not safe, have to find a better method to send credentials to identity server on every connection.
Session::put("password", $_POST["password"]);
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/3ca02155/app/filters.php
----------------------------------------------------------------------
diff --git a/app/filters.php b/app/filters.php
index 93b988b..33f98d2 100755
--- a/app/filters.php
+++ b/app/filters.php
@@ -13,11 +13,9 @@
App::before(function($request)
{
- $airavataClient = Utilities::get_airavata_client();
- if( ! is_object( $airavataClient))
+ $apiVersion = Airavata::getApiVersion();
+ if(empty($apiVersion))
return View::make("server-down");
- else
- Session::put("airavataClient", $airavataClient);
});
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/3ca02155/app/libraries/AdminUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/AdminUtilities.php b/app/libraries/AdminUtilities.php
index b2bf9e1..5775991 100644
--- a/app/libraries/AdminUtilities.php
+++ b/app/libraries/AdminUtilities.php
@@ -3,10 +3,9 @@
use Airavata\Model\Workspace\Gateway;
public function addGateway( $input){
- $airavataClient = Session::get("airavataClient");
$gateway = new Gateway();
$gateway->domain = $input["domainName"];
$gateway->gatewayName = $input["gatewayName"];
$gateway->emailAddress = $input["admin-email"];
- return $airavataClient->addGateway( $gateway);
+ return Airavata::addGateway( $gateway);
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/3ca02155/app/libraries/AiravataClientFactory.php
----------------------------------------------------------------------
diff --git a/app/libraries/AiravataClientFactory.php b/app/libraries/AiravataClientFactory.php
index c55a359..efd01a9 100755
--- a/app/libraries/AiravataClientFactory.php
+++ b/app/libraries/AiravataClientFactory.php
@@ -2,29 +2,6 @@
namespace Airavata\Client;
-$GLOBALS['THRIFT_ROOT'] = 'Thrift/';
-//require_once $GLOBALS['THRIFT_ROOT'] . 'Thrift.php';
-/*
-require_once $GLOBALS['THRIFT_ROOT'] . 'Transport/TTransport.php';
-require_once $GLOBALS['THRIFT_ROOT'] . 'Transport/TSocket.php';
-require_once $GLOBALS['THRIFT_ROOT'] . 'Protocol/TProtocol.php';
-require_once $GLOBALS['THRIFT_ROOT'] . 'Protocol/TBinaryProtocol.php';
-require_once $GLOBALS['THRIFT_ROOT'] . 'Exception/TException.php';
-require_once $GLOBALS['THRIFT_ROOT'] . 'Exception/TTransportException.php';
-require_once $GLOBALS['THRIFT_ROOT'] . 'Type/TType.php';
-require_once $GLOBALS['THRIFT_ROOT'] . 'Type/TMessageType.php';
-require_once $GLOBALS['THRIFT_ROOT'] . 'Factory/TStringFuncFactory.php';
-require_once $GLOBALS['THRIFT_ROOT'] . 'StringFunc/TStringFunc.php';
-require_once $GLOBALS['THRIFT_ROOT'] . 'StringFunc/Core.php';
-
-$GLOBALS['AIRAVATA_ROOT'] = 'Airavata/';
-require_once $GLOBALS['AIRAVATA_ROOT'] . 'API/Airavata.php';
-*/
-
-use Thrift\Protocol\TBinaryProtocol;
-use Thrift\Transport\TSocket;
-use Airavata\API\AiravataClient;
-
class AiravataClientFactory
{
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/3ca02155/app/libraries/AppUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/AppUtilities.php b/app/libraries/AppUtilities.php
index 2f9b32e..e485a36 100644
--- a/app/libraries/AppUtilities.php
+++ b/app/libraries/AppUtilities.php
@@ -1,29 +1,20 @@
<?php
//Airavata classes - loaded from app/libraries/Airavata
-use Airavata\API\AiravataClient;
-
use Airavata\Model\AppCatalog\AppInterface\DataType;
use Airavata\Model\AppCatalog\AppInterface\InputDataObjectType;
use Airavata\Model\AppCatalog\AppInterface\OutputDataObjectType;
use Airavata\Model\AppCatalog\AppInterface\ApplicationInterfaceDescription;
-
-use Airavata\Model\Workspace\Project;
-
use Airavata\Model\AppCatalog\AppDeployment\ApplicationModule;
use Airavata\Model\AppCatalog\AppDeployment\ApplicationParallelismType;
use Airavata\Model\AppCatalog\AppDeployment\ApplicationDeploymentDescription;
use Airavata\Model\AppCatalog\AppDeployment\SetEnvPaths;
-//use Airavata\Model\AppCatalog\ComputeResource
-
class AppUtilities{
public static function create_or_update_appModule( $inputs, $update = false){
- $airavataclient = Session::get("airavataClient");
-
$appModule = new ApplicationModule( array(
"appModuleName" => $inputs["appModuleName"],
"appModuleVersion" => $inputs["appModuleVersion"],
@@ -31,25 +22,21 @@ class AppUtilities{
));
if( $update)
- return $airavataclient->updateApplicationModule( $inputs["appModuleId"], $appModule);
+ return Airavata::updateApplicationModule( $inputs["appModuleId"], $appModule);
else
- return $airavataclient->registerApplicationModule( Session::get("gateway_id"), $appModule);
+ return Airavata::registerApplicationModule( Session::get("gateway_id"), $appModule);
}
public static function deleteAppModule( $appModuleId){
- $airavataclient = Session::get("airavataClient");
-
- return $airavataclient->deleteApplicationModule( $appModuleId);
+ return Airavata::deleteApplicationModule( $appModuleId);
}
public static function getAppInterfaceData(){
- $airavataclient = Session::get("airavataClient");
-
$dataType = new DataType();
$modules = AppUtilities::getAllModules();
- $appInterfaces = $airavataclient->getAllApplicationInterfaces( Session::get("gateway_id"));
+ $appInterfaces = Airavata::getAllApplicationInterfaces( Session::get("gateway_id"));
$InputDataObjectType = new InputDataObjectType();
@@ -62,8 +49,7 @@ class AppUtilities{
}
public static function create_or_update_appInterface( $appInterfaceValues, $update = false){
-
- $airavataclient = Session::get("airavataClient");
+
//var_dump( $appInterfaceValues); exit;
$appInterface = new ApplicationInterfaceDescription( array(
"applicationName" => $appInterfaceValues["applicationName"],
@@ -112,28 +98,23 @@ class AppUtilities{
//var_dump( $appInterface); exit;
if( $update)
- $airavataclient->updateApplicationInterface( $appInterfaceValues["app-interface-id"], $appInterface);
+ Airavata::updateApplicationInterface( $appInterfaceValues["app-interface-id"], $appInterface);
else
- $airavataclient->getApplicationInterface($airavataclient->registerApplicationInterface( Session::get("gateway_id"), $appInterface) );
+ Airavata::getApplicationInterface(Airavata::registerApplicationInterface( Session::get("gateway_id"), $appInterface) );
//print_r( "App interface has been created.");
}
public static function deleteAppInterface( $appInterfaceId){
-
- $airavataclient = Session::get("airavataClient");
-
- return $airavataclient->deleteApplicationInterface( $appInterfaceId);
+ return Airavata::deleteApplicationInterface( $appInterfaceId);
}
public static function getAppDeploymentData(){
- $airavataclient = Session::get("airavataClient");
-
- $appDeployments = $airavataclient->getAllApplicationDeployments( Session::get("gateway_id"));
+ $appDeployments = Airavata::getAllApplicationDeployments( Session::get("gateway_id"));
//var_dump( $appDeployments); exit;
- $computeResources = $airavataclient->getAllComputeResourceNames();
+ $computeResources = Airavata::getAllComputeResourceNames();
$modules = AppUtilities::getAllModules();
$apt = new ApplicationParallelismType();
@@ -149,8 +130,6 @@ class AppUtilities{
$appDeploymentValues = $inputs;
- $airavataclient = Session::get("airavataClient");
-
if( isset( $appDeploymentValues["moduleLoadCmds"]))
$appDeploymentValues["moduleLoadCmds"] = array_unique( array_filter( $appDeploymentValues["moduleLoadCmds"]));
@@ -207,9 +186,9 @@ class AppUtilities{
//var_dump( $appDeploymentValues); exit;
$appDeployment = new ApplicationDeploymentDescription( $appDeploymentValues);
if( $update)
- $airavataclient->updateApplicationDeployment( $inputs["app-deployment-id"], $appDeployment);
+ Airavata::updateApplicationDeployment( $inputs["app-deployment-id"], $appDeployment);
else
- $appDeploymentId = $airavataclient->registerApplicationDeployment( Session::get("gateway_id"), $appDeployment);
+ $appDeploymentId = Airavata::registerApplicationDeployment( Session::get("gateway_id"), $appDeployment);
return;
@@ -217,14 +196,10 @@ class AppUtilities{
public static function deleteAppDeployment( $appDeploymentId )
{
-
- $airavataclient = Session::get("airavataClient");
-
- return $airavataclient->deleteApplicationDeployment( $appDeploymentId);
+ return Airavata::deleteApplicationDeployment( $appDeploymentId);
}
public static function getAllModules(){
- $airavataclient = Session::get("airavataClient");
- return $airavataclient->getAllAppModules( Session::get("gateway_id"));
+ return Airavata::getAllAppModules( Session::get("gateway_id"));
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/3ca02155/app/libraries/CRUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/CRUtilities.php b/app/libraries/CRUtilities.php
index 98fa54e..92e06f3 100755
--- a/app/libraries/CRUtilities.php
+++ b/app/libraries/CRUtilities.php
@@ -2,12 +2,8 @@
//Airavata classes - loaded from app/libraries/Airavata
-use Airavata\API\AiravataClient;
-
//Compute Resource classes
-
use Airavata\Model\AppCatalog\ComputeResource\FileSystems;
-use Airavata\Model\AppCatalog\ComputeResource\JobSubmissionInterface;
use Airavata\Model\AppCatalog\ComputeResource\JobSubmissionProtocol;
use Airavata\Model\AppCatalog\ComputeResource\SecurityProtocol;
use Airavata\Model\AppCatalog\ComputeResource\ResourceJobManager;
@@ -25,9 +21,7 @@ use Airavata\Model\AppCatalog\ComputeResource\LOCALDataMovement;
use Airavata\Model\AppCatalog\ComputeResource\UnicoreDataMovement;
use Airavata\Model\AppCatalog\ComputeResource\MonitorMode;
-
//Gateway Classes
-
use Airavata\Model\AppCatalog\GatewayProfile\GatewayResourceProfile;
use Airavata\Model\AppCatalog\GatewayProfile\ComputeResourcePreference;
@@ -46,14 +40,13 @@ class CRUtilities{
*/
public static function register_or_update_compute_resource( $computeDescription, $update = false)
{
- $airavataclient = Session::get("airavataClient");
if( $update)
{
$computeResourceId = $computeDescription->computeResourceId;
- if( $airavataclient->updateComputeResource( $computeResourceId, $computeDescription) )
+ if( Airavata::updateComputeResource( $computeResourceId, $computeDescription) )
{
- $computeResource = $airavataclient->getComputeResource( $computeResourceId);
+ $computeResource = Airavata::getComputeResource( $computeResourceId);
return $computeResource;
}
else
@@ -67,10 +60,10 @@ public static function register_or_update_compute_resource( $computeDescription,
$computeDescription["fileSystems"][$fileSystem] = "";
*/
$cd = new ComputeResourceDescription( $computeDescription);
- $computeResourceId = $airavataclient->registerComputeResource( $cd);
+ $computeResourceId = Airavata::registerComputeResource( $cd);
}
- $computeResource = $airavataclient->getComputeResource( $computeResourceId);
+ $computeResource = Airavata::getComputeResource( $computeResourceId);
return $computeResource;
}
@@ -111,8 +104,7 @@ public static function createQueueObject( $queue){
public static function deleteQueue( $computeResourceId, $queueName)
{
- $airavataclient = Session::get("airavataClient");
- $airavataclient->deleteBatchQueue( $computeResourceId, $queueName);
+ Airavata::deleteBatchQueue( $computeResourceId, $queueName);
}
@@ -122,7 +114,6 @@ public static function deleteQueue( $computeResourceId, $queueName)
public static function create_or_update_JSIObject( $inputs, $update = false){
- $airavataclient = Session::get("airavataClient");
$computeResource = Utilities::get_compute_resource( $inputs["crId"]);
@@ -151,13 +142,13 @@ public static function create_or_update_JSIObject( $inputs, $update = false){
if( $update) //update Local JSP
{
- $jsiObject = $airavataclient->getLocalJobSubmission( $jsiId);
- $localSub = $airavataclient->updateResourceJobManager( $jsiObject->resourceJobManager->resourceJobManagerId, $resourceManager);
+ $jsiObject = Airavata::getLocalJobSubmission( $jsiId);
+ $localSub = Airavata::updateResourceJobManager( $jsiObject->resourceJobManager->resourceJobManagerId, $resourceManager);
//$localSub = $airavataclient->updateLocalSubmissionDetails( $jsiId, $localJobSubmission);
}
else // create Local JSP
{
- $localSub = $airavataclient->addLocalSubmissionDetails( $computeResource->computeResourceId, 0, $localJobSubmission);
+ $localSub = Airavata::addLocalSubmissionDetails( $computeResource->computeResourceId, 0, $localJobSubmission);
return $localSub;
}
@@ -182,26 +173,26 @@ public static function create_or_update_JSIObject( $inputs, $update = false){
//var_dump( $sshJobSubmission); exit;
if( $update) //update Local JSP
{
- $jsiObject = $airavataclient->getSSHJobSubmission( $jsiId);
+ $jsiObject = Airavata::getSSHJobSubmission( $jsiId);
//first update resource job manager
$rmjId = $jsiObject->resourceJobManager->resourceJobManagerId;
- $airavataclient->updateResourceJobManager( $rmjId, $resourceManager);
- $jsiObject = $airavataclient->getSSHJobSubmission( $jsiId);
+ Airavata::updateResourceJobManager( $rmjId, $resourceManager);
+ $jsiObject = Airavata::getSSHJobSubmission( $jsiId);
$jsiObject->securityProtocol = intval( $inputs["securityProtocol"] );
$jsiObject->alternativeSSHHostName = $inputs["alternativeSSHHostName"];
$jsiObject->sshPort = intval( $inputs["sshPort"] );
$jsiObject->monitorMode = intval( $inputs["monitorMode"] );
- $jsiObject->resourceJobManager = $airavataclient->getresourceJobManager( $rmjId);
+ $jsiObject->resourceJobManager = Airavata::getresourceJobManager( $rmjId);
//var_dump( $jsiObject); exit;
//add updated resource job manager to ssh job submission object.
//$sshJobSubmission->resourceJobManager->resourceJobManagerId = $rmjId;
- $localSub = $airavataclient->updateSSHJobSubmissionDetails( $jsiId, $jsiObject);
+ $localSub = Airavata::updateSSHJobSubmissionDetails( $jsiId, $jsiObject);
}
else
{
- $sshSub = $airavataclient->addSSHJobSubmissionDetails( $computeResource->computeResourceId, 0, $sshJobSubmission);
+ $sshSub = Airavata::addSSHJobSubmissionDetails( $computeResource->computeResourceId, 0, $sshJobSubmission);
}
return;
}
@@ -215,15 +206,15 @@ public static function create_or_update_JSIObject( $inputs, $update = false){
);
if( $update)
{
- $jsiObject = $airavataclient->getUnicoreJobSubmission( $jsiId);
+ $jsiObject = Airavata::getUnicoreJobSubmission( $jsiId);
$jsiObject->securityProtocol = intval( $inputs["securityProtocol"] );
$jsiObject->unicoreEndPointURL = $inputs["unicoreEndPointURL"];
- $unicoreSub = $airavataclient->updateUnicoreJobSubmissionDetails( $jsiId, $jsiObject);
+ $unicoreSub = Airavata::updateUnicoreJobSubmissionDetails( $jsiId, $jsiObject);
}
else
{
- $unicoreSub = $airavataclient->addUNICOREJobSubmissionDetails( $computeResource->computeResourceId, 0, $unicoreJobSubmission);
+ $unicoreSub = Airavata::addUNICOREJobSubmissionDetails( $computeResource->computeResourceId, 0, $unicoreJobSubmission);
}
}
else /* Globus does not work currently */
@@ -236,13 +227,12 @@ public static function create_or_update_JSIObject( $inputs, $update = false){
* Creating Data Movement Interface Object.
*/
public static function create_or_update_DMIObject( $inputs, $update = false){
- $airavataclient = Session::get("airavataClient");
$computeResource = Utilities::get_compute_resource( $inputs["crId"] );
if( $inputs["dataMovementProtocol"] == DataMovementProtocol::LOCAL) /* LOCAL */
{
$localDataMovement = new LOCALDataMovement();
- $localdmp = $airavataclient->addLocalDataMovementDetails( $computeResource->computeResourceId, 0, $localDataMovement);
+ $localdmp = Airavata::addLocalDataMovementDetails( $computeResource->computeResourceId, 0, $localDataMovement);
if( $localdmp)
print_r( "The Local Data Movement has been added. Edit UI for the Local Data Movement Interface is yet to be made.
@@ -260,9 +250,9 @@ public static function create_or_update_DMIObject( $inputs, $update = false){
);
if( $update)
- $scpdmp = $airavataclient->updateSCPDataMovementDetails( $inputs["dmiId"], $scpDataMovement);
+ $scpdmp = Airavata::updateSCPDataMovementDetails( $inputs["dmiId"], $scpDataMovement);
else
- $scpdmp = $airavataclient->addSCPDataMovementDetails( $computeResource->computeResourceId, 0, $scpDataMovement);
+ $scpdmp = Airavata::addSCPDataMovementDetails( $computeResource->computeResourceId, 0, $scpDataMovement);
}
else if( $inputs["dataMovementProtocol"] == DataMovementProtocol::GridFTP) /* GridFTP */
{
@@ -271,9 +261,9 @@ public static function create_or_update_DMIObject( $inputs, $update = false){
"gridFTPEndPoints" => $inputs["gridFTPEndPoints"]
));
if( $update)
- $gridftpdmp = $airavataclient->updateGridFTPDataMovementDetails( $inputs["dmiId"], $gridFTPDataMovement);
+ $gridftpdmp = Airavata::updateGridFTPDataMovementDetails( $inputs["dmiId"], $gridFTPDataMovement);
else
- $gridftpdmp = $airavataclient->addGridFTPDataMovementDetails( $computeResource->computeResourceId, 0, $gridFTPDataMovement);
+ $gridftpdmp = Airavata::addGridFTPDataMovementDetails( $computeResource->computeResourceId, 0, $gridFTPDataMovement);
}
else if( $inputs["dataMovementProtocol"] == DataMovementProtocol::UNICORE_STORAGE_SERVICE) /* Unicore Storage Service */
{
@@ -284,9 +274,9 @@ public static function create_or_update_DMIObject( $inputs, $update = false){
)
);
if( $update)
- $unicoredmp = $airavataclient->updateUnicoreDataMovementDetails( $inputs["dmiId"], $unicoreDataMovement);
+ $unicoredmp = Airavata::updateUnicoreDataMovementDetails( $inputs["dmiId"], $unicoreDataMovement);
else
- $unicoredmp = $airavataclient->addUnicoreDataMovementDetails( $computeResource->computeResourceId, 0, $unicoreDataMovement);
+ $unicoredmp = Airavata::addUnicoreDataMovementDetails( $computeResource->computeResourceId, 0, $unicoreDataMovement);
}
else /* other data movement protocols */
{
@@ -295,8 +285,7 @@ public static function create_or_update_DMIObject( $inputs, $update = false){
}
public static function getAllCRObjects( $onlyName = false){
- $airavataclient = Session::get("airavataClient");
- $crNames = $airavataclient->getAllComputeResourceNames();
+ $crNames = Airavata::getAllComputeResourceNames();
if( $onlyName)
return $crNames;
else
@@ -304,7 +293,7 @@ public static function getAllCRObjects( $onlyName = false){
$crObjects = array();
foreach( $crNames as $id => $crName)
{
- $crObjects[] = $airavataclient->getComputeResource( $id);
+ $crObjects[] = Airavata::getComputeResource( $id);
}
return $crObjects;
}
@@ -312,8 +301,7 @@ public static function getAllCRObjects( $onlyName = false){
}
public static function getBrowseCRData(){
- $airavataclient = Session::get("airavataClient");
- $appDeployments = $airavataclient->getAllApplicationDeployments( Session::get("gateway_id"));
+ $appDeployments = Airavata::getAllApplicationDeployments( Session::get("gateway_id"));
return array( 'crObjects' => CRUtilities::getAllCRObjects(true),
'appDeployments' => $appDeployments
@@ -322,30 +310,28 @@ public static function getBrowseCRData(){
public static function getJobSubmissionDetails( $jobSubmissionInterfaceId, $jsp){
//jsp = job submission protocol type
- $airavataclient = Session::get("airavataClient");
if( $jsp == JobSubmissionProtocol::LOCAL)
- return $airavataclient->getLocalJobSubmission( $jobSubmissionInterfaceId);
+ return Airavata::getLocalJobSubmission( $jobSubmissionInterfaceId);
else if( $jsp == JobSubmissionProtocol::SSH)
- return $airavataclient->getSSHJobSubmission( $jobSubmissionInterfaceId);
+ return Airavata::getSSHJobSubmission( $jobSubmissionInterfaceId);
else if( $jsp == JobSubmissionProtocol::UNICORE)
- return $airavataclient->getUnicoreJobSubmission( $jobSubmissionInterfaceId);
+ return Airavata::getUnicoreJobSubmission( $jobSubmissionInterfaceId);
else if( $jsp == JobSubmissionProtocol::CLOUD)
- return $airavataclient->getCloudJobSubmission( $jobSubmissionInterfaceId);
+ return Airavata::getCloudJobSubmission( $jobSubmissionInterfaceId);
//globus get function not present ??
}
public static function getDataMovementDetails( $dataMovementInterfaceId, $dmi){
//jsp = job submission protocol type
- $airavataclient = Session::get("airavataClient");
if( $dmi == DataMovementProtocol::LOCAL)
- return $airavataclient->getLocalDataMovement( $dataMovementInterfaceId);
+ return Airavata::getLocalDataMovement( $dataMovementInterfaceId);
else if( $dmi == DataMovementProtocol::SCP)
- return $airavataclient->getSCPDataMovement( $dataMovementInterfaceId);
+ return Airavata::getSCPDataMovement( $dataMovementInterfaceId);
else if( $dmi == DataMovementProtocol::GridFTP)
- return $airavataclient->getGridFTPDataMovement( $dataMovementInterfaceId);
+ return Airavata::getGridFTPDataMovement( $dataMovementInterfaceId);
else if( $dmi == DataMovementProtocol::UNICORE_STORAGE_SERVICE)
- return $airavataclient->getUnicoreDataMovement( $dataMovementInterfaceId);
+ return Airavata::getUnicoreDataMovement( $dataMovementInterfaceId);
/*
else if( $dmi == JobSubmissionProtocol::CLOUD)
return $airavataclient->getCloudJobSubmission( $dataMovementInterfaceId);
@@ -355,26 +341,24 @@ public static function getDataMovementDetails( $dataMovementInterfaceId, $dmi){
}
public static function deleteActions( $inputs){
- $airavataclient = Session::get("airavataClient");
if( isset( $inputs["jsiId"]) )
- if( $airavataclient->deleteJobSubmissionInterface( $inputs["crId"], $inputs["jsiId"]) )
+ if( Airavata::deleteJobSubmissionInterface( $inputs["crId"], $inputs["jsiId"]) )
return 1;
else
return 0;
else if( isset( $inputs["dmiId"]) )
- if( $airavataclient->deleteDataMovementInterface( $inputs["crId"], $inputs["dmiId"]) )
+ if( Airavata::deleteDataMovementInterface( $inputs["crId"], $inputs["dmiId"]) )
return 1;
else
return 0;
elseif( isset( $inputs["del-crId"]))
- if( $airavataclient->deleteComputeResource( $inputs["del-crId"] ) )
+ if( Airavata::deleteComputeResource( $inputs["del-crId"] ) )
return 1;
else
return 0;
}
public static function create_or_update_gateway_profile( $inputs, $update = false){
- $airavataclient = Session::get("airavataClient");
$computeResourcePreferences = array();
if( isset( $input["crPreferences"]) )
@@ -393,23 +377,22 @@ public static function create_or_update_gateway_profile( $inputs, $update = fals
"gatewayDescription" => $inputs["gatewayDescription"]
)
);
- $gatewayProfileId = $airavataclient->updateGatewayResourceProfile( $inputs["edit-gpId"], $gatewayProfile);
+ $gatewayProfileId = Airavata::updateGatewayResourceProfile( $inputs["edit-gpId"], $gatewayProfile);
}
else
- $gatewayProfileId = $airavataclient->registerGatewayResourceProfile( $gatewayProfile);
+ $gatewayProfileId = Airavata::registerGatewayResourceProfile( $gatewayProfile);
}
public static function getAllGatewayProfilesData(){
- $airavataclient = Session::get("airavataClient");
if( Session::has("scigap_admin") )
- $gateways = $airavataclient->getAllGateways();
+ $gateways = Airavata::getAllGateways();
else
{
- $gateways[0] = $airavataclient->getGateway( Config::get('wsis::gateway-id'));
+ $gateways[0] = Airavata::getGateway( Config::get('wsis::gateway-id'));
}
- $gatewayProfiles = $airavataclient->getAllGatewayComputeResources();
+ $gatewayProfiles = Airavata::getAllGatewayComputeResources();
//$gatewayProfileIds = array("GatewayTest3_57726e98-313f-4e7c-87a5-18e69928afb5", "GatewayTest4_4fd9fb28-4ced-4149-bdbd-1f276077dad8");
foreach( $gateways as $key => $gw)
{
@@ -421,7 +404,7 @@ public static function getAllGatewayProfilesData(){
{
foreach( (array)$gp->computeResourcePreferences as $i => $crp)
{
- $gatewayProfiles[$index]->computeResourcePreferences[$i]->crDetails = $airavataclient->getComputeResource( $crp->computeResourceId);
+ $gatewayProfiles[$index]->computeResourcePreferences[$i]->crDetails = Airavata::getComputeResource( $crp->computeResourceId);
}
$gateways[$key]->profile = $gatewayProfiles[$index];
}
@@ -433,25 +416,19 @@ public static function getAllGatewayProfilesData(){
}
public static function add_or_update_CRP( $inputs){
- $airavataclient = Session::get("airavataClient");
-
$computeResourcePreferences = new computeResourcePreference( $inputs);
//var_dump( $inputs); exit;
- return $airavataclient->addGatewayComputeResourcePreference( $inputs["gatewayId"], $inputs["computeResourceId"], $computeResourcePreferences);
+ return Airavata::addGatewayComputeResourcePreference( $inputs["gatewayId"], $inputs["computeResourceId"], $computeResourcePreferences);
}
public static function deleteGP( $gpId){
- $airavataclient = Session::get("airavataClient");
-
- return $airavataclient->deleteGatewayResourceProfile( $gpId);
+ return Airavata::deleteGatewayResourceProfile( $gpId);
}
public static function deleteCR( $inputs){
- $airavataclient = Session::get("airavataClient");
-
- return $airavataclient->deleteGatewayComputeResourcePreference( $inputs["gpId"], $inputs["rem-crId"]);
+ return Airavata::deleteGatewayComputeResourcePreference( $inputs["gpId"], $inputs["rem-crId"]);
}
}
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/3ca02155/app/libraries/ExpUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/ExpUtilities.php b/app/libraries/ExpUtilities.php
index 40e5d36..ae5ab7f 100644
--- a/app/libraries/ExpUtilities.php
+++ b/app/libraries/ExpUtilities.php
@@ -1,15 +1,6 @@
<?php
-//Thrift classes - loaded from Vendor/Thrift
-use Thrift\Transport\TTransport;
-use Thrift\Exception\TException;
-use Thrift\Exception\TTransportException;
-use Thrift\Factory\TStringFuncFactory;
-use Thrift\Protocol\TBinaryProtocol;
-use Thrift\Transport\TSocket;
-
//Airavata classes - loaded from app/libraries/Airavata
-use Airavata\API\AiravataClient;
use Airavata\API\Error\InvalidRequestException;
use Airavata\API\Error\AiravataClientException;
use Airavata\API\Error\AiravataSystemException;
@@ -22,8 +13,6 @@ use Airavata\Model\Workspace\Experiment\Experiment;
use Airavata\Model\Workspace\Experiment\ExperimentState;
use Airavata\Model\AppCatalog\AppInterface\DataType;
use Airavata\Model\Workspace\Experiment\JobState;
-use Airavata\Model\AppCatalog\ComputeResource\JobSubmissionInterface;
-use Airavata\Model\AppCatalog\ComputeResource\JobSubmissionProtocol;
class ExpUtilities{
@@ -33,7 +22,6 @@ class ExpUtilities{
*/
public static function launch_experiment($expId)
{
- $airavataclient = Session::get("airavataClient");
//global $tokenFilePath;
try
{
@@ -151,12 +139,11 @@ public static function list_input_files($experiment)
*/
public static function get_application_inputs($id)
{
- $airavataclient = Session::get("airavataClient");
$inputs = null;
try
{
- $inputs = $airavataclient->getApplicationInputs($id);
+ $inputs = Airavata::getApplicationInputs($id);
}
catch (InvalidRequestException $ire)
{
@@ -188,12 +175,11 @@ public static function get_application_inputs($id)
*/
public static function get_application_outputs($id)
{
- $airavataclient = Session::get("airavataClient");
$outputs = null;
try
{
- $outputs = $airavataclient->getApplicationOutputs($id);
+ $outputs = Airavata::getApplicationOutputs($id);
}
catch (InvalidRequestException $ire)
{
@@ -225,11 +211,9 @@ public static function get_application_outputs($id)
*/
public static function get_experiment($expId)
{
- $airavataclient = Session::get("airavataClient");
-
try
{
- return $airavataclient->getExperiment($expId);
+ return Airavata::getExperiment($expId);
}
catch (InvalidRequestException $ire)
{
@@ -575,11 +559,9 @@ public static function file_upload_successful()
*/
public static function update_experiment($expId, $updatedExperiment)
{
- $airavataclient = Session::get("airavataClient");
-
try
{
- $airavataclient->updateExperiment($expId, $updatedExperiment);
+ Airavata::updateExperiment($expId, $updatedExperiment);
/*
Utilities::print_success_message("<p>Experiment updated!</p>" .
@@ -621,14 +603,12 @@ public static function update_experiment($expId, $updatedExperiment)
*/
public static function clone_experiment($expId)
{
- $airavataclient = Session::get("airavataClient");
-
try
{
//create new experiment to receive the clone
- $experiment = $airavataclient->getExperiment($expId);
+ $experiment = Airavata::getExperiment($expId);
- $cloneId = $airavataclient->cloneExperiment($expId, 'Clone of ' . $experiment->name);
+ $cloneId = Airavata::cloneExperiment($expId, 'Clone of ' . $experiment->name);
Utilities::print_success_message("<p>Experiment cloned!</p>" .
'<p>You will be redirected to the edit page shortly, or you can
@@ -674,11 +654,9 @@ public static function clone_experiment($expId)
*/
public static function cancel_experiment($expId)
{
- $airavataclient = Session::get("airavataClient");
-
try
{
- $airavataclient->terminateExperiment($expId);
+ Airavata::terminateExperiment($expId);
Utilities::print_success_message("Experiment canceled!");
}
@@ -727,8 +705,6 @@ public static function cancel_experiment($expId)
*/
public static function create_experiment()
{
- $airavataclient = Session::get("airavataClient");
-
$experiment = Utilities::assemble_experiment();
//var_dump($experiment); exit;
$expId = null;
@@ -737,7 +713,7 @@ public static function create_experiment()
{
if($experiment)
{
- $expId = $airavataclient->createExperiment( Session::get("gateway_id"), $experiment);
+ $expId = Airavata::createExperiment( Session::get("gateway_id"), $experiment);
}
if ($expId)
@@ -805,8 +781,6 @@ public static function list_output_files($experiment, $expStatus)
}
public static function get_experiment_values( $experiment, $project, $forSearch = false)
{
- $airavataclient = Session::get("airavataClient");
- //var_dump( $experiment); exit;
$expVal = array();
$expVal["experimentStatusString"] = "";
$expVal["experimentTimeOfStateChange"] = "";
@@ -821,7 +795,7 @@ public static function get_experiment_values( $experiment, $project, $forSearch
$expVal["experimentTimeOfStateChange"] = date('Y-m-d H:i:s', $experimentStatus->timeOfStateChange/1000); // divide by 1000 since timeOfStateChange is in ms
$expVal["experimentCreationTime"] = date('Y-m-d H:i:s', $experiment->creationTime/1000); // divide by 1000 since creationTime is in ms
}
- $jobStatus = $airavataclient->getJobStatuses($experiment->experimentID);
+ $jobStatus = Airavata::getJobStatuses($experiment->experimentID);
if ($jobStatus)
{
@@ -884,7 +858,6 @@ public static function get_experiment_values( $experiment, $project, $forSearch
*/
public static function get_expsearch_results( $inputs)
{
- $airavataclient = Session::get("airavataClient");
$experiments = array();
try
@@ -892,16 +865,16 @@ public static function get_expsearch_results( $inputs)
switch ( $inputs["search-key"])
{
case 'experiment-name':
- $experiments = $airavataclient->searchExperimentsByName(Session::get('gateway_id'), Session::get('username'), $inputs["search-value"]);
+ $experiments = Airavata::searchExperimentsByName(Session::get('gateway_id'), Session::get('username'), $inputs["search-value"]);
break;
case 'experiment-description':
- $experiments = $airavataclient->searchExperimentsByDesc(Session::get('gateway_id'), Session::get('username'), $inputs["search-value"]);
+ $experiments = Airavata::searchExperimentsByDesc(Session::get('gateway_id'), Session::get('username'), $inputs["search-value"]);
break;
case 'application':
- $experiments = $airavataclient->searchExperimentsByApplication(Session::get('gateway_id'), Session::get('username'), $inputs["search-value"]);
+ $experiments = Airavata::searchExperimentsByApplication(Session::get('gateway_id'), Session::get('username'), $inputs["search-value"]);
break;
case 'creation-time':
- $experiments = $airavataclient->searchExperimentsByCreationTime(Session::get('gateway_id'), Session::get('username'), strtotime( $inputs["from-date"])*1000, strtotime( $inputs["to-date"])*1000 );
+ $experiments = Airavata::searchExperimentsByCreationTime(Session::get('gateway_id'), Session::get('username'), strtotime( $inputs["from-date"])*1000, strtotime( $inputs["to-date"])*1000 );
break;
case '':
}
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/3ca02155/app/libraries/IdUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/IdUtilities.php b/app/libraries/IdUtilities.php
new file mode 100755
index 0000000..9db7450
--- /dev/null
+++ b/app/libraries/IdUtilities.php
@@ -0,0 +1,172 @@
+<?php
+/**
+ * Interface for ID management
+ */
+
+interface IdUtilities
+{
+ /**
+ * Connect to the user database.
+ * @return mixed|void
+ */
+ public function connect();
+
+ /**
+ * Return true if the given username exists in the database.
+ * @param $username
+ * @return bool
+ */
+ public function username_exists($username);
+
+ /**
+ * Authenticate user given username and password.
+ * @param $username
+ * @param $password
+ * @return int|mixed
+ */
+ public function authenticate($username, $password);
+
+ /**
+ * Create new user
+ *
+ * @param $username
+ * @param $password
+ * @param $first_name
+ * @param $last_name
+ * @param $email
+ * @param $organization
+ * @param $address
+ * @param $country
+ * @param $telephone
+ * @param $mobile
+ * @param $im
+ * @param $url
+ * @return mixed
+ */
+ public function add_user($username, $password, $first_name, $last_name, $email, $organization,
+ $address, $country,$telephone, $mobile, $im, $url);
+
+ /**
+ * Function to remove an existing user
+ *
+ * @param $username
+ * @return void
+ */
+ public function remove_user($username);
+
+ /**
+ * Get the user profile
+ * @param $username
+ * @return mixed|void
+ */
+ public function get_user_profile($username);
+
+ /**
+ * Update the user profile
+ *
+ * @param $username
+ * @param $first_name
+ * @param $last_name
+ * @param $email
+ * @param $organization
+ * @param $address
+ * @param $country
+ * @param $telephone
+ * @param $mobile
+ * @param $im
+ * @param $url
+ * @return mixed
+ */
+ public function update_user_profile($username, $first_name, $last_name, $email, $organization, $address,
+ $country, $telephone, $mobile, $im, $url);
+
+ /**
+ * Function to update user password
+ *
+ * @param $username
+ * @param $current_password
+ * @param $new_password
+ * @return mixed
+ */
+ public function change_password($username, $current_password, $new_password);
+
+ /**
+ * Function to check whether a user has permission for a particular permission string(api method).
+ *
+ * @param $username
+ * @param $permission_string
+ * @return bool
+ */
+ public function checkPermissionForUser($username, $permission_string);
+
+ /**
+ * Function to get all the permissions that a particular user has.
+ *
+ * @param $username
+ * @return mixed
+ */
+ public function getUserPermissions($username);
+
+ /**
+ * Function to get the entire list of roles in the application
+ *
+ * @return mixed
+ */
+ public function getRoleNames();
+
+ /**
+ * Function to check whether a role is existing
+ *
+ * @param string $roleName
+ * @return IsExistingRoleResponse
+ */
+ public function isExistingRole( $roleName);
+
+ /**
+ * Function to add new role by providing the role name.
+ *
+ * @param string $roleName
+ */
+ public function addRole($roleName);
+
+ /**
+ * Function to get the role list of a user
+ *
+ * @param $username
+ * @return mixed
+ */
+ public function getRoleListOfUser($username);
+ /**
+ * Function to update role list of user
+ *
+ * @param UpdateRoleListOfUser $parameters
+ * @return void
+ */
+ public function updateRoleListOfUser( $username, $roles);
+
+ /**
+ * Function to get the user list of a particular role
+ *
+ * @param $role
+ * @return mixed
+ */
+ public function getUserListOfRole($role);
+
+ /**
+ * Function to add a role to a user
+ *
+ * @param $username
+ * @param $role
+ * @return void
+ */
+ public function addUserToRole($username, $role);
+
+ /**
+ * Function to role from user
+ *
+ * @param $username
+ * @param $role
+ * @return void
+ */
+ public function removeUserFromRole($username, $role);
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/3ca02155/app/libraries/Utilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/Utilities.php b/app/libraries/Utilities.php
index b3ccf64..923e1d2 100644
--- a/app/libraries/Utilities.php
+++ b/app/libraries/Utilities.php
@@ -1,15 +1,6 @@
<?php
-//Thrift classes - loaded from Vendor/Thrift
-use Thrift\Transport\TTransport;
-use Thrift\Exception\TException;
-use Thrift\Exception\TTransportException;
-use Thrift\Factory\TStringFuncFactory;
-use Thrift\Protocol\TBinaryProtocol;
-use Thrift\Transport\TSocket;
-
//Airavata classes - loaded from app/libraries/Airavata
-use Airavata\API\AiravataClient;
use Airavata\API\Error\InvalidRequestException;
use Airavata\API\Error\AiravataClientException;
use Airavata\API\Error\AiravataSystemException;
@@ -23,8 +14,6 @@ use Airavata\Model\Workspace\Experiment\ExperimentState;
use Airavata\Model\AppCatalog\AppInterface\DataType;
use Airavata\Model\Workspace\Project;
use Airavata\Model\Workspace\Experiment\JobState;
-use Airavata\Model\AppCatalog\ComputeResource\JobSubmissionInterface;
-use Airavata\Model\AppCatalog\ComputeResource\JobSubmissionProtocol;
@@ -207,9 +196,6 @@ public static function connect_to_id_store()
case 'XML':
$idStore = new XmlIdUtilities(); // XML user database
break;
- case 'USER_API':
- $idStore = new UserAPIUtilities(); // Airavata UserAPI
- break;
}
try
@@ -224,40 +210,6 @@ public static function connect_to_id_store()
}
}
-/**
- * Return an Airavata client
- * @return AiravataClient
- */
-public static function get_airavata_client()
-{
- try
- {
- $app_config = Utilities::read_config();
- $transport = new TSocket( $app_config["airavata-server"], $app_config["airavata-port"]);
- $transport->setRecvTimeout( $app_config["airavata-timeout"]);
- $transport->setSendTimeout( $app_config["airavata-timeout"]);
-
- $protocol = new TBinaryProtocol($transport);
- $transport->open();
-
- $client = new AiravataClient($protocol);
-
- if( is_object( $client))
- return $client;
- else
- return Redirect::to("airavata/down");
- }
- catch (Exception $e)
- {
- /*Utilities::print_error_message('<p>There was a problem connecting to Airavata.
- Please try again later or submit a bug report using the link in the Help menu.</p>' .
- '<p>' . $e->getMessage() . '</p>');
- */
-
- }
-}
-
-
/**
* Launch the experiment with the given ID
@@ -265,7 +217,6 @@ public static function get_airavata_client()
*/
public static function launch_experiment($expId)
{
- $airavataclient = Session::get("airavataClient");
//global $tokenFilePath;
try
{
@@ -286,7 +237,7 @@ public static function launch_experiment($expId)
$app_config = Utilities::read_config();
$hardCodedToken = $app_config['credential-store-token'];
- $airavataclient->launchExperiment($expId, $hardCodedToken);
+ Airavata::launchExperiment($expId, $hardCodedToken);
/*
Utilities::print_success_message('Experiment launched!');
@@ -335,12 +286,11 @@ public static function launch_experiment($expId)
*/
public static function get_all_user_projects($gatewayId, $username)
{
- $airavataclient = Session::get("airavataClient");
$userProjects = null;
try
{
- $userProjects = $airavataclient->getAllUserProjects($gatewayId, $username);
+ $userProjects = Airavata::getAllUserProjects($gatewayId, $username);
//var_dump( $userProjects); exit;
}
catch (InvalidRequestException $ire)
@@ -380,12 +330,11 @@ public static function get_all_user_projects($gatewayId, $username)
*/
public static function get_all_applications()
{
- $airavataclient = Session::get("airavataClient");
$applications = null;
try
{
- $applications = $airavataclient->getAllApplicationInterfaceNames( Session::get("gateway_id"));
+ $applications = Airavata::getAllApplicationInterfaceNames( Session::get("gateway_id"));
}
catch (InvalidRequestException $ire)
{
@@ -426,12 +375,11 @@ public static function get_all_applications()
*/
public static function get_application_interface($id)
{
- $airavataclient = Session::get("airavataClient");
$applicationInterface = null;
try
{
- $applicationInterface = $airavataclient->getApplicationInterface($id);
+ $applicationInterface = Airavata::getApplicationInterface($id);
}
catch (InvalidRequestException $ire)
{
@@ -463,12 +411,11 @@ public static function get_application_interface($id)
*/
public static function get_available_app_interface_compute_resources($id)
{
- $airavataclient = Session::get("airavataClient");
$computeResources = null;
try
{
- $computeResources = $airavataclient->getAvailableAppInterfaceComputeResources($id);
+ $computeResources = Airavata::getAvailableAppInterfaceComputeResources($id);
}
catch (InvalidRequestException $ire)
{
@@ -500,12 +447,11 @@ public static function get_available_app_interface_compute_resources($id)
*/
public static function get_compute_resource($id)
{
- $airavataclient = Session::get("airavataClient");
$computeResource = null;
try
{
- $computeResource = $airavataclient->getComputeResource($id);
+ $computeResource = Airavata::getComputeResource($id);
}
catch (InvalidRequestException $ire)
{
@@ -585,12 +531,11 @@ public static function list_input_files($experiment)
*/
public static function get_application_inputs($id)
{
- $airavataclient = Session::get("airavataClient");
$inputs = null;
try
{
- $inputs = $airavataclient->getApplicationInputs($id);
+ $inputs = Airavata::getApplicationInputs($id);
}
catch (InvalidRequestException $ire)
{
@@ -622,12 +567,11 @@ public static function get_application_inputs($id)
*/
public static function get_application_outputs($id)
{
- $airavataclient = Session::get("airavataClient");
$outputs = null;
try
{
- $outputs = $airavataclient->getApplicationOutputs($id);
+ $outputs = Airavata::getApplicationOutputs($id);
}
catch (InvalidRequestException $ire)
{
@@ -659,11 +603,10 @@ public static function get_application_outputs($id)
*/
public static function get_experiment($expId)
{
- $airavataclient = Session::get("airavataClient");
try
{
- return $airavataclient->getExperiment($expId);
+ return Airavata::getExperiment($expId);
}
catch (InvalidRequestException $ire)
{
@@ -711,11 +654,10 @@ public static function get_experiment($expId)
*/
public static function get_project($projectId)
{
- $airavataclient = Session::get("airavataClient");
try
{
- return $airavataclient->getProject($projectId);
+ return Airavata::getProject($projectId);
}
catch (InvalidRequestException $ire)
{
@@ -760,10 +702,7 @@ public static function assemble_experiment()
$userConfigData = new UserConfigurationData();
$userConfigData->computationalResourceScheduling = $scheduling;
if( isset( $_POST["userDN"]) )
- {
- $userConfigData->generateCert = 1;
$userConfigData->userDN = $_POST["userDN"];
- }
$applicationInputs = Utilities::get_application_inputs($_POST['application']);
$experimentInputs = Utilities::process_inputs($applicationInputs, $experimentInputs);
@@ -1050,11 +989,9 @@ public static function file_upload_successful()
*/
public static function update_experiment($expId, $updatedExperiment)
{
- $airavataclient = Session::get("airavataClient");
-
try
{
- $airavataclient->updateExperiment($expId, $updatedExperiment);
+ Airavata::updateExperiment($expId, $updatedExperiment);
/*
Utilities::print_success_message("<p>Experiment updated!</p>" .
@@ -1096,12 +1033,10 @@ public static function update_experiment($expId, $updatedExperiment)
*/
public static function clone_experiment($expId)
{
- $airavataclient = Session::get("airavataClient");
-
try
{
//create new experiment to receive the clone
- $experiment = $airavataclient->getExperiment($expId);
+ $experiment = Airavata::getExperiment($expId);
$cloneId = $airavataclient->cloneExperiment($expId, 'Clone of ' . $experiment->name);
@@ -1149,14 +1084,13 @@ public static function clone_experiment($expId)
*/
public static function cancel_experiment($expId)
{
- $airavataclient = Session::get("airavataClient");
$app_config = Utilities::read_config();
try
{
- $airavataclient->terminateExperiment($expId, $app_config["credential-store-token"]);
+ Airavata::terminateExperiment($expId, $app_config["credential-store-token"]);
Utilities::print_success_message("Experiment canceled!");
}
@@ -1268,7 +1202,27 @@ public static function create_application_select($id = null, $editable = true)
*/
public static function create_compute_resources_select($applicationId, $resourceHostId)
{
- return Utilities::get_available_app_interface_compute_resources($applicationId);
+ $computeResources = Utilities::get_available_app_interface_compute_resources($applicationId);
+
+ if( count( $computeResources) > 0)
+ {
+ echo '<select class="form-control" name="compute-resource" id="compute-resource">';
+ foreach ($computeResources as $id => $name)
+ {
+ $selected = ($resourceHostId == $id)? ' selected' : '';
+
+ echo '<option value="' . $id . '"' . $selected . '>' .
+ $name . '</option>';
+
+ }
+
+ echo '</select>';
+ }
+ else
+ {
+ echo "<h4>No Compute Resources exist at the moment.";
+ }
+
}
@@ -1385,12 +1339,14 @@ public static function create_nav_bar()
'Project' => array
(
array('label' => 'Create', 'url' => URL::to('/') . '/project/create', "nav-active" => "project"),
- array('label' => 'Search', 'url' => URL::to('/') . '/project/search', "nav-active"=> "project")
+ array('label' => 'Search', 'url' => URL::to('/') . '/project/search', "nav-active"=> "project"),
+ array('label' => 'Browse', 'url' => URL::to('/') . '/project/browse', "nav-active" => "project")
),
'Experiment' => array
(
array('label' => 'Create', 'url' => URL::to('/') . '/experiment/create', "nav-active" => "experiment"),
- array('label' => 'Search', 'url' => URL::to('/') . '/experiment/search', "nav-active" => "experiment")
+ array('label' => 'Search', 'url' => URL::to('/') . '/experiment/search', "nav-active" => "experiment"),
+ array('label' => 'Browse', 'url' => URL::to('/') . '/experiment/browse', "nav-active" => "experiment")
)
);
@@ -1573,9 +1529,6 @@ public static function write_new_token($tokenId)
public static function create_project()
{
-
- $airavataclient = Session::get("airavataClient");
-
$project = new Project();
$project->owner = Session::get('username');
$project->name = $_POST['project-name'];
@@ -1586,7 +1539,7 @@ public static function create_project()
try
{
- $projectId = $airavataclient->createProject( Session::get("gateway_id"), $project);
+ $projectId = Airavata::createProject( Session::get("gateway_id"), $project);
if ($projectId)
{
@@ -1622,13 +1575,12 @@ public static function create_project()
*/
public static function get_experiments_in_project($projectId)
{
- $airavataclient = Session::get("airavataClient");
$experiments = array();
try
{
- $experiments = $airavataclient->getAllExperimentsInProject($projectId);
+ $experiments = Airavata::getAllExperimentsInProject($projectId);
}
catch (InvalidRequestException $ire)
{
@@ -1652,7 +1604,6 @@ public static function get_experiments_in_project($projectId)
public static function update_project($projectId, $projectDetails)
{
- $airavataclient = Session::get("airavataClient");
$updatedProject = new Project();
$updatedProject->owner = $projectDetails["owner"];
@@ -1661,7 +1612,7 @@ public static function update_project($projectId, $projectDetails)
try
{
- $airavataclient->updateProject($projectId, $updatedProject);
+ Airavata::updateProject($projectId, $updatedProject);
//Utilities::print_success_message('Project updated! Click <a href="project_summary.php?projId=' . $projectId . '">here</a> to view the project summary.');
}
@@ -1690,7 +1641,6 @@ public static function update_project($projectId, $projectDetails)
*/
public static function create_experiment()
{
- $airavataclient = Session::get("airavataClient");
$experiment = Utilities::assemble_experiment();
$expId = null;
@@ -1699,7 +1649,7 @@ public static function create_experiment()
{
if($experiment)
{
- $expId = $airavataclient->createExperiment( Session::get("gateway_id"), $experiment);
+ $expId = Airavata::createExperiment( Session::get("gateway_id"), $experiment);
}
if ($expId)
@@ -1770,7 +1720,6 @@ public static function list_output_files($experiment, $expStatus)
public static function get_experiment_values( $experiment, $project, $forSearch = false)
{
- $airavataclient = Session::get("airavataClient");
//var_dump( $experiment); exit;
$expVal = array();
$expVal["experimentStatusString"] = "";
@@ -1786,7 +1735,7 @@ public static function get_experiment_values( $experiment, $project, $forSearch
$expVal["experimentTimeOfStateChange"] = date('Y-m-d H:i:s', $experimentStatus->timeOfStateChange/1000); // divide by 1000 since timeOfStateChange is in ms
$expVal["experimentCreationTime"] = date('Y-m-d H:i:s', $experiment->creationTime/1000); // divide by 1000 since creationTime is in ms
}
- $jobStatus = $airavataclient->getJobStatuses($experiment->experimentID);
+ $jobStatus = Airavata::getJobStatuses($experiment->experimentID);
if ($jobStatus)
{
@@ -1842,9 +1791,98 @@ public static function get_experiment_values( $experiment, $project, $forSearch
}
+ public static function get_all_user_projects_with_pagination($limit, $offset)
+ {
+
+ $projects = array();
+
+ try
+ {
+ $projects = Airavata::getAllUserProjectsWithPagination( Session::get("gateway_id"),
+ Session::get("username"), $limit, $offset);
+ }
+ catch (InvalidRequestException $ire)
+ {
+ Utilities::print_error_message('InvalidRequestException!<br><br>' . $ire->getMessage());
+ }
+ catch (AiravataClientException $ace)
+ {
+ Utilities::print_error_message('AiravataClientException!<br><br>' . $ace->getMessage());
+ }
+ catch (AiravataSystemException $ase)
+ {
+ if ($ase->airavataErrorType == 2) // 2 = INTERNAL_ERROR
+ {
+ Utilities::print_info_message('<p>You have not created any projects yet, so no results will be returned!</p>
+ <p>Click <a href="create_project.php">here</a> to create a new project.</p>');
+ }
+ else
+ {
+ Utilities::print_error_message('There was a problem with Airavata. Please try again later, or report a bug using the link in the Help menu.');
+ //print_error_message('AiravataSystemException!<br><br>' . $ase->airavataErrorType . ': ' . $ase->getMessage());
+ }
+ }
+ catch (TTransportException $tte)
+ {
+ Utilities::print_error_message('TTransportException!<br><br>' . $tte->getMessage());
+ }
+
+ return $projects;
+ }
+
+
+
+ public static function get_projsearch_results_with_pagination( $searchKey, $searchValue, $limit, $offset)
+ {
+
+ $projects = array();
+
+ try
+ {
+ switch ( $searchKey)
+ {
+ case 'project-name':
+ $projects = Airavata::searchProjectsByProjectNameWithPagination( Session::get("gateway_id"),
+ Session::get("username"), $searchValue, $limit, $offset);
+ break;
+ case 'project-description':
+ $projects = $airavataclient->searchProjectsByProjectDescWithPagination( Session::get("gateway_id"),
+ Session::get("username"), $searchValue, $limit, $offset);
+ break;
+ }
+ }
+ catch (InvalidRequestException $ire)
+ {
+ Utilities::print_error_message('InvalidRequestException!<br><br>' . $ire->getMessage());
+ }
+ catch (AiravataClientException $ace)
+ {
+ Utilities::print_error_message('AiravataClientException!<br><br>' . $ace->getMessage());
+ }
+ catch (AiravataSystemException $ase)
+ {
+ if ($ase->airavataErrorType == 2) // 2 = INTERNAL_ERROR
+ {
+ Utilities::print_info_message('<p>You have not created any projects yet, so no results will be returned!</p>
+ <p>Click <a href="create_project.php">here</a> to create a new project.</p>');
+ }
+ else
+ {
+ Utilities::print_error_message('There was a problem with Airavata. Please try again later, or report a bug using the link in the Help menu.');
+ //print_error_message('AiravataSystemException!<br><br>' . $ase->airavataErrorType . ': ' . $ase->getMessage());
+ }
+ }
+ catch (TTransportException $tte)
+ {
+ Utilities::print_error_message('TTransportException!<br><br>' . $tte->getMessage());
+ }
+
+ return $projects;
+ }
+
+
public static function get_projsearch_results( $searchKey, $searchValue)
{
- $airavataclient = Session::get("airavataClient");;
$projects = array();
@@ -1853,7 +1891,7 @@ public static function get_projsearch_results( $searchKey, $searchValue)
switch ( $searchKey)
{
case 'project-name':
- $projects = $airavataclient->searchProjectsByProjectName( Session::get("gateway_id"), Session::get("username"), $searchValue);
+ $projects = Airavata::searchProjectsByProjectName( Session::get("gateway_id"), Session::get("username"), $searchValue);
break;
case 'project-description':
$projects = $airavataclient->searchProjectsByProjectDesc( Session::get("gateway_id"), Session::get("username"), $searchValue);
@@ -1915,13 +1953,87 @@ public static function create_options($values, $labels, $disabled)
}
}
-/**
+ /**
+ * Get results of the user's search of experiments with pagination
+ * @return array|null
+ */
+ public static function get_expsearch_results_with_pagination( $inputs, $limit, $offset)
+ {
+ $experiments = array();
+
+ try
+ {
+ switch ( $inputs["search-key"])
+ {
+ case 'experiment-name':
+ $experiments = Airavata::searchExperimentsByNameWithPagination(
+ Session::get('gateway_id'), Session::get('username'), $inputs["search-value"], $limit, $offset);
+ break;
+ case 'experiment-description':
+ $experiments = Airavata::searchExperimentsByDescWithPagination(
+ Session::get('gateway_id'), Session::get('username'), $inputs["search-value"], $limit, $offset);
+ break;
+ case 'application':
+ $experiments = Airavata::searchExperimentsByApplicationWithPagination(
+ Session::get('gateway_id'), Session::get('username'), $inputs["search-value"], $limit, $offset);
+ break;
+ case 'creation-time':
+ $experiments = Airavata::searchExperimentsByCreationTimeWithPagination(
+ Session::get('gateway_id'), Session::get('username'), strtotime( $inputs["from-date"])*1000,
+ strtotime( $inputs["to-date"])*1000 , $limit, $offset);
+ break;
+ case '':
+ }
+ }
+ catch (InvalidRequestException $ire)
+ {
+ Utilities::print_error_message('InvalidRequestException!<br><br>' . $ire->getMessage());
+ }
+ catch (AiravataClientException $ace)
+ {
+ Utilities::print_error_message('AiravataClientException!<br><br>' . $ace->getMessage());
+ }
+ catch (AiravataSystemException $ase)
+ {
+ if ($ase->airavataErrorType == 2) // 2 = INTERNAL_ERROR
+ {
+ Utilities::print_info_message('<p>You have not created any experiments yet, so no results will be returned!</p>
+ <p>Click <a href="create_experiment.php">here</a> to create an experiment, or
+ <a href="create_project.php">here</a> to create a new project.</p>');
+ }
+ else
+ {
+ Utilities::print_error_message('There was a problem with Airavata. Please try again later or report a bug using the link in the Help menu.');
+ //print_error_message('AiravataSystemException!<br><br>' . $ase->airavataErrorType . ': ' . $ase->getMessage());
+ }
+ }
+ catch (TTransportException $tte)
+ {
+ Utilities::print_error_message('TTransportException!<br><br>' . $tte->getMessage());
+ }
+
+ //get values of all experiments
+ $expContainer = array();
+ $expNum = 0;
+ foreach( $experiments as $experiment)
+ {
+ $expValue = Utilities::get_experiment_values( $experiment, Utilities::get_project($experiment->projectID), true );
+ $expContainer[$expNum]['experiment'] = $experiment;
+ if( $expValue["experimentStatusString"] == "FAILED")
+ $expValue["editable"] = false;
+ $expContainer[$expNum]['expValue'] = $expValue;
+ $expNum++;
+ }
+
+ return $expContainer;
+ }
+
+ /**
* Get results of the user's search of experiments
* @return array|null
*/
public static function get_expsearch_results( $inputs)
{
- $airavataclient = Session::get("airavataClient");
$experiments = array();
try
@@ -1929,16 +2041,16 @@ public static function get_expsearch_results( $inputs)
switch ( $inputs["search-key"])
{
case 'experiment-name':
- $experiments = $airavataclient->searchExperimentsByName(Session::get('gateway_id'), Session::get('username'), $inputs["search-value"]);
+ $experiments = Airavata::searchExperimentsByName(Session::get('gateway_id'), Session::get('username'), $inputs["search-value"]);
break;
case 'experiment-description':
- $experiments = $airavataclient->searchExperimentsByDesc(Session::get('gateway_id'), Session::get('username'), $inputs["search-value"]);
+ $experiments = Airavata::searchExperimentsByDesc(Session::get('gateway_id'), Session::get('username'), $inputs["search-value"]);
break;
case 'application':
- $experiments = $airavataclient->searchExperimentsByApplication(Session::get('gateway_id'), Session::get('username'), $inputs["search-value"]);
+ $experiments = Airavata::searchExperimentsByApplication(Session::get('gateway_id'), Session::get('username'), $inputs["search-value"]);
break;
case 'creation-time':
- $experiments = $airavataclient->searchExperimentsByCreationTime(Session::get('gateway_id'), Session::get('username'), strtotime( $inputs["from-date"])*1000, strtotime( $inputs["to-date"])*1000 );
+ $experiments = Airavata::searchExperimentsByCreationTime(Session::get('gateway_id'), Session::get('username'), strtotime( $inputs["from-date"])*1000, strtotime( $inputs["to-date"])*1000 );
break;
case '':
}
@@ -1986,6 +2098,64 @@ public static function get_expsearch_results( $inputs)
return $expContainer;
}
+ /**
+ * Get results of the user's all experiments with pagination.
+ * Results are ordered creation time DESC
+ * @return array|null
+ */
+ public static function get_all_user_experiments_with_pagination($limit, $offset)
+ {
+ $experiments = array();
+
+ try
+ {
+ $experiments = Airavata::getAllUserExperimentsWithPagination(
+ Session::get('gateway_id'), Session::get('username'), $limit, $offset
+ );
+ }
+ catch (InvalidRequestException $ire)
+ {
+ Utilities::print_error_message('InvalidRequestException!<br><br>' . $ire->getMessage());
+ }
+ catch (AiravataClientException $ace)
+ {
+ Utilities::print_error_message('AiravataClientException!<br><br>' . $ace->getMessage());
+ }
+ catch (AiravataSystemException $ase)
+ {
+ if ($ase->airavataErrorType == 2) // 2 = INTERNAL_ERROR
+ {
+ Utilities::print_info_message('<p>You have not created any experiments yet, so no results will be returned!</p>
+ <p>Click <a href="create_experiment.php">here</a> to create an experiment, or
+ <a href="create_project.php">here</a> to create a new project.</p>');
+ }
+ else
+ {
+ Utilities::print_error_message('There was a problem with Airavata. Please try again later or report a bug using the link in the Help menu.');
+ //print_error_message('AiravataSystemException!<br><br>' . $ase->airavataErrorType . ': ' . $ase->getMessage());
+ }
+ }
+ catch (TTransportException $tte)
+ {
+ Utilities::print_error_message('TTransportException!<br><br>' . $tte->getMessage());
+ }
+
+ //get values of all experiments
+ $expContainer = array();
+ $expNum = 0;
+ foreach( $experiments as $experiment)
+ {
+ $expValue = Utilities::get_experiment_values( $experiment, Utilities::get_project($experiment->projectID), true );
+ $expContainer[$expNum]['experiment'] = $experiment;
+ if( $expValue["experimentStatusString"] == "FAILED")
+ $expValue["editable"] = false;
+ $expContainer[$expNum]['expValue'] = $expValue;
+ $expNum++;
+ }
+
+ return $expContainer;
+ }
+
public static function getExpStates(){
return ExperimentState::$__names;
}
@@ -2026,11 +2196,7 @@ public static function apply_changes_to_experiment($experiment, $input)
$userConfigDataUpdated->computationalResourceScheduling = $schedulingUpdated;
if( isset( $input["userDN"]) )
- {
- $userConfigDataUpdated->generateCert = 1;
$userConfigDataUpdated->userDN = $input["userDN"];
- }
-
$experiment->userConfigurationData = $userConfigDataUpdated;
@@ -2084,20 +2250,11 @@ public static function read_config( $fileName = null){
}
public static function get_job_details( $experimentId){
- $airavataclient = Session::get("airavataClient");
- return $airavataclient->getJobDetails( $experimentId);
+ return Airavata::getJobDetails( $experimentId);
}
public static function get_transfer_details( $experimentId){
- $airavataclient = Session::get("airavataClient");
- return $airavataclient->getDataTransferDetails( $experimentId);
-}
-
-public static function getQueueDatafromResourceId( $crId){
- $airavataclient = Session::get("airavataClient");
- $resourceObject = $airavataclient->getComputeResource( $crId);
-
- return $resourceObject->batchQueues;
+ return Airavata::getDataTransferDetails( $experimentId);
}
}
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/3ca02155/app/libraries/WSISUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/WSISUtilities.php b/app/libraries/WSISUtilities.php
new file mode 100755
index 0000000..29804d2
--- /dev/null
+++ b/app/libraries/WSISUtilities.php
@@ -0,0 +1,318 @@
+<?php
+
+/**
+ * Utilities for ID management with a WSO2 IS 4.6.0
+ */
+
+class WSISUtilities implements IdUtilities{
+
+ /**
+ * Return true if the given username exists in the identity server.
+ * @param $username
+ * @return bool
+ */
+ public function username_exists($username) {
+ try{
+ //$this->wsis_client = new WSISClient( $username);
+ return WSIS::username_exists($username);
+ } catch (Exception $ex) {
+ print_r( $ex);
+ throw new Exception("Unable to check whether username exists", 0, NULL);
+ }
+
+ }
+
+ /**
+ * authenticate a given user
+ * @param $username
+ * @param $password
+ * @return boolean
+ */
+ public function authenticate($username, $password) {
+ try{
+ return WSIS::authenticate($username, $password);
+ } catch (Exception $ex) {
+ var_dump( $ex);
+ throw new Exception("Unable to authenticate user", 0, NULL);
+ }
+ }
+
+ /**
+ * Add a new user to the identity server.
+ * @param $username
+ * @param $password
+ * @return void
+ */
+ public function add_user($username, $password, $first_name, $last_name, $email, $organization,
+ $address, $country,$telephone, $mobile, $im, $url) {
+ try{
+ WSIS::addUser($username, $password, $first_name . " " . $last_name);
+ } catch (Exception $ex) {
+ var_dump($ex);
+ throw new Exception("Unable to add new user", 0, NULL);
+ }
+ }
+
+ /**
+ * Get the user profile
+ * @param $username
+ * @return mixed|void
+ */
+ public function get_user_profile($username)
+ {
+ // TODO: Implement get_user_profile() method.
+ }
+
+ /**
+ * Update the user profile
+ *
+ * @param $username
+ * @param $first_name
+ * @param $last_name
+ * @param $email
+ * @param $organization
+ * @param $address
+ * @param $country
+ * @param $telephone
+ * @param $mobile
+ * @param $im
+ * @param $url
+ * @return mixed
+ */
+ public function update_user_profile($username, $first_name, $last_name, $email, $organization, $address,
+ $country, $telephone, $mobile, $im, $url)
+ {
+ // TODO: Implement update_user_profile() method.
+ }
+
+ /**
+ * Function to update user password
+ *
+ * @param $username
+ * @param $current_password
+ * @param $new_password
+ * @return mixed
+ */
+ public function change_password($username, $current_password, $new_password)
+ {
+ // TODO: Implement change_password() method.
+ }
+
+ /**
+ * Function to remove an existing user
+ *
+ * @param $username
+ * @return void
+ */
+ public function remove_user($username)
+ {
+ // TODO: Implement remove_user() method.
+ }
+
+ /**
+ * Function to check whether a user has permission for a particular permission string(api method).
+ *
+ * @param $username
+ * @param $permission_string
+ * @return bool
+ */
+ public function checkPermissionForUser($username, $permission_string)
+ {
+ // TODO: Implement checkPermissionForUser() method.
+ }
+
+ /**
+ * Function to get all the permissions that a particular user has.
+ *
+ * @param $username
+ * @return mixed
+ */
+ public function getUserPermissions($username)
+ {
+ // TODO: Implement getUserPermissions() method.
+ }
+
+ /**
+ * Function to check whether a role is existing
+ *
+ * @param string $roleName
+ * @return IsExistingRoleResponse
+ */
+ public function isExistingRole( $roleName){
+ try{
+ return WSIS::is_existing_role( $roleName);
+ } catch (Exception $ex) {
+ var_dump($ex);
+ throw new Exception("Unable to check if role exists.", 0, $ex);
+ }
+ }
+
+ /**
+ * Function to add new role by providing the role name.
+ *
+ * @param string $roleName
+ */
+ public function addRole($roleName){
+ try{
+ return WSIS::add_role( $roleName);
+ } catch (Exception $ex) {
+ var_dump( $ex);
+ throw new Exception("Unable to add role.", 0, $ex);
+ }
+ }
+
+ /**
+ * Function to delete existing role
+ *
+ * @param string $roleName
+ * @return void
+ * @throws Exception
+ */
+ public function deleteRole($roleName) {
+ try {
+ WSIS::delete_role($roleName);
+ } catch (Exception $ex) {
+ throw new Exception("Unable to delete role", 0, $ex);
+ }
+ }
+
+ /**
+ * Function to get the entire list of roles in the application
+ *
+ * @return mixed
+ */
+ public function getRoleNames()
+ {
+ try{
+ WSIS::get_all_roles();
+ } catch (Exception $ex) {
+ var_dump($ex);
+ throw new Exception("Unable to get roles.", 0, NULL);
+ }
+ }
+
+ /**
+ * Function to get the role list of a user
+ *
+ * @param $username
+ * @return mixed
+ */
+ public function getRoleListOfUser($username)
+ {
+ try{
+ return WSIS::get_user_roles( $username);
+ } catch (Exception $ex) {
+ var_dump($ex);
+ throw new Exception("Unable to get roles.", 0, NULL);
+ }
+ }
+
+ /**
+ * Function to get the user list of a particular role
+ *
+ * @param $role
+ * @return mixed
+ */
+ public function getUserListOfRole($role)
+ {
+ try{
+ return WSIS::get_userlist_of_role( $role);
+ } catch (Exception $ex) {
+ var_dump( $ex); exit;
+ throw new Exception("Unable to get users.", 0, NULL);
+ }
+ }
+
+ /**
+ * Function to add a role to a user
+ *
+ * @param $username
+ * @param $role
+ * @return void
+ */
+ public function addUserToRole($username, $role)
+ {
+ // TODO: Implement addUserToRole() method.
+ }
+
+ /**
+ * Function to role from user
+ *
+ * @param $username
+ * @param $role
+ * @return void
+ */
+
+ /**
+ * Function to update role list of user
+ *
+ * @param UpdateRoleListOfUser $parameters
+ * @return void
+ */
+ public function updateRoleListOfUser($username, $roles)
+ {
+ try{
+ return WSIS::update_user_roles( $username, $roles);
+ } catch (Exception $ex) {
+ var_dump($ex); exit;
+ throw new Exception("Unable to update User roles.", 0, NULL);
+ }
+ }
+ public function removeUserFromRole($username, $role)
+ {
+ // TODO: Implement removeUserFromRole() method.
+ }
+
+ /**
+ * Function to list users
+ *
+ * @param void
+ * @return void
+ */
+ public function listUsers(){
+ try {
+ return WSIS::list_users();
+ } catch (Exception $ex) {
+
+ throw new Exception( "Unable to list users", 0, $ex);
+ }
+ }
+
+ /**
+ * Function to get the tenant id
+ *
+ * @param GetTenantId $parameters
+ * @return GetTenantIdResponse
+ */
+ public function getTenantId(){
+ try {
+ return WSIS::get_tenant_id();
+ } catch (Exception $ex) {
+ var_dump( $ex->debug_message);
+ throw new Exception("Unable to get the Tenant Id.", 0, $ex);
+ }
+ }
+ /**
+ * Function create a new Tenant
+ *
+ * @param Tenant $parameters
+ * @return void
+ */
+ public function createTenant( $inputs){
+ try {
+ return WSIS::create_tenant( $inputs);
+ } catch (Exception $ex) {
+ var_dump( $ex);
+ //throw new Exception("Unable to create Tenant.", 0, $ex);
+ }
+ }
+
+ /**
+ * Connect to the user database.
+ * @return mixed|void
+ */
+ public function connect()
+ {
+ // TODO: Implement connect() method.
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/3ca02155/app/libraries/Wsis/Facades/Wsis.php
----------------------------------------------------------------------
diff --git a/app/libraries/Wsis/Facades/Wsis.php b/app/libraries/Wsis/Facades/Wsis.php
new file mode 100755
index 0000000..500c9a7
--- /dev/null
+++ b/app/libraries/Wsis/Facades/Wsis.php
@@ -0,0 +1,16 @@
+<?php
+
+namespace Wsis\Facades;
+
+use Illuminate\Support\Facades\Facade;
+
+class Wsis extends Facade {
+
+ /**
+ * Get the registered name of the component.
+ *
+ * @return string
+ */
+ protected static function getFacadeAccessor() { return 'wsis'; }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/3ca02155/app/libraries/Wsis/Stubs/AuthenticationAdmin.php
----------------------------------------------------------------------
diff --git a/app/libraries/Wsis/Stubs/AuthenticationAdmin.php b/app/libraries/Wsis/Stubs/AuthenticationAdmin.php
new file mode 100755
index 0000000..3c1ef1b
--- /dev/null
+++ b/app/libraries/Wsis/Stubs/AuthenticationAdmin.php
@@ -0,0 +1,55 @@
+<?php
+namespace Wsis\Stubs;
+
+use Wsis\Stubs\AuthenticationAdminStub;
+
+/**
+ * AuthenticationAdmin class
+ *
+ * This class provide an easy to use interface for
+ * WSO2 IS 5.0.0 TenantMgtAdmin service.
+ */
+class AuthenticationAdmin {
+ /**
+ * @var AuthenticationAdminStub $serviceStub
+ * @access private
+ */
+ private $serviceStub;
+
+ public function __construct($server_url, $options) {
+ $this->serviceStub = new AuthenticationAdminStub(
+ $server_url . "AuthenticationAdmin?wsdl", $options
+ );
+ }
+
+ /**
+ * Function to get the soap client
+ *
+ * @return SoapClient
+ */
+ public function getSoapClient(){
+ return $this->serviceStub;
+ }
+
+ /**
+ * Method to login the user
+ * @param $username
+ * @param $password
+ * @param $tenantDomain
+ * @return true/false
+ */
+ public function login($username, $password, $tenantDomain){
+ $parameters = new login();
+ $parameters->username = $username. "@" . $tenantDomain;
+ $parameters->password = $password;
+ return $this->serviceStub->login($parameters);
+ }
+
+ /**
+ * Method to logout the current user
+ */
+ public function logout(){
+ $parameters = new logout();
+ $this->serviceStub->logout($parameters);
+ }
+}