How to handle multiple account types sanely

I am building a decent-sized application with Ember, and I am having trouble designing a solution to handle multiple account types. Here’s what I have: accounts: manager, administrator, assistant, volunteer, parent/guardian. Each account is associated with an organization, such as a school or library.

When designing for multiple accounts, how do I reasonably structure the routes such that I have something like this: /login : we code for an integrated login that will take them to a dashboard. /account or /dashboard: this is where everyone lands after login.

But how do I have different accounts go to the same route without running into security issues?

I had thought about just designing 5 different apps for each account type, but I don’t see that as good practice.

I tried to dive into Discourse, but their Ember app is hard to digest and understand how things are getting done. The admin routes aren’t loaded into the page when looking at Ember Inspector.

Any advice?

I think the best thing is to put an account object into the container and inject it into your wherever you want to use it.

This is the basic approach our open source application is using. We use an application initializer to inject authentication details into the application. Then when the user goes to the dashboard route, we lookup the user record based on the authentication details. After that we use the user record from the dashboard controller to determine when to show/hide parts of the application. Additionally, we have a special mixin for any routes we want to ensure are secured.

Another option, look into using an existing library like torii or ember-simple-auth.