oncall-engine/engine/apps/user_management/migrations
Joey Orlando 59f727d4f5
Google OAuth2 flow + fetch Google Calendar OOO events (#4067)
# What this PR does

The following is deployed under a feature flag.

**How it works**
1. The user clicks on the "Connect using your Google account" button in
the user profile settings modal
2. The UI makes a call to `GET /api/internal/v1/login/google-oauth2`.
The backend has now been configured to add
`apps.social_auth.backends.GoogleOAuth2` as a "`social_auth` backend".
3. The backend will respond w/ a URL which points to the Google OAuth2
consent screen. The frontend then proceeds by sending the user to this
page. This URL includes the following query parameters (amongst others):
- `redirect_uri` - this will send the user back to
`/api/internal/v1/complete/google-oauth2` (ie. make another API call to
the OnCall backend to finalize the Google OAuth2 flow)
- `state` - this represents an
`apps.auth_token.models.GoogleOAuth2Token` token. This allows us to
identify the OnCall user once they've linked their Google account.
4. Once redirected back to `/api/internal/v1/complete/google-oauth2`,
this will complete the OAuth2 flow. At this point, the backend has
access to several pieces of information about the Google user, including
their `access_token` and `refresh_token`. We persist these (encrypted)
for future use to fetch the user's out-of-office calendar events
5. The response from the API call in 4 above ☝️ is HTTP 302 (redirect)
to `/a/grafana-oncall-app/users/me` (ie. open the user profile settings
modal). At this point the user will see that their account has been
connected and they can further configure the settings

![image](https://github.com/grafana/oncall/assets/9406895/c7673055-8485-4f9a-98df-b4f7347229ce)


## Which issue(s) this PR closes

Closes https://github.com/grafana/oncall-private/issues/2584

## Checklist

- [x] Unit, integration, and e2e (if applicable) tests updated
- [x] Documentation added (or `pr:no public docs` PR label added if not
required) - will be done in
https://github.com/grafana/oncall-private/issues/2591
- [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. - will be done in
https://github.com/grafana/oncall-private/issues/2591

---------

Co-authored-by: Dominik <dominik.broj@grafana.com>
Co-authored-by: Maxim Mordasov <maxim.mordasov@grafana.com>
2024-04-02 14:59:03 -04:00
..
0001_squashed_initial.py Add database migrations linter (#1020) 2023-02-06 16:01:37 +08:00
0002_auto_20220705_1214.py Add database migrations linter (#1020) 2023-02-06 16:01:37 +08:00
0003_user_hide_phone_number.py Add database migrations linter (#1020) 2023-02-06 16:01:37 +08:00
0004_auto_20221025_0316.py Add database migrations linter (#1020) 2023-02-06 16:01:37 +08:00
0005_rbac_permissions.py Add database migrations linter (#1020) 2023-02-06 16:01:37 +08:00
0006_organization_uuid.py Add database migrations linter (#1020) 2023-02-06 16:01:37 +08:00
0007_organization_deleted_at.py Add database migrations linter (#1020) 2023-02-06 16:01:37 +08:00
0008_organization_is_grafana_incident_enabled.py Add database migrations linter (#1020) 2023-02-06 16:01:37 +08:00
0009_organization_cluster_slug.py Store org cluster_slug (#1480) 2023-03-09 04:10:19 +00:00
0010_team_is_sharing_resources_to_all.py Teams redesign (#1528) 2023-03-22 00:57:20 +08:00
0011_auto_20230411_1358.py add several new database columns + emit two new Django signals (#1522) 2023-04-14 09:15:57 +02:00
0012_auto_20230711_1554.py remove deprecated backend code (#2502) 2023-07-12 02:07:45 -04:00
0013_alter_organization_acknowledge_remind_timeout.py mark manual_severity and resolution_note_ts columns on alertgroup table as deprecated (#2564) 2023-07-18 09:41:58 +00:00
0014_auto_20230728_0802.py Shift Swap Requests in Slack + improve typing for Slack django app (#2653) 2023-07-28 15:11:38 +00:00
0015_auto_20230926_2203.py Add db indexes to user table (#3067) 2023-09-27 12:35:52 +00:00
0016_alter_user_role.py Handle None role when syncing users from Grafana (#3147) 2023-10-19 17:39:08 +00:00
0017_alter_organization_maintenance_author.py add missing db migrations + add additional backend db migration check to CI (#3234) 2023-10-31 16:00:55 -04:00
0018_auto_20231115_1206.py Alert group column/label selector (#3281) 2023-11-29 12:11:31 +00:00
0019_organization_grafana_incident_backend_url.py Mobile app proxy gateway (#3449) 2023-12-05 19:58:05 +00:00
0020_organization_is_grafana_labels_enabled.py Enable labels feature only if labels plugin is enabled (#3769) 2024-01-30 07:29:16 +00:00
0021_user_google_calendar_settings.py Google OAuth2 flow + fetch Google Calendar OOO events (#4067) 2024-04-02 14:59:03 -04:00
__init__.py World, meet OnCall! 2022-06-03 08:09:47 -06:00