diff options
author | zhangab <zhanganbing@chinamobile.com> | 2018-04-18 09:11:56 +0800 |
---|---|---|
committer | zhangab <zhanganbing@chinamobile.com> | 2018-04-18 09:12:03 +0800 |
commit | d698af153772ca4351ad3b23fbb987fc749890af (patch) | |
tree | 8fa49f10523134f9596814ef7a30528e298ac660 /usecaseui-common/src/main/webapp/app/fusion/scripts/DS2-controllers/ds2-profile/self-profile-controller.js | |
parent | ffffd8a35ae5fcea703a7427844037c07c232b92 (diff) |
Fix Security/Vulnerability problems
Change-Id: Ie0f2c9e0794941d9b9a7f00a6c3d349269d98ed1
Issue-ID: USECASEUI-104
Signed-off-by: zhangab <zhanganbing@chinamobile.com>
Diffstat (limited to 'usecaseui-common/src/main/webapp/app/fusion/scripts/DS2-controllers/ds2-profile/self-profile-controller.js')
-rw-r--r-- | usecaseui-common/src/main/webapp/app/fusion/scripts/DS2-controllers/ds2-profile/self-profile-controller.js | 358 |
1 files changed, 0 insertions, 358 deletions
diff --git a/usecaseui-common/src/main/webapp/app/fusion/scripts/DS2-controllers/ds2-profile/self-profile-controller.js b/usecaseui-common/src/main/webapp/app/fusion/scripts/DS2-controllers/ds2-profile/self-profile-controller.js deleted file mode 100644 index efe2b749..00000000 --- a/usecaseui-common/src/main/webapp/app/fusion/scripts/DS2-controllers/ds2-profile/self-profile-controller.js +++ /dev/null @@ -1,358 +0,0 @@ -appDS2.controller('selfProfileController', function($scope, $http, $modal, $routeParams, $rootScope,SelfProfileService){ - - /************init values***********************/ - $scope.tableData=[]; - $scope.profile=[]; - $scope.oriProfile=[]; - $scope.ociavailableRoles=[]; - $scope.ociTimeZones; - $scope.ociCountries; - var stateList=[]; - $scope.availableRoles = []; - $scope.timeZones = []; - $scope.selectedTimeZone = {"index":'',"value":"","title":""}; - $scope.countries = []; - $scope.selectedCountry = {"index":'',"value":"","title":""}; - - $scope.isUserSystemAdmin = false; - $scope.profileId=''; - $scope.showLoader=false; - $scope.pageType=1 /*1 for slef page 2 for general profile page*/ - $scope.pageTitle='Self Profile Detail'; - $scope.profileIdParam = $routeParams.profileId; - if (typeof($scope.profileIdParam) != "undefined" && $scope.profileIdParam!=''){ - $scope.pageTitle='Profile Detail'; - $scope.pageType=2; - } - - $scope.sbcid=$scope.profile.sbcid; - $scope.managerAttuid=$scope.profile.managerAttuid; - - /***********************************************************functions***********************************************/ - $scope.getProfileDetail = function(profileIdParam){ - $scope.showLoader=true; - SelfProfileService.getProfileDetail(profileIdParam).then(function(data){ - $scope.showLoader=false; - var j = data; - $scope.data = JSON.parse(j.data); - $scope.profile =JSON.parse($scope.data.profile); - $scope.oriProfile=JSON.parse($scope.data.profile); /*original value*/ - $scope.profileId = $scope.profile.id; - $scope.ociavailableRoles =JSON.parse($scope.data.availableRoles); - $scope.ociTimeZones=JSON.parse($scope.data.timeZones); - $scope.ociCountries=JSON.parse($scope.data.countries); - stateList=JSON.parse($scope.data.stateList); - $scope.sbcid=$scope.profile.sbcid; - $scope.managerAttuid=$scope.profile.managerAttuid; - - if($scope.ociavailableRoles) - $.each($scope.ociavailableRoles, function(i, a){ - var availableRole = a; - availableRole.selected = false; - $.each($scope.profile.roles, function(j, b){ - if(a.id === b.id) { - availableRole.selected = true; - if(a.id === 1){ - $scope.isUserSystemAdmin = true; - } - } - }); - $scope.availableRoles.push(availableRole); - }); - ; - if($scope.ociTimeZones){ - $.each($scope.ociTimeZones, function(i, a){ - var timeZone = {"index":i, "value":a.value, "title":a.label}; - $scope.timeZones.push(timeZone); - if($scope.profile.timeZoneId !== null && a.value === $scope.profile.timeZoneId.toString()){ - $scope.selectedTimeZone = timeZone; - } - }); - }; - if($scope.ociCountries) - $.each($scope.ociCountries, function(i, a){ - var country = {"index":i, "value":a.value, "title":a.label}; - $scope.countries.push(country); - if(a.value === $scope.profile.country){ - $scope.selectedCountry = country; - } - }); - ; - stateList = stateList== null? []: stateList; - var selectedState= $scope.profile.state ? $scope.profile.state:""; - $scope.stateList = initDropdownWithLookUp(stateList,selectedState ); - },function(error){ - $scope.errorPopUp(error); - $scope.showLoader=false; - }); - } - - $scope.getSelfProfileDetail = function(){ - $scope.showLoader=true; - SelfProfileService.getSelfProfileDetail().then(function(data){ - $scope.showLoader=false; - var j = data; - $scope.data = JSON.parse(j.data); - $scope.profile =JSON.parse($scope.data.profile); - $scope.oriProfile=JSON.parse($scope.data.profile); /*original value*/ - $scope.profileId = $scope.profile.id; - $scope.ociavailableRoles =JSON.parse($scope.data.availableRoles); - $scope.ociTimeZones=JSON.parse($scope.data.timeZones); - $scope.ociCountries=JSON.parse($scope.data.countries); - stateList=JSON.parse($scope.data.stateList); - $scope.sbcid=$scope.profile.sbcid; - $scope.managerAttuid=$scope.profile.managerAttuid; - - if($scope.ociavailableRoles) - $.each($scope.ociavailableRoles, function(i, a){ - var availableRole = a; - availableRole.selected = false; - $.each($scope.profile.roles, function(j, b){ - if(a.id === b.id) { - availableRole.selected = true; - if(a.id === 1){ - $scope.isUserSystemAdmin = true; - } - } - }); - $scope.availableRoles.push(availableRole); - }); - ; - if($scope.ociTimeZones){ - $.each($scope.ociTimeZones, function(i, a){ - var timeZone = {"index":i, "value":a.value, "title":a.label}; - $scope.timeZones.push(timeZone); - if($scope.profile.timeZoneId !== null && a.value === $scope.profile.timeZoneId.toString()){ - $scope.selectedTimeZone = timeZone; - } - }); - }; - if($scope.ociCountries) - $.each($scope.ociCountries, function(i, a){ - var country = {"index":i, "value":a.value, "title":a.label}; - $scope.countries.push(country); - if(a.value === $scope.profile.country){ - $scope.selectedCountry = country; - } - }); - ; - stateList = stateList== null? []: stateList; - var selectedState= $scope.profile.state ? $scope.profile.state:""; - $scope.stateList = initDropdownWithLookUp(stateList,selectedState ); - },function(error){ - $scope.errorPopUp(error); - $scope.showLoader=false; - }); - } - - - $scope.removeRole = function(data) { - var modalInstance = $modal.open({ - templateUrl: 'app/fusion/scripts/DS2-view-models/ds2-profile/modals/role-del-confirm.html', - controller: ModalInstanceCtrl, - sizeClass: 'modal-small', - resolve: { - items: function () { - var message = { - role:data, - roleId:$scope.profileId, - }; - return message; - } - } - }); - }; - $scope.addNewRoleFunctionModalPopup = function(data) { - var modalInstance = $modal.open({ - templateUrl: 'app/fusion/scripts/DS2-view-models/ds2-profile/modals/role-add.html', - controller: ModalInstanceCtrl, - windowClass:'modal-docked', - sizeClass: 'modal-medium', - resolve: { - items: function () { - var message = { - roleFunctions:data, - roleId:$scope.profileId, - availableRoleFunctions:$scope.ociavailableRoles - }; - return message; - } - } - }); - } - - - $scope.successPopUp = function () { - var modalInstance = $modal.open({ - templateUrl: 'app/fusion/scripts/DS2-modal/success_modal.html', - controller: ModalInstanceCtrl, - sizeClass: 'modal-small', - resolve: { - items: function () { - return ''; - } - } - }); - }; - - $scope.errorPopUp = function (msg) { - var modalInstance = $modal.open({ - templateUrl: 'app/fusion/scripts/DS2-modal/error_modal.html', - controller: ModalInstanceCtrl, - sizeClass: 'modal-small', - resolve: { - items: function () { - return msg; - } - } - }); - }; - $scope.saveProfile = function() { - $scope.errorMsg = ''; - if($scope.oriProfile.orgUserId != $scope.profile.orgUserId){ - $scope.errorPopUp('Organization User ID cannot be changed'); - return; - } - if($scope.oriProfile.orgManagerUserId != $scope.profile.orgManagerUserId){ - $scope.errorPopUp('Organization Manager ID cannot be changed'); - return; - } - if($scope.oriProfile.loginId != $scope.profile.loginId){ - $scope.errorPopUp('Login ID cannot be changed'); - return; - } - if($scope.oriProfile.loginPwd != $scope.profile.loginPwd){ - $scope.errorPopUp('Login Password cannot be changed'); - return; - } - - var postData={ - profile: $scope.profile, - selectedCountry:$scope.selectedCountry!=null?$scope.selectedCountry.value:"", - selectedState:$scope.stateList.selected!=null?$scope.stateList.selected.value:"", - selectedTimeZone:$scope.selectedTimeZone!=null?$scope.selectedTimeZone.value:"" - }; - SelfProfileService.saveProfile(postData, $scope.profileId).then(function(msg){ - $scope.successPopUp(); - },function(error){ - $scope.errorPopUp(error); - }); - } - /* updating role tables after adding or deleting*/ - $rootScope.$on('updateRoles',function(e,d){ - $scope.profile.roles = d.data; - }) - /*****init call*****/ - - if ($scope.pageType==2){ - $scope.getProfileDetail($scope.profileIdParam); - }else{ - $scope.getSelfProfileDetail(); - } - - - /****************************************************************popup modal*************************************************************/ - var ModalInstanceCtrl = function ($scope, $modalInstance, items,$rootScope) { - $scope.roleFun=items; - $scope.msg=items; - $scope.activateRoleConfirmPopUp = function (selected, availableRole) { - $scope.msg.roleFun = availableRole.name; - $scope.msg.selected = selected; - $scope.msg.availableRole = availableRole; - var modalInstance = $modal.open({ - templateUrl: 'app/fusion/scripts/DS2-view-models/ds2-profile/modals/role-add-confirm.html', - controller: ModalInstanceCtrl, - sizeClass: 'modal-small', - resolve: { - items: function () { - return $scope.msg; - } - } - }); - } - $scope.confirmRoleDel = function(role,profileId){ - var postData={role:role}; - SelfProfileService.removeRole(postData,profileId).then(function(msg){ - $scope.cancel(); - $scope.roleTableRefresh(profileId); - },function(error){ - $scope.errorPopUp(error); - }); - } - $scope.confirmRoleFunAdd = function(availableRole,profileId){ - var postData={role:availableRole}; - SelfProfileService.addRole(postData,profileId).then(function(msg){ - $scope.cancel(); - $scope.roleTableRefresh(profileId); - },function(error){ - $scope.errorPopUp(error); - }); - } - - // confirm Role Function Remove - $scope.confirmRoleFunRemove = function(availableRole,profileId){ - var postData={role:availableRole}; - SelfProfileService.deRole(postData,profileId).then(function(msg){ - $scope.cancel(); - $scope.roleTableRefresh(profileId); - },function(error){ - $scope.errorPopUp(error); - }); - } - - $scope.cancel = function () { - $modalInstance.dismiss('cancel'); - }; - - $scope.cancelRoleFunSwitch = function (msg) { - $scope.msg.availableRole.selected = !$scope.msg.availableRole.selected; - $modalInstance.dismiss('cancel'); - }; - - $scope.selfProfileRoleRefresh = function(){ - SelfProfileService.getSelfProfileDetail().then(function(data){ - var j = data; - $scope.data = JSON.parse(j.data); - $scope.profileTemp =JSON.parse($scope.data.profile); - $rootScope.$broadcast('updateRoles',{data:$scope.profileTemp.roles}); - }); - } - $scope.profileRoleRefresh = function(profileId){ - SelfProfileService.getProfileDetail(profileId).then(function(data){ - var j = data; - $scope.data = JSON.parse(j.data); - $scope.profileTemp =JSON.parse($scope.data.profile); - $rootScope.$broadcast('updateRoles',{data:$scope.profileTemp.roles}); - }); - } - $scope.roleTableRefresh = function (profileId) { - if($scope.pageType==1) - $scope.selfProfileRoleRefresh(); - else - $scope.profileRoleRefresh(profileId); - }; - - }; - -}); -function initDropdownWithLookUp(arr,selectedValue){ - var dropdownArray=[]; - var selected = null; - if(arr){ - for(var i = 0,l = arr.length; i < l; i++) { - var option = { - "index" : i , - "value" : arr[i].value, - "title" : arr[i].label - }; - dropdownArray.push(option); - if(arr[i].value === selectedValue){ - selected = option; - } - } - } - var dropDown={}; - dropDown.options = dropdownArray; - dropDown.selected = selected!=null?selected:{"index":'',"value":"","title":""}; - return dropDown; -}; |