mirror of
https://github.com/ansible/awx.git
synced 2026-03-13 23:17:32 -02:30
We need to check for AnonymousUser here sine that's what Django Request Framework will return when no authentication is provided
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
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.db.models.signals import pre_save, post_save
|
from django.db.models.signals import pre_save, post_save
|
||||||
from django.utils.functional import curry
|
from django.utils.functional import curry
|
||||||
from awx.main.models import ActivityStream, AuthToken
|
from awx.main.models import ActivityStream, AuthToken
|
||||||
@@ -17,7 +17,6 @@ class ActivityStreamMiddleware(object):
|
|||||||
user = None
|
user = None
|
||||||
|
|
||||||
self.instances = []
|
self.instances = []
|
||||||
self.cached_user = None
|
|
||||||
set_actor = curry(self.set_actor, user)
|
set_actor = curry(self.set_actor, user)
|
||||||
self.disp_uid = str(uuid.uuid1())
|
self.disp_uid = str(uuid.uuid1())
|
||||||
self.finished = False
|
self.finished = False
|
||||||
@@ -30,7 +29,7 @@ class ActivityStreamMiddleware(object):
|
|||||||
self.finished = True
|
self.finished = True
|
||||||
if self.isActivityStreamEvent:
|
if self.isActivityStreamEvent:
|
||||||
for instance in self.instances:
|
for instance in self.instances:
|
||||||
if drf_user is not None:
|
if drf_user is not None and drf_user.__class__ != AnonymousUser:
|
||||||
instance.user = drf_user
|
instance.user = drf_user
|
||||||
instance.save()
|
instance.save()
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user