mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-24 23:48:13 -05:00
Updated Dashboard visibility
- only owner/admins can view Dashboard, everyone else is redirected to "View site"
This commit is contained in:
parent
10f58f74dd
commit
0503ce5f35
3 changed files with 14 additions and 1 deletions
|
@ -86,7 +86,9 @@
|
|||
</GhBasicDropdown>
|
||||
</div>
|
||||
<div class="flex items-center">
|
||||
<LinkTo class="gh-nav-bottom-tabicon" @route="settings" @current-when={{this.isSettingsRoute}} data-test-nav="settings">{{svg-jar "settings"}}</LinkTo>
|
||||
{{#if (gh-user-can-admin this.session.user)}}
|
||||
<LinkTo class="gh-nav-bottom-tabicon" @route="settings" @current-when={{this.isSettingsRoute}} data-test-nav="settings">{{svg-jar "settings"}}</LinkTo>
|
||||
{{/if}}
|
||||
<div class="nightshift-toggle-container">
|
||||
<div class="nightshift-toggle {{if this.feature.nightShift "on"}}" {{action (toggle "nightShift" this.feature)}}>
|
||||
<div class="sun">{{svg-jar "sun"}}</div>
|
||||
|
|
|
@ -17,9 +17,11 @@
|
|||
<section class="gh-nav-body">
|
||||
<div class="gh-nav-top">
|
||||
<ul class="gh-nav-list gh-nav-main">
|
||||
{{#if (gh-user-can-admin this.session.user)}}
|
||||
<li class="relative">
|
||||
<LinkTo @route="dashboard" @alt="Dashboard" @title="Dashboard" data-test-nav="dashboard">{{svg-jar "house"}} Dashboard</LinkTo>
|
||||
</li>
|
||||
{{/if}}
|
||||
<li class="relative">
|
||||
<span {{action "transitionToOrRefreshSite" on="click"}}>
|
||||
<LinkTo @route="site" data-test-nav="site" @current-when={{this.isOnSite}} @preventDefault={{false}}>
|
||||
|
|
|
@ -1,6 +1,15 @@
|
|||
import AuthenticatedRoute from 'ghost-admin/routes/authenticated';
|
||||
|
||||
export default class DashboardRoute extends AuthenticatedRoute {
|
||||
beforeModel() {
|
||||
super.beforeModel(...arguments);
|
||||
return this.session.user.then((user) => {
|
||||
if (!user.isOwnerOrAdmin) {
|
||||
return this.transitionTo('site');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
buildRouteInfoMetadata() {
|
||||
return {
|
||||
mainClasses: ['gh-main-wide']
|
||||
|
|
Loading…
Add table
Reference in a new issue