Repository: airavata-php-gateway Updated Branches: refs/heads/master fcdbe4ccf -> c644bc8ec
Multi tenancy roles and users progress 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/861e7779 Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/861e7779 Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/861e7779 Branch: refs/heads/master Commit: 861e777946fe45e096e6b524ae0f809e383ba2cd Parents: fcdbe4c Author: Nipurn Doshi <[email protected]> Authored: Thu Mar 12 11:16:57 2015 -0400 Committer: Suresh Marru <[email protected]> Committed: Thu Apr 9 11:33:23 2015 -0400 ---------------------------------------------------------------------- app/config/app_config.ini | 3 +- app/controllers/AdminController.php | 45 +++- app/filters.php | 2 + app/libraries/AppUtilities.php | 2 +- .../UserStoreManager/UserStoreManager.php | 6 +- app/libraries/WSISClient.php | 20 +- app/libraries/wsis_utilities.php | 24 ++- app/routes.php | 2 + app/views/admin/manage-admin1.blade.php | 109 ---------- app/views/admin/manage-gateway.blade.php | 213 +++++++++++++++++++ app/views/admin/manage-roles.blade.php | 93 +++++++- app/views/admin/manage-users.blade.php | 51 ++++- app/views/application/interface.blade.php | 36 ++-- app/views/partials/dashboard-block.blade.php | 2 +- public/css/admin.css | 3 +- public/css/bootstrap.min.css | 4 + 16 files changed, 462 insertions(+), 153 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/861e7779/app/config/app_config.ini ---------------------------------------------------------------------- diff --git a/app/config/app_config.ini b/app/config/app_config.ini index b6144d6..194938a 100644 --- a/app/config/app_config.ini +++ b/app/config/app_config.ini @@ -12,7 +12,8 @@ admin-username = "[email protected]" ;Tenant admin's password admin-password = "[email protected]" -;Super admin-password = "sci9067@min" +;Super Admin's password +;admin-password = "sci9067@min" ;Identity server domain server = "idp.scigap.org" http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/861e7779/app/controllers/AdminController.php ---------------------------------------------------------------------- diff --git a/app/controllers/AdminController.php b/app/controllers/AdminController.php index bdf539a..425d0a2 100644 --- a/app/controllers/AdminController.php +++ b/app/controllers/AdminController.php @@ -28,6 +28,8 @@ class AdminController extends BaseController { } public function dashboard(){ + + //Session::put("scigap_admin", true); $idStore = $this->idStore; //$ti = $idStore->createTenant( Input::all() ); //print_r( $ti); exit; @@ -35,11 +37,15 @@ class AdminController extends BaseController { foreach ($roles as $key => $role) { //$gatewayAdmins = $idStore->getUserListOfRole } + $crData = CRUtilities::getEditCRData(); $gateways = CRUtilities::getAllGatewayProfilesData(); //var_dump( $gatewayProfiles[0]); exit; //return View::make("admin/manage-admin", array( "roles" => $roles, "gatewayProfiles" => $gatewayProfiles)); - return View::make("admin/manage-admin1", array( "gateways" => $gateways)); + return View::make("admin/manage-gateway", array( + "gateways" => $gateways, + "computeResources" => CRUtilities::getAllCRObjects(), + "crData" => $crData)); } public function addAdminSubmit(){ @@ -51,17 +57,21 @@ class AdminController extends BaseController { public function usersView(){ $idStore = $this->idStore; - $users = $idStore->listUsers(); - - return View::make("admin/manage-users", array("users" => $users)); - - } + if( Input::has("role")) + { + $users = $idStore->getUserListOfRole( Input::get("role")); + if( isset( $users->return)) + $users = $users->return; + else + $users = array(); + } + else + $users = $idStore->listUsers(); + + $roles = $idStore->getRoleNames(); - public function addRole(){ - $idStore = $this->idStore; + return View::make("admin/manage-users", array("users" => $users, "roles" => $roles)); - $idStore->addRole( Input::get("role") ); - return Redirect::to("manage/admins")->with("Admin has been added."); } public function addGatewayAdminSubmit(){ @@ -98,4 +108,19 @@ class AdminController extends BaseController { return View::make("admin/manage-roles", array("roles" => $roles)); } + + public function addRole(){ + $idStore = $this->idStore; + + $idStore->addRole( Input::get("role") ); + return Redirect::to("admin/dashboard/roles")->with( "message", "Role has been added."); + } + + public function deleteRole(){ + $idStore = $this->idStore; + + $idStore->deleteRole( Input::get("role") ); + return Redirect::to("admin/dashboard/roles")->with( "message", "Role has been deleted."); + + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/861e7779/app/filters.php ---------------------------------------------------------------------- diff --git a/app/filters.php b/app/filters.php index b5d641e..93b988b 100755 --- a/app/filters.php +++ b/app/filters.php @@ -106,7 +106,9 @@ Route::filter('verifyadmin', function() if( Utilities::verify_login() ) { if( !Session::has("admin")) + { return Redirect::to("home")->with("admin-alert", true); + } } else return Redirect::to("home")->with("login-alert", true); http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/861e7779/app/libraries/AppUtilities.php ---------------------------------------------------------------------- diff --git a/app/libraries/AppUtilities.php b/app/libraries/AppUtilities.php index 6e034c4..af85485 100644 --- a/app/libraries/AppUtilities.php +++ b/app/libraries/AppUtilities.php @@ -114,7 +114,7 @@ class AppUtilities{ if( $update) $airavataclient->updateApplicationInterface( $appInterfaceValues["app-interface-id"], $appInterface); else - $airavataclient->getApplicationInterface($airavataclient->registerApplicationInterface( $appInterface) ); + $airavataclient->getApplicationInterface($airavataclient->registerApplicationInterface( Session::get("gateway_id", $appInterface) ); //print_r( "App interface has been created."); } http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/861e7779/app/libraries/UserStoreManager/UserStoreManager.php ---------------------------------------------------------------------- diff --git a/app/libraries/UserStoreManager/UserStoreManager.php b/app/libraries/UserStoreManager/UserStoreManager.php index 9b8f9d8..6732a9b 100755 --- a/app/libraries/UserStoreManager/UserStoreManager.php +++ b/app/libraries/UserStoreManager/UserStoreManager.php @@ -168,10 +168,10 @@ class UserStoreManager { * @param GetUserListOfRole $parameters * @return GetUserListOfRoleResponse */ - public function getUserListOfRole( $role){ + public function getUserListOfRole( $roleName){ $parameters = new GetUserListOfRole(); - $paramerters->roleName = $role; - return $this->serviceStub->getUserListOfRole( $paramerters)->return; + $parameters->roleName = $roleName; + return $this->serviceStub->getUserListOfRole( $parameters); } /** http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/861e7779/app/libraries/WSISClient.php ---------------------------------------------------------------------- diff --git a/app/libraries/WSISClient.php b/app/libraries/WSISClient.php index 93a9262..47e242d 100755 --- a/app/libraries/WSISClient.php +++ b/app/libraries/WSISClient.php @@ -162,6 +162,23 @@ class WSISClient { 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 @@ -197,8 +214,9 @@ class WSISClient { */ public function get_userlist_of_role( $role){ try { - return $this->userStoreManager->getRoleListOfUser( $role); + return $this->userStoreManager->getUserListOfRole( $role); } catch (Exception $ex) { + var_dump( $ex); exit; throw new Exception("Unable to get user list of roles.", 0, $ex); } } http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/861e7779/app/libraries/wsis_utilities.php ---------------------------------------------------------------------- diff --git a/app/libraries/wsis_utilities.php b/app/libraries/wsis_utilities.php index 0757984..311ce56 100755 --- a/app/libraries/wsis_utilities.php +++ b/app/libraries/wsis_utilities.php @@ -211,10 +211,25 @@ class WSISUtilities implements IdUtilities{ try{ return $this->wsis_client->add_role( $roleName); } catch (Exception $ex) { - var_dump($ex); exit; 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 { + $this->wsis_client->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 * @@ -254,7 +269,12 @@ class WSISUtilities implements IdUtilities{ */ public function getUserListOfRole($role) { - // TODO: Implement getUserListOfRole() method. + try{ + return $this->wsis_client->get_userlist_of_role( $role); + } catch (Exception $ex) { + var_dump( $ex); exit; + throw new Exception("Unable to get users.", 0, NULL); + } } /** http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/861e7779/app/routes.php ---------------------------------------------------------------------- diff --git a/app/routes.php b/app/routes.php index a9f6754..7c55a33 100755 --- a/app/routes.php +++ b/app/routes.php @@ -157,6 +157,8 @@ Route::post("admin/addgatewayadmin", "AdminController@addGatewayAdminSubmit"); Route::post("admin/addrole", "AdminController@addRole"); +Route::post("admin/deleterole", "AdminController@deleteRole"); + //Airavata Server Check Route::get("airavata/down", function(){ return View::make("server-down"); http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/861e7779/app/views/admin/manage-admin1.blade.php ---------------------------------------------------------------------- diff --git a/app/views/admin/manage-admin1.blade.php b/app/views/admin/manage-admin1.blade.php deleted file mode 100644 index 8667cf2..0000000 --- a/app/views/admin/manage-admin1.blade.php +++ /dev/null @@ -1,109 +0,0 @@ -@extends('layout.basic') - -@section('page-header') - @parent - {{ HTML::style('css/admin.css')}} -@stop - -@section('content') - - <div id="wrapper"> - <!-- Sidebar Menu Items - These collapse to the responsive navigation menu on small screens --> - @include( 'partials/dashboard-block') - <div id="page-wrapper"> - - <div class="container-fluid"> - - <div class="row"> - - <div class="col-md-6"> - <h3>Existing Gateway Resource Profiles :</h3> - </div> - <div class="col-md-6" style="margin-top:3.5%"> - <input type="text" class="col-md-12 filterinput" placeholder="Search by Gateway Name" /> - </div> - </div> - <div class="panel-group" id="accordion2"> - @foreach( $gateways as $indexGP => $gp ) - <div class="panel panel-default"> - <div class="panel-heading"> - <h4 class="panel-title"> - <a class="accordion-toggle collapsed gateway-name" data-toggle="collapse" data-parent="#accordion2" href="#collapse-gateway-{{$indexGP}}"> - {{ $gp->gatewayName }} - </a> - <div class="pull-right col-md-2 gateway-options fade"> - <span class="glyphicon glyphicon-pencil edit-gateway" style="cursor:pointer;" data-toggle="modal" data-target="#edit-gateway-block" data-gp-id="{{ $gp->gatewayId }}" data-gp-name="{{ $gp->gatewayName }}"></span> - <span class="glyphicon glyphicon-trash delete-gateway" style="cursor:pointer;" data-toggle="modal" data-target="#delete-gateway-block" data-gp-name="{{$gp->gatewayName}}" data-gp-id="{{ $gp->gatewayId }}"></span> - </div> - </h4> - </div> - <div id="collapse-gateway-{{$indexGP}}" class="panel-collapse collapse"> - <div class="panel-body"> - <div class="app-interface-block"> - <div class="row"> - <div class="col-md-10"> - <h4><span class="glyphicon glyphicon-plus"></span> Add a user as Admin to this Gateway</h4> - <form action="{{URL::to('/')}}/admin/addgatewayadmin" method="POST" role="form" enctype="multipart/form-data"> - <div class="form-group required"> - <label for="experiment-name" class="control-label">Enter Username</label> - <input type="text" class="form-control" name="username" id="experiment-name" placeholder="username" autofocus required="required"> - <input type="hidden" name="gateway_name" value="{{ $gp->gatewayName }}"/> - </div> - <div class="btn-toolbar"> - <input name="add" type="submit" class="btn btn-primary" value="Add Admin"/> - </div> - </form> - </div> - </div> - </div> - </div> - </div> - </div> - @endforeach - </div> - <div class="col-md-12"> - <button type="button" class="btn btn-default toggle-add-tenant"><span class="glyphicon glyphicon-plus"></span>Add a new gateway</button> - </div> - <div class="add-tenant col-md-6"> - <div class="form-group"> - <label>Enter Domain Name</label> - <input type="text" class="form-control"/> - </div> - <div class="form-group"> - <label>Enter Admin Username</label> - <input type="text" class="form-control"/> - </div> - <div class="form-group"> - <label>Enter Admin Password</label> - <input type="text" class="form-control"/> - </div> - <div class="form-group"> - <label>Re-enter Admin Password</label> - <input type="text" class="form-control"/> - </div> - <div class="form-group"> - <input type="submit" class="form-control btn btn-primary" value="Register" /> - </div> - </div> - - </div> - <!-- /.container-fluid --> - - </div> - <!-- /#page-wrapper --> - - </div> - -@stop - - -@section('scripts') - @parent - <script> - $(".add-tenant").slideUp(); - - $(".toggle-add-tenant").click( function(){ - $(".add-tenant").slideDown(); - }); - </script> -@stop \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/861e7779/app/views/admin/manage-gateway.blade.php ---------------------------------------------------------------------- diff --git a/app/views/admin/manage-gateway.blade.php b/app/views/admin/manage-gateway.blade.php new file mode 100644 index 0000000..d96af00 --- /dev/null +++ b/app/views/admin/manage-gateway.blade.php @@ -0,0 +1,213 @@ +@extends('layout.basic') + +@section('page-header') + @parent + {{ HTML::style('css/admin.css')}} +@stop + +@section('content') + + <div id="wrapper"> + <!-- Sidebar Menu Items - These collapse to the responsive navigation menu on small screens --> + @include( 'partials/dashboard-block') + <div id="page-wrapper"> + + <div class="container-fluid"> + + <div class="row"> + + <div class="col-md-6"> + @if( Session::has("scigap_admin") ) + <h3>Existing Gateways :</h3> + @else + <h3>Gateway Settings</h3> + @endif + </div> + @if( Session::has("scigap_admin")) + <div class="col-md-6" style="margin-top:3.5%"> + <input type="text" class="col-md-12 filterinput" placeholder="Search by Gateway Name" /> + </div> + @endif + </div> + <div class="panel-group" id="accordion2"> + @foreach( $gateways as $indexGP => $gp ) + <div class="panel panel-default"> + <div class="panel-heading"> + <h4 class="panel-title"> + <a class="accordion-toggle collapsed gateway-name" data-toggle="collapse" data-parent="#accordion2" href="#collapse-gateway-{{$indexGP}}"> + {{ $gp->gatewayName }} + </a> + <div class="pull-right col-md-2 gateway-options fade"> + <span class="glyphicon glyphicon-pencil edit-gateway" style="cursor:pointer;" data-toggle="modal" data-target="#edit-gateway-block" data-gp-id="{{ $gp->gatewayId }}" data-gp-name="{{ $gp->gatewayName }}"></span> + <span class="glyphicon glyphicon-trash delete-gateway" style="cursor:pointer;" data-toggle="modal" data-target="#delete-gateway-block" data-gp-name="{{$gp->gatewayName}}" data-gp-id="{{ $gp->gatewayId }}"></span> + </div> + </h4> + </div> + <div id="collapse-gateway-{{$indexGP}}" class="panel-collapse collapse"> + <div class="panel-body"> + <div class="app-interface-block"> + <div class="row"> + <div class="col-md-10"> + @if( count( $gp->profile->computeResourcePreferences) ) + <div class="col-md-12"> + <h3>Existing Compute Resources :</h3> + </div> + @endif + <div class="accordion-inner"> + <div class="panel-group" id="accordion-{{$indexGP}}"> + @foreach( (array)$gp->profile->computeResourcePreferences as $indexCRP => $crp ) + <div class="panel panel-default"> + <div class="panel-heading"> + <h4 class="panel-title"> + <a class="accordion-toggle collapsed gateway-name" data-toggle="collapse" data-parent="#accordion" href="#collapse-crp-{{$indexGP}}-{{$indexCRP}}"> + {{ $crp->crDetails->hostName }} + </a> + <div class="pull-right col-md-2 gateway-options fade"> + <span class="glyphicon glyphicon-remove remove-resource" style="cursor:pointer;" data-toggle="modal" data-target="#remove-resource-block" data-cr-name="{{$crp->crDetails->hostName}}" data-cr-id="{{$crp->computeResourceId}}" data-gp-id="{{ $gp->gatewayId }}"></span> + </div> + </h4> + </div> + <div id="collapse-crp-{{$indexGP}}-{{$indexCRP}}" class="panel-collapse collapse"> + <div class="panel-body"> + <div class="app-compute-resource-preferences-block"> + <form action="{{URL::to('/')}}/gp/update-crp" method="POST"> + <input type="hidden" name="gatewayId" id="gatewayId" value="{{$gp->gatewayId}}"> + <input type="hidden" name="computeResourceId" id="gatewayId" value="{{$crp->computeResourceId}}"> + <div class="form-horizontal"> + @include('partials/gateway-preferences', array('computeResource' => $crp->crDetails, 'crData' => $crData, 'preferences'=>$crp, 'show'=>true)) + </div> + </form> + </div> + </div> + </div> + </div> + @endforeach + </div> + </div> + + <h4><span class="glyphicon glyphicon-plus"></span> Add a user as Admin to this Gateway</h4> + <form action="{{URL::to('/')}}/admin/addgatewayadmin" method="POST" role="form" enctype="multipart/form-data"> + <div class="form-group required"> + <label for="experiment-name" class="control-label">Enter Username</label> + <input type="text" class="form-control" name="username" id="experiment-name" placeholder="username" autofocus required="required"> + <input type="hidden" name="gateway_name" value="{{ $gp->gatewayName }}"/> + </div> + <div class="btn-toolbar"> + <input name="add" type="submit" class="btn btn-primary" value="Add Admin"/> + </div> + </form> + </div> + </div> + </div> + </div> + </div> + </div> + @endforeach + </div> + @if( Session::has("scigap_admin")) + <div class="col-md-12"> + <button type="button" class="btn btn-default toggle-add-tenant"><span class="glyphicon glyphicon-plus"></span>Add a new gateway</button> + </div> + <div class="add-tenant col-md-6"> + <div class="form-group"> + <label>Enter Domain Name</label> + <input type="text" class="form-control"/> + </div> + <div class="form-group"> + <label>Enter Admin Username</label> + <input type="text" class="form-control"/> + </div> + <div class="form-group"> + <label>Enter Admin Password</label> + <input type="text" class="form-control"/> + </div> + <div class="form-group"> + <label>Re-enter Admin Password</label> + <input type="text" class="form-control"/> + </div> + <div class="form-group"> + <input type="submit" class="form-control btn btn-primary" value="Register" /> + </div> + </div> + @endif + + </div> + <!-- /.container-fluid --> + + </div> + <!-- /#page-wrapper --> + + </div> + + +<div class="add-compute-resource-block hide"> + <div class="well"> + <form action="{{URL::to('/')}}/gp/add-crp" method="POST"> + <input type="hidden" name="gatewayId" id="gatewayId" value=""> + <div class="input-group"> + <select name="computeResourceId" class="cr-select form-control"> + <option value="">Select a compute Resource and set its preferences</option> + @foreach( (array)$computeResources as $index => $cr) + <option value="{{ $cr->computeResourceId}}">{{ $cr->hostName }}</option> + @endforeach + </select> + <span class="input-group-addon remove-cr" style="cursor:pointer;">x</span> + </div> + <div class="pref-space form-horizontal"></div> + </form> + </div> +</div> + + +<!-- Remove a Compute Resource from a Gateway --> +<div class="modal fade" id="remove-resource-block" tabindex="-1" role="dialog" aria-labelledby="add-modal" aria-hidden="true"> + <div class="modal-dialog"> + + <form action="{{URL::to('/')}}/gp/remove-cr" method="POST"> + <div class="modal-content"> + <div class="modal-header"> + <h3 class="text-center">Remove Compute Resource Confirmation</h3> + </div> + <div class="modal-body"> + <input type="hidden" class="form-control remove-crId" name="rem-crId"/> + <input type="hidden" class="form-control cr-gpId" name="gpId"/> + + Do you really want to remove the Compute Resource, <span class="remove-cr-name"> </span>from the selected Gateway? + </div> + <div class="modal-footer"> + <div class="form-group"> + <input type="submit" class="btn btn-danger" value="Remove"/> + <input type="button" class="btn btn-default" data-dismiss="modal" value ="Cancel"/> + </div> + </div> + </div> + + </form> + </div> +</div> + +<!-- contains all compute resource choices that might get selected on adding a new one to a gateway --> +@foreach( (array)$computeResources as $index => $cr) + @include('partials/gateway-preferences', array('computeResource' => $cr, 'crData' => $crData)) +@endforeach + + + +@stop + + +@section('scripts') + @parent + {{ HTML::script('js/gateway.js') }} + <script> + + //make first tab of accordion open by default. + //temporary fix + $("#accordion2").children(".panel").children(".collapse").addClass("in"); + $(".add-tenant").slideUp(); + + $(".toggle-add-tenant").click( function(){ + $(".add-tenant").slideDown(); + }); + </script> +@stop \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/861e7779/app/views/admin/manage-roles.blade.php ---------------------------------------------------------------------- diff --git a/app/views/admin/manage-roles.blade.php b/app/views/admin/manage-roles.blade.php index 8104bd7..6d8a6b8 100644 --- a/app/views/admin/manage-roles.blade.php +++ b/app/views/admin/manage-roles.blade.php @@ -33,18 +33,105 @@ </tr> @foreach( $roles as $role) <tr> - <td>{{ $role }}</td> + <td class="role-name">{{ $role }}</td> <td> - <span class="glyphicon glyphicon-pencil"></span> - <span class="glyphicon glyphicon-remove"></span> + <span class="glyphicon glyphicon-pencil edit-role-name"></span> + <a href="{{URL::to('/')}}/admin/dashboard/users?role={{$role}}"> + <span class="glyphicon glyphicon-user role-users"></span> + </a> + <span class="glyphicon glyphicon-trash delete-role"></span> </td> </tr> @endforeach </table> + <div class="col-md-12"> + <button type="button" class="btn btn-default toggle-add-role"><span class="glyphicon glyphicon-plus"></span>Add a new Role</button> + </div> + <div class="add-role col-md-6"> + <form role="form" action="{{URL::to('/')}}/admin/addrole" method="POST" class="add-role-form"> + <div class="form-group"> + <label>Enter Role Name</label> + <input type="text" name="role" class="form-control"/> + </div> + <div class="form-group"> + <input type="submit" class="form-control btn btn-primary" value="Add" /> + </div> + </form> + </div> + + <div class="edit-role hide"> + <form class="edit-role-form"> + <div class="form-group col-md-4"> + <input type="text" name="new-role-name" class="new-role-name form-control"/> + <input type="hidden" name="original-role-name" class="original-role-name" value=""/> + </div> + <div class="form-group col-md-4"> + <input type="submit" class="form-control btn btn-primary" value="Edit" /> + </div> + </form> + </div> </div> </div> </div> </div> + <div class="modal fade" id="delete-role-block" tabindex="-1" role="dialog" aria-labelledby="add-modal" aria-hidden="true"> + <div class="modal-dialog"> + + <form action="{{URL::to('/')}}/admin/deleterole" method="POST"> + <div class="modal-content"> + <div class="modal-header"> + <h3 class="text-center">Delete Role Confirmation</h3> + </div> + <div class="modal-body"> + <input type="hidden" class="form-control delete-roleName" name="role"/> + Do you really want to delete the role - <span class="delete-role-name"></span> + </div> + <div class="modal-footer"> + <div class="form-group"> + <input type="submit" class="btn btn-danger" value="Delete"/> + <input type="button" class="btn btn-default" data-dismiss="modal" value ="Cancel"/> + </div> + </div> + </div> + + </form> + + + </div> + </div> + + +@stop + +@section('scripts') + @parent + <script> + $(".toggle-add-role").click( function(){ + $(".add-role").slideDown(); + }); + + $(".edit-role-name").click( function(){ + var roleNameSpace = $(this).parent().parent().find(".role-name"); + if( roleNameSpace.find(".edit-role-form").length ) + { + roleNameSpace.html( roleNameSpace.find(".original-role-name").val() ); + } + else + { + var role = roleNameSpace.html(); + roleNameSpace.html( $(".edit-role").html() ); + roleNameSpace.find(".original-role-name").val( role ); + roleNameSpace.find(".new-role-name").val( role ); + } + }); + + $(".delete-role").click( function(){ + $("#delete-role-block").modal("show"); + var roleName = $(this).parent().parent().find(".role-name").html(); + $(".delete-role-name").html(roleName); + $(".delete-roleName").val(roleName); + }) + </script> @stop \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/861e7779/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 2132281..8d098f7 100644 --- a/app/views/admin/manage-users.blade.php +++ b/app/views/admin/manage-users.blade.php @@ -29,12 +29,24 @@ <table class="table table-striped table-condensed"> <tr> <th>Username</th> - <th>Role</th> + <th> + Role : + <select onchange="location = this.options[this.selectedIndex].value;"> + <option>Select a role</option> + <option value="{{URL::to('/')}}/admin/dashboard/users">All</option> + @foreach( (array)$roles as $role) + <option value="{{URL::to('/')}}/admin/dashboard/users?role={{$role}}">{{$role}}</option> + @endforeach + </select> + </th> </tr> - @foreach( $users as $user) + @foreach( (array)$users as $user) <tr> <td>{{ $user }}</td> - <td><button class="button btn btn-default" type="button">Check Role</button></td> + <td> + <button class="button btn btn-default check-role" type="button">Check Role</button> + <div class="user-roles"></div> + </td> </tr> @endforeach </table> @@ -44,4 +56,37 @@ </div> </div> + <div class="modal fade" id="check-role-block" tabindex="-1" role="dialog" aria-labelledby="add-modal" aria-hidden="true"> + <div class="modal-dialog"> + <div class="modal-content"> + <div class="modal-header"> + <h3 class="text-center">User Roles</h3> + </div> + <div class="modal-body"> + User roles will be displayed and modified here. + </div> + <div class="modal-footer"> + <div class="form-group"> + <input type="submit" class="btn btn-primary" data-dismiss="modal" value="Ok"/> + </div> + </div> + </div> + + </form> + + + </div> + </div> + +@stop + +@section('scripts') + @parent + <script> + $(".check-role").click( function(){ + $("#check-role-block").modal("show"); + }); + + + </script> @stop \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/861e7779/app/views/application/interface.blade.php ---------------------------------------------------------------------- diff --git a/app/views/application/interface.blade.php b/app/views/application/interface.blade.php index 1057099..140a951 100644 --- a/app/views/application/interface.blade.php +++ b/app/views/application/interface.blade.php @@ -132,30 +132,30 @@ </div> <div class="modal fade" id="delete-app-interface-block" tabindex="-1" role="dialog" aria-labelledby="add-modal" aria-hidden="true"> - <div class="modal-dialog"> - - <form action="{{URL::to('/')}}/app/interface-delete" method="POST"> - <div class="modal-content"> - <div class="modal-header"> - <h3 class="text-center">Delete Confirmation Application Interface</h3> - </div> - <div class="modal-body"> - <input type="hidden" class="form-control delete-interfaceid" name="appInterfaceId"/> - Do you really want to delete the Application Interface - <span class="delete-interface-name"></span> - </div> - <div class="modal-footer"> - <div class="form-group"> - <input type="submit" class="btn btn-danger" value="Delete"/> - <input type="button" class="btn btn-default" data-dismiss="modal" value ="Cancel"/> - </div> + <div class="modal-dialog"> + + <form action="{{URL::to('/')}}/app/interface-delete" method="POST"> + <div class="modal-content"> + <div class="modal-header"> + <h3 class="text-center">Delete Confirmation Application Interface</h3> + </div> + <div class="modal-body"> + <input type="hidden" class="form-control delete-interfaceid" name="appInterfaceId"/> + Do you really want to delete the Application Interface - <span class="delete-interface-name"></span> + </div> + <div class="modal-footer"> + <div class="form-group"> + <input type="submit" class="btn btn-danger" value="Delete"/> + <input type="button" class="btn btn-default" data-dismiss="modal" value ="Cancel"/> </div> </div> + </div> - </form> + </form> - </div> </div> +</div> @stop http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/861e7779/app/views/partials/dashboard-block.blade.php ---------------------------------------------------------------------- diff --git a/app/views/partials/dashboard-block.blade.php b/app/views/partials/dashboard-block.blade.php index b4f405b..2db3712 100644 --- a/app/views/partials/dashboard-block.blade.php +++ b/app/views/partials/dashboard-block.blade.php @@ -1,7 +1,7 @@ <div class="collapse navbar-collapse navbar-ex1-collapse"> <ul class="nav navbar-nav side-nav"> <li @if( Session::has("manage")) class="active" @endif> - <a href="{{ URL::to('/')}}/admin/dashboard/gateway"><i class="fa fa-fw fa-dashboard"></i> Gateways</a> + <a href="{{ URL::to('/')}}/admin/dashboard/gateway"><i class="fa fa-fw fa-dashboard"></i> Gateway @if( Session::has("scigap_admin"))s @endif</a> </li> <li> <a href="{{ URL::to('/')}}/admin/dashboard/users"><i class="fa fa-fw fa-bar-chart-o"></i> Users</a> http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/861e7779/public/css/admin.css ---------------------------------------------------------------------- diff --git a/public/css/admin.css b/public/css/admin.css index 49dd40c..58739c5 100644 --- a/public/css/admin.css +++ b/public/css/admin.css @@ -235,4 +235,5 @@ ul.alert-dropdown { .navbar-ex1-collapse .active a{ background-color: #000; color: #fff; -} \ No newline at end of file +} +.add-role, .add-tenant{ display: none;} http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/861e7779/public/css/bootstrap.min.css ---------------------------------------------------------------------- diff --git a/public/css/bootstrap.min.css b/public/css/bootstrap.min.css index 2ed4b11..55d56ab 100644 --- a/public/css/bootstrap.min.css +++ b/public/css/bootstrap.min.css @@ -50,4 +50,8 @@ body{ .navbar-inverse{ background: #2c3e50; +} + +.glyphicon{ + cursor: pointer; } \ No newline at end of file
