Skip to content
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

Merged
merged 7 commits into from
Dec 2, 2024

Conversation

stopfstedt
Copy link
Member

@stopfstedt stopfstedt commented Nov 7, 2024

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

@stopfstedt stopfstedt force-pushed the 403verboten branch 2 times, most recently from bfbcab3 to 907f73c Compare November 14, 2024 16:23
@stopfstedt stopfstedt force-pushed the 403verboten branch 3 times, most recently from 9aff3b1 to 6bc5d2b Compare November 21, 2024 16:37
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.
@stopfstedt stopfstedt marked this pull request as ready for review November 22, 2024 17:48
@jrjohnson jrjohnson self-assigned this Nov 22, 2024
Copy link
Member

@jrjohnson jrjohnson left a 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
Copy link
Member

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) {
Copy link
Member

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?

Copy link
Contributor

@michaelchadwick michaelchadwick left a 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).

@jrjohnson jrjohnson assigned dartajax and unassigned jrjohnson Nov 27, 2024
@dartajax dartajax added the run ui tests Run the expensive UI tests label Nov 27, 2024
@dartajax dartajax enabled auto-merge November 27, 2024 20:02
@dartajax dartajax disabled auto-merge December 2, 2024 17:12
@dartajax dartajax merged commit 5effed5 into ilios:master Dec 2, 2024
43 checks passed
@stopfstedt stopfstedt deleted the 403verboten branch December 10, 2024 23:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
run ui tests Run the expensive UI tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants