Ember CLI - Injecting a service in route and get the current User with ember-simple-auth
<p>I am using ember-simple-auth to authenticate. I have created the service to get the current user.</p>

<pre><code>//services/session.js
import Ember from 'ember';
import ESASession from "ember-simple-auth/services/session";

 export default ESASession.extend({

  store: Ember.inject.service(),

  setCurrentUser: function() {
    if (this.get('isAuthenticated')) {
      let user_id = this.get('session.content.authenticated.user_id');
      this.get('store').findRecord('user', user_id).then((user) =&gt; {
        this.set('currentUser', user);
      });
    }
  }.observes('isAuthenticated')
 });
</code></pre>

<p>In the controller when I inject the session is working</p>

<pre><code>//controller/application.js
import Ember from 'ember';

export default Ember.Controller.extend({
  auth: Ember.inject.service('session'), 

  actions: {

    save() {
       var current_user = this.get('auth.currentUser');
       console.log(current_user) // I got the current user model
    }
  }
});
</code></pre>

<p>But when I try to use the same in the route, my current_user is undefined</p>

<pre><code>//routes/application.js
import Ember from 'ember';
import ApplicationRouteMixin from 'ember-simple-auth/mixins/application-route-mixin';

export default Ember.Route.extend(ApplicationRouteMixin, {
  auth: Ember.inject.service('session'),

  model() {
    console.log(this.get('auth.currentUser')); // I got undefined
  }
 });
</code></pre>

<p>I need to get the current user, because I want to know if the user has the is_admin flag, something like</p>

<pre><code>afterModel: function(model, transition) {
    if (model.is_admin) {
        this.transitionTo('admin');
     }
}
</code></pre>

<p>What is the best way to inject the session in routes? What I am doing wrong?</p>