-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
re-route users without elevated privileges from course admin pages to error page. #8217
Conversation
bfbcab3
to
907f73c
Compare
9aff3b1
to
6bc5d2b
Compare
6bc5d2b
to
3bf1fcf
Compare
accessing the session page as a non-privved user redirects now to an error page. which makes this test obsolete. i renamed the counterpart test accordingly while at it.
perms check happens before data availability, as it should be. ensuring here that the test user has privileged access.
ensure that test user has proper perms before interacting with instructor group management.
users without elevated privs get routed to the 404 page.
967e581
to
5f3b664
Compare
4e28a3d
to
02051a8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like a net positive, LGTM.
|
||
titleToken = 'general.coursesAndSessions'; | ||
editable = false; | ||
#preloadTopLevel = null; | ||
|
||
beforeModel(transition) { | ||
this.session.requireAuthentication(transition, 'login'); | ||
if (!this.currentUser.performsNonLearnerFunction) { | ||
// Slash on the route name is necessary here due to this bug: | ||
// https://github.com/emberjs/ember.js/issues/12945 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ugh.
@@ -19,6 +21,9 @@ export default class CourseIndexRoute extends Route { | |||
|
|||
beforeModel(transition) { | |||
this.session.requireAuthentication(transition, 'login'); | |||
if (!this.currentUser.performsNonLearnerFunction) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm pretty sure the beforeModel
hook in the course route will fire and redirect before this one is hit making this code unnecessary. The same is true of the this.session.requireAuthentication(transition, 'login');
so maybe better to have it in both places and be sure?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checked out the Netlify preview and it seems to do what it says on the tin (at least as far as Courses go).
this affects the course details page and sub-pages (like session management) that share the same root path
/courses/{id}/
, and other course-management related routes.it's a foot in the door - i'll lock other admin areas such as instructor group/learner group management down in consecutive steps.
refs ilios/ilios#5721