To achieve this using iron:router
, there are multiple approaches you can take.
One option is to set an onBeforeAction
hook on a route that will redirect to the appropriate route or template using Router.go
. You can find more information about hooks in the documentation located here.
Another possibility is to render different templates based on certain conditions:
if (Roles.userIsInRole(Meteor.userId(), ['admin'])) {
this.render('addItem');
} else if(Roles.userIsInRole(Meteor.userId(), ['admin-category'])) {
this.render('addCategory');
} else {
this.render('defaultRoute');
}