diff --git a/app/pods/protected/users/edit/controller.js b/app/pods/protected/users/edit/controller.js index 903eefd..3d4940c 100644 --- a/app/pods/protected/users/edit/controller.js +++ b/app/pods/protected/users/edit/controller.js @@ -6,8 +6,17 @@ export default Ember.Controller.extend({ let user = this.get('model'); if (user.get('hasDirtyAttributes')) { + let attrs = user.changedAttributes(), roleChanged = false; + if (attrs.role) { + roleChanged = true; + } user.save().then((user) => { this.get('flashMessages').clearMessages(); + if (roleChanged) { + // Need to clear the store so that canEdit and canAdd + // attributes reflect the new role. + this.get('store').unloadAll(); + } this.transitionToRoute('protected.users.show', user); }, (err) => { err.errors.forEach((error) => {