From 726174deff9fbb3264b8207ef54b4c7c0d7b41f5 Mon Sep 17 00:00:00 2001 From: Pete Matsyburka Date: Tue, 11 Aug 2026 08:55:17 +0300 Subject: [PATCH] authorize reminder config --- app/controllers/notifications_settings_controller.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/controllers/notifications_settings_controller.rb b/app/controllers/notifications_settings_controller.rb index f03f09c8..83502acd 100644 --- a/app/controllers/notifications_settings_controller.rb +++ b/app/controllers/notifications_settings_controller.rb @@ -8,6 +8,7 @@ class NotificationsSettingsController < ApplicationController before_action :build_account_config, only: :create authorize_resource :account_config, only: :create + before_action :authorize_email_reminders!, only: :create def index; end @@ -21,6 +22,14 @@ class NotificationsSettingsController < ApplicationController private + def authorize_email_reminders! + return unless Docuseal.multitenant? + return if @account_config.key != AccountConfig::SUBMITTER_REMINDERS + return if can?(:manage, :email_reminders) + + redirect_back fallback_location: settings_notifications_path, alert: I18n.t('unlock_with_docuseal_pro') + end + def build_account_config @account_config = AccountConfig.find_or_initialize_by(account: current_account, key: email_config_params[:key])