Skip to content

Commit

Permalink
[Inventory] Update deprecated access tags to the new security configu…
Browse files Browse the repository at this point in the history
…ration in routes (elastic#204010)

## Summary

Closes elastic#203794

This PR replaces the deprecated `access` tags with the new `security`
configuration.

All instances of `options: {tags: ['access:inventory']}` are now updated
to `security: {authz: {requiredPrivileges: ['inventory']}}`.
  • Loading branch information
iblancof authored Dec 13, 2024
1 parent 0ca6502 commit 3f64ce1
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ import { getLatestEntitiesAlerts } from './get_latest_entities_alerts';

export const getEntityTypesRoute = createInventoryServerRoute({
endpoint: 'GET /internal/inventory/entities/types',
options: {
tags: ['access:inventory'],
security: {
authz: {
requiredPrivileges: ['inventory'],
},
},
handler: async ({ context, logger }) => {
const coreContext = await context.core;
Expand Down Expand Up @@ -52,8 +54,10 @@ export const listLatestEntitiesRoute = createInventoryServerRoute({
}),
]),
}),
options: {
tags: ['access:inventory'],
security: {
authz: {
requiredPrivileges: ['inventory'],
},
},
handler: async ({
params,
Expand Down Expand Up @@ -119,8 +123,10 @@ export const groupEntitiesByRoute = createInventoryServerRoute({
}),
}),
]),
options: {
tags: ['access:inventory'],
security: {
authz: {
requiredPrivileges: ['inventory'],
},
},
handler: async ({ params, context, logger }) => {
const coreContext = await context.core;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ import { getHasData } from './get_has_data';

export const hasDataRoute = createInventoryServerRoute({
endpoint: 'GET /internal/inventory/has_data',
options: {
tags: ['access:inventory'],
security: {
authz: {
requiredPrivileges: ['inventory'],
},
},
handler: async ({ context, logger }) => {
const coreContext = await context.core;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,4 @@ export interface InventoryRouteCreateOptions {
timeout?: {
idleSocket?: number;
};
tags: Array<'access:inventory'>;
}

0 comments on commit 3f64ce1

Please sign in to comment.