In an Ember.js application, you can use various hooks to check authorization. There are beforeModel, willTransition, redirect hooks on route. also the same events applies on Router.
I'm developing authorization infrastructure for a project. All the route's are written by developers. But an abstract-route (which is extended by all routes) is my code.
- If I implement beforeModal or redirect hook in an abstract-route, when a developer writes his own beforeModal methods, my hook will be overwritten.
- If I implement willTransition, checking code will be laid on a route that starts transition. From the guide, it seems that willTransition is applicable when leaving the route.
- Is it a correct way to handle Router's events?
So what is the correct way to check authorization and abort/prevent transition?
Aucun commentaire:
Enregistrer un commentaire