Add mobile app auth for notification_policies endpoint (#1725)

Add mobile app authentication for `notification_policies` endpoint
This commit is contained in:
Yulya Artyukhina 2023-04-11 18:36:46 +02:00 committed by GitHub
parent 1d096b2fb4
commit f61af74411
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 3 deletions

View file

@ -11,6 +11,8 @@
Developer-friendly incident response with brilliant Slack integration.
<!-- markdownlint-disable MD013 MD033 -->
<table>
<tbody>
<tr>
@ -20,6 +22,8 @@ Developer-friendly incident response with brilliant Slack integration.
</tbody>
</table>
<!-- markdownlint-enable MD013 MD033 -->
- Collect and analyze alerts from multiple monitoring systems
- On-call rotations based on schedules
- Automatic escalations

View file

@ -40,8 +40,8 @@ environment variable.
out/disable which components are run in Docker.
3. Open Grafana in a browser [here](http://localhost:3000/plugins/grafana-oncall-app) (login: `oncall`, password: `oncall`).
4. You should now see the OnCall plugin configuration page. You may safely ignore the warning about the invalid
plugin signature. Set "OnCall backend URL" as "http://host.docker.internal:8080". When opening the main plugin page, you may also ignore warnings about version mismatch and lack of
communication channels.
plugin signature. Set "OnCall backend URL" as "http://host.docker.internal:8080". When opening the main plugin page,
you may also ignore warnings about version mismatch and lack of communication channels.
5. Enjoy! Check our [OSS docs](https://grafana.com/docs/grafana-cloud/oncall/open-source/) if you want to set up Slack,
Telegram, Twilio or SMS/calls through Grafana Cloud.
6. (Optional) Install `pre-commit` hooks by running `make install-precommit-hook`

View file

@ -15,6 +15,7 @@ from apps.auth_token.auth import PluginAuthentication
from apps.base.messaging import get_messaging_backend_from_id
from apps.base.models import UserNotificationPolicy
from apps.base.models.user_notification_policy import BUILT_IN_BACKENDS, NotificationChannelAPIOptions
from apps.mobile_app.auth import MobileAppAuthTokenAuthentication
from apps.user_management.models import User
from common.api_helpers.exceptions import BadRequest
from common.api_helpers.mixins import UpdateSerializerMixin
@ -23,7 +24,10 @@ from common.insight_log import EntityEvent, write_resource_insight_log
class UserNotificationPolicyView(UpdateSerializerMixin, ModelViewSet):
authentication_classes = (PluginAuthentication,)
authentication_classes = (
MobileAppAuthTokenAuthentication,
PluginAuthentication,
)
permission_classes = (IsAuthenticated, RBACPermission)
rbac_permissions = {