diff --git a/app/controllers/accounts_controller.rb b/app/controllers/accounts_controller.rb index a3e80d06e78..04ac7304bbe 100644 --- a/app/controllers/accounts_controller.rb +++ b/app/controllers/accounts_controller.rb @@ -711,11 +711,7 @@ class AccountsController < ApplicationController unless account_settings.empty? if @account.grants_right?(@current_user, session, :manage_account_settings) if account_settings[:settings] - account_settings[:settings].slice!(:restrict_student_past_view, - :restrict_student_future_view, - :restrict_student_future_listing, - :lock_all_announcements, - :sis_assignment_name_length_input) + account_settings[:settings].slice!(*permitted_api_account_settings) ensure_sis_max_name_length_value!(account_settings) end @account.errors.add(:name, t(:account_name_required, 'The account name cannot be blank')) if account_params.has_key?(:name) && account_params[:name].blank? @@ -1437,6 +1433,14 @@ class AccountsController < ApplicationController ] end + def permitted_api_account_settings + [:restrict_student_past_view, + :restrict_student_future_view, + :restrict_student_future_listing, + :lock_all_announcements, + :sis_assignment_name_length_input] + end + def strong_account_params # i'm doing this instead of normal params because we do too much hackery to the weak params, especially in plugins # and it breaks when we enforce inherited weak parameters (because we're not actually editing request.parameters anymore)