This repository has been archived on 2025-03-30. You can view files and clone it, but cannot push or open issues or pull requests.
hymenobacterdotinfo/app/pods/protected/users/show/route.js
Matthew Dillon be1b58a380 Need to wait for currentUser promise
Also, add ‘id’ to password change payload
2015-10-13 10:32:25 -07:00

19 lines
528 B
JavaScript

import Ember from 'ember';
export default Ember.Route.extend({
beforeModel: function(transition) {
this._super(transition);
this.get('session.currentUser').then((currentUser) => {
let user_id = transition.params['protected.users.show'].user_id;
if (!currentUser.get('isAdmin') && currentUser.get('id') !== user_id) {
this.transitionTo('protected.users.index');
}
})
},
model: function(params) {
return this.store.findRecord('user', params.user_id, { reload: true });
},
});