Include extra details in Invitation AuditEvent
This commit is contained in:
@@ -25,6 +25,10 @@ class AuditLog(object):
|
||||
)
|
||||
return AuditEventQuery.get_all(pagination_opts)
|
||||
|
||||
@classmethod
|
||||
def get_by_resource(cls, resource_id):
|
||||
return db.session.query(AuditEvent).filter(AuditEvent.resource_id == resource_id).order_by(AuditEvent.time_created.desc()).all()
|
||||
|
||||
@classmethod
|
||||
def _resource_type(cls, resource):
|
||||
return type(resource).__name__.lower()
|
||||
|
@@ -91,3 +91,24 @@ class Invitation(Base, TimestampsMixin, AuditableMixin):
|
||||
@property
|
||||
def is_revokable(self):
|
||||
return self.is_pending and not self.is_expired
|
||||
|
||||
@property
|
||||
def user_dod_id(self):
|
||||
return self.user.dod_id if self.user is not None else None
|
||||
|
||||
@property
|
||||
def event_details(self):
|
||||
return {
|
||||
"email": self.email,
|
||||
"dod_id": self.user_dod_id,
|
||||
}
|
||||
|
||||
@property
|
||||
def history(self):
|
||||
changes = self.get_changes()
|
||||
change_set = {}
|
||||
|
||||
if "status" in changes:
|
||||
change_set["status"] = [s.name for s in changes["status"]]
|
||||
|
||||
return change_set
|
||||
|
Reference in New Issue
Block a user