Skip to content

Commit

Permalink
fixing a few things from recent rebase with 100127
Browse files Browse the repository at this point in the history
  • Loading branch information
yctercero committed May 25, 2021
1 parent 690f66c commit dc0b04b
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 71 deletions.
110 changes: 69 additions & 41 deletions x-pack/plugins/features/server/feature_schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,53 +61,81 @@ const managementSchema = schema.recordOf(
}),
listOfCapabilitiesSchema
);
const catalogueSchema = Joi.array().items(Joi.string().regex(uiCapabilitiesRegex));
const alertingSchema = Joi.array().items(Joi.string());

const appCategorySchema = Joi.object({
id: Joi.string().required(),
label: Joi.string().required(),
ariaLabel: Joi.string(),
euiIconType: Joi.string(),
order: Joi.number(),
}).required();

const kibanaPrivilegeSchema = Joi.object({
excludeFromBasePrivileges: Joi.boolean(),
management: managementSchema,
catalogue: catalogueSchema,
api: Joi.array().items(Joi.string()),
app: Joi.array().items(Joi.string()),
alerting: Joi.object({
rule: {
all: alertingSchema,
read: alertingSchema,
},
alert: {
all: alertingSchema,
read: alertingSchema,
},
const catalogueSchema = listOfCapabilitiesSchema;
const alertingSchema = schema.arrayOf(schema.string());

const appCategorySchema = schema.object({
id: schema.string(),
label: schema.string(),
ariaLabel: schema.maybe(schema.string()),
euiIconType: schema.maybe(schema.string()),
order: schema.maybe(schema.number()),
});

const kibanaPrivilegeSchema = schema.object({
excludeFromBasePrivileges: schema.maybe(schema.boolean()),
management: schema.maybe(managementSchema),
catalogue: schema.maybe(catalogueSchema),
api: schema.maybe(schema.arrayOf(schema.string())),
app: schema.maybe(schema.arrayOf(schema.string())),
alerting: schema.maybe(
schema.object({
rule: schema.maybe(
schema.object({
all: schema.maybe(alertingSchema),
read: schema.maybe(alertingSchema),
})
),
alert: schema.maybe(
schema.object({
all: schema.maybe(alertingSchema),
read: schema.maybe(alertingSchema),
})
),
})
),
savedObject: schema.object({
all: schema.arrayOf(schema.string()),
read: schema.arrayOf(schema.string()),
}),
ui: listOfCapabilitiesSchema,
});

const kibanaIndependentSubFeaturePrivilegeSchema = Joi.object({
id: Joi.string().regex(subFeaturePrivilegePartRegex).required(),
name: Joi.string().required(),
includeIn: Joi.string().allow('all', 'read', 'none').required(),
minimumLicense: Joi.string().valid(...validSubFeaturePrivilegeLicenses),
management: managementSchema,
catalogue: catalogueSchema,
alerting: Joi.object({
rule: {
all: alertingSchema,
read: alertingSchema,
},
alert: {
all: alertingSchema,
read: alertingSchema,
const kibanaIndependentSubFeaturePrivilegeSchema = schema.object({
id: schema.string({
validate(key: string) {
if (!subFeaturePrivilegePartRegex.test(key)) {
return `Does not satisfy regexp ${subFeaturePrivilegePartRegex.toString()}`;
}
},
}),
name: schema.string(),
includeIn: schema.oneOf([schema.literal('all'), schema.literal('read'), schema.literal('none')]),
minimumLicense: schema.maybe(validSubFeaturePrivilegeLicensesSchema),
management: schema.maybe(managementSchema),
catalogue: schema.maybe(catalogueSchema),
alerting: schema.maybe(
schema.object({
rule: schema.maybe(
schema.object({
all: schema.maybe(alertingSchema),
read: schema.maybe(alertingSchema),
})
),
alert: schema.maybe(
schema.object({
all: schema.maybe(alertingSchema),
read: schema.maybe(alertingSchema),
})
),
})
),
api: schema.maybe(schema.arrayOf(schema.string())),
app: schema.maybe(schema.arrayOf(schema.string())),
savedObject: schema.object({
all: schema.arrayOf(schema.string()),
read: schema.arrayOf(schema.string()),
}),
ui: listOfCapabilitiesSchema,
});

Expand Down
30 changes: 0 additions & 30 deletions x-pack/plugins/stack_alerts/server/feature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,11 @@ export const BUILT_IN_ALERTS_FEATURE: KibanaFeatureConfig = {
insightsAndAlerting: ['triggersActions'],
},
alerting: {
<<<<<<< HEAD
rule: {
all: [IndexThreshold, GeoContainment, ElasticsearchQuery],
},
alert: {
read: [IndexThreshold, GeoContainment, ElasticsearchQuery],
=======
all: {
rule: [IndexThreshold, GeoContainment, ElasticsearchQuery],
alert: [],
},
read: {
rule: [],
alert: [IndexThreshold, GeoContainment, ElasticsearchQuery],
>>>>>>> Initial commit with changes needed for subfeature privilege
},
},
savedObject: {
Expand All @@ -63,21 +53,11 @@ export const BUILT_IN_ALERTS_FEATURE: KibanaFeatureConfig = {
insightsAndAlerting: ['triggersActions'],
},
alerting: {
<<<<<<< HEAD
rule: {
read: [IndexThreshold, GeoContainment, ElasticsearchQuery],
},
alert: {
read: [IndexThreshold, GeoContainment, ElasticsearchQuery],
=======
all: {
rule: [],
alert: [],
},
read: {
rule: [IndexThreshold, GeoContainment, ElasticsearchQuery],
alert: [IndexThreshold, GeoContainment, ElasticsearchQuery],
>>>>>>> Initial commit with changes needed for subfeature privilege
},
},
savedObject: {
Expand All @@ -100,18 +80,8 @@ export const BUILT_IN_ALERTS_FEATURE: KibanaFeatureConfig = {
name: 'Manage Alerts',
includeIn: 'all',
alerting: {
<<<<<<< HEAD
alert: {
all: [IndexThreshold, GeoContainment, ElasticsearchQuery],
=======
all: {
rule: [],
alert: [IndexThreshold, GeoContainment, ElasticsearchQuery],
},
read: {
rule: [],
alert: [],
>>>>>>> Initial commit with changes needed for subfeature privilege
},
},
savedObject: {
Expand Down

0 comments on commit dc0b04b

Please sign in to comment.