Creates a basic permit function that will check a user's roles against a list of provided roles using the match function. Designed to be used by a route.

Usage: (in a route file)

import Ember from 'ember';
import PermissionsMixin from '@bennerinformatics/ember-fw-gc/mixin/permissions';

export default Ember.Route.extend(PermissionsMixin, {
    // your code here
});

This mixin is used by the addon AuthRoute, which is extended by both AuthRoute and RestrictedRoute, so then, this mixin is incorporated behind the scenes into all the routes used in the Informatics Apps (whether AuthRoute or RestrictedRoute).

Show:

Methods

permit
(
  • roles
  • goTo
)
Ember.Transition | Null
public

Checks a role or list of roles against a user's available roles. If the check fails, the app will transition to the route specified.

Parameters:

  • roles String | Array

    Roles to check

  • goTo String

    Route to transition to if the check fails

Returns:

Ember.Transition | Null