add api documentation and data for course restriction settings

test plan:
* should be able to view api documentation for the new
 "restrict_student_past_view" and "restrict_student_future_view"
 course settings, as well as retrieve the values
 through the settings API

closes #CNVS-19425

Change-Id: Icca2fdc959f67591400990ac4a5ea532f2adce1d
Reviewed-on: https://gerrit.instructure.com/50690
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
This commit is contained in:
James Williams 2015-03-20 08:20:10 -06:00
parent 58a48b457a
commit 69e91d1d79
3 changed files with 17 additions and 3 deletions

View File

@ -1037,6 +1037,12 @@ class CoursesController < ApplicationController
# @argument lock_all_announcements [Boolean]
# Disable comments on announcements
#
# @argument restrict_student_past_view [Boolean]
# Restrict students from preventing courses after end date
#
# @argument restrict_student_future_view [Boolean]
# Restrict students from viewing courses before start date
#
# @example_request
# curl https://<canvas>/api/v1/courses/<course_id>/settings \
# -X PUT \

View File

@ -33,6 +33,8 @@ module Api::V1::Course
settings[:hide_final_grades] = course.hide_final_grades?
settings[:hide_distribution_graphs] = course.hide_distribution_graphs?
settings[:lock_all_announcements] = course.lock_all_announcements?
settings[:restrict_student_past_view] = course.restrict_student_past_view?
settings[:restrict_student_future_view] = course.restrict_student_future_view?
settings
end

View File

@ -2286,7 +2286,9 @@ describe CoursesController, type: :request do
'allow_student_organized_groups' => true,
'hide_distribution_graphs' => false,
'hide_final_grades' => false,
'lock_all_announcements' => false
'lock_all_announcements' => false,
'restrict_student_past_view' => false,
'restrict_student_future_view' => false
})
end
@ -2305,7 +2307,9 @@ describe CoursesController, type: :request do
:allow_student_organized_groups => false,
:hide_distribution_graphs => true,
:hide_final_grades => true,
:lock_all_announcements => true
:lock_all_announcements => true,
:restrict_student_past_view => true,
:restrict_student_future_view => true
})
expect(json).to eq({
'allow_student_discussion_topics' => false,
@ -2316,7 +2320,9 @@ describe CoursesController, type: :request do
'allow_student_organized_groups' => false,
'hide_distribution_graphs' => true,
'hide_final_grades' => true,
'lock_all_announcements' => true
'lock_all_announcements' => true,
'restrict_student_past_view' => true,
'restrict_student_future_view' => true
})
@course.reload
expect(@course.allow_student_discussion_topics).to eq false