Only show cred type test button to superusers.

Without a credential instance, plugin tests go through the credential
type (not credential) api. Since this endpoint is for superusers only,
we hide the test button when non-superusers are adding a new external
credential.
This commit is contained in:
Jake McDermott 2019-12-03 15:23:02 -05:00
parent 68a6984fcd
commit 540f8ab7d6
No known key found for this signature in database
GPG Key ID: 0E56ED990CDFCB4F

View File

@ -156,7 +156,13 @@ function AddEditCredentialsController (
if (credential.get('credential_type') === credentialType.get('id')) {
vm.inputSources.items = credential.get('related.input_sources.results');
}
vm.isTestable = (isEditable && credentialType.get('kind') === 'external');
if (mode === 'add') {
vm.isTestable = (models.me.get('is_superuser') && credentialType.get('kind') === 'external');
} else {
vm.isTestable = (isEditable && credentialType.get('kind') === 'external');
}
vm.getSubmitData = getSubmitData;
vm.checkForm = check;