From 895ad70a123b40262233d5d9e08f6d13d3c8f2a4 Mon Sep 17 00:00:00 2001
From: mabashian
Date: Mon, 16 Apr 2018 15:38:32 -0400
Subject: [PATCH] Prevent users from attempting to create a template schedule
or workflow node with credentials that require passwords
---
.../launchTemplateButton.partial.html | 2 +-
.../relaunchButton/relaunchButton.partial.html | 2 +-
.../job-templates/job-templates-list.partial.html | 2 +-
.../client/src/portal-mode/portal-mode.route.js | 2 +-
.../src/scheduler/schedulerAdd.controller.js | 2 ++
.../src/scheduler/schedulerEdit.controller.js | 2 ++
.../src/scheduler/schedulerForm.partial.html | 2 +-
.../src/templates/prompt/prompt.controller.js | 1 +
.../src/templates/prompt/prompt.directive.js | 3 ++-
.../src/templates/prompt/prompt.partial.html | 15 ++++++++++++---
.../credential/prompt-credential.directive.js | 3 ++-
.../credential/prompt-credential.partial.html | 14 +++++++++++++-
.../workflow-maker/workflow-maker.controller.js | 1 +
.../workflow-maker/workflow-maker.partial.html | 2 +-
14 files changed, 41 insertions(+), 12 deletions(-)
diff --git a/awx/ui/client/lib/components/launchTemplateButton/launchTemplateButton.partial.html b/awx/ui/client/lib/components/launchTemplateButton/launchTemplateButton.partial.html
index 9ac0fc2e1b..fc5c90de57 100644
--- a/awx/ui/client/lib/components/launchTemplateButton/launchTemplateButton.partial.html
+++ b/awx/ui/client/lib/components/launchTemplateButton/launchTemplateButton.partial.html
@@ -5,5 +5,5 @@
data-placement="top">
-
+
diff --git a/awx/ui/client/lib/components/relaunchButton/relaunchButton.partial.html b/awx/ui/client/lib/components/relaunchButton/relaunchButton.partial.html
index 69b3eea711..280380dcbc 100644
--- a/awx/ui/client/lib/components/relaunchButton/relaunchButton.partial.html
+++ b/awx/ui/client/lib/components/relaunchButton/relaunchButton.partial.html
@@ -30,5 +30,5 @@
ng-if="!vm.showDropdown">
-
+
diff --git a/awx/ui/client/src/home/dashboard/lists/job-templates/job-templates-list.partial.html b/awx/ui/client/src/home/dashboard/lists/job-templates/job-templates-list.partial.html
index c80c4f955e..e60a7e5c71 100644
--- a/awx/ui/client/src/home/dashboard/lists/job-templates/job-templates-list.partial.html
+++ b/awx/ui/client/src/home/dashboard/lists/job-templates/job-templates-list.partial.html
@@ -56,4 +56,4 @@
You can create a job template here.
-
+
diff --git a/awx/ui/client/src/portal-mode/portal-mode.route.js b/awx/ui/client/src/portal-mode/portal-mode.route.js
index cb347821b3..8812a489d6 100644
--- a/awx/ui/client/src/portal-mode/portal-mode.route.js
+++ b/awx/ui/client/src/portal-mode/portal-mode.route.js
@@ -50,7 +50,7 @@ export default {
list: PortalJobTemplateList,
mode: 'edit'
});
- return html + '';
+ return html + '';
},
controller: PortalModeJobTemplatesController
}
diff --git a/awx/ui/client/src/scheduler/schedulerAdd.controller.js b/awx/ui/client/src/scheduler/schedulerAdd.controller.js
index 4e34389a7e..4a6ad12c9c 100644
--- a/awx/ui/client/src/scheduler/schedulerAdd.controller.js
+++ b/awx/ui/client/src/scheduler/schedulerAdd.controller.js
@@ -32,6 +32,8 @@ export default ['$filter', '$state', '$stateParams', '$http', 'Wait',
$scope.$parent.schedulerEndDt = month + '/' + day + '/' + dt.getFullYear();
};
+ $scope.preventCredsWithPasswords = true;
+
/*
* This is a workaround for the angular-scheduler library inserting `ll` into fields after an
* invalid entry and never unsetting them. Presumably null is being truncated down to 2 chars
diff --git a/awx/ui/client/src/scheduler/schedulerEdit.controller.js b/awx/ui/client/src/scheduler/schedulerEdit.controller.js
index f82d89cd46..5893d7394e 100644
--- a/awx/ui/client/src/scheduler/schedulerEdit.controller.js
+++ b/awx/ui/client/src/scheduler/schedulerEdit.controller.js
@@ -10,6 +10,8 @@ function($filter, $state, $stateParams, Wait, $scope, moment,
let schedule, scheduler, scheduleCredentials = [];
+ $scope.preventCredsWithPasswords = true;
+
// initial end @ midnight values
$scope.schedulerEndHour = "00";
$scope.schedulerEndMinute = "00";
diff --git a/awx/ui/client/src/scheduler/schedulerForm.partial.html b/awx/ui/client/src/scheduler/schedulerForm.partial.html
index bea1d9eade..bb68bfbaaf 100644
--- a/awx/ui/client/src/scheduler/schedulerForm.partial.html
+++ b/awx/ui/client/src/scheduler/schedulerForm.partial.html
@@ -686,5 +686,5 @@
ng-disabled="!schedulerIsValid || promptModalMissingReqFields"> Save
-
+
diff --git a/awx/ui/client/src/templates/prompt/prompt.controller.js b/awx/ui/client/src/templates/prompt/prompt.controller.js
index 5b6f035dd5..95e756fd78 100644
--- a/awx/ui/client/src/templates/prompt/prompt.controller.js
+++ b/awx/ui/client/src/templates/prompt/prompt.controller.js
@@ -16,6 +16,7 @@ export default [ 'Rest', 'GetBasePath', 'ProcessErrors', 'CredentialTypeModel',
({ modal } = scope[scope.ns]);
scope.$watch('vm.promptData.triggerModalOpen', () => {
+
vm.actionButtonClicked = false;
if(vm.promptData && vm.promptData.triggerModalOpen) {
diff --git a/awx/ui/client/src/templates/prompt/prompt.directive.js b/awx/ui/client/src/templates/prompt/prompt.directive.js
index 501d89f79a..b09a3bcc84 100644
--- a/awx/ui/client/src/templates/prompt/prompt.directive.js
+++ b/awx/ui/client/src/templates/prompt/prompt.directive.js
@@ -5,7 +5,8 @@ export default [ 'templateUrl',
scope: {
promptData: '=',
onFinish: '&',
- actionText: '@actionText'
+ actionText: '@actionText',
+ preventCredsWithPasswords: '<'
},
templateUrl: templateUrl('templates/prompt/prompt'),
replace: true,
diff --git a/awx/ui/client/src/templates/prompt/prompt.partial.html b/awx/ui/client/src/templates/prompt/prompt.partial.html
index 98ca4f9644..a25bef7e0b 100644
--- a/awx/ui/client/src/templates/prompt/prompt.partial.html
+++ b/awx/ui/client/src/templates/prompt/prompt.partial.html
@@ -12,7 +12,11 @@
+
+
+
+
+ Credentials that require passwords on launch are not permitted for template schedules and workflow nodes. The following credentials must be removed or replaced to proceed:
+
+
+
{{promptData.prompts.credentials.passwords.ssh.name || promptData.prompts.credentials.passwords.become.name || promptData.prompts.credentials.passwords.ssh_key_unlock.name}}
+
{{vaultCred.name}}
+
+
+
{{:: vm.strings.get('prompt.CREDENTIAL_TYPE') }}:
@@ -53,7 +65,7 @@
-
+
{{:: vm.strings.get('prompt.PASSWORDS_REQUIRED_HELP') }}