Listen for changes to environment roles and only log update events when something has changed

This commit is contained in:
Montana 2018-11-14 15:27:29 -05:00
parent 887c134b25
commit f21608ef5e
2 changed files with 3 additions and 2 deletions

View File

@ -10,7 +10,7 @@ class CSPRole(Enum):
NONSENSE_ROLE = "nonsense_role"
class EnvironmentRole(Base, mixins.TimestampsMixin):
class EnvironmentRole(Base, mixins.TimestampsMixin, mixins.AuditableMixin):
__tablename__ = "environment_roles"
id = types.Id()

View File

@ -52,6 +52,7 @@ class AuditableMixin(object):
@staticmethod
def audit_update(mapper, connection, target):
if AuditableMixin.get_history(target):
target.create_audit_event(connection, target, ACTION_UPDATE)
def get_changes(self):