mirror of
https://github.com/discourse/discourse.git
synced 2025-04-10 03:30:49 +08:00
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
|
rescue BackupRestore::OperationRunningError
|
||||||
render json: failed_json.merge(message: I18n.t("backup.operation_already_running"))
|
render json: failed_json.merge(message: I18n.t("backup.operation_already_running"))
|
||||||
else
|
else
|
||||||
|
StaffActionLogger.new(current_user).log_backup_operation
|
||||||
render json: success_json
|
render json: success_json
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -50,7 +50,8 @@ class UserHistory < ActiveRecord::Base
|
|||||||
grant_admin: 32,
|
grant_admin: 32,
|
||||||
revoke_admin: 33,
|
revoke_admin: 33,
|
||||||
grant_moderation: 34,
|
grant_moderation: 34,
|
||||||
revoke_moderation: 35)
|
revoke_moderation: 35,
|
||||||
|
backup_operation: 36)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Staff actions is a subset of all actions, used to audit actions taken by staff users.
|
# 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,
|
:grant_admin,
|
||||||
:revoke_admin,
|
:revoke_admin,
|
||||||
:grant_moderation,
|
:grant_moderation,
|
||||||
:revoke_moderation]
|
:revoke_moderation,
|
||||||
|
:backup_operation]
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.staff_action_ids
|
def self.staff_action_ids
|
||||||
|
@ -326,6 +326,12 @@ class StaffActionLogger
|
|||||||
}))
|
}))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def log_backup_operation(opts={})
|
||||||
|
UserHistory.create(params(opts).merge({
|
||||||
|
action: UserHistory.actions[:backup_operation]
|
||||||
|
}))
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def params(opts=nil)
|
def params(opts=nil)
|
||||||
|
@ -2354,6 +2354,7 @@ en:
|
|||||||
revoke_admin: "revoke admin"
|
revoke_admin: "revoke admin"
|
||||||
grant_moderation: "grant moderation"
|
grant_moderation: "grant moderation"
|
||||||
revoke_moderation: "revoke moderation"
|
revoke_moderation: "revoke moderation"
|
||||||
|
backup_operation: "backup operation"
|
||||||
screened_emails:
|
screened_emails:
|
||||||
title: "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."
|
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…
x
Reference in New Issue
Block a user