FEATURE: log backup operation
This commit is contained in:
parent
89d550dac5
commit
8f62a0caa8
|
@ -32,6 +32,7 @@ class Admin::BackupsController < Admin::AdminController
|
|||
rescue BackupRestore::OperationRunningError
|
||||
render json: failed_json.merge(message: I18n.t("backup.operation_already_running"))
|
||||
else
|
||||
StaffActionLogger.new(current_user).log_backup_operation
|
||||
render json: success_json
|
||||
end
|
||||
|
||||
|
|
|
@ -50,7 +50,8 @@ class UserHistory < ActiveRecord::Base
|
|||
grant_admin: 32,
|
||||
revoke_admin: 33,
|
||||
grant_moderation: 34,
|
||||
revoke_moderation: 35)
|
||||
revoke_moderation: 35,
|
||||
backup_operation: 36)
|
||||
end
|
||||
|
||||
# Staff actions is a subset of all actions, used to audit actions taken by staff users.
|
||||
|
@ -82,7 +83,8 @@ class UserHistory < ActiveRecord::Base
|
|||
:grant_admin,
|
||||
:revoke_admin,
|
||||
:grant_moderation,
|
||||
:revoke_moderation]
|
||||
:revoke_moderation,
|
||||
:backup_operation]
|
||||
end
|
||||
|
||||
def self.staff_action_ids
|
||||
|
|
|
@ -326,6 +326,12 @@ class StaffActionLogger
|
|||
}))
|
||||
end
|
||||
|
||||
def log_backup_operation(opts={})
|
||||
UserHistory.create(params(opts).merge({
|
||||
action: UserHistory.actions[:backup_operation]
|
||||
}))
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def params(opts=nil)
|
||||
|
|
|
@ -2354,6 +2354,7 @@ en:
|
|||
revoke_admin: "revoke admin"
|
||||
grant_moderation: "grant moderation"
|
||||
revoke_moderation: "revoke moderation"
|
||||
backup_operation: "backup operation"
|
||||
screened_emails:
|
||||
title: "Screened Emails"
|
||||
description: "When someone tries to create a new account, the following email addresses will be checked and the registration will be blocked, or some other action performed."
|
||||
|
|
Loading…
Reference in New Issue