diff --git a/x-pack/plugins/security/server/authorization/privileges/feature_privilege_builder/navlink.ts b/x-pack/plugins/security/server/authorization/privileges/feature_privilege_builder/navlink.ts index dd076477a9c11..f25632407be86 100644 --- a/x-pack/plugins/security/server/authorization/privileges/feature_privilege_builder/navlink.ts +++ b/x-pack/plugins/security/server/authorization/privileges/feature_privilege_builder/navlink.ts @@ -9,6 +9,9 @@ import { BaseFeaturePrivilegeBuilder } from './feature_privilege_builder'; export class FeaturePrivilegeNavlinkBuilder extends BaseFeaturePrivilegeBuilder { public getActions(privilegeDefinition: FeatureKibanaPrivileges, feature: Feature): string[] { - return feature.navLinkId ? [this.actions.ui.get('navLinks', feature.navLinkId)] : []; + const appNavLinks = feature.app.map((app) => this.actions.ui.get('navLinks', app)); + return feature.navLinkId + ? [this.actions.ui.get('navLinks', feature.navLinkId), ...appNavLinks] + : appNavLinks; } } diff --git a/x-pack/plugins/security/server/authorization/privileges/privileges.test.ts b/x-pack/plugins/security/server/authorization/privileges/privileges.test.ts index 8a499a3eba8fa..d8ece8f68d425 100644 --- a/x-pack/plugins/security/server/authorization/privileges/privileges.test.ts +++ b/x-pack/plugins/security/server/authorization/privileges/privileges.test.ts @@ -54,8 +54,20 @@ describe('features', () => { const actual = privileges.get(); expect(actual).toHaveProperty('features.foo-feature', { - all: [actions.login, actions.version, actions.ui.get('navLinks', 'kibana:foo')], - read: [actions.login, actions.version, actions.ui.get('navLinks', 'kibana:foo')], + all: [ + actions.login, + actions.version, + actions.ui.get('navLinks', 'kibana:foo'), + actions.ui.get('navLinks', 'app-1'), + actions.ui.get('navLinks', 'app-2'), + ], + read: [ + actions.login, + actions.version, + actions.ui.get('navLinks', 'kibana:foo'), + actions.ui.get('navLinks', 'app-1'), + actions.ui.get('navLinks', 'app-2'), + ], }); }); @@ -635,6 +647,8 @@ describe('reserved', () => { expect(actual).toHaveProperty('reserved.foo', [ actions.version, actions.ui.get('navLinks', 'kibana:foo'), + actions.ui.get('navLinks', 'app-1'), + actions.ui.get('navLinks', 'app-2'), ]); });