mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-24 23:48:13 -05:00
Moved payment settings access control to route
no issue - having owner-only access control in the template meant the route was accessible but would show a blank page - updated access control in the `members-payments` route to redirect admins to the settings index screen and non-admins to the default home screen
This commit is contained in:
parent
4e2a7b9af5
commit
04760132e9
3 changed files with 8 additions and 11 deletions
|
@ -4,7 +4,6 @@ import {inject as service} from '@ember/service';
|
||||||
import {task} from 'ember-concurrency';
|
import {task} from 'ember-concurrency';
|
||||||
|
|
||||||
export default Controller.extend({
|
export default Controller.extend({
|
||||||
session: service(),
|
|
||||||
settings: service(),
|
settings: service(),
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
import AuthenticatedRoute from 'ghost-admin/routes/authenticated';
|
import AuthenticatedRoute from 'ghost-admin/routes/authenticated';
|
||||||
import CurrentUserSettings from 'ghost-admin/mixins/current-user-settings';
|
|
||||||
import {inject as service} from '@ember/service';
|
import {inject as service} from '@ember/service';
|
||||||
|
|
||||||
export default AuthenticatedRoute.extend(CurrentUserSettings, {
|
export default AuthenticatedRoute.extend({
|
||||||
settings: service(),
|
settings: service(),
|
||||||
notifications: service(),
|
notifications: service(),
|
||||||
queryParams: {
|
queryParams: {
|
||||||
|
@ -16,9 +15,13 @@ export default AuthenticatedRoute.extend(CurrentUserSettings, {
|
||||||
|
|
||||||
beforeModel() {
|
beforeModel() {
|
||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
return this.get('session.user')
|
return this.get('session.user').then((user) => {
|
||||||
.then(this.transitionAuthor())
|
if (!user.isOwner && user.isAdmin) {
|
||||||
.then(this.transitionEditor());
|
return this.transitionTo('settings');
|
||||||
|
} else if (!user.isOwner) {
|
||||||
|
return this.transitionTo('home');
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
model() {
|
model() {
|
||||||
|
|
|
@ -17,16 +17,11 @@
|
||||||
</GhCanvasHeader>
|
</GhCanvasHeader>
|
||||||
|
|
||||||
<section class="view-container settings-debug">
|
<section class="view-container settings-debug">
|
||||||
|
|
||||||
{{#if this.session.user.isOwner}}
|
|
||||||
<div class="gh-setting-liquid-section">
|
<div class="gh-setting-liquid-section">
|
||||||
<GhMembersPaymentsSetting
|
<GhMembersPaymentsSetting
|
||||||
@setDefaultContentVisibility={{action "setDefaultContentVisibility"}}
|
@setDefaultContentVisibility={{action "setDefaultContentVisibility"}}
|
||||||
@setStripeConnectIntegrationTokenSetting={{action "setStripeConnectIntegrationTokenSetting"}}
|
@setStripeConnectIntegrationTokenSetting={{action "setStripeConnectIntegrationTokenSetting"}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
</section>
|
</section>
|
Loading…
Add table
Reference in a new issue