gradebook: show sis button when individual section is selected
Previoiusly, when viewing a section in the Gradebook as a teacher, if the "Read SIS Data" permission wasn't enabled, there wasn't a "Sync Grades" button. Now, the button is present in this scenario. closes CNVS-39257 Test Plan: 1. Disable the "Read SIS Data" permission for teachers. 2. Create a course with a SIS ID. 3. Create two sections with SIS IDs. 4. Add a teacher to that course 5. Create an assignment. 6. Go to the assignments page and click the "sync to sis icon" next to the assignment name. 7. As a teacher, go to the gradebook and notice the Sync Grades button. 8. Select an individual section, and notice there is still a Sync Grades button. Change-Id: I308e5b4eb23b18dc94cf8e5b6ea3f579e2ca9594 Reviewed-on: https://gerrit.instructure.com/126694 Tested-by: Jenkins Reviewed-by: Jeremy Neander <jneander@instructure.com> Reviewed-by: Derek Bender <djbender@instructure.com> QA-Review: Indira Pai <ipai@instructure.com> Product-Review: Matt Goodwin <mattg@instructure.com>
This commit is contained in:
parent
25baf4ea2c
commit
546783a4e8
|
@ -410,7 +410,7 @@ class GradebooksController < ApplicationController
|
|||
gradebook_column_order_settings_url: save_gradebook_column_order_course_gradebook_url,
|
||||
post_grades_ltis: post_grades_ltis,
|
||||
post_grades_feature: post_grades_feature?,
|
||||
sections: sections_json(@context.active_course_sections, @current_user, session),
|
||||
sections: sections_json(@context.active_course_sections, @current_user, session, [], allow_sis_ids: true),
|
||||
settings_update_url: api_v1_course_gradebook_settings_update_url(@context),
|
||||
settings: gradebook_settings.fetch(@context.id, {}),
|
||||
login_handle_name: @context.root_account.settings[:login_handle_name],
|
||||
|
|
|
@ -20,10 +20,10 @@ module Api::V1::Section
|
|||
include Api::V1::Json
|
||||
include Api::V1::PostGradesStatus
|
||||
|
||||
def section_json(section, user, session, includes)
|
||||
def section_json(section, user, session, includes, options = {})
|
||||
res = section.as_json(:include_root => false,
|
||||
:only => %w(id name course_id nonxlist_course_id start_at end_at restrict_enrollments_to_section_dates))
|
||||
if section.course.grants_any_right?(user, :read_sis, :manage_sis)
|
||||
if options[:allow_sis_ids] || section.course.grants_any_right?(user, :read_sis, :manage_sis)
|
||||
res['sis_section_id'] = section.sis_source_id
|
||||
res['sis_course_id'] = section.course.sis_source_id
|
||||
res['integration_id'] = section.integration_id
|
||||
|
@ -52,7 +52,7 @@ module Api::V1::Section
|
|||
res
|
||||
end
|
||||
|
||||
def sections_json(sections, user, session, includes = [])
|
||||
sections.map { |s| section_json(s, user, session, includes) }
|
||||
def sections_json(sections, user, session, includes = [], options = {})
|
||||
sections.map { |s| section_json(s, user, session, includes, options) }
|
||||
end
|
||||
end
|
||||
|
|
|
@ -561,6 +561,13 @@ describe GradebooksController do
|
|||
expect(api_max_per_page).to eq(50)
|
||||
end
|
||||
|
||||
it "includes sis_section_id on the sections even if the teacher doesn't have 'Read SIS Data' permissions" do
|
||||
@course.root_account.role_overrides.create!(permission: :read_sis, enabled: false, role: teacher_role)
|
||||
get :show, params: { course_id: @course.id }
|
||||
section = gradebook_options.fetch(:sections).first
|
||||
expect(section).to have_key :sis_section_id
|
||||
end
|
||||
|
||||
describe "graded_late_or_missing_submissions_exist" do
|
||||
it "is not included if New Gradebook is disabled" do
|
||||
get :show, params: {course_id: @course.id}
|
||||
|
|
Loading…
Reference in New Issue