diff options
14 files changed, 236 insertions, 250 deletions
diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/openecomp/portalapp/controller/core/ProfileController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/openecomp/portalapp/controller/core/ProfileController.java index f4132a9e..2f17ac68 100644 --- a/ecomp-sdk/epsdk-app-common/src/main/java/org/openecomp/portalapp/controller/core/ProfileController.java +++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/openecomp/portalapp/controller/core/ProfileController.java @@ -28,6 +28,7 @@ import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; import org.json.JSONObject; import org.openecomp.portalsdk.core.controller.RestrictedBaseController; @@ -37,6 +38,7 @@ import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; import org.openecomp.portalsdk.core.service.RoleService; import org.openecomp.portalsdk.core.service.UserProfileService; import org.openecomp.portalsdk.core.service.UserService; +import org.openecomp.portalsdk.core.util.SystemProperties; import org.openecomp.portalsdk.core.web.support.AppUtils; import org.openecomp.portalsdk.core.web.support.JsonMessage; import org.openecomp.portalsdk.core.web.support.UserUtils; @@ -254,6 +256,11 @@ public class ProfileController extends RestrictedBaseController { domainUser.removeRole(role.getId()); service.saveUser(domainUser); + /*If adding new roles on the current logged in user, we need to update the user value in session*/ + if(UserUtils.getUserId(request)==Integer.valueOf(profileId)){ + HttpSession session = request.getSession(true); + session.setAttribute(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME), domainUser); + } logger.info(EELFLoggerDelegate.auditLogger, "Remove role " + role.getId() + " from user " + profileId); response.setCharacterEncoding("UTF-8"); @@ -294,6 +301,11 @@ public class ProfileController extends RestrictedBaseController { User domainUser = (User) userService.getUser(profileId); domainUser.addRole(role); service.saveUser(domainUser); + /*If removing roles on the current logged in user, we need to update the user value in session*/ + if(UserUtils.getUserId(request)==Integer.valueOf(profileId)){ + HttpSession session = request.getSession(true); + session.setAttribute(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME), domainUser); + } logger.info(EELFLoggerDelegate.auditLogger, "Add new role " + role.getName() + " to user " + profileId); response.setCharacterEncoding("UTF-8"); diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/WEB-INF/fusion/orm/Fusion.hbm.xml b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/WEB-INF/fusion/orm/Fusion.hbm.xml index e569972a..098a5857 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/WEB-INF/fusion/orm/Fusion.hbm.xml +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/WEB-INF/fusion/orm/Fusion.hbm.xml @@ -385,5 +385,9 @@ <query name="getUserByProfileId"> select orgUserId from User where id = :user_id </query> + + <query name="getUserIdByorgUserId"> + select id from User where orgUserId = :orgUserId + </query> </hibernate-mapping> diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-controllers/admin-controller.js b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-controllers/admin-controller.js index d7adaf36..dc59b6c7 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-controllers/admin-controller.js +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-controllers/admin-controller.js @@ -7,17 +7,21 @@ appDS2.controller('adminController', function($scope, $http,AdminService, $modal $scope.nextSort=""; $scope.showLoader = false; $scope.tableData=[]; + $scope.showLoader=false; $scope.routeRoleId = $routeParams.roleId; $scope.regions = []; /*function*/ $scope.getFunctionList = function(){ $scope.tableData.length=0; + $scope.showLoader=true; AdminService.getRoleFunctionList().then(function(data){ var j = data; $scope.data = JSON.parse(j.data); $scope.tableData =JSON.parse($scope.data.availableRoleFunctions); },function(error){ console.log("failed"); + }).finally(function() { + $scope.showLoader=false; // Always execute this on both error and success }); } @@ -605,29 +609,6 @@ appDS2.controller('adminController', function($scope, $http,AdminService, $modal } - /*$scope.showItemDetails = function(cacheName,key) { - $http.get("jcs_admin/showItemDetails?keyName="+key+"&cacheName="+cacheName).success(function(response){ - var message = "CacheName: "+ response.cacheName - +"\nkey: "+response.key - +"\nIS_SPOOL: "+response.attr.IS_SPOOL - +"\nIS_LATERAL: "+response.attr.IS_LATERAL - +"\nIS_REMOTE: "+response.attr.IS_REMOTE - +"\nIS_ETERNAL: "+response.attr.IS_ETERNAL - +"\nversion: "+response.attr.version - +"\nmaxLifeSeconds: "+response.attr.maxLifeSeconds - +"\nmaxIdleTimeSeconds: "+response.attr.maxIdleTimeSeconds - +"\nsize: "+response.attr.size - +"\ncreateTime: "+response.attr.createTime - +"\nlastAccessTime: "+response.attr.lastAccessTime - +"\nidleTime: "+response.attr.idleTime - +"\ntimeToLiveSeconds: "+response.attr.timeToLiveSeconds - +"\nisSpool: "+response.attr.isSpool - +"\nisLateral: "+response.attr.isLateral - +"\nisRemote: "+response.attr.isRemote - +"\nisEternal: "+response.attr.isEternal; - modalService.showSuccess('',message);}); - };*/ - $scope.showItemDetails = function(cacheName, key){ AdminService.showItemDetails(cacheName, key).then(function(msg){ @@ -695,35 +676,38 @@ appDS2.controller('adminController', function($scope, $http,AdminService, $modal } $scope.roleFnInit = function(){ + $scope.showLoader=true; AdminService.getRole($routeParams.roleId).then(function(data){ - - var j = data; - $scope.data = JSON.parse(j.data); - $scope.role =JSON.parse($scope.data.role); - - $scope.ociavailableRoleFunctions =JSON.parse($scope.data.availableRoleFunctions); - $scope.availableRoleFunctions=[]; - - if($scope.ociavailableRoleFunctions) - angular.forEach($scope.ociavailableRoleFunctions, function(a,i){ - var availableRoleFunction = a; - availableRoleFunction.selected = false; - angular.forEach($scope.role.roleFunctions, function(b,j){ - if(a.code === b.code) { - availableRoleFunction.selected = true; - } - }); - $scope.availableRoleFunctions.push(availableRoleFunction); - }); - - - $scope.ociavailableRoles=JSON.parse($scope.data.availableRoles); - $scope.availableRoles=[]; - - },function(error){ - console.log("roleControllerDS2 failed: " + error); - reloadPageOnce(); - }); + + var j = data; + $scope.data = JSON.parse(j.data); + $scope.role =JSON.parse($scope.data.role); + + $scope.ociavailableRoleFunctions =JSON.parse($scope.data.availableRoleFunctions); + $scope.availableRoleFunctions=[]; + + if($scope.ociavailableRoleFunctions) + angular.forEach($scope.ociavailableRoleFunctions, function(a,i){ + var availableRoleFunction = a; + availableRoleFunction.selected = false; + angular.forEach($scope.role.roleFunctions, function(b,j){ + if(a.code === b.code) { + availableRoleFunction.selected = true; + } + }); + $scope.availableRoleFunctions.push(availableRoleFunction); + }); + + + $scope.ociavailableRoles=JSON.parse($scope.data.availableRoles); + $scope.availableRoles=[]; + + },function(error){ + console.log("roleControllerDS2 failed: " + error); + reloadPageOnce(); + }).finally(function() { + $scope.showLoader=false; // Always execute this on both error and success + }); } // updating roles on role list page after deletion of a role @@ -740,7 +724,7 @@ appDS2.controller('adminController', function($scope, $http,AdminService, $modal $scope.saveRole = function() { var errorMsg; - + $scope.showLoader=true; if($scope.role.id == null || $scope.role.id == undefined ){ $scope.role = { 'id':null, @@ -828,7 +812,9 @@ appDS2.controller('adminController', function($scope, $http,AdminService, $modal } },function(error){ console.log("error msg"); - }) + }).finally(function() { + $scope.showLoader=false; // Always execute this on both error and success + }); } } @@ -838,6 +824,7 @@ appDS2.controller('adminController', function($scope, $http,AdminService, $modal templateUrl: 'app/fusion/scripts/DS2-view-models/ds2-admin/modals/role-functions-modal.html', controller: ModalInstanceCtrl, sizeClass: 'modal-large', + windowClass:"modal-docked", resolve: { items: function () { var message = { diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-view-models/ds2-admin/modals/role-fun-role-del-confirm.html b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-view-models/ds2-admin/modals/role-fun-role-del-confirm.html index f293152c..322c6624 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-view-models/ds2-admin/modals/role-fun-role-del-confirm.html +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-view-models/ds2-admin/modals/role-fun-role-del-confirm.html @@ -1,17 +1,17 @@ <div> - <div class="modal-header ng-scope in"> + <div class="b2b-modal-header"> <h2 id="myModalLabel" modal-title="">Role</h2> <div class="corner-button in"> <button type="button" class="close" aria-label="Close" ng-click="$dismiss('cancel')"></button> </div> </div> - <div class="modal-body ng-scope ng-isolate-scope in" tabindex="0" + <div class="b2b-modal-body ng-scope ng-isolate-scope in" tabindex="0" role="region" aria-label="Modal header text content" style="height: 55px;"> You are about to delete this Role Function. Click 'OK' to continue. </div> - <div class="modal-footer ng-scope ng-isolate-scope in"> + <div class="b2b-modal-footer ng-scope ng-isolate-scope in"> <div class="cta-button-group in"> <button class="btn btn-alt btn-medium" type="button" ng-click="roleFunRemoveRole(msg.roleFunction)">Ok</button> diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-view-models/ds2-admin/modals/role-functions-modal.html b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-view-models/ds2-admin/modals/role-functions-modal.html index c4115c4a..dbe9d1c6 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-view-models/ds2-admin/modals/role-functions-modal.html +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-view-models/ds2-admin/modals/role-functions-modal.html @@ -1,7 +1,8 @@ -<div> <div class="b2b-modal-header"> - <h1 class="heading-medium" id="SelectRole">Select Role Functions</h1> - + <h2 class="myModalLabel" id="SelectRole">Select Role Functions</h2> + <div class="corner-button in"> + <button type="button" class="close" aria-label="Close" ng-click="$dismiss('cancel')"></button> + </div> </div> <div class="b2b-modal-body" tabindex="0" aria-label="Modal header text content" role="region"> @@ -33,4 +34,3 @@ </div> <br /> </div> -</div>
\ No newline at end of file diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-view-models/ds2-admin/role-function.html b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-view-models/ds2-admin/role-function.html index 0b07d6e8..cab8c682 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-view-models/ds2-admin/role-function.html +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-view-models/ds2-admin/role-function.html @@ -1,63 +1,67 @@ <div id="page-content"> <h1 class="heading-page" id="profileSearch">Role Function</h1> - - <div class="row-nowrap"> - <div class="span12"> - <div class="form-row"> - <div class="field-group"> - <button class="btn btn-alt btn-medium" type="button" - ng-click="addRoleFuncPopUp(rowData);">Create</button> + <div ng-show="showLoader" class="span loader-container"> + <i class="icon-primary-spinner" role="img" + aria-label="Please wait while we load your content"></i> + </div> + <div ng-hide="showLoader"> + <div class="row-nowrap"> + <div class="span12"> + <div class="form-row"> + <div class="field-group"> + <button class="btn btn-alt btn-medium" type="button" + ng-click="addRoleFuncPopUp(rowData);">Create</button> + </div> </div> </div> - </div> - <div class="span12"> - <div class="form-row"> - <div style="float: right;"> - <div class="form-field form-field__small"> - <input type="text" placeholder="Search role functions" ng-model="searchString" /> + <div class="span12"> + <div class="form-row"> + <div style="float: right;"> + <div class="form-field form-field__small"> + <input type="text" placeholder="Search role functions" ng-model="searchString" /> + </div> </div> </div> </div> </div> - </div> - - <div ng-show="showLoader" class="span loader-container"> - <i class="icon-primary-spinner" role="img" - aria-label="Please wait while we load your content"></i> - </div> - - <div b2b-table class="b2b-table-div" table-data="tableData" - search-string="searchString" current-page="currentPage" - next-sort="nextSort"> - <table> - <thead b2b-table-row type="header"> - <tr> - <th b2b-table-header key="name">Name</th> - <th b2b-table-header key="code">Code</th> - <th b2b-table-header sortable="false">Edit</th> - <th b2b-table-header sortable="false">Delete</th> - </tr> - </thead> - <tbody b2b-table-row type="body" row-repeat="rowData in tableData"> - <tr> - <td b2b-table-body ng-bind="rowData['name']"></td> - <td b2b-table-body ng-bind="rowData['code']"></td> - <td b2b-table-body> - <div style="font-size: 20px;"> - <a ng-click="saveRoleFuncPopUp(rowData);" class="icon-misc-pen"></a> - </div> - </td> - <td b2b-table-body> - <div style="font-size: 20px;"> - <a href="javascript:void(0)" - ng-click="delRoleFuncConfirmPopUp(rowData);" - class="icon-misc-trash"></a> - </div> - </td> - - </tr> - </tbody> - </table> + <div ng-show="showLoader" class="span loader-container"> + <i class="icon-primary-spinner" role="img" + aria-label="Please wait while we load your content"></i> + </div> + + <div b2b-table class="b2b-table-div" table-data="tableData" + search-string="searchString" current-page="currentPage" + next-sort="nextSort"> + <table> + <thead b2b-table-row type="header"> + <tr> + <th b2b-table-header key="name">Name</th> + <th b2b-table-header key="code">Code</th> + <th b2b-table-header sortable="false">Edit</th> + <th b2b-table-header sortable="false">Delete</th> + </tr> + </thead> + <tbody b2b-table-row type="body" row-repeat="rowData in tableData"> + <tr> + <td b2b-table-body ng-bind="rowData['name']"></td> + <td b2b-table-body ng-bind="rowData['code']"></td> + <td b2b-table-body> + <div style="font-size: 20px;"> + <a ng-click="saveRoleFuncPopUp(rowData);" class="icon-misc-pen"></a> + </div> + </td> + <td b2b-table-body> + <div style="font-size: 20px;"> + <a href="javascript:void(0)" + ng-click="delRoleFuncConfirmPopUp(rowData);" + class="icon-misc-trash"></a> + </div> + </td> + + </tr> + </tbody> + </table> + </div> </div> -</div> +</div>
\ No newline at end of file diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-view-models/ds2-admin/role.html b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-view-models/ds2-admin/role.html index 6268cf6f..f4c9d0c6 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-view-models/ds2-admin/role.html +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-view-models/ds2-admin/role.html @@ -2,96 +2,60 @@ <div> <h1 class="heading-page" id="Roles">Manage Roles</h1> </div> - <div> - <h2 class="heading-small-content">Please edit the role details below: </h2> - </div> - - <div> - <label>*Name: - <input type="text" ng-model="role.name" - maxlength="300" /> - </label> - </div> - - <div> - <label>Priority: - <input type="text" ng-model="role.priority" - maxlength="30"/> - </label> + <div ng-show="showLoader" class="span loader-container"> + <i class="icon-primary-spinner" role="img" aria-label="Please wait while we load your content"></i> </div> - - <div> - <button style="margin-left: 105px;" class="btn btn-small" onClick="window.location='admin'">Cancel</button> - <button class="btn btn-alt btn-small" ng-click="saveRole();">Save</button> - </div> - <br/> - <div ng-if="routeRoleId != 0"> + <div ng-hide="showLoader"> <div> - <h3 class="heading-small-emphasis">Role Functions</h3> - <button class="btn btn-alt btn-small" ng-click="addNewRoleFunctionModalPopup(role.roleFunctions,role.name, role);">Manage Role Functions</button> - - <table class="striped" ng-if="role.roleFunctions.length"> - <thead> - <tr> - <th>Role Function Name</th> - <th>Remove</th> - </tr> - </thead> - <tbody type="body" ng-repeat="roleFunction in role.roleFunctions"> - <tr> - <td width="70%">{{ roleFunction.name }}</td> - <td width="10%"> - <div ng-click="removeRoleFunction(roleFunction);"><a href="javascript:void(0)" class="icon-misc-trash"></a></div> - </td> - </tr> - </tbody> - </table> + <h2 class="heading-small-content">Please edit the role details below: </h2> </div> - <br/> - <!-- Commented code due to issues with child role activation and deactivation, should be revisited --> - <!-- <div> - <h4 class="heading-small-emphasis">Child Roles</h4> - <button class="btn btn-alt btn-small" ng-click="addNewChildRoleFunctionModalPopup(role.childRoles,role.name, role);">Manage Child Roles</button> - - <table class="striped" ng-if="role.childRoles.length"> - <thead> - <tr> - <th>Name</th> - <th>Remove?</th> - </tr> - </thead> - <tbody type="body" ng-repeat="role in role.childRoles"> - <tr> - <td width="70%">{{ role.name }}</td> - <td width="10%"> - <div ng-click="removeChildRole(role);"><a href="javascript:void(0)" class="icon-misc-trash"></a></div> - </td> - </tr> - </tbody> - </table> - </div> --> - <br/> <div> - <a href="admin#/role_function_list">Manage Role Functions</a><br><br> + <label>*Name: + <input type="text" ng-model="role.name" + maxlength="300" /> + </label> + </div> + + <div> + <label>Priority: + <input type="text" ng-model="role.priority" + maxlength="30"/> + </label> + </div> + + <div> + <button style="margin-left: 105px;" class="btn btn-small" onClick="window.location='admin'">Cancel</button> + <button class="btn btn-alt btn-small" ng-click="saveRole();">Save</button> + </div> + <br/> + <div ng-if="routeRoleId != 0"> + <div> + <h3 class="heading-small-emphasis">Role Functions</h3> + <button class="btn btn-alt btn-small" ng-click="addNewRoleFunctionModalPopup(role.roleFunctions,role.name, role);">Manage Role Functions</button> + + <table class="striped" ng-if="role.roleFunctions.length"> + <thead> + <tr> + <th>Role Function Name</th> + <th>Remove</th> + </tr> + </thead> + <tbody type="body" ng-repeat="roleFunction in role.roleFunctions"> + <tr> + <td width="70%">{{ roleFunction.name }}</td> + <td width="10%"> + <div ng-click="removeRoleFunction(roleFunction);"><a href="javascript:void(0)" class="icon-misc-trash"></a></div> + </td> + </tr> + </tbody> + </table> + </div> + <br/> + <br/> + <div> + <a href="admin#/role_function_list">Manage Role Functions</a><br><br> + </div> </div> - <!-- <table class="striped" table-data="availableRoles"> - <thead> - <tr> - <th></th> - <th>Role</th> - </tr> - </thead> - <tbody type="body" ng-repeat="availableRole in availableRoles"> - <tr> - <td width="70%"> - <div ng-click="toggleChildRole(availableRole.selected,availableRole);"> - <input type="checkbox" ng-model="availableRole.selected" /> - </div> - </td> - <td> {{ availableRole.name }} </td> - </tr> - </tbody> - </table> --> </div> </div>
\ No newline at end of file diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-view-models/ds2-admin/role_list.html b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-view-models/ds2-admin/role_list.html index a608a0db..5c407390 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-view-models/ds2-admin/role_list.html +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-view-models/ds2-admin/role_list.html @@ -2,13 +2,16 @@ <div> <h1 class="heading-page" id="Roles">Roles</h1> </div> - - <div> - <button type="submit" onClick="window.location='admin#/role/0';" class="btn btn-alt btn-small">Add New Role</button> + <div ng-show="showLoader" class="span loader-container"> + <i class="icon-primary-spinner" role="img" + aria-label="Please wait while we load your content"></i> </div> - <h2 class="heading-small">Click on a Role to view its details.</h2> - - <table class="striped" ng-if="availableRoleFunctions" style="width: auto;"> + <div ng-hide="showLoader"> + <div> + <button type="submit" onClick="window.location='admin#/role/0';" class="btn btn-alt btn-small">Add New Role</button> + </div> + <h2 class="heading-small">Click on a Role to view its details.</h2> + <table class="striped" ng-if="availableRoleFunctions" style="width: auto;"> <thead> <tr> <th>Name</th> @@ -38,5 +41,5 @@ </tr> </tbody> </table> - + </div> </div>
\ No newline at end of file diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-view-models/ds2-profile/modals/role-add.html b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-view-models/ds2-profile/modals/role-add.html index d662fc01..f182417e 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-view-models/ds2-profile/modals/role-add.html +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-view-models/ds2-profile/modals/role-add.html @@ -1,36 +1,37 @@ -<div> - <div class="b2b-modal-header ng-scope in"> - <h1 class="heading-medium" id="SelectRole">Select Role Functions</h1> +<div class="b2b-modal-header"> + <h1 class="heading-medium" id="SelectRole">Select Role</h1> + <div class="corner-button in"> + <button type="button" class="close" aria-label="Close" ng-click="$dismiss('cancel')"></button> </div> +</div> - <div class="b2b-modal-body ng-scope ng-isolate-scope in" tabindex="0" aria-label="Modal header text content" role="region"> - <table class="striped"> - <thead> - <tr> - <th></th> - <th>Role Function</th> - </tr> - </thead> - <tbody type="body"ng-repeat="roleFunction in msg.availableRoleFunctions"> - <tr> - <td> - <label class="btn-switch-label" tabindex="0" role="option"> - <input type="checkbox" b2b-switches ng-model="roleFunction.selected" ng-click="activateRoleConfirmPopUp(roleFunction.selected,roleFunction);" size-class="modal-small modal-alert"> - </label> - </td> - <td>{{roleFunction.name}}</td> - </tr> - </tbody> - </table> - </div> +<div class="b2b-modal-body" tabindex="0" aria-label="Modal header text content" role="region"> + <table class="striped"> + <thead> + <tr> + <th></th> + <th>Role</th> + </tr> + </thead> + <tbody type="body"ng-repeat="roleFunction in msg.availableRoleFunctions"> + <tr> + <td> + <label class="btn-switch-label" tabindex="0" role="option"> + <input type="checkbox" b2b-switches ng-model="roleFunction.selected" ng-click="activateRoleConfirmPopUp(roleFunction.selected,roleFunction);" size-class="modal-small modal-alert"> + </label> + </td> + <td>{{roleFunction.name}}</td> + </tr> + </tbody> + </table> +</div> - <div class="b2b-modal-footer ng-scope ng-isolate-scope in"> - <div class="cta-button-group in"> - <button style="float: right; margin-right: 20px;" - class="btn btn-alt btn-small" - ng-click="$dismiss('cancel')">Close</button> - </div> - <br /> +<div class="b2b-modal-footer" id="role-popup-footer"> + <div class="cta-button-group"> + <button style="float: right; margin-right: 20px;" + class="btn btn-alt btn-small" + ng-click="$dismiss('cancel')">Close</button> </div> -</div>
\ No newline at end of file +</div> + diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/styles/ecomp.css b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/styles/ecomp.css index e593c24a..dd25f755 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/styles/ecomp.css +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/styles/ecomp.css @@ -171,4 +171,7 @@ p,a{ .header-image{ height:28px; -}
\ No newline at end of file +} +#role-popup-footer{ + height:100px; +} diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/LoginServiceCentralizedImpl.java b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/LoginServiceCentralizedImpl.java index e5d380c9..bab2249c 100644 --- a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/LoginServiceCentralizedImpl.java +++ b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/LoginServiceCentralizedImpl.java @@ -5,6 +5,7 @@ import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.List; +import java.util.Map; import java.util.Set; import org.openecomp.portalsdk.core.command.LoginBean; @@ -132,9 +133,21 @@ public class LoginServiceCentralizedImpl extends FusionService implements LoginS User user = null; String repsonse = restApiRequestBuilder.getViaREST("/user/" + bean.getUserid(), true, bean.getUserid()); user = userService.userMapper(repsonse); + user.setId(getUserIdByOrgUserId(user.getOrgUserId())); return user; } + public Long getUserIdByOrgUserId(String orgUserId) { + Map<String, String> params = new HashMap<String, String>(); + params.put("orgUserId", orgUserId); + @SuppressWarnings("rawtypes") + List list = getDataAccessService().executeNamedQuery("getUserIdByorgUserId", params, null); + Long userId = null; + if (list != null && !list.isEmpty()) + userId = (Long) list.get(0); + return userId; + } + public User findUser(String loginId, String password) { diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/RestApiRequestBuilder.java b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/RestApiRequestBuilder.java index 00673682..52473608 100644 --- a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/RestApiRequestBuilder.java +++ b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/RestApiRequestBuilder.java @@ -98,7 +98,7 @@ public class RestApiRequestBuilder { } - public void deleteViaRest(String restEndPoint, boolean isBasicAuth, String content, String filter , String userId) throws Exception { + public void deleteViaRest(String restEndPoint, boolean isBasicAuth, String content, String userId) throws Exception { String appName = ""; String requestId = ""; String appUserName = ""; @@ -128,7 +128,7 @@ public class RestApiRequestBuilder { try { RestWebServiceClient.getInstance().deletePortalContent(restEndPoint, userId, appName, requestId, appUserName, - decryptedPwd, content_type, content, isBasicAuth, filter); + decryptedPwd, content_type, content, isBasicAuth); } catch (Exception ex) { logger.error(EELFLoggerDelegate.errorLogger, "DELETE response: {}", ex); throw new Exception("Delete Failed"); diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/RoleServiceCentralizedAccess.java b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/RoleServiceCentralizedAccess.java index eff02543..53f257bd 100644 --- a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/RoleServiceCentralizedAccess.java +++ b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/RoleServiceCentralizedAccess.java @@ -108,11 +108,9 @@ public class RoleServiceCentralizedAccess implements RoleService { @Override public void deleteRole(String loginId, Role domainRole) throws Exception { - ObjectMapper mapper = new ObjectMapper(); - String role = mapper.writeValueAsString(domainRole); String roleName = domainRole.getName().replaceAll(" ", "%20"); try { - restApiRequestBuilder.deleteViaRest("/deleteRole/"+ roleName, true, role, null, loginId); + restApiRequestBuilder.deleteViaRest("/deleteRole/"+ roleName, true, null, loginId); } catch (Exception e) { logger.error(EELFLoggerDelegate.errorLogger, "deleteRole Failed", e); throw new Exception(e.getMessage()); @@ -165,10 +163,8 @@ public class RoleServiceCentralizedAccess implements RoleService { @Override public void deleteRoleFunction(String requestedLoginId, RoleFunction domainRoleFunction) throws Exception { String code = domainRoleFunction.getCode(); - ObjectMapper mapper = new ObjectMapper(); - String roleFunction = mapper.writeValueAsString(domainRoleFunction); try { - restApiRequestBuilder.deleteViaRest("/roleFunction/"+ code, true, roleFunction, null, requestedLoginId); + restApiRequestBuilder.deleteViaRest("/roleFunction/"+ code, true, null, requestedLoginId); } catch (Exception e) { logger.error(EELFLoggerDelegate.errorLogger, "deleteRoleFunction Failed ", e); throw new Exception(e.getMessage()); @@ -178,7 +174,7 @@ public class RoleServiceCentralizedAccess implements RoleService { @Override public void deleteDependcyRoleRecord(String requestedLoginId, Long id) { try { - restApiRequestBuilder.deleteViaRest("/deleteDependcyRoleRecord/" + id, true, null, null, requestedLoginId); + restApiRequestBuilder.deleteViaRest("/deleteDependcyRoleRecord/" + id, true, null, requestedLoginId); } catch (Exception e) { logger.error(EELFLoggerDelegate.errorLogger, "deleteDependcyRoleRecord Failed", e); } diff --git a/ecomp-sdk/epsdk-fw/src/main/java/org/openecomp/portalsdk/core/onboarding/rest/RestWebServiceClient.java b/ecomp-sdk/epsdk-fw/src/main/java/org/openecomp/portalsdk/core/onboarding/rest/RestWebServiceClient.java index 9a1ea9fb..44177466 100644 --- a/ecomp-sdk/epsdk-fw/src/main/java/org/openecomp/portalsdk/core/onboarding/rest/RestWebServiceClient.java +++ b/ecomp-sdk/epsdk-fw/src/main/java/org/openecomp/portalsdk/core/onboarding/rest/RestWebServiceClient.java @@ -393,7 +393,7 @@ public class RestWebServiceClient { public String deletePortalContent(String restPath, String userId, String appName, String requestId, - String appUserName, String appPassword, String contentType, String content, boolean isBasicAuth ,String filter) throws Exception { + String appUserName, String appPassword, String contentType, String content, boolean isBasicAuth) throws Exception { String restURL = PortalApiProperties.getProperty(PortalApiConstants.ECOMP_REST_URL); if (restURL == null) { @@ -415,11 +415,11 @@ public class RestWebServiceClient { final String separator = restURL.endsWith("/") || restPath.startsWith("/") ? "" : "/"; final String restEndpointUrl = restURL + separator + restPath; return delete(restEndpointUrl, userId, appName, requestId, appUebKey, appUserName, appPassword, contentType, - content,isBasicAuth,filter); + content,isBasicAuth); } public String delete(String url, String loginId, String appName, String requestId, String appUebKey, - String appUserName, String appPassword, String contentType, String content,boolean isBasicAuth ,String filter) throws Exception { + String appUserName, String appPassword, String contentType, String content,boolean isBasicAuth) throws Exception { if (logger.isDebugEnabled()) logger.debug("RestWebServiceClient.post to URL " + url); @@ -451,7 +451,6 @@ public class RestWebServiceClient { con.setRequestProperty("user-agent", appName); con.setRequestProperty("X-ECOMP-RequestID", requestId); con.setRequestProperty("Content-Type", contentType); - con.setRequestProperty("filter", filter); if(isBasicAuth){ String encoding = Base64.getEncoder().encodeToString((appUserName + ":" + appPassword).getBytes()); con.setRequestProperty("Authorization", "Basic "+ encoding); |