mirror of
https://github.com/ansible/awx.git
synced 2026-04-09 12:09:20 -02:30
credential validation for execution envs to allow only registry credentials to be associated with them, also adding security precautions for authfile and password, also combined token & password into one term to align with Quay, and added handling to account for users not filling in credential data and add a has_inputs function to simplify checking if the host, username, and password are present in the credential
This commit is contained in:
@@ -1412,6 +1412,11 @@ class ExecutionEnvironmentSerializer(BaseSerializer):
|
||||
res['credential'] = self.reverse('api:credential_detail', kwargs={'pk': obj.credential.pk})
|
||||
return res
|
||||
|
||||
def validate_credential(self, value):
|
||||
if value and value.kind != 'registry':
|
||||
raise serializers.ValidationError(_('Only Container Registry credentials can be associated with an Execution Environment'))
|
||||
return value
|
||||
|
||||
def validate(self, attrs):
|
||||
# prevent changing organization of ee. Unsetting (change to null) is allowed
|
||||
if self.instance:
|
||||
|
||||
Reference in New Issue
Block a user