forked from instructure/canvas-lms
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
don't show courses dropdown on grades page for linked observers
The grades page for a student has a dropdown to let them quickly jump between grades pages for different courses. The dropdown was also appearing for linked observers, who don't necessarily have access to grades for the student's other courses. This dropdown should now only appear for the student. fixes #6388 test plan: - create a student in more than one course - masquerade as that student - make sure the dropdown appears on the course grades page - link an observer to the student and masquerade as the observer - make sure the dropdown does not appear - stop masquerading and view the grades page for the student - make sure the dropdown does not appear Change-Id: I99f2b4361df964663f72b16084604740d6b9f17f Reviewed-on: https://gerrit.instructure.com/7119 Tested-by: Jenkins <[email protected]> Reviewed-by: Jacob Fugal <[email protected]>
- Loading branch information
Showing
4 changed files
with
55 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,6 +44,7 @@ | |
response.should render_template('grade_summary') | ||
get 'grade_summary', :course_id => @course.id, :id => @user.id | ||
response.should render_template('grade_summary') | ||
assigns[:courses_with_grades].should_not be_nil | ||
end | ||
|
||
it "should not allow access for wrong user" do | ||
|
@@ -68,6 +69,7 @@ | |
@user.reload | ||
get 'grade_summary', :course_id => @course.id, :id => @student.id | ||
response.should render_template('grade_summary') | ||
assigns[:courses_with_grades].should be_nil | ||
end | ||
|
||
it "should allow concluded teachers to see a student grades pages" do | ||
|
@@ -79,6 +81,7 @@ | |
get 'grade_summary', :course_id => @course.id, :id => @student.id | ||
response.should be_success | ||
response.should render_template('grade_summary') | ||
assigns[:courses_with_grades].should be_nil | ||
end | ||
|
||
it "should allow concluded students to see their grades pages" do | ||
|
@@ -87,6 +90,51 @@ | |
get 'grade_summary', :course_id => @course.id, :id => @user.id | ||
response.should render_template('grade_summary') | ||
end | ||
|
||
it "give a student the option to switch between courses" do | ||
teacher = user_with_pseudonym(:username => '[email protected]', :active_all => 1) | ||
student = user_with_pseudonym(:username => '[email protected]', :active_all => 1) | ||
course1 = course_with_teacher(:user => teacher, :active_all => 1).course | ||
student_in_course :user => student, :active_all => 1 | ||
course2 = course_with_teacher(:user => teacher, :active_all => 1).course | ||
student_in_course :user => student, :active_all => 1 | ||
user_session(student) | ||
get 'grade_summary', :course_id => @course.id, :id => student.id | ||
response.should be_success | ||
assigns[:courses_with_grades].should_not be_nil | ||
assigns[:courses_with_grades].length.should == 2 | ||
end | ||
|
||
it "should not give a teacher the option to switch between courses when viewing a student's grades" do | ||
teacher = user_with_pseudonym(:username => '[email protected]', :active_all => 1) | ||
student = user_with_pseudonym(:username => '[email protected]', :active_all => 1) | ||
course1 = course_with_teacher(:user => teacher, :active_all => 1).course | ||
student_in_course :user => student, :active_all => 1 | ||
course2 = course_with_teacher(:user => teacher, :active_all => 1).course | ||
student_in_course :user => student, :active_all => 1 | ||
user_session(teacher) | ||
get 'grade_summary', :course_id => @course.id, :id => student.id | ||
response.should be_success | ||
assigns[:courses_with_grades].should be_nil | ||
end | ||
|
||
it "should not give a linked observer the option to switch between courses when viewing a student's grades" do | ||
teacher = user_with_pseudonym(:username => '[email protected]', :active_all => 1) | ||
student = user_with_pseudonym(:username => '[email protected]', :active_all => 1) | ||
observer = user_with_pseudonym(:username => '[email protected]', :active_all => 1) | ||
course1 = course_with_teacher(:user => teacher, :active_all => 1).course | ||
student_in_course :user => student, :active_all => 1 | ||
course2 = course_with_teacher(:user => teacher, :active_all => 1).course | ||
student_in_course :user => student, :active_all => 1 | ||
oe = course1.enroll_user(observer, 'ObserverEnrollment') | ||
oe.associated_user = student | ||
oe.save! | ||
oe.accept | ||
user_session(observer) | ||
get 'grade_summary', :course_id => @course.id, :id => student.id | ||
response.should be_success | ||
assigns[:courses_with_grades].should be_nil | ||
end | ||
end | ||
|
||
describe "GET 'show'" do | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -205,14 +205,14 @@ def find_wizard_box | |
end | ||
end | ||
|
||
it "should not redirect to the gradebook when switching courses when viewing a student's grades" do | ||
it "should redirect to the gradebook when switching courses when viewing a student's grades" do | ||
teacher = user_with_pseudonym(:username => '[email protected]', :active_all => 1) | ||
student = user_with_pseudonym(:username => '[email protected]', :active_all => 1) | ||
course1 = course_with_teacher_logged_in(:user => teacher, :active_all => 1).course | ||
student_in_course :user => student, :active_all => 1 | ||
course2 = course_with_teacher(:user => teacher, :active_all => 1).course | ||
student_in_course :user => student, :active_all => 1 | ||
create_session(teacher.pseudonyms.first, false) | ||
create_session(student.pseudonyms.first, false) | ||
|
||
get "/courses/#{course1.id}/grades/#{student.id}" | ||
|
||
|
@@ -222,7 +222,7 @@ def find_wizard_box | |
select.click | ||
find_with_jquery('#course_url option:not([selected])').click | ||
|
||
driver.current_url.should match %r{/courses/#{course2.id}/grades/#{student.id}} | ||
driver.current_url.should match %r{/courses/#{course2.id}/grades} | ||
end | ||
end | ||
|
||
|