diff --git a/hourglass/lib/router.js b/hourglass/lib/router.js index 990478a..9932be0 100644 --- a/hourglass/lib/router.js +++ b/hourglass/lib/router.js @@ -58,7 +58,7 @@ Router.route('/user/:email', { } }); -Router.route('/admin', { +/*Router.route('/admin', { waitOn: function() { if (Roles.userIsInRole(Meteor.userId(), ['admin', 'superadmin'])) { return [ @@ -75,6 +75,25 @@ Router.route('/admin', { action: function() { this.render("admin"); } +});*/ + +Router.route('/admin', { + waitOn: function() { + 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) + ]; + }, + action: function() { + if (!Roles.userIsInRole(Meteor.userId(), ['admin', 'superadmin'])) { + this.render("NotFound"); + } else { + this.render("admin"); + } + } }); Router.configure({