mirror of
https://github.com/ansible/awx.git
synced 2026-05-19 23:07:42 -02:30
Hide active tasks if anonymous user
This commit is contained in:
@@ -15,7 +15,7 @@ from collections import OrderedDict
|
|||||||
|
|
||||||
# Django
|
# Django
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User, AnonymousUser
|
||||||
from django.core.cache import cache
|
from django.core.cache import cache
|
||||||
from django.core.urlresolvers import reverse
|
from django.core.urlresolvers import reverse
|
||||||
from django.core.exceptions import FieldError
|
from django.core.exceptions import FieldError
|
||||||
@@ -180,9 +180,11 @@ class ApiV1PingView(APIView):
|
|||||||
'ha': is_ha_environment(),
|
'ha': is_ha_environment(),
|
||||||
'version': get_awx_version(),
|
'version': get_awx_version(),
|
||||||
'active_node': settings.CLUSTER_HOST_ID,
|
'active_node': settings.CLUSTER_HOST_ID,
|
||||||
'celery_active_tasks': json.loads(active_tasks) if active_tasks is not None else None
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if not isinstance(request.user, AnonymousUser):
|
||||||
|
response['celery_active_tasks'] = json.loads(active_tasks) if active_tasks is not None else None
|
||||||
|
|
||||||
response['instances'] = []
|
response['instances'] = []
|
||||||
for instance in Instance.objects.all():
|
for instance in Instance.objects.all():
|
||||||
response['instances'].append(dict(node=instance.hostname, heartbeat=instance.modified, capacity=instance.capacity))
|
response['instances'].append(dict(node=instance.hostname, heartbeat=instance.modified, capacity=instance.capacity))
|
||||||
|
|||||||
Reference in New Issue
Block a user