2019-01-18 22:04:40 +00:00
|
|
|
import Helper from '@ember/component/helper';
|
|
|
|
import { inject as service } from '@ember/service';
|
2019-03-26 16:20:09 +00:00
|
|
|
import { observer } from '@ember/object';
|
2019-01-18 22:04:40 +00:00
|
|
|
|
|
|
|
export default Helper.extend({
|
|
|
|
permissions: service(),
|
2019-04-19 01:50:05 +00:00
|
|
|
/* eslint-disable-next-line ember/no-observers */
|
2019-03-26 16:20:09 +00:00
|
|
|
onPermissionsChange: observer(
|
|
|
|
'permissions.exactPaths',
|
|
|
|
'permissions.globPaths',
|
|
|
|
'permissions.canViewAll',
|
|
|
|
function() {
|
|
|
|
this.recompute();
|
|
|
|
}
|
|
|
|
),
|
|
|
|
|
2019-01-28 22:49:25 +00:00
|
|
|
compute([route], { routeParams, capability }) {
|
2019-01-18 22:04:40 +00:00
|
|
|
let permissions = this.permissions;
|
2019-01-28 22:49:25 +00:00
|
|
|
return permissions.hasNavPermission(route, routeParams, capability);
|
2019-01-18 22:04:40 +00:00
|
|
|
},
|
|
|
|
});
|