Skip to content

Use via RouterDSL #56

@denzo

Description

@denzo

Hi there, we found ourselves writing the following code in routes, which is great. However, as the app grew we felt like we could all benefit from a birds eye view of all the routes that require abilities.

beforeModel: function() {
    if (!this.can('write post')) {
      this.transitionTo('index');
    }
  }

We thought the best place for overlooking those would be in the Router.map.

Router.map(function() {
  this.route('posts', { abilities: ['manage team', 'view post'] }, function() {
    this.route('create', { abilities: ['create post'] });
    this.route('show', { path: ':id', resourceAbilities: ['update post'] });
  });
});

We've implemented an extension of the RouterDSL in a similar manner to the way ember-torii does with authenticatedRoute.

I was wondering if you would be interested in including this type of functionality into this addon.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions