diff --git a/app/controllers/filters/grading_periods.rb b/app/controllers/filters/grading_periods.rb index dfe70444b26..669590aceaa 100644 --- a/app/controllers/filters/grading_periods.rb +++ b/app/controllers/filters/grading_periods.rb @@ -1,7 +1,11 @@ module Filters::GradingPeriods def check_feature_flag unless multiple_grading_periods? - render status: 404, template: "shared/errors/404_message" + if api_request? + render json: {message: t('Page not found')}, status: :not_found + else + render status: 404, template: "shared/errors/404_message" + end end end end diff --git a/app/models/grading_period_group.rb b/app/models/grading_period_group.rb index 44d27279596..7465bbb8577 100644 --- a/app/models/grading_period_group.rb +++ b/app/models/grading_period_group.rb @@ -9,6 +9,7 @@ class GradingPeriodGroup < ActiveRecord::Base can :read given do |user, http_session| + return false unless (course || account).root_account.feature_enabled?(:multiple_grading_periods) if course course.grants_right?(user, http_session, :update) elsif account