From 6c0c3c4bdebf1b7799a5dc06175f5eb547b61d02 Mon Sep 17 00:00:00 2001 From: Ian Mitchell Date: Mon, 21 Jul 2014 14:19:46 -0700 Subject: [PATCH] Hide Settings Tab if Author MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Implements #3293. Currently, we don’t have a permission system on the client side, so this relies on a hardcoded “author” string. --- core/client/models/user.js | 7 +++++++ core/client/templates/-navbar.hbs | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/core/client/models/user.js b/core/client/models/user.js index 9e03e36bd5..59f430b3e9 100644 --- a/core/client/models/user.js +++ b/core/client/models/user.js @@ -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, { diff --git a/core/client/templates/-navbar.hbs b/core/client/templates/-navbar.hbs index 3a2d3dc9fd..6a54b81148 100644 --- a/core/client/templates/-navbar.hbs +++ b/core/client/templates/-navbar.hbs @@ -6,7 +6,9 @@