UNPKG

@bennerinformatics/ember-fw-gc

Version:

A set of components, controllers, routes, and helpers used in all Group-Control managed FW App System applications

27 lines (24 loc) 831 B
import Helper from '@ember/component/helper'; import {inject as injectService} from '@ember/service'; /** * This helper can be used to determine if the user is part of a specific department. * It does *not* extend match, so it will not take an either/or array. It will only take * a single string. Then the helper returns a boolean value based on whether or not the * user is in the department. * * Usage: * ```handlebars * {{has-department 'test'}} <!-- if the user is in the "test" department, this returns true --> * ``` * * @public * @class HasDepartment * @extends Ember.Helper * @module Helpers */ export default Helper.extend({ currentUser: injectService(), compute(department) { return this.get('currentUser.departments').includes(department.get('id')); } });