diff --git a/awx/api/serializers.py b/awx/api/serializers.py index 7a36209fc6..416a7fc925 100644 --- a/awx/api/serializers.py +++ b/awx/api/serializers.py @@ -2584,7 +2584,7 @@ class V2CredentialFields(BaseSerializer, metaclass=BaseSerializerMetaclass): class CredentialSerializer(BaseSerializer): - show_capabilities = ['edit', 'delete', 'copy'] + show_capabilities = ['edit', 'delete', 'copy', 'use'] capabilities_prefetch = ['admin', 'use'] class Meta: diff --git a/awx/main/access.py b/awx/main/access.py index 753d436b3d..a211622357 100644 --- a/awx/main/access.py +++ b/awx/main/access.py @@ -1162,6 +1162,11 @@ class CredentialAccess(BaseAccess): # return True return self.can_change(obj, None) + def get_user_capabilities(self, obj, **kwargs): + user_capabilities = super(CredentialAccess, self).get_user_capabilities(obj, **kwargs) + user_capabilities['use'] = self.can_use(obj) + return user_capabilities + class CredentialInputSourceAccess(BaseAccess): '''