mirror of
https://github.com/ZwareBear/awx.git
synced 2026-04-30 20:01:48 -05:00
Merge pull request #333 from jangsutsr/7505_disallow_changing_credential_type_of_credential
Disallow changing credential_type of an existing credential
This commit is contained in:
@@ -2143,6 +2143,14 @@ class CredentialSerializer(BaseSerializer):
|
||||
return value
|
||||
return super(CredentialSerializer, self).to_internal_value(data)
|
||||
|
||||
def validate_credential_type(self, credential_type):
|
||||
if self.instance and credential_type.pk != self.instance.credential_type.pk:
|
||||
raise ValidationError(
|
||||
_('You cannot change the credential type of the credential, as it may break the functionality'
|
||||
' of the resources using it.'),
|
||||
)
|
||||
return credential_type
|
||||
|
||||
|
||||
class CredentialSerializerCreate(CredentialSerializer):
|
||||
|
||||
|
||||
Reference in New Issue
Block a user