Merge pull request #3358 from IanMitchell/sidebar-role

Hide Settings Sidebar Based on Role
This commit is contained in:
Hannah Wolfe 2014-07-23 03:41:40 +01:00
commit 4eb03af0a3
2 changed files with 19 additions and 5 deletions

View File

@ -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, {

View File

@ -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>