SECURITY: Moderators cannot see user emails.

Unless `moderators_view_emails` SiteSetting is enabled, moderators should not be able to discover users’ emails.
This commit is contained in:
Krzysztof Kotlarek
2024-11-13 14:04:20 +11:00
committed by =
parent 023b61ad22
commit 95564a3df2
9 changed files with 112 additions and 12 deletions

View File

@@ -1,6 +1,8 @@
# frozen_string_literal: true
class Admin::ScreenedEmailsController < Admin::StaffController
before_action :ensure_can_see_emails
def index
screened_emails = ScreenedEmail.limit(200).order("last_match_at desc").to_a
render_serialized(screened_emails, ScreenedEmailSerializer)
@@ -11,4 +13,8 @@ class Admin::ScreenedEmailsController < Admin::StaffController
screen.destroy!
render json: success_json
end
def ensure_can_see_emails
guardian.ensure_can_see_emails!
end
end