Merge pull request #341 from dod-ccpo/ui/clean-up-audit-log

Initial audit log UI cleanup
This commit is contained in:
richard-dds
2018-09-26 11:33:03 -04:00
committed by GitHub
4 changed files with 60 additions and 12 deletions

View File

@@ -42,6 +42,20 @@ 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