diff --git a/app/pods/components/x-application/component.js b/app/pods/components/x-application/component.js index 27c8d25..967b497 100644 --- a/app/pods/components/x-application/component.js +++ b/app/pods/components/x-application/component.js @@ -3,6 +3,9 @@ import Ember from 'ember'; export default Ember.Component.extend({ classNames: ["flakes-frame"], + session: Ember.inject.service('session'), + currentUser: Ember.inject.service('session-account'), + didInsertElement: function() { FlakesFrame.init(); }, diff --git a/app/pods/components/x-application/template.hbs b/app/pods/components/x-application/template.hbs index e859890..49cc38e 100644 --- a/app/pods/components/x-application/template.hbs +++ b/app/pods/components/x-application/template.hbs @@ -14,7 +14,7 @@ {{#link-to 'protected.characteristics' tagName='li' href=false}} {{link-to 'Characteristics' 'protected.characteristics'}} {{/link-to}} - {{#if session.currentUser.isAdmin}} + {{#if currentUser.account.isAdmin}} {{#link-to 'protected.users' tagName='li' href=false}} {{link-to 'Users' 'protected.users'}} {{/link-to}} @@ -24,7 +24,7 @@ {{/link-to}}

- {{link-to session.currentUser.name 'protected.users.show' session.currentUser.id}}
+ {{link-to currentUser.account.name 'protected.users.show' currentUser.account.id}}
Logout

{{else}} diff --git a/app/pods/protected/characteristics/edit/route.js b/app/pods/protected/characteristics/edit/route.js index 1c04a5d..3f35133 100644 --- a/app/pods/protected/characteristics/edit/route.js +++ b/app/pods/protected/characteristics/edit/route.js @@ -1,10 +1,11 @@ import Ember from 'ember'; -import AuthenticatedRouteMixin from 'simple-auth/mixins/authenticated-route-mixin'; -export default Ember.Route.extend(AuthenticatedRouteMixin, { +export default Ember.Route.extend({ + currentUser: Ember.inject.service('session-account'), + beforeModel: function(transition) { this._super(transition); - this.get('session.currentUser').then((user) => { + this.get('currentUser.account').then((user) => { if (user.get('isReader')) { this.transitionTo('protected.characteristics.index'); } diff --git a/app/pods/protected/characteristics/index/route.js b/app/pods/protected/characteristics/index/route.js index a68c605..3ee78f4 100644 --- a/app/pods/protected/characteristics/index/route.js +++ b/app/pods/protected/characteristics/index/route.js @@ -1,13 +1,15 @@ import Ember from 'ember'; export default Ember.Route.extend({ + currentUser: Ember.inject.service('session-account'), + model: function() { return this.store.findAll('characteristic'); }, setupController: function(controller, model) { controller.set('model', model); - this.get('session.currentUser').then((user) => { + this.get('currentUser.account').then((user) => { controller.set('metaData', user.get('metaData')); }); }, diff --git a/app/pods/protected/characteristics/new/route.js b/app/pods/protected/characteristics/new/route.js index 677a5fc..2773092 100644 --- a/app/pods/protected/characteristics/new/route.js +++ b/app/pods/protected/characteristics/new/route.js @@ -1,9 +1,11 @@ import Ember from 'ember'; export default Ember.Route.extend({ + currentUser: Ember.inject.service('session-account'), + beforeModel: function(transition) { this._super(transition); - this.get('session.currentUser').then((user) => { + this.get('currentUser.account').then((user) => { if (user.get('isReader')) { this.transitionTo('protected.characteristics.index'); } diff --git a/app/pods/protected/species/edit/route.js b/app/pods/protected/species/edit/route.js index 3da73d9..1f5b616 100644 --- a/app/pods/protected/species/edit/route.js +++ b/app/pods/protected/species/edit/route.js @@ -1,9 +1,11 @@ import Ember from 'ember'; export default Ember.Route.extend({ + currentUser: Ember.inject.service('session-account'), + beforeModel: function(transition) { this._super(transition); - this.get('session.currentUser').then((user) => { + this.get('currentUser.account').then((user) => { if (user.get('isReader')) { this.transitionTo('protected.species.index'); } @@ -18,7 +20,7 @@ export default Ember.Route.extend({ setupController: function(controller, model) { controller.set('model', model); - this.get('session.currentUser').then((user) => { + this.get('currentUser.account').then((user) => { controller.set('metaData', user.get('metaData')); }); }, diff --git a/app/pods/protected/species/index/route.js b/app/pods/protected/species/index/route.js index fdb9293..89c832d 100644 --- a/app/pods/protected/species/index/route.js +++ b/app/pods/protected/species/index/route.js @@ -1,13 +1,15 @@ import Ember from 'ember'; export default Ember.Route.extend({ + currentUser: Ember.inject.service('session-account'), + model: function() { return this.store.findAll('species'); }, setupController: function(controller, model) { controller.set('model', model); - this.get('session.currentUser').then((user) => { + this.get('currentUser.account').then((user) => { controller.set('metaData', user.get('metaData')); }); }, diff --git a/app/pods/protected/species/new/route.js b/app/pods/protected/species/new/route.js index 3f813d2..d265f9e 100644 --- a/app/pods/protected/species/new/route.js +++ b/app/pods/protected/species/new/route.js @@ -1,9 +1,11 @@ import Ember from 'ember'; export default Ember.Route.extend({ + currentUser: Ember.inject.service('session-account'), + beforeModel: function(transition) { this._super(transition); - this.get('session.currentUser').then((user) => { + this.get('currentUser.account').then((user) => { if (user.get('isReader')) { this.transitionTo('protected.species.index'); } diff --git a/app/pods/protected/strains/edit/route.js b/app/pods/protected/strains/edit/route.js index 90ae097..ee75d51 100644 --- a/app/pods/protected/strains/edit/route.js +++ b/app/pods/protected/strains/edit/route.js @@ -1,10 +1,11 @@ import Ember from 'ember'; -import AuthenticatedRouteMixin from 'simple-auth/mixins/authenticated-route-mixin'; -export default Ember.Route.extend(AuthenticatedRouteMixin, { +export default Ember.Route.extend({ + currentUser: Ember.inject.service('session-account'), + beforeModel: function(transition) { this._super(transition); - this.get('session.currentUser').then((user) => { + this.get('currentUser.account').then((user) => { if (user.get('isReader')) { this.transitionTo('protected.strains.index'); } @@ -26,7 +27,7 @@ export default Ember.Route.extend(AuthenticatedRouteMixin, { setupController: function(controller, models) { controller.setProperties(models); - this.get('session.currentUser').then((user) => { + this.get('currentUser.account').then((user) => { controller.set('metaData', user.get('metaData')); }); }, diff --git a/app/pods/protected/strains/index/route.js b/app/pods/protected/strains/index/route.js index 89b5e40..e5582d7 100644 --- a/app/pods/protected/strains/index/route.js +++ b/app/pods/protected/strains/index/route.js @@ -1,13 +1,15 @@ import Ember from 'ember'; export default Ember.Route.extend({ + currentUser: Ember.inject.service('session-account'), + model: function() { return this.store.findAll('strain'); }, setupController: function(controller, model) { controller.set('model', model); - this.get('session.currentUser').then((user) => { + this.get('currentUser.account').then((user) => { controller.set('metaData', user.get('metaData')); }); }, diff --git a/app/pods/protected/strains/new/route.js b/app/pods/protected/strains/new/route.js index 45ca831..6def196 100644 --- a/app/pods/protected/strains/new/route.js +++ b/app/pods/protected/strains/new/route.js @@ -1,9 +1,11 @@ import Ember from 'ember'; export default Ember.Route.extend({ + currentUser: Ember.inject.service('session-account'), + beforeModel: function(transition) { this._super(transition); - this.get('session.currentUser').then((user) => { + this.get('currentUser.account').then((user) => { if (user.get('isReader')) { this.transitionTo('protected.strains.index'); } diff --git a/app/pods/protected/users/changepassword/controller.js b/app/pods/protected/users/changepassword/controller.js index 94ce219..512c539 100644 --- a/app/pods/protected/users/changepassword/controller.js +++ b/app/pods/protected/users/changepassword/controller.js @@ -2,6 +2,8 @@ import Ember from 'ember'; import ajaxRequest from '../../../../utils/ajax-request'; export default Ember.Controller.extend({ + currentUser: Ember.inject.service('session-account'), + passwordConfirm: null, actions: { @@ -16,7 +18,7 @@ export default Ember.Controller.extend({ let options = { method: 'POST', data: { - id: this.get('session.currentUser.id'), + id: this.get('currentUser.account.id'), password: this.get('password'), }, }; diff --git a/app/pods/protected/users/changepassword/route.js b/app/pods/protected/users/changepassword/route.js index 2e3f295..ce869dd 100644 --- a/app/pods/protected/users/changepassword/route.js +++ b/app/pods/protected/users/changepassword/route.js @@ -1,12 +1,14 @@ import Ember from 'ember'; export default Ember.Route.extend({ + currentUser: Ember.inject.service('session-account'), + beforeModel: function(transition) { this._super(transition); let user_id = transition.params['protected.users.changepassword'].user_id; - this.get('session.currentUser').then((user) => { + this.get('currentUser.account').then((user) => { if (user.get('id') !== user_id) { this.transitionTo('protected.users.index'); } diff --git a/app/pods/protected/users/edit/route.js b/app/pods/protected/users/edit/route.js index 3a943b8..b95bdb2 100644 --- a/app/pods/protected/users/edit/route.js +++ b/app/pods/protected/users/edit/route.js @@ -1,12 +1,14 @@ import Ember from 'ember'; export default Ember.Route.extend({ + currentUser: Ember.inject.service('session-account'), + beforeModel: function(transition) { this._super(transition); let user_id = transition.params['protected.users.edit'].user_id; - this.get('session.currentUser').then((user) => { + this.get('currentUser.account').then((user) => { if (user.get('id') !== user_id && !user.get('isAdmin')) { this.transitionTo('protected.users.index'); } diff --git a/app/pods/protected/users/edit/template.hbs b/app/pods/protected/users/edit/template.hbs index 2f2f678..e53c6e8 100644 --- a/app/pods/protected/users/edit/template.hbs +++ b/app/pods/protected/users/edit/template.hbs @@ -1,7 +1,7 @@ {{ protected/users/user-form user=model - currentUser=session.currentUser + currentUser=currentUser.account save="save" cancel="cancel" }} diff --git a/app/pods/protected/users/index/route.js b/app/pods/protected/users/index/route.js index e8b6bc7..8429726 100644 --- a/app/pods/protected/users/index/route.js +++ b/app/pods/protected/users/index/route.js @@ -1,9 +1,11 @@ import Ember from 'ember'; export default Ember.Route.extend({ + currentUser: Ember.inject.service('session-account'), + beforeModel: function(transition) { this._super(transition); - this.get('session.currentUser').then((user) => { + this.get('currentUser.account').then((user) => { if (!user.get('isAdmin')) { this.transitionTo('protected.index'); } diff --git a/app/pods/protected/users/show/controller.js b/app/pods/protected/users/show/controller.js index 481b126..3c6c549 100644 --- a/app/pods/protected/users/show/controller.js +++ b/app/pods/protected/users/show/controller.js @@ -1,7 +1,9 @@ import Ember from 'ember'; export default Ember.Controller.extend({ - isUser: Ember.computed('model.id', 'session.currentUser.id', function() { - return this.get('model.id') === this.get('session.currentUser.id'); + currentUser: Ember.inject.service('session-account'), + + isUser: Ember.computed('model.id', 'currentUser.account.id', function() { + return this.get('model.id') === this.get('currentUser.account.id'); }), }); diff --git a/app/pods/protected/users/show/route.js b/app/pods/protected/users/show/route.js index 33eeba7..a0c9fd9 100644 --- a/app/pods/protected/users/show/route.js +++ b/app/pods/protected/users/show/route.js @@ -1,10 +1,12 @@ import Ember from 'ember'; export default Ember.Route.extend({ + currentUser: Ember.inject.service('session-account'), + beforeModel: function(transition) { this._super(transition); - this.get('session.currentUser').then((currentUser) => { + this.get('currentUser.account').then((currentUser) => { let user_id = transition.params['protected.users.show'].user_id; if (!currentUser.get('isAdmin') && currentUser.get('id') !== user_id) { this.transitionTo('protected.users.index');