Skip to content

Commit

Permalink
re-route users without elevated privileges from course admin pages to…
Browse files Browse the repository at this point in the history
… error page.
  • Loading branch information
stopfstedt committed Nov 7, 2024
1 parent 645d054 commit bfbcab3
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/ilios-common/addon/routes/course.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,20 @@ export default class CourseRoute extends Route {
@service dataLoader;
@service session;
@service store;
@service router;
@service currentUser;

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
this.router.replaceWith('/four-oh-four');
}
}

async model(params) {
Expand Down

0 comments on commit bfbcab3

Please sign in to comment.