diff --git a/hourglass/lib/router.js b/hourglass/lib/router.js index b87e5ce..71a904f 100644 --- a/hourglass/lib/router.js +++ b/hourglass/lib/router.js @@ -47,13 +47,24 @@ Router.route('/profile', { }); Router.route('/admin', function() { - if (Roles.userIsInRole(Meteor.userId(), ['admin', 'superadmin'])) { + waitOn: function() { + if (Roles.userIsInRole(Meteor.userId(), ['admin', 'superadmin'])) { + return [ + Meteor.subscribe('classes',this.params._id), + Meteor.subscribe('schools',this.params._id), + Meteor.subscribe('work',this.params._id), + Meteor.subscribe('requests',this.params._id), + Meteor.subscribe('users',this.params._id) + ]; + } else { + this.render('NotFound'); + } + }, + action: function() { this.render("admin"); - } else { - this.redirect('/login'); } }); Router.configure({ notFoundTemplate: "NotFound" -}); +}); \ No newline at end of file