Ghost/core/client/routes/settings/apps.js
Alan Richards dacd1060ee Settings screens redirect for certain roles
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`
2014-07-30 00:57:16 -07:00

20 lines
539 B
JavaScript

import CurrentUserSettings from 'ghost/mixins/current-user-settings';
var AppsRoute = Ember.Route.extend(SimpleAuth.AuthenticatedRouteMixin, CurrentUserSettings, {
beforeModel: function () {
if (!this.get('config.apps')) {
return this.transitionTo('settings.general');
}
return this.currentUser()
.then(this.transitionAuthor())
.then(this.transitionEditor());
},
model: function () {
return this.store.find('app');
}
});
export default AppsRoute;