mirror of
https://github.com/ansible/awx.git
synced 2026-02-25 06:56:00 -03:30
Merge pull request #1147 from AlanCoding/exclude_last_used
Exclude last_used from activity stream
This commit is contained in:
@@ -350,11 +350,14 @@ def get_allowed_fields(obj, serializer_mapping):
|
|||||||
allowed_fields = [x for x in serializer_actual.fields if not serializer_actual.fields[x].read_only] + ['id']
|
allowed_fields = [x for x in serializer_actual.fields if not serializer_actual.fields[x].read_only] + ['id']
|
||||||
else:
|
else:
|
||||||
allowed_fields = [x.name for x in obj._meta.fields]
|
allowed_fields = [x.name for x in obj._meta.fields]
|
||||||
if obj._meta.model_name == 'user':
|
|
||||||
field_blacklist = ['last_login']
|
ACTIVITY_STREAM_FIELD_EXCLUSIONS = {
|
||||||
allowed_fields = [f for f in allowed_fields if f not in field_blacklist]
|
'user': ['last_login'],
|
||||||
if obj._meta.model_name == 'oauth2application':
|
'oauth2accesstoken': ['last_used'],
|
||||||
field_blacklist = ['client_secret']
|
'oauth2application': ['client_secret']
|
||||||
|
}
|
||||||
|
field_blacklist = ACTIVITY_STREAM_FIELD_EXCLUSIONS.get(obj._meta.model_name, [])
|
||||||
|
if field_blacklist:
|
||||||
allowed_fields = [f for f in allowed_fields if f not in field_blacklist]
|
allowed_fields = [f for f in allowed_fields if f not in field_blacklist]
|
||||||
return allowed_fields
|
return allowed_fields
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user