From a3334cb52616eddb6088ab4e4e99a463a4137aca Mon Sep 17 00:00:00 2001 From: hc-github-team-secure-vault-core <82990506+hc-github-team-secure-vault-core@users.noreply.github.com> Date: Thu, 6 Jul 2023 12:15:50 -0400 Subject: [PATCH] backport of commit 6acd2921c5d78382b0a554674cd4f7c81a9a126a (#21622) Co-authored-by: Jordan Reimer --- ui/app/services/permissions.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ui/app/services/permissions.js b/ui/app/services/permissions.js index b2aa1b6c5..324c17f30 100644 --- a/ui/app/services/permissions.js +++ b/ui/app/services/permissions.js @@ -97,13 +97,15 @@ export default Service.extend({ hasNavPermission(navItem, routeParams, requireAll) { if (routeParams) { - // viewing the entity and groups pages require the list capability, while the others require the default, which is anything other than deny - const capability = routeParams === 'entities' || routeParams === 'groups' ? ['list'] : [null]; // check that the user has permission to access all (requireAll = true) or any of the routes when array is passed // useful for hiding nav headings when user does not have access to any of the links const params = Array.isArray(routeParams) ? routeParams : [routeParams]; const evalMethod = !Array.isArray(routeParams) || requireAll ? 'every' : 'some'; - return params[evalMethod]((param) => this.hasPermission(API_PATHS[navItem][param], capability)); + return params[evalMethod]((param) => { + // viewing the entity and groups pages require the list capability, while the others require the default, which is anything other than deny + const capability = param === 'entities' || param === 'groups' ? ['list'] : [null]; + return this.hasPermission(API_PATHS[navItem][param], capability); + }); } return Object.values(API_PATHS[navItem]).some((path) => this.hasPermission(path)); },