mirror of
https://github.com/ansible/awx.git
synced 2024-10-31 15:21:13 +03:00
On JT form, Show credential tags from summary_fields if user
doesn't have view permission on the credential
This commit is contained in:
parent
ddc2af0691
commit
a3c8bd6b6f
@ -177,7 +177,7 @@ export default ['Rest', 'ProcessErrors', '$q', 'GetBasePath', function(Rest, Pro
|
||||
}, credTypes, credTypeOptions, credTags;
|
||||
|
||||
let credDefers = [];
|
||||
|
||||
let job_template_obj = data;
|
||||
// get machine credential
|
||||
if (data.related.credential) {
|
||||
Rest.setUrl(data.related.credential);
|
||||
@ -186,6 +186,11 @@ export default ['Rest', 'ProcessErrors', '$q', 'GetBasePath', function(Rest, Pro
|
||||
selectedCredentials.machine = data;
|
||||
})
|
||||
.catch(({data, status}) => {
|
||||
if (status === 403) {
|
||||
/* User doesn't have read access to the machine credential, so use summary_fields */
|
||||
selectedCredentials.machine = job_template_obj.summary_fields.credential;
|
||||
selectedCredentials.machine.credential_type = job_template_obj.summary_fields.credential.credential_type_id;
|
||||
} else {
|
||||
ProcessErrors(
|
||||
null, data, status, null,
|
||||
{
|
||||
@ -194,6 +199,7 @@ export default ['Rest', 'ProcessErrors', '$q', 'GetBasePath', function(Rest, Pro
|
||||
'Get returned status: ' +
|
||||
status
|
||||
});
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
@ -204,6 +210,11 @@ export default ['Rest', 'ProcessErrors', '$q', 'GetBasePath', function(Rest, Pro
|
||||
selectedCredentials.vault = data;
|
||||
})
|
||||
.catch(({data, status}) => {
|
||||
if (status === 403) {
|
||||
/* User doesn't have read access to the vault credential, so use summary_fields */
|
||||
selectedCredentials.vault = job_template_obj.summary_fields.vault_credential;
|
||||
selectedCredentials.vault.credential_type = job_template_obj.summary_fields.vault_credential.credential_type_id;
|
||||
} else {
|
||||
ProcessErrors(
|
||||
null, data, status, null,
|
||||
{
|
||||
@ -212,6 +223,7 @@ export default ['Rest', 'ProcessErrors', '$q', 'GetBasePath', function(Rest, Pro
|
||||
'Get returned status: ' +
|
||||
status
|
||||
});
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
@ -223,6 +235,11 @@ export default ['Rest', 'ProcessErrors', '$q', 'GetBasePath', function(Rest, Pro
|
||||
selectedCredentials.extra = data.results;
|
||||
})
|
||||
.catch(({data, status}) => {
|
||||
if (status === 403) {
|
||||
/* User doesn't have read access to the extra credentials, so use summary_fields */
|
||||
selectedCredentials.extra = job_template_obj.summary_fields.extra_credentials;
|
||||
_.map(selectedCredentials.extra, (cred) => {cred.credential_type = cred.credential_type_id;});
|
||||
} else {
|
||||
ProcessErrors(null, data, status, null,
|
||||
{
|
||||
hdr: 'Error!',
|
||||
@ -230,6 +247,7 @@ export default ['Rest', 'ProcessErrors', '$q', 'GetBasePath', function(Rest, Pro
|
||||
'Get returned status: ' +
|
||||
status
|
||||
});
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user