* feat: add audit_trail for sign_in event * chore: ignore unrelated User model columns for auditing * chore: fix prepend call for webhook/automation rule * chore: add spec for sign_in event * chore: refactor sign_in auditlog method to enterprise namespace * feat: add sign_out audit trail * feat: review comments
26 lines
523 B
Ruby
26 lines
523 B
Ruby
module Enterprise::DeviseOverrides::SessionsController
|
|
def render_create_success
|
|
create_audit_event('sign_in')
|
|
super
|
|
end
|
|
|
|
def destroy
|
|
create_audit_event('sign_out')
|
|
super
|
|
end
|
|
|
|
def create_audit_event(action)
|
|
return unless @resource
|
|
|
|
associated_type = 'Account'
|
|
@resource.accounts.each do |account|
|
|
@resource.audits.create(
|
|
action: action,
|
|
user_id: @resource.id,
|
|
associated_id: account.id,
|
|
associated_type: associated_type
|
|
)
|
|
end
|
|
end
|
|
end
|