javascript - meteor with flow-router: Do I have access to Meteor.User from within a flow-router trigger? -
i believe security perspective, best handle access restricted url in 2 places:
- routing level: make sure no-one able route not permitted for
- template level: no restricted data showed before verifying permissions.
iron-router
support first way, want use flow-router
.
i found article satya van he-men
, meteor: using flow router authentication , permissions
in article using routing groups , triggers "filter" routes permissions.
in article using meteor.loggingin()
, meteor.userid()
, meteor.user()
, roles.userisinrole()
inside triggersenter:
function of flowrouter
object.
is possible of functions undefined during triggersenter
execution?
is safe use them?
pattern article, want make sure safe use (or can become safe few changes)
i think reason concern valid it's possible because triggersenter
called once recommend reading official tutorial on auth logic permission on template level , it's reactive.
previously, did in router layer (specifically iron router). however, that's not design , don't recommend it.
https://kadira.io/academy/meteor-routing-guide/content/implementing-auth-logic-and-permissions
Comments
Post a Comment