[v10.1.x] Alerting: Prevent showing "Permissions denied" alert when not accurate #74925
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Backport db2295b from #74887
What is this feature?
Users without org admin role were shown a "Permissions denied" alert in the creation/edition rule form even though they had access to create/edit the rule. The problem came after the
NotificationPreview
component made a request to/api/v1/ngalert/alertmanagers
in order to obtain external alertmanagers information which is an endpoint that requires that permission level.Turns out we don't actually need to call that endpoint to obtain that information.
Why do we need this feature?
To prevent showing the "Permissions denied" alert which is confusing and inaccurate.
Who is this feature for?
All users without org admin access.
Which issue(s) does this PR fix?:
Related to https://github.com/grafana/support-escalations/issues/7303
Before
![2023-09-13 19 01 57](https://private-user-images.githubusercontent.com/6271380/267799913-872c3657-d088-4f56-b01b-ef161042b6fd.gif?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjIxODMxNjcsIm5iZiI6MTcyMjE4Mjg2NywicGF0aCI6Ii82MjcxMzgwLzI2Nzc5OTkxMy04NzJjMzY1Ny1kMDg4LTRmNTYtYjAxYi1lZjE2MTA0MmI2ZmQuZ2lmP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDcyOCUyRnVzLWVhc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