You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sc...@apache.org on 2015/05/14 16:05:14 UTC
airavata-php-gateway git commit: Removing the old identity management
code and changing the wsis method names to camel case
Repository: airavata-php-gateway
Updated Branches:
refs/heads/master cf9a7e9d0 -> fa1b1c123
Removing the old identity management code and changing the wsis method names to camel case
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/fa1b1c12
Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/fa1b1c12
Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/fa1b1c12
Branch: refs/heads/master
Commit: fa1b1c123e878fa3560c3c4d0b8f8727babf00dc
Parents: cf9a7e9
Author: Supun Nakandala <su...@gmail.com>
Authored: Thu May 14 19:34:46 2015 +0530
Committer: Supun Nakandala <su...@gmail.com>
Committed: Thu May 14 19:34:46 2015 +0530
----------------------------------------------------------------------
app/controllers/AccountController.php | 25 +--
app/controllers/AdminController.php | 61 +-----
app/libraries/IdUtilities.php | 172 ----------------
app/libraries/Utilities.php | 68 ------
app/libraries/WSISUtilities.php | 320 -----------------------------
app/libraries/Wsis/Wsis.php | 22 +-
app/libraries/XmlIdUtilities.php | 292 --------------------------
7 files changed, 30 insertions(+), 930 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/fa1b1c12/app/controllers/AccountController.php
----------------------------------------------------------------------
diff --git a/app/controllers/AccountController.php b/app/controllers/AccountController.php
index 63a87db..85ffd1d 100755
--- a/app/controllers/AccountController.php
+++ b/app/controllers/AccountController.php
@@ -39,26 +39,13 @@ class AccountController extends BaseController {
$im = $_POST['im'];
$url = $_POST['url'];
- $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>');
- }
-
- if ($idStore->username_exists($username)) {
+ if (WSIS::usernameExists($username)) {
return Redirect::to("create")
->withInput(Input::except('password', 'password_confirm'))
->with("username_exists", true);
}
else{
- $idStore->add_user($username, $password, $first_name, $last_name, $email, $organization,
+ WSIS::addUser($username, $password, $first_name, $last_name, $email, $organization,
$address, $country,$telephone, $mobile, $im, $url);
Utilities::print_success_message('New user created!');
@@ -76,8 +63,12 @@ class AccountController extends BaseController {
$username = $_POST['username'];
$password = $_POST['password'];
try {
- if ( Utilities::id_matches_db($username, $password)) {
-
+ if (WSIS::authenticate($username, $password)) {
+ if( in_array(Config::get('pga_config.wsis')['admin-role-name'], (array)WSIS::getUserRoles($username)))
+ {
+ Session::put("admin", true);
+ }
+
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('pga_config.wsis')['gateway-id']);
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/fa1b1c12/app/controllers/AdminController.php
----------------------------------------------------------------------
diff --git a/app/controllers/AdminController.php b/app/controllers/AdminController.php
index fc0c244..35c3e67 100755
--- a/app/controllers/AdminController.php
+++ b/app/controllers/AdminController.php
@@ -2,24 +2,8 @@
class AdminController extends BaseController {
- private $idStore = null;
-
public function __construct()
{
- $this->beforeFilter('verifyadmin');
- $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>');
- }
- $this->idStore = $idStore;
- //Session::put("idStore", $idStore);
Session::put("nav-active", "user-console");
}
@@ -30,7 +14,6 @@ class AdminController extends BaseController {
public function dashboard(){
//only for super admin
//Session::put("scigap_admin", true);
- $idStore = $this->idStore;
$crData = CRUtilities::getEditCRData();
$gateways = CRUtilities::getAllGatewayProfilesData();
@@ -48,42 +31,35 @@ class AdminController extends BaseController {
}
public function addAdminSubmit(){
- $idStore = $this->idStore;
- $idStore->updateRoleListOfUser( Input::get("username"), array( "new"=>array("admin"), "deleted"=>array() ) );
+ WSIS::update_user_roles( Input::get("username"), array( "new"=>array("admin"), "deleted"=>array() ) );
return View::make("account/admin-dashboard")->with("message", "User has been added to Admin.");
}
public function usersView(){
- $idStore = $this->idStore;
if( Input::has("role"))
{
- $users = $idStore->getUserListOfRole( Input::get("role"));
+ $users = WSIS::getUserlistOfRole(Input::get("role"));
if( isset( $users->return))
$users = $users->return;
else
$users = array();
}
else
- $users = $idStore->listUsers();
+ $users = WSIS::listUsers();
- $roles = $idStore->getRoleNames();
+ $roles = WSIS::getAllRoles();
return View::make("admin/manage-users", array("users" => $users, "roles" => $roles));
}
public function addGatewayAdminSubmit(){
- $idStore = $this->idStore;
//check if username exists
- if( $idStore->username_exists( Input::get("username")) )
+ if(WSIS::usernameExists( Input::get("username")) )
{
- //add user to admin role
- $app_config = Utilities::read_config();
- $idStore->updateRoleListOfUser( Input::get("username"), array( "new"=>array( Config::get('wsis::admin-role-name')), "deleted"=>array() ) );
-
+ WSIS::updateUserRoles(Input::get("username"), array( "new"=>array( Config::get('wsis::admin-role-name')), "deleted"=>array() ) );
return Redirect::to("admin/dashboard/users?role=" . Config::get('wsis::admin-role-name'))->with("Gateway Admin has been added.");
-
}
else
{
@@ -92,43 +68,30 @@ class AdminController extends BaseController {
}
public function rolesView(){
- $idStore = $this->idStore;
- $roles = $idStore->getRoleNames();
-
+ $roles = WSIS::getAllRolles();
return View::make("admin/manage-roles", array("roles" => $roles));
}
public function experimentsView(){
- $idStore = $this->idStore;
- //$roles = $idStore->getExperiments();
-
return View::make("admin/manage-experiments" );
}
public function addRole(){
- $idStore = $this->idStore;
-
- $idStore->addRole( Input::get("role") );
+ WSIS::addRole( Input::get("role") );
return Redirect::to("admin/dashboard/roles")->with( "message", "Role has been added.");
}
public function getRoles(){
- $idStore = $this->idStore;
-
- return json_encode( (array)$idStore->getRoleListOfUser( Input::get("username") ) );
+ return json_encode((array)WSIS::getUserRoles(Input::get("username")));
}
public function deleteRole(){
- $idStore = $this->idStore;
-
- $idStore->deleteRole( Input::get("role") );
+ WSIS::deleteRole( Input::get("role") );
return Redirect::to("admin/dashboard/roles")->with( "message", "Role has been deleted.");
}
public function credentialStoreView(){
- $idStore = $this->idStore;
-
return View::make("admin/manage-credentials", array("tokens" => array()) );
}
@@ -139,9 +102,7 @@ class AdminController extends BaseController {
$inputs = Input::all();
- $idStore = $this->idStore;
-
- $tm = $idStore->createTenant(1, $inputs["admin-username"], $inputs["admin-password"], $inputs["admin-email"],
+ $tm = WSIS::createTenant(1, $inputs["admin-username"], $inputs["admin-password"], $inputs["admin-email"],
$inputs["admin-firstname"], $inputs["admin-lastname"], $inputs["domain"]);
print_r( $tm); exit;
$gateway = AdminUtilities::addGateway(Input::all() );
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/fa1b1c12/app/libraries/IdUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/IdUtilities.php b/app/libraries/IdUtilities.php
deleted file mode 100755
index 9db7450..0000000
--- a/app/libraries/IdUtilities.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
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/fa1b1c12/app/libraries/Utilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/Utilities.php b/app/libraries/Utilities.php
index 722f326..e461a25 100644
--- a/app/libraries/Utilities.php
+++ b/app/libraries/Utilities.php
@@ -103,43 +103,6 @@ public static function form_submitted()
}
/**
- * 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))
- {
- if( in_array(Config::get('pga_config.wsis')['admin-role-name'], (array)$idStore->getRoleListOfUser( $username)))
- {
- Session::put("admin", true);
- }
- return true;
- }else{
- return false;
- }
-}
-
-
-/**
* Store username in session variables
* @param $username
*/
@@ -178,37 +141,6 @@ public static function verify_login()
}
/**
- * 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>');
- }
-}
-
-
-/**
* Launch the experiment with the given ID
* @param $expId
*/
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/fa1b1c12/app/libraries/WSISUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/WSISUtilities.php b/app/libraries/WSISUtilities.php
deleted file mode 100755
index 12b49ab..0000000
--- a/app/libraries/WSISUtilities.php
+++ /dev/null
@@ -1,320 +0,0 @@
-<?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( $active, $adminUsername, $adminPassword, $email,
- $firstName, $lastName, $tenantDomain){
- try {
- return WSIS::create_tenant( $active, $adminUsername, $adminPassword, $email,
- $firstName, $lastName, $tenantDomain);
- } 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/fa1b1c12/app/libraries/Wsis/Wsis.php
----------------------------------------------------------------------
diff --git a/app/libraries/Wsis/Wsis.php b/app/libraries/Wsis/Wsis.php
index 2588012..d677268 100755
--- a/app/libraries/Wsis/Wsis.php
+++ b/app/libraries/Wsis/Wsis.php
@@ -133,7 +133,7 @@ class Wsis {
* @return boolean
* @throws Exception
*/
- public function username_exists($username){
+ public function usernameExists($username){
try {
return $this->userStoreManager->isExistingUser($username);
} catch (Exception $ex) {
@@ -147,7 +147,7 @@ class Wsis {
* @param string $roleName
* @return IsExistingRoleResponse
*/
- public function is_existing_role( $roleName){
+ public function isExistingRole( $roleName){
try {
return $this->userStoreManager->isExistingRole( $roleName);
} catch (Exception $ex) {
@@ -160,7 +160,7 @@ class Wsis {
*
* @param string $roleName
*/
- public function add_role($roleName){
+ public function addRole($roleName){
try {
return $this->userStoreManager->addRole( $roleName);
} catch (Exception $ex) {
@@ -175,7 +175,7 @@ class Wsis {
* @return void
* @throws Exception
*/
- public function delete_role($roleName) {
+ public function deleteRole($roleName) {
try {
$this->userStoreManager->deleteRole($roleName);
} catch (Exception $ex) {
@@ -190,7 +190,7 @@ class Wsis {
*
* @return roles list
*/
- public function get_all_roles(){
+ public function getAllRoles(){
try {
return $this->userStoreManager->getRoleNames();
} catch (Exception $ex) {
@@ -203,7 +203,7 @@ class Wsis {
*
* @return user role
*/
- public function get_user_roles( $username){
+ public function getUserRoles( $username){
try {
return $this->userStoreManager->getRoleListOfUser( $username);
} catch (Exception $ex) {
@@ -217,7 +217,7 @@ class Wsis {
* @param GetUserListOfRole $parameters
* @return GetUserListOfRoleResponse
*/
- public function get_userlist_of_role( $role){
+ public function getUserListOfRole( $role){
try {
return $this->userStoreManager->getUserListOfRole( $role);
} catch (Exception $ex) {
@@ -232,7 +232,7 @@ class Wsis {
* @param UpdateRoleListOfUser $parameters
* @return void
*/
- public function update_user_roles( $username, $roles){
+ public function updateUserRoles( $username, $roles){
try {
return $this->userStoreManager->updateRoleListOfUser( $username, $roles);
} catch (Exception $ex) {
@@ -246,7 +246,7 @@ class Wsis {
* @param void
* @return void
*/
- public function list_users(){
+ public function listUsers(){
try {
return $this->userStoreManager->listUsers();
} catch (Exception $ex) {
@@ -261,7 +261,7 @@ class Wsis {
* @param GetTenantId $parameters
* @return GetTenantIdResponse
*/
- public function get_tenant_id(){
+ public function getTenantId(){
try {
return $this->userStoreManager->getTenantId();
} catch (Exception $ex) {
@@ -281,7 +281,7 @@ class Wsis {
* @param $tenantDomain
* @throws Exception
*/
- public function create_tenant($active, $adminUsername, $adminPassword, $email,
+ public function createTenant($active, $adminUsername, $adminPassword, $email,
$firstName, $lastName, $tenantDomain){
try {
return $this->tenantManager->addTenant($active, $adminUsername, $adminPassword, $email,
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/fa1b1c12/app/libraries/XmlIdUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/XmlIdUtilities.php b/app/libraries/XmlIdUtilities.php
deleted file mode 100755
index 5580796..0000000
--- a/app/libraries/XmlIdUtilities.php
+++ /dev/null
@@ -1,292 +0,0 @@
-<?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.
- }
-}