Repository: airavata-php-gateway Updated Branches: refs/heads/develop 5e16ca779 -> f421e1e06
Remove Storage link from gateway provider ui + code cleanup 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/4c886f57 Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/4c886f57 Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/4c886f57 Branch: refs/heads/develop Commit: 4c886f572c139e54c1f905bde63aa2b2914c5bb3 Parents: 5e16ca7 Author: Nipurn Doshi <[email protected]> Authored: Mon Sep 26 21:56:08 2016 -0700 Committer: Nipurn Doshi <[email protected]> Committed: Mon Sep 26 21:56:08 2016 -0700 ---------------------------------------------------------------------- app/libraries/CommonUtilities.php | 6 +- app/views/admin/manage-users.blade.php | 121 +++++++++++----------------- 2 files changed, 51 insertions(+), 76 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/4c886f57/app/libraries/CommonUtilities.php ---------------------------------------------------------------------- diff --git a/app/libraries/CommonUtilities.php b/app/libraries/CommonUtilities.php index bc45135..962bbcd 100644 --- a/app/libraries/CommonUtilities.php +++ b/app/libraries/CommonUtilities.php @@ -186,8 +186,10 @@ class CommonUtilities echo '<li class="brand-logo"></li>'; $active = ""; - if(Session::has('loggedin') && (Session::has('authorized-user') || Session::has('admin') - || Session::has('admin-read-only'))){ + if(Session::has('loggedin') && + (Session::has('authorized-user') || Session::has('admin') || Session::has('admin-read-only')) && + !Session::has("gateway-provider") + ){ if( Session::get("nav-active") == "storage") $active = "active"; echo '<li class="' . $active . '"><a href="' . URL::to("/") . '/files/browse"><span class="glyphicon glyphicon-folder-close"></span> Storage</a></li>'; http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/4c886f57/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 f5cb2f4..8b07e9e 100644 --- a/app/views/admin/manage-users.blade.php +++ b/app/views/admin/manage-users.blade.php @@ -102,7 +102,11 @@ <select multiple name="new-role" class="new-roles-select" class="form-control"> <!-- <option>Select a role</option>--> @foreach( (array)$roles as $role) - <option value="{{$role}}">{{$role}}</option> + @if( strpos( $role, 'Internal/') === false || + strpos( $role, 'Application/') === false + ) + <option value="{{$role}}">{{$role}}</option> + @endif @endforeach </select> <button type="button" class="btn btn-primary add-roles-submit" data-username="">Add Roles @@ -147,43 +151,7 @@ function update_users_existing_roles(that){ userName = $(that).data("username"); - $("#check-role-block").modal("show"); - $(".roles-of-user").html("User : " + userName); - $(".roles-load").removeClass("hide"); - $(".roles-list").addClass("hide"); - $(".add-roles-submit").data("username", userName); - $(that).find(".alert-success").remove(); - - //getting user's existing roles - $.ajax({ - type: "POST", - url: $(".base-url").val() + "/admin/check-roles", - data: { - username: userName - } - }).complete(function (data) { - roles = JSON.parse(data.responseText); - roleBlocks = ""; - $(".new-roles-select option").each(function () { - $(this).removeAttr("disabled"); - }); - for (var i = 0; i < roles.length; i++) { - //disable roles which user already has. - $(".new-roles-select option").each(function () { - if ($(this).val().trim() == roles[i].trim()){ - $(this).attr("disabled", "disabled"); - } - }); - $(".role-block").find(".role-name").html(roles[i]); - $(".role-block").find(".existing-role-button").attr("roleName", roles[i]); - var newRoleBlock = $(".role-block").html(); - roleBlocks += newRoleBlock; - $(".roles-list").html(roleBlocks); - $(".add-roles-block").removeClass("hide"); - } - $(".roles-load").addClass("hide"); - $(".roles-list").removeClass("hide"); - }); + repopulatePopup( username); $(document).on("click",".existing-role-button",function(e) { e.preventDefault(); @@ -197,43 +165,8 @@ roleName:$(this).attr("roleName") } }).complete(function (data) { - $("#check-role-block").modal("show"); - $(".roles-of-user").html("User : " + userName); - $(".roles-load").removeClass("hide"); - $(".roles-list").addClass("hide"); - $(".add-roles-submit").data("username", userName); - $(document).find(".alert-success").remove(); - //getting user's existing roles - $.ajax({ - type: "POST", - url: $(".base-url").val() + "/admin/check-roles", - data: { - username: userName - } - }).complete(function (data) { - roles = JSON.parse(data.responseText); - roleBlocks = ""; - $(".new-roles-select option").each(function () { - $(this).removeAttr("disabled"); - }); - for (var i = 0; i < roles.length; i++) { - //disable roles which user already has. - $(".new-roles-select option").each(function () { - if ($(this).val().trim() == roles[i].trim()){ - $(this).attr("disabled", "disabled"); - } - }); - $(".role-block").find(".role-name").html(roles[i]); - $(".role-block").find(".existing-role-button").attr("roleName", roles[i]); - var newRoleBlock = $(".role-block").html(); - roleBlocks += newRoleBlock; - $(".roles-list").html(roleBlocks); - $(".add-roles-block").removeClass("hide"); - } - $(".roles-load").addClass("hide"); - $(".roles-list").removeClass("hide"); - }); + repopulatePopup( username); $(".success-message").html("<span class='alert alert-success col-md-12'>Role has been removed</span>"); }); } @@ -280,5 +213,45 @@ $(".add-roles-submit").html("Add Roles"); $(this).removeAttr("disabled"); }); + + function repopulatePopup( username){ + + $("#check-role-block").modal("show"); + $(".roles-of-user").html("User : " + userName); + $(".roles-load").removeClass("hide"); + $(".roles-list").addClass("hide"); + $(".add-roles-submit").data("username", userName); + $(document).find(".alert-success").remove(); + + $.ajax({ + type: "POST", + url: $(".base-url").val() + "/admin/check-roles", + data: { + username: userName + } + }).complete(function (data) { + roles = JSON.parse(data.responseText); + roleBlocks = ""; + $(".new-roles-select option").each(function () { + $(this).removeAttr("disabled"); + }); + for (var i = 0; i < roles.length; i++) { + //disable roles which user already has. + $(".new-roles-select option").each(function () { + if ($(this).val().trim() == roles[i].trim()){ + $(this).attr("disabled", "disabled"); + } + }); + $(".role-block").find(".role-name").html(roles[i]); + $(".role-block").find(".existing-role-button").attr("roleName", roles[i]); + var newRoleBlock = $(".role-block").html(); + roleBlocks += newRoleBlock; + $(".roles-list").html(roleBlocks); + $(".add-roles-block").removeClass("hide"); + } + $(".roles-load").addClass("hide"); + $(".roles-list").removeClass("hide"); + }); + } </script> @stop \ No newline at end of file
