authorize reminder config
This commit is contained in:
@@ -8,6 +8,7 @@ class NotificationsSettingsController < ApplicationController
|
|||||||
|
|
||||||
before_action :build_account_config, only: :create
|
before_action :build_account_config, only: :create
|
||||||
authorize_resource :account_config, only: :create
|
authorize_resource :account_config, only: :create
|
||||||
|
before_action :authorize_email_reminders!, only: :create
|
||||||
|
|
||||||
def index; end
|
def index; end
|
||||||
|
|
||||||
@@ -21,6 +22,14 @@ class NotificationsSettingsController < ApplicationController
|
|||||||
|
|
||||||
private
|
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
|
def build_account_config
|
||||||
@account_config =
|
@account_config =
|
||||||
AccountConfig.find_or_initialize_by(account: current_account, key: email_config_params[:key])
|
AccountConfig.find_or_initialize_by(account: current_account, key: email_config_params[:key])
|
||||||
|
|||||||
Reference in New Issue
Block a user