oncall-engine/engine/apps/api/views
Joey Orlando eb777f5415
address Google OAuth2 issues where user didn't grant us the https://www.googleapis.com/auth/calendar.events.readonly scope (#4802)
# What this PR does

Follow up PR to https://github.com/grafana/oncall/pull/4792

Basically if when communicating with Google Calendar's API we encounter
an HTTP 403, or the Google client throws a
`google.auth.exceptions.RefreshError` this means one of three things:
1. the refresh token we have persisted for the user is missing the
`https://www.googleapis.com/auth/calendar.events.readonly` scope (HTTP
403)
2. the Google user has been deleted
(`google.auth.exceptions.RefreshError`)
3. the refresh token has expired (`google.auth.exceptions.RefreshError`)

To prevent scenario 1 above from happening in the future we now will
check that the token has been granted the required scopes. If the user
doesn't grant us all the necessary scopes, we will show them an error
message in the UI:
https://www.loom.com/share/0055ef03192b4154b894c2221cecbd5f

For tokens that were granted prior to this PR and which are missing the
required scope, we will show the user a dismissible warning banner in
the UI letting them know that they will need to reconnect their account
and grant us the missing permissions (see [this second demo
video](https://www.loom.com/share/bf2ee8b840864a64893165370a892bcd)
showing this).

## Checklist

- [x] Unit, integration, and e2e (if applicable) tests updated
- [x] Documentation added (or `pr:no public docs` PR label added if not
required)
- [x] Added the relevant release notes label (see labels prefixed w/
`release:`). These labels dictate how your PR will
    show up in the autogenerated release notes.

---------

Co-authored-by: Dominik <dominik.broj@grafana.com>
2024-08-14 18:02:34 -04:00
..
__init__.py World, meet OnCall! 2022-06-03 08:09:47 -06:00
alert_group.py Force index only on list & stats (#4734) 2024-07-25 13:25:01 +00:00
alert_group_table_settings.py Google OAuth2 flow + fetch Google Calendar OOO events (#4067) 2024-04-02 14:59:03 -04:00
alert_receive_channel.py Address deprecation warnings in tests (#4681) 2024-08-13 20:51:18 +00:00
alert_receive_channel_template.py Support alert routing based on labels (#3778) 2024-01-30 13:07:19 -05:00
alerts.py Add alert detail view (#385) 2022-08-19 14:03:07 +05:00
auth.py Prepare OnCall for Unified Slack App (#4232) 2024-06-03 09:07:10 +00:00
channel_filter.py Support alert routing based on labels (#3778) 2024-01-30 13:07:19 -05:00
escalation_chain.py Make it clear alert groups can't be searched (#4713) 2024-07-22 10:30:28 +00:00
escalation_policy.py Allow custom wait delay (#4446) 2024-06-03 13:06:47 +00:00
features.py adjust to unified slack (#4776) 2024-08-08 14:16:19 +00:00
integration_heartbeat.py Add reset button to disable integration heartbeat (#3959) 2024-03-04 19:20:00 +00:00
labels.py Support prescribed labels (#3848) 2024-02-20 14:42:51 +08:00
live_setting.py Support alert routing based on labels (#3778) 2024-01-30 13:07:19 -05:00
on_call_shifts.py Support alert routing based on labels (#3778) 2024-01-30 13:07:19 -05:00
organization.py Add endpoint for organization config checks (#4204) 2024-04-11 14:51:56 +00:00
paging.py Let mobile use paging endpoint (#3619) 2024-01-08 12:18:39 +00:00
preview_template_options.py Fix of templates api behaviour for public and private api (#1408) 2023-03-01 16:32:15 +08:00
public_api_tokens.py Add RBAC Support (#777) 2022-11-29 09:41:56 +01:00
resolution_note.py Support alert routing based on labels (#3778) 2024-01-30 13:07:19 -05:00
route_regex_debugger.py remove references to AlertGroup.is_archived and AlertGroup.unarchived_objects (#2524) 2023-07-18 11:48:34 +00:00
schedule.py Make it clear alert groups can't be searched (#4713) 2024-07-22 10:30:28 +00:00
shift_swap.py Address deprecation warnings in tests (#4681) 2024-08-13 20:51:18 +00:00
slack_channel.py Support alert routing based on labels (#3778) 2024-01-30 13:07:19 -05:00
slack_team_settings.py Handle None role when syncing users from Grafana (#3147) 2023-10-19 17:39:08 +00:00
team.py Support alert routing based on labels (#3778) 2024-01-30 13:07:19 -05:00
telegram_channels.py Support alert routing based on labels (#3778) 2024-01-30 13:07:19 -05:00
user.py address Google OAuth2 issues where user didn't grant us the https://www.googleapis.com/auth/calendar.events.readonly scope (#4802) 2024-08-14 18:02:34 -04:00
user_group.py Add endpoint to get a single user group (#4395) 2024-05-24 20:26:28 +00:00
user_notification_policy.py don't force create default user notification policies (#4608) 2024-07-05 15:08:17 -04:00
webhooks.py Make it clear alert groups can't be searched (#4713) 2024-07-22 10:30:28 +00:00