Commit graph

511 commits

Author SHA1 Message Date
Joey Orlando
f8c8ceb2f6
only grant admins read/write access to public api keys (#952) 2022-12-06 13:02:53 +01:00
Joey Orlando
ffda80ae34
add permalinks.web attribute to alert group internal/public api response (#953) 2022-12-06 11:06:05 +01:00
Joey Orlando
53a7b02393
patch engine logging middleware (#950)
need to check that the user associated
with the request actually has an organization_id
attribute (there are certain cases, such as
if the request.user is a "django user"
where this attribute would not be present)
2022-12-05 17:01:49 +01:00
Michael Derynck
ad3cd8f5dd
Remove unused call for checking gcom api keys (#931) 2022-12-01 10:35:53 -07:00
Vadim Stepanov
1878b7e596
Mobile app FCM support (#923)
* Add ability to configure FCM_API_KEY and FCM_POST_URL

* Delete APNSDevice and GCMDevice instances when unlinking the mobile app backend

* Add a simple FCM relay endpoint

* GCM -> FCM

* comment
2022-12-01 15:17:01 +00:00
Joey Orlando
c08eeb72a3
add precommit rules for markdown/json files (#915)
* add markdownlint precommit steps + fix existing errors

* prettier json linting
2022-12-01 14:26:54 +01:00
Joey Orlando
9a7b8acd5a
centralize timezone validation + add serializer validation for on call shifts and schedules (#924)
* Centralize timezone validation into one spot + add serializer validation
for schedules and oncall shifts (both public and internal API)

* add engine-manage make command
2022-12-01 14:13:39 +01:00
Matias Bordese
3e8417e000 Update final schedule to consider priority level for overrides 2022-11-30 10:26:33 -03:00
Matias Bordese
1f49c6e44a Do not include event repetitions terminated before start (until rrule) 2022-11-30 08:56:19 -03:00
Joey Orlando
a9ac7e82df
update grafana API RBAC permissions endpoint 2022-11-30 09:03:10 +01:00
Vadim Stepanov
96868e1038
Add a temporary URL for the mobile app API 2022-11-29 16:46:51 +00:00
Matias Bordese
706aef10f2
Merge pull request #827 from grafana/matiasb/fix-filtering-events-from-deleted-schedule
Handle error when updating ical cache from deleted web schedule
2022-11-29 09:12:48 -03:00
Vadim Stepanov
0985094112
Add a temporary URL for the mobile app API 2022-11-29 11:46:19 +00:00
Joey Orlando
9e598385f4
Add RBAC Support (#777)
* Modify plugin.json to support RBAC role registration

* defines 26 new custom roles in plugin.json. The main roles are:

- Admin: read/write access to everything in OnCall
- Reader: read access to everything in OnCall
- OnCaller : read access to everything in OnCall + edit access to Alert Groups and Schedules
- <object-type> Editor: read/write access to everything related to <object-type>
- <object-type> Reader: read access for <object-type>
- User Settings Admin: read/write access to all user's settings, not just own settings. This is in comparison to User Settings Editor which can only read/write own settings

* update changelog and documentation (#686)

* implement RBAC for OnCall backend

This commit refactors backend authorization. It trys to use RBAC authorization if the org's grafana instance supports it, otherwise it falls back to basic role authorization.

* update RBAC backend tests

* add tests for RBAC changes
- run backend tests as matrix where RBAC is enabled/disabled. When RBAC is enabled, the permissions granted are read from the role grants in the frontend's plugin.json file (instead of relying what we specify in RBACPermission.Permissions)
- remove --reuse-db --nomigrations flags from engine/tox.ini
- minor autoformatting changes to docker-compose-developer.yml

* remove --ds=settings.ci-test from pytest CI command

DJANGO_SETTINGS_MODULE is already specified as an env var so this is just unecessary duplication

* update gitignore

* update github action job name for "test"

* RBAC frontend changes

* refactors the use of basic roles (ex. Viewer, Editor, Admin) use RBAC permissions (when supported), or falling back to basic roles when RBAC is not supported.

- updates the UserAction enum in grafana-plugin/src/state/userAction.ts. Previously this was hardcoded to a list of strings that were being returned by the OnCall API. Now the values here correspond to the permissions in plugin.json (plus a fallback role)

* changes per Gabriel's comments:
- get rid of group attribute in rbac roles
- remove displayName role attribute
- remove hidden role attribute
- add back role to includes section

* don't try to update user timezone if they don't have permission
2022-11-29 09:41:56 +01:00
Ildar Iskhakov
132cf1da7f
Add celery profiling (#913) 2022-11-29 16:20:41 +08:00
Ildar Iskhakov
3198612c65
Add flag to debug logs (#912) 2022-11-29 11:16:42 +08:00
Joey Orlando
eb97797d43
Merge pull request #880 from grafana/jorlando/mobile-app-qr-code
Fetch/Display Mobile App QR Code
2022-11-28 18:54:05 +01:00
Joey Orlando
5a4fc90fa4
fetch/render mobile app QR code in user settings modal 2022-11-28 18:47:59 +01:00
Michael Derynck
3582f9b08f
Improve Jinja Template feedback and error handling (#884)
* Improve feedback so template errors are given to user

* Add security error logging

* Add limits for templates, payloads, results

* Show popup error notification for webhook errors and template errors that don't have a result

* Update tests

* Split exceptions into warnings/errors to give more control when previewing, rendering, saving templates

* Limit title lengths

* Make TypeError a warning

* Adjust title length limit

* Remove length limiting on urlize since it is being done on template render

* Fix tests

* Add KeyError and ValueError to warnings

* No longer enforcing json result when saving webhook in case it is dependent on payload

* Add tests for expected exceptions coming from apply_jinja_template

* Update changelog

* Send raw post if template result is not JSON
2022-11-28 09:46:51 -07:00
Vadim Stepanov
dc6fcf5c05
Add internal API fields for the mobile app (#910)
* add permalinks list to internal API alertgroup view

* add user's name and full avatar URL to the user view

* make avatar_full_url a property

* fix tests

* fix user connection criteria
2022-11-28 15:52:31 +00:00
Matias Bordese
69f1218bab Handle error when updating ical cache from deleted web schedule 2022-11-28 10:24:52 -03:00
Vadim Stepanov
54d14d1025
Move MobileAppAuthToken view to mobile_app (#902) 2022-11-28 12:50:58 +00:00
Ildar Iskhakov
09bf0ee3d5
Add celery parameters to disable gossip, heartbeat, mingle (#907) 2022-11-28 14:18:27 +08:00
Innokentii Konstantinov
3b73522f5a
Fix saving source link template (#898)
* Add test for update integration templates

* Fix saving source link template
2022-11-24 16:26:12 +08:00
Vadim Stepanov
255964ceaf
Mobile app messaging backend (#874)
* move mobile notifications to a separate backend, remove critical notification

* remove outdated mobile app code

* MOBILE_APP_PUSH_NOTIFICATIONS_ENABLED -> FEATURE_MOBILE_APP_INTEGRATION_ENABLED

* create error log if no devices are set up

* move mobile auth related code to the mobile_app Django app

* move mobile auth related code to the mobile_app Django app

* move mobile auth related code to the mobile_app Django app

* fix typing

* add GCMDevice todos

* add user connection capabilities

* add user connect/disconnect to the messaging backend

* move APNS endpoint to mobile_app Django app

* restore critical notifications

* support hackathon app

* tweak migrations so mobile app auth tokens are preserved

* reuse notify_by IDs

* use mobile app template to render push notification

* add GCM/FCM (Android) support

* fix unlink user

* logger.error -> logger.info
2022-11-23 15:56:43 +00:00
Ildar Iskhakov
2052faa8d1
Fix web oncall calendars not loading (#891)
* Fix oncall schedules bug

* Update custom_on_call_shift.py
2022-11-23 20:19:52 +08:00
Michael Derynck
9e5efbd1b0
Merge pull request #830 from grafana/mderynck/organization-moved-headers
Organization moved headers
2022-11-21 16:40:50 +00:00
Yulya Artyukhina
381520ee13
Get rid of installation token + add a bunch of tests (#624)
* Get rid of installation token (for OSS installations)

This is done by being required to supply the grafana API URL as an
environment variable on the backend. Additionally, optionally an OnCall
API URL environment variable can be passed in to the frontend (this basically
allows completely skipping the need to configure anything).
- deduplicated a lot of the sync logic on the frontend + made
error message more useful and consistent
- Split PluginConfigPage component into several subcomponents
(making it easier to test each individual component)
- Moved RootWithLoader (from plugin/GrafanaPluginRootPage) into its own
subcomponent (making it easier to test)
- Added tests for pre-existing components that were touched:
  - PluginConfigPage component (and its new subcomponents)
  - state/plugin and state/rootBaseStore functions
  - apps.grafana_plugin django app

Helm changes:
- add GRAFANA_API_URL to oncall.env
- some yaml autoformatting changes
- remove reference to python manage.py issue_invite_for_the_frontend --override

Co-authored-by: Joey Orlando <joseph.t.orlando@gmail.com>
2022-11-21 16:26:00 +01:00
Ildar Iskhakov
d26f76fea0
Add new ci pipeline: helm chart end to end testing (#855) 2022-11-21 16:10:25 +01:00
Yulya Artyukhina
5b62060e41
Merge pull request #836 from grafana/fix-warning-popup-on-slack-slash-command
Fix warning pop-up on action in slack for disconnected user
2022-11-21 11:51:59 +01:00
Innokentii Konstantinov
0816813237 Handle 404 for get_alerting_config 2022-11-18 17:07:39 +08:00
Innokentii Konstantinov
f5fd3dd76b Fixes to clean_slack_channel_leftovers 2022-11-16 18:23:49 +08:00
Innokentii Konstantinov
f9a9c1d978
Cleanup on deletion/archivation of slack channel (#822)
* Cleanup on deletion/archivation of slack channel

* Bulk update of organizations, filter channel filters by org

* Optimize org bulk update
2022-11-16 17:56:05 +08:00
Innokentii Konstantinov
043700d228
Add additional validation for route's position field (#831)
* Add test for out of range route's order value

* Add additional validation for route's position when manual ordering is applied

* Remove print()

* Remove print
2022-11-16 17:55:53 +08:00
Julia
cc028783bb Change warning window text 2022-11-14 12:34:05 +01:00
Julia
7438464052 Add warning pop-up on action in slack if user is not connected to OnCall 2022-11-11 10:38:24 +01:00
Michael Derynck
758cf87255 -1 lookup 2022-11-10 15:09:18 -07:00
Michael Derynck
0dee4ebed8 Lint 2022-11-10 14:54:24 -07:00
Michael Derynck
28bf9c1228 Only copy headers we need when forwarding to a different backend 2022-11-10 14:52:53 -07:00
Michael Derynck
5143393e4b
Merge pull request #820 from grafana/mderynck/twilio-api-key-permission
Twilio add simple check if using API key instead of AUTH token
2022-11-10 08:23:32 -07:00
Joey Orlando
c7c3aa823c
local dev setup - fixes for some minor issues (#821)
* use docker compose instead of docker-compose

the former is the newer version, latter is being deprecated

* default to using latest version of grafana, not main

main is "bleeding-edge" grafana, use the more stable "latest" tag

* support requirements-enterprise.txt for both docker/non-docker setups

* backend-bootstrap make command should install enterprise
requirements if the file is there

* only mount the sqlite db file in docker-compose if using sqlite as the DB
2022-11-10 16:04:30 +01:00
Michael Derynck
d15a507763 Add simple check if using API key instead of AUTH token 2022-11-09 21:52:42 -07:00
Michael Derynck
04d2c4ac19
Merge pull request #808 from grafana/mderynck/region-reroute-fix-headers
Fix organization rerouting headers
2022-11-09 06:52:08 -07:00
Joey Orlando
fd4877408a
remove grafana_plugin_management django app (#812)
* remove grafana_plugin_management django app

it seems to be no longer used or referenced. In addition apps.api.serializers.organization.PluginOrganizationSerializer was only
referenced from within grafana_plugin_management and is thereby safe
to remove.
2022-11-09 13:53:59 +01:00
Joey Orlando
1177e44cc7
enterprise dev changes + few other small changes (#802)
* support enterprise development in docker

* fix flaky mysql healthcheck command

I was getting the mysql_to_create_grafana_db and oncall_db_migration prematurely starting up
this commit changes the healthcheck used here to
be the same as what is used in docker-compose-mysql-rabbitmq.yml

* upgrade docker-compose config files to 3.9

3.8 does not actually support the "long form" version of depends_on
see here for more info https://stackoverflow.com/a/54249757
https://docs.docker.com/compose/compose-file/compose-file-v3/#depends_on

* add make init command and update documentation

* cleanup gitignore files
2022-11-09 07:21:33 +01:00
Michael Derynck
6b86c4ceff Avoid key error 2022-11-08 15:46:38 -07:00
Michael Derynck
1002d94787 Add content type header, remove host 2022-11-08 15:40:21 -07:00
Michael Derynck
fc78dd98da
Merge pull request #707 from grafana/add-region-to-organization
Add region info to organizations
2022-11-08 10:30:53 -07:00
Michael Derynck
f01d754851 Merge dev 2022-11-08 10:14:35 -07:00
Matias Bordese
818747bd07
Merge pull request #798 from grafana/matiasb/start-date-selected-days
Ensure start date matches by_day selection
2022-11-08 12:43:46 -03:00