2
1
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2023-12-13 21:00:40 +01:00

Hide Settings Tab if Author

Implements #3293. 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:
Ian Mitchell 2014-07-21 14:19:46 -07:00
parent 27c42c2bf0
commit 6c0c3c4bde
2 changed files with 10 additions and 1 deletions

View file

@ -25,6 +25,13 @@ var User = DS.Model.extend(NProgressSaveMixin, ValidationEngine, {
updated_by: DS.belongsTo('user', { async: true }),
roles: DS.hasMany('role', { embedded: 'always' }),
// TODO: Once client-side permissions are in place,
// remove the hard role check.
isAuthor: Ember.computed('roles', function () {
return this.get('roles').objectAt(0).get('name').toLowerCase() === 'author';
}),
saveNewPassword: function () {
var url = this.get('ghostPaths.url').api('users', 'password');
return ic.ajax.request(url, {

View file

@ -6,7 +6,9 @@
<ul id="main-menu" >
{{gh-activating-list-item route="posts" title="Content" classNames="content js-close-sidebar"}}
{{gh-activating-list-item route="editor.new" title="New Post" classNames="editor js-close-sidebar"}}
{{gh-activating-list-item route="settings" title="Settings" classNames="settings js-close-sidebar"}}
{{#unless session.user.isAuthor}}
{{gh-activating-list-item route="settings" title="Settings" classNames="settings js-close-sidebar"}}
{{/unless}}
<li id="usermenu" class="usermenu subnav">
{{#gh-popover-button popoverName="user-menu" tagName="a" href="#" classNames="dropdown"}}