From 0a78b99fd829a87604b39c97c6a256ce0fbde22a Mon Sep 17 00:00:00 2001 From: Joey Orlando Date: Tue, 6 Jun 2023 10:46:17 +0200 Subject: [PATCH] allow mobile app to consume internal schedules api endpoints (#2109) # What this PR does allow mobile app to consume internal schedules api endpoints ## Checklist - [ ] Unit, integration, and e2e (if applicable) tests updated - [ ] Documentation added (or `pr:no public docs` PR label added if not required) - [x] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not required) --- CHANGELOG.md | 4 ++++ engine/apps/api/views/schedule.py | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 56583ebf..f650206d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased +### Added + +- Allow mobile app to consume "internal" schedules API endpoints by @joeyorlando ([#2109](https://github.com/grafana/oncall/pull/2109)) + ## v1.2.39 (2023-06-06) ### Changed diff --git a/engine/apps/api/views/schedule.py b/engine/apps/api/views/schedule.py index afdd025b..c87e5b5d 100644 --- a/engine/apps/api/views/schedule.py +++ b/engine/apps/api/views/schedule.py @@ -27,6 +27,7 @@ from apps.api.serializers.user import ScheduleUserSerializer from apps.auth_token.auth import PluginAuthentication from apps.auth_token.constants import SCHEDULE_EXPORT_TOKEN_NAME from apps.auth_token.models import ScheduleExportAuthToken +from apps.mobile_app.auth import MobileAppAuthTokenAuthentication from apps.schedules.models import OnCallSchedule from apps.slack.models import SlackChannel from apps.slack.tasks import update_slack_user_group_for_schedules @@ -72,7 +73,10 @@ class ScheduleView( ModelViewSet, mixins.ListModelMixin, ): - authentication_classes = (PluginAuthentication,) + authentication_classes = ( + MobileAppAuthTokenAuthentication, + PluginAuthentication, + ) permission_classes = (IsAuthenticated, RBACPermission) rbac_permissions = { "metadata": [RBACPermission.Permissions.SCHEDULES_READ],