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/07/29 19:49:07 UTC

[35/50] [abbrv] airavata-php-gateway git commit: adding user search to admin dashboard

adding user search to admin dashboard


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

Branch: refs/heads/master
Commit: 5fd84e8de381387872ff564702e5179ecdc65420
Parents: 404c5ea
Author: Supun Nakandala <sc...@apache.org>
Authored: Thu Jul 23 02:08:50 2015 +0530
Committer: Supun Nakandala <sc...@apache.org>
Committed: Thu Jul 23 02:08:50 2015 +0530

----------------------------------------------------------------------
 app/controllers/AdminController.php           | 16 +++++++++++++++-
 app/libraries/Wsis/Stubs/UserStoreManager.php | 13 +++++++++++++
 app/libraries/Wsis/Wsis.php                   | 15 +++++++++++++++
 app/routes.php                                |  2 ++
 app/views/admin/manage-users.blade.php        | 19 +++++++++++++++++--
 5 files changed, 62 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/5fd84e8d/app/controllers/AdminController.php
----------------------------------------------------------------------
diff --git a/app/controllers/AdminController.php b/app/controllers/AdminController.php
index bdd4a0a..20e97c6 100644
--- a/app/controllers/AdminController.php
+++ b/app/controllers/AdminController.php
@@ -49,13 +49,27 @@ class AdminController extends BaseController {
 		}
 		else
 	    	$users =  WSIS::listUsers();
-	    
+
 	    $roles = WSIS::getAllRoles();
         Session::put("admin-nav", "manage-users");
 	    return View::make("admin/manage-users", array("users" => $users, "roles" => $roles));
 
 	}
 
+    public function searchUsersView(){
+        if(Input::has("search_val"))
+        {
+            $users =  WSIS::searchUsers(Input::get("search_val"));
+        }
+        else
+            $users = WSIS::listUsers();
+
+        $roles = WSIS::getAllRoles();
+        Session::put("admin-nav", "manage-users");
+        return View::make("admin/manage-users", array("users" => $users, "roles" => $roles));
+
+    }
+
 	public function addGatewayAdminSubmit(){
 		//check if username exists
 		if(WSIS::usernameExists( Input::get("username")) )

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/5fd84e8d/app/libraries/Wsis/Stubs/UserStoreManager.php
----------------------------------------------------------------------
diff --git a/app/libraries/Wsis/Stubs/UserStoreManager.php b/app/libraries/Wsis/Stubs/UserStoreManager.php
index a04e47c..c986653 100755
--- a/app/libraries/Wsis/Stubs/UserStoreManager.php
+++ b/app/libraries/Wsis/Stubs/UserStoreManager.php
@@ -118,6 +118,19 @@ class UserStoreManager {
         return $this->serviceStub->listUsers($parameters)->return;
     }
 
+    /**
+     * Function to search users
+     * @param $phrase
+     * @return string
+     */
+    public function searchUsers($phrase){
+        $parameters = new ListUsers();
+        $parameters->filter = "*" . $phrase . "*";
+        $parameters->maxItemLimit = -1;
+
+        return $this->serviceStub->listUsers($parameters)->return;
+    }
+
      /**
      * Function get user list
      *

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/5fd84e8d/app/libraries/Wsis/Wsis.php
----------------------------------------------------------------------
diff --git a/app/libraries/Wsis/Wsis.php b/app/libraries/Wsis/Wsis.php
index 8ef55c4..f8ee3fb 100755
--- a/app/libraries/Wsis/Wsis.php
+++ b/app/libraries/Wsis/Wsis.php
@@ -272,6 +272,21 @@ class Wsis {
     }
 
     /**
+     * Function to search users
+     * @param $phrase
+     * @return string
+     * @throws Exception
+     */
+    public function searchUsers($phrase){
+        try {
+            return $this->userStoreManager->searchUsers($phrase);
+        } 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

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/5fd84e8d/app/routes.php
----------------------------------------------------------------------
diff --git a/app/routes.php b/app/routes.php
index 7ede441..bb707a4 100755
--- a/app/routes.php
+++ b/app/routes.php
@@ -164,6 +164,8 @@ Route::get("admin/dashboard/gateway", "AdminController@dashboard");
 
 Route::get("admin/dashboard/users", "AdminController@usersView");
 
+Route::post("admin/dashboard/users", "AdminController@searchUsersView");
+
 Route::get("admin/dashboard/roles", "AdminController@rolesView");
 
 Route::get("admin/dashboard/experiments", "AdminController@experimentsView");

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/5fd84e8d/app/views/admin/manage-users.blade.php
----------------------------------------------------------------------
diff --git a/app/views/admin/manage-users.blade.php b/app/views/admin/manage-users.blade.php
index bda20f6..4aa563b 100644
--- a/app/views/admin/manage-users.blade.php
+++ b/app/views/admin/manage-users.blade.php
@@ -25,8 +25,23 @@
         </div>
         <div class="container-fluid">
             <div class="col-md-12">
-
-                <h1 class="text-center">Users</h1>
+                <form action="{{URL::to('/') }}/admin/dashboard/users" method="post" role="form">
+                    <div class="row">
+                        <div class="col-md-6">
+                            <h3>Users :</h3>
+                        </div>
+                        <div class="input-group" style="margin-top: 1.5%">
+                            <input required="required" name="search_val" type="text" class="form-control" placeholder="Search by Username"
+                            @if(Input::has("search_val"))
+                            value="{{Input::get("search_val")}}"
+                            @endif
+                            >
+                            <span class="input-group-btn">
+                                <button class="btn btn-default" type="submit">Search</button>
+                            </span>
+                        </div>
+                    </div>
+                </form>
 
                 <table class="table table-striped table-condensed">
                     <tr>