allow updatable account settings via api endpoint to be extended
Change-Id: I8d4a625294acf0535b1c27ed04ab34875f3a24d2 Reviewed-on: https://gerrit.instructure.com/181334 Tested-by: Jenkins Reviewed-by: Cody Cutrer <cody@instructure.com> QA-Review: Cody Cutrer <cody@instructure.com> Product-Review: James Williams <jamesw@instructure.com>
This commit is contained in:
parent
f9017511b1
commit
7df1200f02
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue