mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-20 22:42:53 -05:00
Hide Settings Sidebar Based on Role
Implements #3294. Currently, we don’t have a permission system on the client side, so this relies on a hardcoded “author” string.
This commit is contained in:
parent
6c0c3c4bde
commit
47ae9d6ca6
2 changed files with 19 additions and 5 deletions
|
@ -32,6 +32,12 @@ var User = DS.Model.extend(NProgressSaveMixin, ValidationEngine, {
|
|||
return this.get('roles').objectAt(0).get('name').toLowerCase() === 'author';
|
||||
}),
|
||||
|
||||
// TODO: Once client-side permissions are in place,
|
||||
// remove the hard role check.
|
||||
isEditor: Ember.computed('roles', function () {
|
||||
return this.get('roles').objectAt(0).get('name').toLowerCase() === 'editor';
|
||||
}),
|
||||
|
||||
saveNewPassword: function () {
|
||||
var url = this.get('ghostPaths.url').api('users', 'password');
|
||||
return ic.ajax.request(url, {
|
||||
|
|
|
@ -4,11 +4,19 @@
|
|||
</header>
|
||||
<nav class="settings-menu">
|
||||
<ul>
|
||||
{{gh-activating-list-item route="settings.general" title="General" classNames="general"}}
|
||||
{{gh-activating-list-item route="settings.users" title="Users" classNames="users"}}
|
||||
{{#if showApps}}
|
||||
{{gh-activating-list-item route="settings.apps" title="Apps" classNames="apps"}}
|
||||
{{/if}}
|
||||
{{#unless session.user.isAuthor}}
|
||||
{{#unless session.user.isEditor}}
|
||||
{{gh-activating-list-item route="settings.general" title="General" classNames="general"}}
|
||||
{{/unless}}
|
||||
|
||||
{{gh-activating-list-item route="settings.users" title="Users" classNames="users"}}
|
||||
|
||||
{{#if showApps}}
|
||||
{{#unless session.user.isEditor}}
|
||||
{{gh-activating-list-item route="settings.apps" title="Apps" classNames="apps"}}
|
||||
{{/unless}}
|
||||
{{/if}}
|
||||
{{/unless}}
|
||||
</ul>
|
||||
</nav>
|
||||
</aside>
|
||||
|
|
Loading…
Add table
Reference in a new issue