Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fleet] Add fleet subfeatures #178006

Merged
merged 4 commits into from
Mar 11, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions x-pack/plugins/fleet/common/experimental_features.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export const allowedExperimentalValues = Object.freeze<Record<string, boolean>>(
remoteESOutput: true,
agentless: false,
enableStrictKQLValidation: false,
subfeaturePrivileges: false,
});

type ExperimentalConfigKeys = Array<keyof ExperimentalFeatures>;
Expand Down
111 changes: 110 additions & 1 deletion x-pack/plugins/fleet/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ export class FleetPlugin
registerSavedObjects(core.savedObjects);
registerEncryptedSavedObjects(deps.encryptedSavedObjects);

const experimentalFeatures = parseExperimentalConfigValue(config.enableExperimental ?? []);
// Register feature
if (deps.features) {
deps.features.registerKibanaFeature({
Expand Down Expand Up @@ -318,6 +319,115 @@ export class FleetPlugin
},
],
},
subFeatures: experimentalFeatures.subfeaturePrivileges
? [
{
name: 'Agents',
requireAllSpaces: true,
privilegeGroups: [
{
groupType: 'mutually_exclusive',
privileges: [
{
id: `${PLUGIN_ID}-agents-all`,
api: [`${PLUGIN_ID}-agent-read`, `${PLUGIN_ID}-agent-all`],
name: 'All',
ui: ['read', 'all'],
savedObject: {
all: [],
read: allSavedObjectTypes,
},
includeIn: 'all',
},
{
id: `${PLUGIN_ID}-agents-read`,
api: [`${PLUGIN_ID}-agent-read`],
name: 'Read',
ui: ['read'],
savedObject: {
all: [],
read: allSavedObjectTypes,
},
includeIn: 'read',
alerting: {},
},
],
},
],
},
{
name: 'Agent policies',
requireAllSpaces: true,
privilegeGroups: [
{
groupType: 'mutually_exclusive',
privileges: [
{
id: `${PLUGIN_ID}-agent-policies-all`,
api: [
`${PLUGIN_ID}-agent-policies-read`,
`${PLUGIN_ID}-agent-policies-all`,
],
name: 'All',
ui: ['read', 'all'],
savedObject: {
all: [],
read: allSavedObjectTypes,
},
includeIn: 'all',
},
{
id: `${PLUGIN_ID}-agent-policies-read`,
api: [`${PLUGIN_ID}-agent-policies-read`],
name: 'Read',
ui: ['read'],
savedObject: {
all: [],
read: allSavedObjectTypes,
},
includeIn: 'read',
alerting: {},
},
],
},
],
},
{
name: 'Settings',
requireAllSpaces: true,
privilegeGroups: [
{
groupType: 'mutually_exclusive',
privileges: [
{
id: `${PLUGIN_ID}-settings-all`,
api: [`${PLUGIN_ID}-settings-read`, `${PLUGIN_ID}-settings-all`],
name: 'All',
ui: ['read', 'all'],
savedObject: {
all: [],
read: allSavedObjectTypes,
},
includeIn: 'all',
},
{
id: `${PLUGIN_ID}-settings-read`,
api: [`${PLUGIN_ID}-settings-read`],
name: 'Read',
ui: ['read'],
savedObject: {
all: [],
read: allSavedObjectTypes,
},
includeIn: 'read',
alerting: {},
},
],
},
],
},
]
: [],
privileges: {
all: {
api: [`${PLUGIN_ID}-read`, `${PLUGIN_ID}-all`],
Expand All @@ -340,7 +450,6 @@ export class FleetPlugin
read: allSavedObjectTypes,
},
ui: ['read'],
disabled: true,
},
},
});
Expand Down