If a user does not have Infrastructure privilege or elasticsearch privilege for related indices they cannot access Infrastructure data, resulting in an error.
Steps to reproduce
Create a user with elasticsearch index privileges:
indices: metrics-apm,apm,traces-apm,logs-apm
privileges: 'read', 'view_index_metadata'
and kibana privileges: APM and User Experience
Navigate to APM Service Overview
Click on the Infrastructure tab (I don't think we have a synthtrace scenario to make this tab work. I forced the code to run a path that would try to fetch infra data)
Possible solution
We could show the Infrastructure tab only if application.uiCapabilities.infrastructure.show is true or display a message saying that the user doesn't have permission if the same condition is not met, eg:
Because roles could also be configured such that users could have permission to Infrastructure but not to read Infrastructure indices, we also need to check on the server side, before running the query, whether the current user has permission to read from Infrastructure indices (see an example here)
Summary
If a user does not have Infrastructure privilege or elasticsearch privilege for related indices they cannot access Infrastructure data, resulting in an error.
Steps to reproduce
Possible solution
We could show the Infrastructure tab only if
application.uiCapabilities.infrastructure.show
istrue
or display a message saying that the user doesn't have permission if the same condition is not met, eg:Because roles could also be configured such that users could have permission to Infrastructure but not to read Infrastructure indices, we also need to check on the server side, before running the query, whether the current user has permission to read from Infrastructure indices (see an example here)