parent
0dbcd45c4e
commit
bcd2bbb4c4
10 changed files with 70 additions and 12 deletions
|
@ -2,6 +2,15 @@ import Ember from 'ember';
|
|||
import AuthenticatedRouteMixin from 'simple-auth/mixins/authenticated-route-mixin';
|
||||
|
||||
export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
||||
beforeModel: function(transition) {
|
||||
this._super(transition);
|
||||
this.get('session.currentUser').then((user) => {
|
||||
if (user.get('isReader')) {
|
||||
this.transitionTo('protected.strains.index');
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
model: function(params) {
|
||||
return Ember.RSVP.hash({
|
||||
strain: this.store.find('strain', params.strain_id),
|
||||
|
|
|
@ -3,9 +3,11 @@ import Ember from 'ember';
|
|||
export default Ember.Route.extend({
|
||||
beforeModel: function(transition) {
|
||||
this._super(transition);
|
||||
if (this.get('session.currentUser.role') === 'R') {
|
||||
this.transitionTo('strains.index');
|
||||
}
|
||||
this.get('session.currentUser').then((user) => {
|
||||
if (user.get('isReader')) {
|
||||
this.transitionTo('protected.strains.index');
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
model: function() {
|
||||
|
|
Reference in a new issue