Skip to content

Commit

Permalink
Merge remote-tracking branch 'sneha/2233' into develop
Browse files Browse the repository at this point in the history
This closes #63
  • Loading branch information
machristie committed Jul 4, 2017
2 parents 06544a1 + 1b3afd1 commit 8fefd01
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 11 deletions.
10 changes: 7 additions & 3 deletions app/controllers/AdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ public function addGatewayAdminSubmit(){
}
}

public function updateGatewayRequest(){
public function updateGateway(){

$returnVal = AdminUtilities::update_gateway( Input::get("internal_gateway_id"), Input::except("oauthClientId","oauthClientSecret"));
if( Request::ajax()){
Expand All @@ -178,6 +178,10 @@ public function updateGatewayRequest(){
$user_profile = Keycloak::getUserProfile($username);
EmailUtilities::mailToUser($user_profile["firstname"], $user_profile["lastname"], $email, Input::get("gateway_id"));
EmailUtilities::mailToAdmin($email, Input::get("gateway_id"));
if (isset($gatewayData["createTenant"]))
Session::put("successMessages", "Tenant has been created successfully!");
else
Session::put("successMessages", "Gateway has been updated successfully!");
return json_encode(AdminUtilities::get_gateway(Input::get("internal_gateway_id")));
}
else {
Expand All @@ -191,10 +195,10 @@ public function updateGatewayRequest(){
$user_profile = Keycloak::getUserProfile($username);
EmailUtilities::mailToUser($user_profile["firstname"], $user_profile["lastname"], $email, Input::get("gateway_id"));
EmailUtilities::mailToAdmin($email, Input::get("gateway_id"));
Session::put("message", "Request has been updated");
Session::put("message", "Gateway has been updated successfully!");
}
else {
Session::put("message", "An error has occurred while updating your request. Please make sure you've entered all the details correctly. Try again or contact admin to report the issue.");
Session::put("message", "An error has occurred while updating your Gateway. Please make sure you've entered all the details correctly. Try again or contact the Admin to report the issue.");
}

return Redirect::back();
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/GatewayRequestUpdateController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
class GatewayRequestUpdateController extends BaseController
{

public function updateGatewayRequest(){
public function updateGateway(){

$gateway = AdminUtilities::update_form( Input::get("gateway-id"), Input::all() );

Expand Down
3 changes: 3 additions & 0 deletions app/libraries/AdminUtilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ public static function update_gateway( $gatewayId, $gatewayData){
return -1;
}
}
if ($gateway->identityServerPasswordToken == null)
return -1;
$gateway = IamAdminServices::setUpGateway( Session::get('authz-token'), $gateway);
$gateway->gatewayApprovalStatus = GatewayApprovalStatus::CREATED;
}
Expand All @@ -175,6 +177,7 @@ public static function update_gateway( $gatewayId, $gatewayData){
$gateway->gatewayAdminFirstName = $gatewayData["gatewayAdminFirstName"];
$gateway->gatewayAdminLastName = $gatewayData["gatewayAdminLastName"];
$gateway->identityServerUserName = $gatewayData["identityServerUserName"];
$gateway->gatewayAdminEmail = $gatewayData["gatewayAdminEmail"];
$gateway->reviewProposalDescription = $gatewayData["reviewProposalDescription"];
$gateway->gatewayPublicAbstract = $gatewayData["gatewayPublicAbstract"];
$gateway->gatewayApprovalStatus = GatewayApprovalStatus::APPROVED;
Expand Down
4 changes: 2 additions & 2 deletions app/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

Route::get("account/dashboard", "AccountController@dashboard");

Route::get("account/update-gateway", "GatewayRequestUpdateController@updateGatewayRequest");
Route::get("account/update-gateway", "GatewayRequestUpdateController@updateGateway");

Route::get("callback-url", "AccountController@oauthCallback");

Expand Down Expand Up @@ -379,7 +379,7 @@
Route::get("admin/add-gateway", "AdminController@createGateway");
Route::get("admin/add-new-gateway", "AdminController@addGateway");

Route::get("admin/update-gateway-request", "AdminController@updateGatewayRequest");
Route::get("admin/update-gateway-request", "AdminController@updateGateway");

/*
* Theme Pages Routes
Expand Down
22 changes: 17 additions & 5 deletions app/views/admin/manage-gateway.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,17 @@ class="sr-only">Close</span></button>
</div>
{{ Session::forget("errorMessages") }}
@endif

@if (Session::has("successMessages"))
<div class="row">
<div class="alert alert-success alert-dismissible" role="alert">
<button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">&times;</span><span
class="sr-only">Close</span></button>
{{ Session::get("successMessages") }}
</div>
</div>
{{ Session::forget("successMessages") }}
@endif
</div>

@if ($errors->has())
Expand Down Expand Up @@ -230,7 +241,7 @@ class="glyphicon glyphicon-plus"></span>Add a new gateway
<form action="{{URL::to('/')}}/admin/update-gateway-request" id="update-gateway-request" method="GET">

<div class="modal-header">
<button type="button" class="close update-gateway-request-close-modal" data-dismiss="modal" aria-label="Close" onclick="window.location.reload()"><span
<button type="button" class="close update-gateway-request-close-modal" data-dismiss="modal" aria-label="Close" ><span
aria-hidden="true">&times;</span></button>

<h3>View the Gateway Details</h3>
Expand Down Expand Up @@ -768,23 +779,24 @@ function disableInputs( elem){
if( data == -1 ){
//errors only with -1
if( updateVal == "createTenant"){
$(".submit-actions").before("<div class='alert alert-danger fail-alert'>All fields are required to create the gateway! Please make sure you've first updated all the Gateway details accurately. Try again or contact admin to report the issue.");
$(".submit-actions").before("<div class='alert alert-danger fail-alert'>All fields are required to create the gateway! Please make sure you've first updated all the Gateway details accurately and try again. Ask the Gateway Provider to set a Password token if they haven't set it yet.");
}
else{
$(".submit-actions").before("<div class='alert alert-danger fail-alert'>Error updating Gateway. Please try again.");
}
}
else{
if( updateVal == "createTenant"){
/*if( updateVal == "createTenant"){
$(".submit-actions").before("<div class='alert alert-success success-alert'>Tenant has been created!");
$(".notCreatedGateway").addClass("hide");
$(".createdGateway").removeClass("hide");
}
else{
$(".submit-actions").before("<div class='alert alert-success success-alert'>Gateway has been updated successfully.");
}
}*/
window.location.reload();
//refresh data next time if same popup is opened.
var gatewayIdWithoutSpaces = dataObj['gateway_id'].replace(/\s+/g, '-');
Expand Down

0 comments on commit 8fefd01

Please sign in to comment.