diff --git a/client/cat3/src/partials/sections/dashboard/bots/view/editParams.html b/client/cat3/src/partials/sections/dashboard/bots/view/editParams.html index 18d05e419..6bc3ca30d 100644 --- a/client/cat3/src/partials/sections/dashboard/bots/view/editParams.html +++ b/client/cat3/src/partials/sections/dashboard/bots/view/editParams.html @@ -90,15 +90,15 @@

Add Parameters:

- + - - - + + + diff --git a/client/cat3/src/partials/sections/dashboard/workzone/orchestration/popups/addScriptParams.html b/client/cat3/src/partials/sections/dashboard/workzone/orchestration/popups/addScriptParams.html index 052d788a5..9595ac27b 100644 --- a/client/cat3/src/partials/sections/dashboard/workzone/orchestration/popups/addScriptParams.html +++ b/client/cat3/src/partials/sections/dashboard/workzone/orchestration/popups/addScriptParams.html @@ -11,7 +11,7 @@ - + @@ -20,12 +20,11 @@ - + - diff --git a/client/cat3/src/partials/sections/dashboard/workzone/orchestration/popups/newTask.html b/client/cat3/src/partials/sections/dashboard/workzone/orchestration/popups/newTask.html index c28c6c900..98a6df5bf 100644 --- a/client/cat3/src/partials/sections/dashboard/workzone/orchestration/popups/newTask.html +++ b/client/cat3/src/partials/sections/dashboard/workzone/orchestration/popups/newTask.html @@ -579,10 +579,11 @@
Script Details
- + - + + diff --git a/server/app/model/classes/tasks/tasks.js b/server/app/model/classes/tasks/tasks.js index 1f24c7d8a..9b87b7a7f 100755 --- a/server/app/model/classes/tasks/tasks.js +++ b/server/app/model/classes/tasks/tasks.js @@ -1089,8 +1089,12 @@ function filterScriptTaskData(data,callback){ if (scriptTask.scriptParameters.length > 0) { scriptCount++; for (var k = 0; k < scriptTask.scriptParameters.length; k++) { - scriptTask.scriptParameters[k].paramVal = cryptography.decryptText(scriptTask.scriptParameters[k].paramVal, cryptoConfig.decryptionEncoding, + if(scriptTask.scriptParameters[k].paramType === '' || scriptTask.scriptParameters[k].paramType === 'Default' || scriptTask.scriptParameters[k].paramType === 'Password'){ + scriptTask.scriptParameters[k].paramVal = cryptography.decryptText(scriptTask.scriptParameters[k].paramVal, cryptoConfig.decryptionEncoding, cryptoConfig.encryptionEncoding); + }else { + scriptTask.scriptParameters[k].paramVal = ''; + } } } else { scriptCount++; diff --git a/server/app/routes/v1.0/routes_tasks.js b/server/app/routes/v1.0/routes_tasks.js index b92e70f64..9d6928efa 100755 --- a/server/app/routes/v1.0/routes_tasks.js +++ b/server/app/routes/v1.0/routes_tasks.js @@ -545,7 +545,7 @@ module.exports.setRoutes = function(app, sessionVerification) { res.status(500).send(errorResponses.db.error); return; } - encryptedParam(taskData.scriptDetails,function(err, encryptedParam) { + encryptedParam(taskData.scriptDetails,scriptTask.taskConfig.scriptDetails,function(err, encryptedParam) { if (err) { logger.error(err); res.status(500).send("Failed to encrypted script parameters: ", err); @@ -684,7 +684,7 @@ module.exports.setRoutes = function(app, sessionVerification) { }; -function encryptedParam(paramDetails, callback) { +function encryptedParam(paramDetails,existingParams, callback) { var cryptoConfig = appConfig.cryptoSettings; var cryptography = new Cryptography(cryptoConfig.algorithm, cryptoConfig.password); var count = 0; @@ -695,13 +695,33 @@ function encryptedParam(paramDetails, callback) { count++; for (var j = 0; j < paramDetail.scriptParameters.length; j++) { (function (scriptParameter) { - var encryptedText = cryptography.encryptText(scriptParameter.paramVal, cryptoConfig.encryptionEncoding, - cryptoConfig.decryptionEncoding); - encryptedList.push({ - paramVal: encryptedText, - paramDesc: scriptParameter.paramDesc, - paramType: scriptParameter.paramType - }); + if(scriptParameter.paramType ==='Restricted' && scriptParameter.paramVal ===''){ + if(paramDetails.length === existingParams.length && paramDetail.scriptId ===existingParams[i].scriptId) { + encryptedList.push({ + paramVal: existingParams[i].scriptParameters[j].paramVal, + paramDesc: scriptParameter.paramDesc, + paramType: scriptParameter.paramType + }); + }else{ + for(var k = 0; k < existingParams.length; k++){ + if(paramDetail.scriptId === existingParams[k].scriptId){ + encryptedList.push({ + paramVal: existingParams[k].scriptParameters[j].paramVal, + paramDesc: scriptParameter.paramDesc, + paramType: scriptParameter.paramType + }); + } + } + } + }else { + var encryptedText = cryptography.encryptText(scriptParameter.paramVal, cryptoConfig.encryptionEncoding, + cryptoConfig.decryptionEncoding); + encryptedList.push({ + paramVal: encryptedText, + paramDesc: scriptParameter.paramDesc, + paramType: scriptParameter.paramType + }); + } if (encryptedList.length === paramDetail.scriptParameters.length) { paramDetail.scriptParameters = encryptedList; encryptedList = []; diff --git a/server/app/services/botsService.js b/server/app/services/botsService.js index 902571d19..134f3008a 100644 --- a/server/app/services/botsService.js +++ b/server/app/services/botsService.js @@ -330,7 +330,7 @@ botsService.executeBots = function executeBots(botId,reqBody,callback){ if(reqBody.paramOptions.scriptParams){ encryptedParam(reqBody.paramOptions.scriptParams,next); }else{ - next([],next); + next(null,[]); } }, function(encryptedParamList,next) { @@ -399,7 +399,7 @@ function filterScriptBotsData(data,callback){ if (scriptBot.scriptParameters.length > 0) { scriptCount++; for (var k = 0; k < scriptBot.scriptParameters.length; k++) { - if(scriptBot.scriptParameters[k].paramType === 'Default' || scriptBot.scriptParameters[k].paramType === 'Password'){ + if(scriptBot.scriptParameters[k].paramType === '' || scriptBot.scriptParameters[k].paramType === 'Default' || scriptBot.scriptParameters[k].paramType === 'Password'){ scriptBot.scriptParameters[k].paramVal = cryptography.decryptText(scriptBot.scriptParameters[k].paramVal, cryptoConfig.decryptionEncoding, cryptoConfig.encryptionEncoding); }else {