feat: Audit Logs for Account User Changes (#7405)
- Audit log for user invitations: https://linear.app/chatwoot/issue/CW-1768/invited-a-user-to-the-account - Audit log for change role: https://linear.app/chatwoot/issue/CW-1767/name-or-email-changed-the-role-of-the-user-email-to-agent-or-admin - Audit log for status change: https://linear.app/chatwoot/issue/CW-1766/availability-status-as-events-for-audit-logs Co-authored-by: Shivam Mishra <scm.mymail@gmail.com>
This commit is contained in:
13
enterprise/app/models/enterprise/audit/account_user.rb
Normal file
13
enterprise/app/models/enterprise/audit/account_user.rb
Normal file
@@ -0,0 +1,13 @@
|
||||
module Enterprise::Audit::AccountUser
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
audited only: [
|
||||
:availability,
|
||||
:role,
|
||||
:account_id,
|
||||
:inviter_id,
|
||||
:user_id
|
||||
], on: [:create, :update], associated_with: :account
|
||||
end
|
||||
end
|
||||
@@ -2,12 +2,13 @@ module Enterprise::Audit::User
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
# required only for sign_in and sign_out events, which we are logging manually
|
||||
# hence the proc that always returns false
|
||||
audited only: [
|
||||
:availability,
|
||||
:display_name,
|
||||
:email,
|
||||
:name
|
||||
]
|
||||
audited associated_with: :account
|
||||
], unless: proc { |_u| true }
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user