Skip to content

Inheritable state permissions

Compare
Choose a tag to compare
@RafaelVidaurre RafaelVidaurre released this 04 Sep 22:16
· 689 commits to master since this release

Changes

  • Now allowing to define state permissions from the data key instead the actualy state object. Thus allowing children states to inherit permission restrictions
  • Will still allow for now state permissions on the state object though this will be deprecated in version 1.0.0

Defining state permissions now allows:

$stateProvider
  .state('bookmarks', {
    ...,
    data: {
      permissions: {...}
    }
  });

Which makes us capable of using inheritance from parent states like this:

$stateProvider
  .state('bookmarks', {
    abstract: true,
    data: {
      permissions: {...}
    }
  })
  // This state will require permissions from parent state
  .state('bookmarks.index', {
  ...
  });