Router.map(function() {
this.route('home', { path: '/' });
this.route('about');
this.route('admin');
this.route('noAuth');
});
Router.onBeforeAction(function(pause) {
var user;
user = Meteor.user();
if (!Meteor.loggingIn()) {
if (!(user && user.profile && user.profile.role === 'ADMIN')) {
Router.go('noAuth');
}
} else {
this.render('loggingIn');
pause();
}
}, {
only: ['admin']
});