feat: Audit log APIs (#6434)
- Adds the appropriate APIs for Audit Logs. ref: #6015
This commit is contained in:
7
enterprise/app/models/enterprise/audit/account.rb
Normal file
7
enterprise/app/models/enterprise/audit/account.rb
Normal file
@@ -0,0 +1,7 @@
|
||||
module Enterprise::Audit::Account
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
has_associated_audits
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,7 @@
|
||||
module Enterprise::Audit::AutomationRule
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
audited associated_with: :account
|
||||
end
|
||||
end
|
||||
7
enterprise/app/models/enterprise/audit/inbox.rb
Normal file
7
enterprise/app/models/enterprise/audit/inbox.rb
Normal file
@@ -0,0 +1,7 @@
|
||||
module Enterprise::Audit::Inbox
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
audited associated_with: :account
|
||||
end
|
||||
end
|
||||
7
enterprise/app/models/enterprise/audit/webhook.rb
Normal file
7
enterprise/app/models/enterprise/audit/webhook.rb
Normal file
@@ -0,0 +1,7 @@
|
||||
module Enterprise::Audit::Webhook
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
audited associated_with: :account
|
||||
end
|
||||
end
|
||||
11
enterprise/app/models/enterprise/audit_log.rb
Normal file
11
enterprise/app/models/enterprise/audit_log.rb
Normal file
@@ -0,0 +1,11 @@
|
||||
class Enterprise::AuditLog < Audited::Audit
|
||||
after_save :log_additional_information
|
||||
|
||||
private
|
||||
|
||||
def log_additional_information
|
||||
# rubocop:disable Rails/SkipsModelValidations
|
||||
update_columns(username: user&.email)
|
||||
# rubocop:enable Rails/SkipsModelValidations
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user