remove course.allow_student_assignment_edits
this was a course setting which allowed students to edit assignment descriptions only. unfortunately, it didn't work, because the form validation code assumed a title input field would be present and tried to require that it was there. closes CNVS-3267 test plan: - make sure the setting is not availble in course settings - make sure students cannot edit assignments - make sure teachers can still edit assignments Change-Id: Iebeaa00f357a59bff8462ecde79c57d68c04320f Reviewed-on: https://gerrit.instructure.com/17056 Tested-by: Jenkins <jenkins@instructure.com> Reviewed-by: Cody Cutrer <cody@instructure.com> QA-Review: Myller de Araujo <myller@instructure.com>
This commit is contained in:
parent
78213d6879
commit
6b2185cf36
|
@ -295,7 +295,7 @@ class AssignmentOverridesController < ApplicationController
|
|||
end
|
||||
|
||||
def require_assignment_edit
|
||||
authorized_action(@assignment, @current_user, :update_content)
|
||||
authorized_action(@assignment, @current_user, :update)
|
||||
end
|
||||
|
||||
def require_override
|
||||
|
|
|
@ -403,7 +403,7 @@ class AssignmentsApiController < ApplicationController
|
|||
def update
|
||||
@assignment = @context.assignments.find(params[:id])
|
||||
|
||||
if authorized_action(@assignment, @current_user, :update_content)
|
||||
if authorized_action(@assignment, @current_user, :update)
|
||||
save_and_render_response
|
||||
end
|
||||
end
|
||||
|
|
|
@ -268,52 +268,44 @@ class AssignmentsController < ApplicationController
|
|||
|
||||
def edit
|
||||
@assignment = @context.assignments.active.find(params[:id])
|
||||
if authorized_action(@assignment, @current_user, :update_content)
|
||||
if authorized_action(@assignment, @current_user, :update)
|
||||
@editing = true
|
||||
params[:return_to] = nil
|
||||
if @assignment.grants_right?(@current_user, session, :update)
|
||||
@assignment.title = params[:title] if params[:title]
|
||||
@assignment.due_at = params[:due_at] if params[:due_at]
|
||||
@assignment.submission_types = params[:submission_types] if params[:submission_types]
|
||||
@assignment.assignment_group_id = params[:assignment_group_id] if params[:assignment_group_id]
|
||||
end
|
||||
@assignment.title = params[:title] if params[:title]
|
||||
@assignment.due_at = params[:due_at] if params[:due_at]
|
||||
@assignment.submission_types = params[:submission_types] if params[:submission_types]
|
||||
@assignment.assignment_group_id = params[:assignment_group_id] if params[:assignment_group_id]
|
||||
show
|
||||
end
|
||||
end
|
||||
|
||||
def update
|
||||
@assignment = @context.assignments.find(params[:id])
|
||||
if authorized_action(@assignment, @current_user, :update_content)
|
||||
if authorized_action(@assignment, @current_user, :update)
|
||||
params[:assignment][:time_zone_edited] = Time.zone.name if params[:assignment]
|
||||
if !@assignment.grants_rights?(@current_user, session, :update)[:update]
|
||||
p = {}
|
||||
p[:description] = params[:assignment][:description]
|
||||
params[:assignment] = p
|
||||
else
|
||||
params[:assignment] ||= {}
|
||||
@assignment.updating_user = @current_user
|
||||
if params[:assignment][:default_grade]
|
||||
params[:assignment][:overwrite_existing_grades] = (params[:assignment][:overwrite_existing_grades] == "1")
|
||||
@assignment.set_default_grade(params[:assignment])
|
||||
render :json => @assignment.submissions.to_json(:include => :quiz_submission)
|
||||
return
|
||||
end
|
||||
params[:assignment].delete :default_grade
|
||||
params[:assignment].delete :overwrite_existing_grades
|
||||
if params[:publish]
|
||||
@assignment.workflow_state = 'published'
|
||||
elsif params[:unpublish]
|
||||
@assignment.workflow_state = 'available'
|
||||
end
|
||||
if params[:assignment_type] == "quiz"
|
||||
params[:assignment][:submission_types] = "online_quiz"
|
||||
elsif params[:assignment_type] == "attendance"
|
||||
params[:assignment][:submission_types] = "attendance"
|
||||
elsif params[:assignment_type] == "discussion_topic"
|
||||
params[:assignment][:submission_types] = "discussion_topic"
|
||||
elsif params[:assignment_type] == "external_tool"
|
||||
params[:assignment][:submission_types] = "external_tool"
|
||||
end
|
||||
params[:assignment] ||= {}
|
||||
@assignment.updating_user = @current_user
|
||||
if params[:assignment][:default_grade]
|
||||
params[:assignment][:overwrite_existing_grades] = (params[:assignment][:overwrite_existing_grades] == "1")
|
||||
@assignment.set_default_grade(params[:assignment])
|
||||
render :json => @assignment.submissions.to_json(:include => :quiz_submission)
|
||||
return
|
||||
end
|
||||
params[:assignment].delete :default_grade
|
||||
params[:assignment].delete :overwrite_existing_grades
|
||||
if params[:publish]
|
||||
@assignment.workflow_state = 'published'
|
||||
elsif params[:unpublish]
|
||||
@assignment.workflow_state = 'available'
|
||||
end
|
||||
if params[:assignment_type] == "quiz"
|
||||
params[:assignment][:submission_types] = "online_quiz"
|
||||
elsif params[:assignment_type] == "attendance"
|
||||
params[:assignment][:submission_types] = "attendance"
|
||||
elsif params[:assignment_type] == "discussion_topic"
|
||||
params[:assignment][:submission_types] = "discussion_topic"
|
||||
elsif params[:assignment_type] == "external_tool"
|
||||
params[:assignment][:submission_types] = "external_tool"
|
||||
end
|
||||
respond_to do |format|
|
||||
@assignment.content_being_saved_by(@current_user)
|
||||
|
|
|
@ -161,7 +161,6 @@ class CoursesController < ApplicationController
|
|||
# @argument course[is_public] [Boolean] [optional] Set to true if course if public.
|
||||
# @argument course[public_description] [String] [optional] A publicly visible description of the course.
|
||||
# @argument course[allow_student_wiki_edits] [Boolean] [optional] If true, students will be able to modify the course wiki.
|
||||
# @argument course[allow_student_assignment_edits] [optional] Set to true if students should be allowed to make modifications to assignments.
|
||||
# @argument course[allow_wiki_comments] [Boolean] [optional] If true, course members will be able to comment on wiki pages.
|
||||
# @argument course[allow_student_forum_attachments] [Boolean] [optional] If true, students can attach files to forum posts.
|
||||
# @argument course[open_enrollment] [Boolean] [optional] Set to true if the course is open enrollment.
|
||||
|
|
|
@ -824,17 +824,11 @@ class Assignment < ActiveRecord::Base
|
|||
}
|
||||
can :submit and can :attach_submission_comment_files
|
||||
|
||||
given { |user, session| !self.locked_for?(user) &&
|
||||
(self.context.allow_student_assignment_edits rescue false) &&
|
||||
self.cached_context_grants_right?(user, session, :participate_as_student)
|
||||
}
|
||||
can :update_content
|
||||
|
||||
given { |user, session| self.cached_context_grants_right?(user, session, :manage_grades) }
|
||||
can :update and can :update_content and can :grade and can :delete and can :create and can :read and can :attach_submission_comment_files
|
||||
can :update and can :grade and can :delete and can :create and can :read and can :attach_submission_comment_files
|
||||
|
||||
given { |user, session| self.cached_context_grants_right?(user, session, :manage_assignments) }
|
||||
can :update and can :update_content and can :delete and can :create and can :read and can :attach_submission_comment_files
|
||||
can :update and can :delete and can :create and can :read and can :attach_submission_comment_files
|
||||
end
|
||||
|
||||
def filter_attributes_for_user(hash, user, session)
|
||||
|
|
|
@ -32,7 +32,6 @@ class Course < ActiveRecord::Base
|
|||
:is_public,
|
||||
:publish_grades_immediately,
|
||||
:allow_student_wiki_edits,
|
||||
:allow_student_assignment_edits,
|
||||
:show_public_context_messages,
|
||||
:syllabus_body,
|
||||
:public_description,
|
||||
|
@ -2362,7 +2361,7 @@ class Course < ActiveRecord::Base
|
|||
def self.clonable_attributes
|
||||
[ :group_weighting_scheme, :grading_standard_id, :is_public,
|
||||
:publish_grades_immediately, :allow_student_wiki_edits,
|
||||
:allow_student_assignment_edits, :show_public_context_messages,
|
||||
:show_public_context_messages,
|
||||
:syllabus_body, :allow_student_forum_attachments,
|
||||
:default_wiki_editing_roles, :allow_student_organized_groups,
|
||||
:default_view, :show_all_discussion_entries, :open_enrollment,
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<% end %>
|
||||
|
||||
<div class="rs-margin-lr rs-margin-top">
|
||||
<% if can_do(@assignment, @current_user, :update_content) %>
|
||||
<% if can_do(@assignment, @current_user, :update) %>
|
||||
<% if @assignment.external_tool? %>
|
||||
<a href="<%= polymorphic_url([@context, @assignment]) %>" class="view_assignment_link btn button-sidebar-wide"><i class="icon-arrow-left"></i> <%= t('links.view_assignment', "View Assignment") %></a>
|
||||
<% end %>
|
||||
|
|
|
@ -259,8 +259,6 @@ TEXT
|
|||
<%= f.label :open_enrollment, :en => "Add a \"Join this Course\" link to the course home page" %><br/>
|
||||
</div>
|
||||
<% end %>
|
||||
<%= f.check_box :allow_student_assignment_edits %>
|
||||
<%= f.label :allow_student_assignment_edits, :en => "Let Students edit Assignment Descriptions" %><br/>
|
||||
<%= f.check_box :allow_student_forum_attachments %>
|
||||
<%= f.label :allow_student_forum_attachments, :en => "Let Students attach files to Discussions" %><br/>
|
||||
<%= f.check_box :allow_student_discussion_topics, :checked => @context.allow_student_discussion_topics %>
|
||||
|
|
|
@ -75,7 +75,7 @@
|
|||
<span class="group_id"><%= (assignment_exists && !assignment.group_name.empty? ? assignment.group_name : t('defaults.other_group', "other")) rescue t('defaults.other_group', "other") %></span>
|
||||
</div>
|
||||
</div>
|
||||
<% if can_do(assignment, @current_user, :update_content) %>
|
||||
<% if can_do(assignment, @current_user, :update) %>
|
||||
<% url = assignment && !assignment.new_record? ? context_url(@context, :context_assignment_url, assignment.id) : context_url(@context, :context_assignments_url) %>
|
||||
<% form_for assignment, :url => url, :html => {:method => (assignment && !assignment.new_record? ? 'PUT' : 'POST'), :id => 'edit_assignment_form', :style => 'display: none;'} do |f| %>
|
||||
<% show_more_grading_options = (assignment.min_score || assignment.max_score || assignment.mastery_score || !assignment.droppable?) rescue false %>
|
||||
|
@ -102,7 +102,6 @@
|
|||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
<% if can_do(assignment, @current_user, :update) %>
|
||||
<% if assignment.frozen_for_user?(@current_user)%>
|
||||
<tr>
|
||||
<td colspan="4">
|
||||
|
@ -405,7 +404,6 @@
|
|||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<% if assignment.att_frozen?(:notify_of_update, @current_user) %>
|
||||
|
|
|
@ -29,7 +29,7 @@ class ActiveRecord::Base
|
|||
'content_tags' => %w(sequence_position context_module_association_id),
|
||||
'conversation_messages' => %w(context_message_id),
|
||||
'course_sections' => %w(sis_cross_listed_section_id sis_cross_listed_section_sis_batch_id sticky_xlist sis_name students_can_participate_before_start_at section_organization_name long_section_code),
|
||||
'courses' => %w(section hidden_tabs sis_name sis_course_code hashtag),
|
||||
'courses' => %w(section hidden_tabs sis_name sis_course_code hashtag allow_student_assignment_edits),
|
||||
'discussion_topics' => %w(authorization_list_id),
|
||||
'enrollment_terms' => %w(sis_data sis_name),
|
||||
'enrollments' => %w(invitation_email can_participate_before_start_at limit_priveleges_to_course_sections),
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
class DropAllowStudentAssignmentEditsFromCourses < ActiveRecord::Migration
|
||||
tag :postdeploy
|
||||
|
||||
def self.up
|
||||
remove_column :courses, :allow_student_assignment_edits
|
||||
end
|
||||
|
||||
def self.down
|
||||
add_column :courses, :allow_student_assignment_edits, :boolean
|
||||
end
|
||||
end
|
|
@ -171,7 +171,6 @@ describe CoursesController, :type => :integration do
|
|||
'end_at' => '2011-05-01T00:00:00-0700',
|
||||
'publish_grades_immediately' => true,
|
||||
'is_public' => true,
|
||||
'allow_student_assignment_edits' => true,
|
||||
'allow_wiki_comments' => true,
|
||||
'allow_student_forum_attachments' => true,
|
||||
'open_enrollment' => true,
|
||||
|
@ -194,7 +193,7 @@ describe CoursesController, :type => :integration do
|
|||
json = api_call(:post, @resource_path, @resource_params, post_params)
|
||||
new_course = Course.find(json['id'])
|
||||
[:name, :course_code, :start_at, :end_at, :publish_grades_immediately,
|
||||
:is_public, :allow_student_assignment_edits, :allow_wiki_comments,
|
||||
:is_public, :allow_wiki_comments,
|
||||
:open_enrollment, :self_enrollment, :license, :sis_course_id,
|
||||
:allow_student_forum_attachments, :public_description,
|
||||
:restrict_enrollments_to_course_dates].each do |attr|
|
||||
|
@ -263,7 +262,6 @@ describe CoursesController, :type => :integration do
|
|||
'license' => 'public_domain',
|
||||
'is_public' => true,
|
||||
'public_description' => 'new description',
|
||||
'allow_student_assignment_edits' => true,
|
||||
'allow_wiki_comments' => true,
|
||||
'allow_student_forum_attachments' => true,
|
||||
'open_enrollment' => true,
|
||||
|
@ -294,7 +292,6 @@ describe CoursesController, :type => :integration do
|
|||
@course.license.should == 'public_domain'
|
||||
@course.is_public.should be_true
|
||||
@course.public_description.should == 'new description'
|
||||
@course.allow_student_assignment_edits.should be_true
|
||||
@course.allow_wiki_comments.should be_true
|
||||
@course.allow_student_forum_attachments.should be_true
|
||||
@course.open_enrollment.should be_true
|
||||
|
|
|
@ -271,64 +271,6 @@ describe AssignmentsController do
|
|||
assigns[:assignment].should eql(@assignment)
|
||||
assigns[:assignment].title.should eql("test title")
|
||||
end
|
||||
|
||||
describe 'updating description' do
|
||||
let(:assignment) { assigns[:assignment] }
|
||||
|
||||
before do
|
||||
Setting.set('enable_page_views', 'db')
|
||||
course_with_student_logged_in(:active_all => true)
|
||||
course_assignment
|
||||
end
|
||||
|
||||
after { Setting.set 'enable_page_views', 'false' }
|
||||
|
||||
def run_update
|
||||
put 'update', :course_id => @course.id, :id => @assignment.id, :assignment => {:title => "test title", :description => "what up"}
|
||||
end
|
||||
|
||||
describe 'when student edits are not allowed' do
|
||||
before do
|
||||
@course.update_attribute(:allow_student_assignment_edits, false)
|
||||
run_update
|
||||
end
|
||||
|
||||
it 'does not update anything' do
|
||||
assignment.should eql(@assignment)
|
||||
assignment.title.should eql("some assignment")
|
||||
assignment.description.should eql(nil)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'when student edits are allowed' do
|
||||
before do
|
||||
@course.update_attribute(:allow_student_assignment_edits, true)
|
||||
run_update
|
||||
end
|
||||
|
||||
it 'only updates the description' do
|
||||
assignment.should eql(@assignment)
|
||||
assignment.title.should eql("some assignment")
|
||||
assignment.description.should eql('what up')
|
||||
end
|
||||
|
||||
it 'logs an asset access record for the assignment' do
|
||||
accessed_asset = assigns[:accessed_asset]
|
||||
accessed_asset[:category].should == 'assignments'
|
||||
accessed_asset[:level].should == 'participate'
|
||||
end
|
||||
|
||||
it 'registers a page view' do
|
||||
page_view = assigns[:page_view]
|
||||
page_view.should_not be_nil
|
||||
page_view.http_method.should == 'put'
|
||||
page_view.url.should =~ %r{^http://test\.host/courses/\d+/assignments}
|
||||
page_view.participated.should be_true
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
describe "DELETE 'destroy'" do
|
||||
|
@ -348,31 +290,4 @@ describe AssignmentsController do
|
|||
assigns[:assignment].should be_deleted
|
||||
end
|
||||
end
|
||||
# describe "GET 'show'" do
|
||||
# it "should be successful" do
|
||||
# get 'show'
|
||||
# response.should be_success
|
||||
# end
|
||||
# end
|
||||
#
|
||||
# describe "GET 'new'" do
|
||||
# it "should be successful" do
|
||||
# get 'new'
|
||||
# response.should be_success
|
||||
# end
|
||||
# end
|
||||
#
|
||||
# describe "GET 'edit'" do
|
||||
# it "should be successful" do
|
||||
# get 'edit'
|
||||
# response.should be_success
|
||||
# end
|
||||
# end
|
||||
#
|
||||
# describe "GET 'destroy'" do
|
||||
# it "should be successful" do
|
||||
# get 'destroy'
|
||||
# response.should be_success
|
||||
# end
|
||||
# end
|
||||
end
|
||||
|
|
|
@ -46,7 +46,6 @@ def course_valid_attributes
|
|||
:publish_grades_immediately => true,
|
||||
:allow_student_wiki_edits => true,
|
||||
:sis_batch_id => 1,
|
||||
:allow_student_assignment_edits => true
|
||||
}
|
||||
end
|
||||
|
||||
|
|
|
@ -16,7 +16,6 @@ courses_002:
|
|||
section: "101"
|
||||
allow_student_wiki_edits:
|
||||
workflow_state: available
|
||||
allow_student_assignment_edits:
|
||||
created_at: 2009-04-30 23:55:49
|
||||
courses_003:
|
||||
name: Hum 200
|
||||
|
@ -34,7 +33,6 @@ courses_003:
|
|||
section: "101"
|
||||
allow_student_wiki_edits:
|
||||
workflow_state: available
|
||||
allow_student_assignment_edits:
|
||||
created_at: 2009-04-30 23:55:49
|
||||
courses_004:
|
||||
name: Chem 105
|
||||
|
@ -52,7 +50,6 @@ courses_004:
|
|||
section: "101"
|
||||
allow_student_wiki_edits:
|
||||
workflow_state: available
|
||||
allow_student_assignment_edits:
|
||||
created_at: 2009-04-30 23:55:49
|
||||
courses_005:
|
||||
name: Biology 100
|
||||
|
@ -70,7 +67,6 @@ courses_005:
|
|||
section: "101"
|
||||
allow_student_wiki_edits:
|
||||
workflow_state: available
|
||||
allow_student_assignment_edits:
|
||||
created_at: 2009-04-30 23:55:49
|
||||
courses_006:
|
||||
name: value for name
|
||||
|
@ -88,7 +84,6 @@ courses_006:
|
|||
section: value for section
|
||||
allow_student_wiki_edits: t
|
||||
workflow_state: created
|
||||
allow_student_assignment_edits: t
|
||||
created_at: 2009-04-30 23:55:53
|
||||
courses_001:
|
||||
name: Math 115
|
||||
|
@ -106,5 +101,4 @@ courses_001:
|
|||
section: "101"
|
||||
allow_student_wiki_edits:
|
||||
workflow_state: available
|
||||
allow_student_assignment_edits:
|
||||
created_at: 2009-04-30 23:55:49
|
||||
|
|
|
@ -130,7 +130,6 @@ describe ContentMigration do
|
|||
@copy_from.course_code = 'something funny'
|
||||
@copy_from.publish_grades_immediately = false
|
||||
@copy_from.allow_student_wiki_edits = true
|
||||
@copy_from.allow_student_assignment_edits = true
|
||||
@copy_from.show_public_context_messages = false
|
||||
@copy_from.allow_student_forum_attachments = false
|
||||
@copy_from.default_wiki_editing_roles = 'teachers'
|
||||
|
|
Loading…
Reference in New Issue