3bf3130268
* only show entities sidenav item if user has list capability on entities * wip - link to correct paths in top navigation * remove comment * only link to groups page if user has list capability * add test for checking multiple capabilities * test when capabilities are not specified * format jsdoc comments * move capabilities check out of helper and into permissions service
24 lines
599 B
JavaScript
24 lines
599 B
JavaScript
import Helper from '@ember/component/helper';
|
|
import { inject as service } from '@ember/service';
|
|
import { observer } from '@ember/object';
|
|
|
|
export default Helper.extend({
|
|
permissions: service(),
|
|
/* eslint-disable-next-line ember/no-observers */
|
|
onPermissionsChange: observer(
|
|
'permissions.exactPaths',
|
|
'permissions.globPaths',
|
|
'permissions.canViewAll',
|
|
function() {
|
|
this.recompute();
|
|
}
|
|
),
|
|
|
|
compute([route], params) {
|
|
let { routeParams } = params;
|
|
let permissions = this.permissions;
|
|
|
|
return permissions.hasNavPermission(route, routeParams);
|
|
},
|
|
});
|