Skip to content

Commit 95341e0

Browse files
authored
Merge pull request #122 from fleetbase/fix/smart-nav-menu-shortcut-permission
fix(smart-nav-menu): use parent extension id for shortcut permission check
2 parents e94926d + 28f690d commit 95341e0

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

addon/components/layout/header/smart-nav-menu.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,14 @@ export default class LayoutHeaderSmartNavMenuComponent extends Component {
161161
const raw = this.universe.headerMenuItems ?? [];
162162
const visible = [];
163163
for (const item of raw) {
164+
// Shortcuts are not standalone extensions — they should be visible
165+
// if and only if their parent extension is visible. Use _parentId
166+
// for the ability check so the shortcut inherits the parent's
167+
// permission rather than being checked against its own (non-existent)
168+
// extension ability, which would always throw and default to visible.
169+
const abilityId = item._isShortcut && item._parentId ? item._parentId : item.id;
164170
try {
165-
if (this.abilities.can(`${item.id} see extension`)) {
171+
if (this.abilities.can(`${abilityId} see extension`)) {
166172
visible.push(item);
167173
}
168174
} catch (_) {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@fleetbase/ember-ui",
3-
"version": "0.3.24",
3+
"version": "0.3.25",
44
"description": "Fleetbase UI provides all the interface components, helpers, services and utilities for building a Fleetbase extension into the Console.",
55
"keywords": [
66
"fleetbase-ui",

0 commit comments

Comments
 (0)