Permissions Meteor IronRouter onBeforeAction在延迟回调中导致异常

Permissions Meteor IronRouter onBeforeAction在延迟回调中导致异常,permissions,routing,meteor,iron-router,meteor-blaze,Permissions,Routing,Meteor,Iron Router,Meteor Blaze,我正在尝试使用iron router保护我的meteor应用程序,以下是我的onBeforeAction功能: this.route('manageUsers', { path: '/panel/user_management', layoutTemplate: 'panel', onBeforeAction: function(){ if((Meteor.user() === null)||(Meteor.user().role !== 'superA

我正在尝试使用
iron router
保护我的meteor应用程序,以下是我的onBeforeAction功能:

this.route('manageUsers', {
    path: '/panel/user_management', 
    layoutTemplate: 'panel',
    onBeforeAction: function(){
        if((Meteor.user() === null)||(Meteor.user().role !== 'superAdmin')){
            Router.go('signIn');
            throwAlert('You dont have access to see this page', 'notification');
        }
    }
});
当我试图通过按链接按钮转到
/panel/user\u management
子页面时,一切正常(用户被重定向等),但当我直接在浏览器中键入路径时(
localhost:3000/panel/user\u management
)点击回车键,用户未被重定向,我在控制台中收到延迟回调中的异常错误。有人知道我做错了什么吗


有关其他信息,此视图将列出所有已注册的用户。当我正常地(没有错误地)转到这个路径时,我会看到完整的用户列表。当我收到的错误模板没有出现在
中时,我终于解决了这个问题-问题是错误的
如果
语句,下面是正确的:

if((!Meteor.user())||(Meteor.user().role !== 'superAdmin')){}

throwAlert
method做什么?它是我处理/显示错误的方法(它有两个参数:message和message类型(取决于第二个参数,它为我的通知/警报框显示蓝色/绿色/红色背景色,用html和css构建-看起来非常类似于引导)