log activity description prop
This commit is contained in:
parent
d0c1bc563f
commit
7a5d733b20
@ -42,6 +42,22 @@ class AuditEvent(Base, TimestampsMixin):
|
||||
|
||||
return " ".join([user_str, action_str, display_name_str, scope_str])
|
||||
|
||||
|
||||
@property
|
||||
def activity_description(self):
|
||||
action_str = "{} on {} {}".format(
|
||||
self.action, self.resource_type, self.resource_id
|
||||
)
|
||||
display_name_str = "({})".format(self.display_name) if self.display_name else ""
|
||||
scope_str = ""
|
||||
if self.request_id and self.resource_type != "request":
|
||||
scope_str = "for request {}".format(self.request_id)
|
||||
elif self.workspace_id and self.resource_type != "workspace":
|
||||
scope_str = "in workspace {}".format(self.workspace_id)
|
||||
|
||||
return " ".join([action_str, display_name_str, scope_str])
|
||||
|
||||
|
||||
def save(self, connection):
|
||||
attrs = inspect(self).dict
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user