Merge pull request #74 from mabashian/7299-pmrun

Fix privilege escalation password label on launch
This commit is contained in:
Michael Abashian 2017-07-27 08:54:01 -04:00 committed by GitHub
commit 453a418ee3
4 changed files with 24 additions and 23 deletions

View File

@ -292,7 +292,7 @@ export default ['i18n', function(i18n) {
ngChange: 'becomeMethodChange()',
},
"become_username": {
labelBind: 'becomeUsernameLabel',
label: i18n._('Privilege Escalation Username'),
type: 'text',
ngShow: "(kind.value == 'ssh' && (become_method && become_method.value)) ",
@ -302,7 +302,7 @@ export default ['i18n', function(i18n) {
ngDisabled: '!(credential_obj.summary_fields.user_capabilities.edit || canAdd)'
},
"become_password": {
labelBind: 'becomePasswordLabel',
label: i18n._('Privilege Escalation Password'),
type: 'sensitive',
ngShow: "(kind.value == 'ssh' && (become_method && become_method.value)) ",
ngDisabled: "become_password_ask || !(credential_obj.summary_fields.user_capabilities.edit || canAdd)",

View File

@ -15,8 +15,6 @@ export default
break;
case 'ssh':
scope.usernameLabel = i18n._('Username'); //formally 'SSH Username'
scope.becomeUsernameLabel = i18n._('Privilege Escalation Username');
scope.becomePasswordLabel = i18n._('Privilege Escalation Password');
break;
case 'scm':
scope.sshKeyDataLabel = i18n._('SCM Private Key');

View File

@ -72,8 +72,6 @@ export default
break;
case 'ssh':
scope.usernameLabel = i18n._('Username'); //formally 'SSH Username'
scope.becomeUsernameLabel = i18n._('Privilege Escalation Username');
scope.becomePasswordLabel = i18n._('Privilege Escalation Password');
break;
case 'scm':
scope.sshKeyDataLabel = i18n._('SCM Private Key');

View File

@ -1,5 +1,5 @@
export default
function CheckPasswords(Rest, GetBasePath, ProcessErrors, Empty) {
function CheckPasswords(Rest, GetBasePath, ProcessErrors, Empty, credentialTypesLookup) {
return function(params) {
var scope = params.scope,
callback = params.callback,
@ -10,21 +10,25 @@ export default
Rest.setUrl(GetBasePath('credentials')+credential);
Rest.get()
.success(function (data) {
if(data.kind === "ssh"){
if(data.password === "ASK" ){
passwords.push("ssh_password");
}
if(data.ssh_key_unlock === "ASK"){
passwords.push("ssh_key_unlock");
}
if(data.become_password === "ASK"){
passwords.push("become_password");
}
if(data.vault_password === "ASK"){
passwords.push("vault_password");
}
}
scope.$emit(callback, passwords);
credentialTypesLookup()
.then(kinds => {
if(data.credential_type === kinds.Machine && data.inputs){console.log(data.inputs);
if(data.inputs.password === "ASK" ){
passwords.push("ssh_password");
}
if(data.inputs.ssh_key_unlock === "ASK"){
passwords.push("ssh_key_unlock");
}
if(data.inputs.become_password === "ASK"){
passwords.push("become_password");
}
if(data.inputs.vault_password === "ASK"){
passwords.push("vault_password");
}
}
scope.$emit(callback, passwords);
});
})
.error(function (data, status) {
ProcessErrors(scope, data, status, null, { hdr: 'Error!',
@ -39,5 +43,6 @@ CheckPasswords.$inject =
[ 'Rest',
'GetBasePath',
'ProcessErrors',
'Empty'
'Empty',
'credentialTypesLookup'
];