mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-24 23:48:13 -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
3d4981307f
commit
5db86f2356
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';
|
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 () {
|
saveNewPassword: function () {
|
||||||
var url = this.get('ghostPaths.url').api('users', 'password');
|
var url = this.get('ghostPaths.url').api('users', 'password');
|
||||||
return ic.ajax.request(url, {
|
return ic.ajax.request(url, {
|
||||||
|
|
|
@ -4,11 +4,19 @@
|
||||||
</header>
|
</header>
|
||||||
<nav class="settings-menu">
|
<nav class="settings-menu">
|
||||||
<ul>
|
<ul>
|
||||||
|
{{#unless session.user.isAuthor}}
|
||||||
|
{{#unless session.user.isEditor}}
|
||||||
{{gh-activating-list-item route="settings.general" title="General" classNames="general"}}
|
{{gh-activating-list-item route="settings.general" title="General" classNames="general"}}
|
||||||
|
{{/unless}}
|
||||||
|
|
||||||
{{gh-activating-list-item route="settings.users" title="Users" classNames="users"}}
|
{{gh-activating-list-item route="settings.users" title="Users" classNames="users"}}
|
||||||
|
|
||||||
{{#if showApps}}
|
{{#if showApps}}
|
||||||
|
{{#unless session.user.isEditor}}
|
||||||
{{gh-activating-list-item route="settings.apps" title="Apps" classNames="apps"}}
|
{{gh-activating-list-item route="settings.apps" title="Apps" classNames="apps"}}
|
||||||
|
{{/unless}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
{{/unless}}
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
</aside>
|
</aside>
|
||||||
|
|
Loading…
Add table
Reference in a new issue