mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-30 01:42:29 +03:00
4d074c3e55
Closes #3291 - Adds redirects based on roles as defined in the case - Adds new mixin `CurrentUserSettings` - For authors, all settings pages redirect to `users/self` - For editors, all settings pages other than specific users redirect to `users`. Any user that is not self or an author redirects to `users`
31 lines
551 B
JavaScript
31 lines
551 B
JavaScript
var CurrentUserSettings = Ember.Mixin.create({
|
|
currentUser: function () {
|
|
return this.store.find('user', 'me');
|
|
},
|
|
|
|
transitionAuthor: function () {
|
|
var self = this;
|
|
|
|
return function (user) {
|
|
if (user.get('isAuthor')) {
|
|
return self.transitionTo('settings.users.user', user);
|
|
}
|
|
|
|
return user;
|
|
};
|
|
},
|
|
|
|
transitionEditor: function () {
|
|
var self = this;
|
|
|
|
return function (user) {
|
|
if (user.get('isEditor')) {
|
|
return self.transitionTo('settings.users');
|
|
}
|
|
|
|
return user;
|
|
};
|
|
}
|
|
});
|
|
|
|
export default CurrentUserSettings; |