redirect to login page when linking to /files as unauth
test plan: * in a new browser/incognito window, try to visit /files * it should redirect to the login page closes #CNVS-36611 Change-Id: Ie0d8e7b145e062b8aa9824c6c49c7ae2386f2d64 Reviewed-on: https://gerrit.instructure.com/110352 Tested-by: Jenkins Reviewed-by: Jeremy Stanley <jeremy@instructure.com> QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com> Product-Review: James Williams <jamesw@instructure.com>
This commit is contained in:
parent
4e01ef33a4
commit
3d94fdc75f
|
@ -587,7 +587,7 @@ class ApplicationController < ActionController::Base
|
|||
def require_context
|
||||
get_context
|
||||
if !@context
|
||||
if request.path.match(/\A\/profile/)
|
||||
if @context_is_current_user
|
||||
store_location
|
||||
redirect_to login_url
|
||||
elsif params[:context_id]
|
||||
|
@ -664,6 +664,7 @@ class ApplicationController < ActionController::Base
|
|||
@context = api_find(CourseSection, params[:course_section_id])
|
||||
elsif request.path.match(/\A\/profile/) || request.path == '/' || request.path.match(/\A\/dashboard\/files/) || request.path.match(/\A\/calendar/) || request.path.match(/\A\/assignments/) || request.path.match(/\A\/files/) || request.path == '/api/v1/calendar_events/visible_contexts'
|
||||
# ^ this should be split out into things on the individual controllers
|
||||
@context_is_current_user = true
|
||||
@context = @current_user
|
||||
@context_membership = @context
|
||||
end
|
||||
|
|
|
@ -39,7 +39,7 @@ describe AssignmentsController do
|
|||
describe "GET 'index'" do
|
||||
it "should throw 404 error without a valid context id" do
|
||||
#controller.use_rails_error_handling!
|
||||
get 'index'
|
||||
get 'index', :course_id => 'notvalid'
|
||||
assert_status(404)
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue