Iron Router Route Allow/Deny

霸气de小男生 提交于 2019-12-08 05:23:27

You could setup a global "Before" in your routes. I'm not using roles in my current app, but we are redirect users globally based on whether or not they are signed in.

You could probably do something like this:

Router.before(function() {
  unless(Meteor.userId()) {
    this.redirect('userUnauthorized');
    do (this.stop)
  }
}, {except: ['userUnauthorized', 'otherPageUnauthorizedUsersAllowedToSee']});

We use something similar right below our Router.configure()

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!