From 6a14087ccc2f99428f86f632a256cbdc0689a31b Mon Sep 17 00:00:00 2001 From: Kevin Ansfield Date: Thu, 4 Feb 2021 17:36:29 +0000 Subject: [PATCH] Made launch wizard only accessible to owners refs https://github.com/TryGhost/Team/issues/460 - member payment settings are only changeable by owners which would leave the wizard being a single step - wizard is designed to be used as one of the first things after initial site setup which will be completed as the owner user --- ghost/admin/app/controllers/dashboard.js | 6 ++++++ ghost/admin/app/routes/launch.js | 13 ++++++++++++- ghost/admin/app/templates/dashboard.hbs | 4 +++- 3 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 ghost/admin/app/controllers/dashboard.js diff --git a/ghost/admin/app/controllers/dashboard.js b/ghost/admin/app/controllers/dashboard.js new file mode 100644 index 0000000000..db7e5fb40f --- /dev/null +++ b/ghost/admin/app/controllers/dashboard.js @@ -0,0 +1,6 @@ +import Controller from '@ember/controller'; +import {inject as service} from '@ember/service'; + +export default class DashboardController extends Controller { + @service session; +} \ No newline at end of file diff --git a/ghost/admin/app/routes/launch.js b/ghost/admin/app/routes/launch.js index 058ec6733e..5e185165cc 100644 --- a/ghost/admin/app/routes/launch.js +++ b/ghost/admin/app/routes/launch.js @@ -1,3 +1,14 @@ import AuthenticatedRoute from 'ghost-admin/routes/authenticated'; +import {inject as service} from '@ember/service'; -export default class LaunchRoute extends AuthenticatedRoute {} +export default class LaunchRoute extends AuthenticatedRoute { + @service session; + + beforeModel() { + return this.session.user.then((user) => { + if (!user.isOwner) { + return this.transitionTo('home'); + } + }); + } +} diff --git a/ghost/admin/app/templates/dashboard.hbs b/ghost/admin/app/templates/dashboard.hbs index 97679927ac..169f2ff0c6 100644 --- a/ghost/admin/app/templates/dashboard.hbs +++ b/ghost/admin/app/templates/dashboard.hbs @@ -6,6 +6,8 @@
- Launch site - Finish setup + {{#if this.session.user.isOwner}} + Launch site - Finish setup + {{/if}}
\ No newline at end of file