イムFlowTemplate
でFlowRouter
を使用してboth/router/router.js
に私がチェックしていますが、それは役割admin
内のユーザーである:Roles.userIsInRoleはFALSEを返します - 流星
....
action: function() {
if(Roles.userIsInRole(Meteor.userId(), 'admin')){
FlowLayout.render('layout', {
sidebar: 'sidebar', main:'admin', cart:'cart'
})
} else {
FlowLayout.render('layout', {
sidebar: 'sidebar', main:'unauthorised', cart:'cart'
})
}
console.log(Meteor.userId());
}
....
とFALSE
を返しますが、私はWebコンソールで使用するときであるTRUE
。この行console.log(Meteor.userId());
が正しいuserID
を出力し、私がログインしたときにWEBコンソールRoles.userIsInRole(Meteor.userId(), 'admin')
でこれを行うと、それはTRUE
です。
{{#if isInRole 'admin' }}
ADMIN
{{/if}}
それはTRUE
ですが、router.js
戻りFALSE
に:私はこれMeteor.user().roles
を行うと、結果は私がテンプレートにチェックした場合、それは役割のユーザーである['admin']
です。
修正方法?