From ed0ac32ebb7cb1d76b1d921898394fc96c3baccc Mon Sep 17 00:00:00 2001 From: Felix Rieseberg Date: Wed, 23 Jul 2014 15:30:18 -0400 Subject: [PATCH] Redirect authors and editors away from debug page A signed in user with role author or editor will be redirected back to /ghost. closes #3292 --- ghost/admin/routes/debug.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ghost/admin/routes/debug.js b/ghost/admin/routes/debug.js index 46e779a90b..4a9949b7a7 100644 --- a/ghost/admin/routes/debug.js +++ b/ghost/admin/routes/debug.js @@ -4,11 +4,21 @@ import loadingIndicator from 'ghost/mixins/loading-indicator'; var DebugRoute = Ember.Route.extend(Ember.SimpleAuth.AuthenticatedRouteMixin, styleBody, loadingIndicator, { classNames: ['settings'], + beforeModel: function () { + var self = this; + this.store.find('user', 'me').then(function (user) { + if (user.get('isAuthor') || user.get('isEditor')) { + self.transitionTo('posts'); + } + }); + }, + model: function () { return this.store.find('setting', { type: 'blog,theme' }).then(function (records) { return records.get('firstObject'); }); } + }); export default DebugRoute;