3
0
mirror of https://github.com/grafana/grafana.git synced 2025-02-25 18:55:37 -06:00
Commit Graph

129 Commits

Author SHA1 Message Date
Kristin Laemmert
f6e3252c00
chore: move notifications models into notifications service () 2023-01-17 14:47:31 -05:00
Michael Mandrus
9dc081e629
SMTP: Update SMTP TemplatesPatterns to do an 'or' filter instead of 'and' ()
update template path parsing to use 'or' logic instead of 'and'
2023-01-13 10:24:22 -05:00
idafurjes
d1c9b308bc
Chore: Move tempuser model to tempuser package ()
* Move tempuser model to tempuser package

* Add xorm tags for ID
2023-01-06 09:02:05 +01:00
idafurjes
325f7a789e
Chore: Delete duplicate models for user ()
* Delete duplicate models for user

* Use new models in some tests

* Add auth model conversion back
2023-01-03 15:25:35 +01:00
Gilles De Mey
ea27eca147
Email: Use MJML email templates ()
Co-authored-by: Santiago <santiagohernandez.1997@gmail.com>
2022-11-17 21:41:46 +01:00
Andreas Gerstmayr
8b22481aec
User management: Use HMAC-SHA256 to generate time limit codes (password reset tokens) ()
Signed-off-by: bergquist <carl.bergquist@gmail.com>
Co-authored-by: bergquist <carl.bergquist@gmail.com>
2022-08-18 16:01:09 +02:00
Jo
062d255124
Handle ioutil deprecations ()
* replace ioutil.ReadFile -> os.ReadFile

* replace ioutil.ReadAll -> io.ReadAll

* replace ioutil.TempFile -> os.CreateTemp

* replace ioutil.NopCloser -> io.NopCloser

* replace ioutil.WriteFile -> os.WriteFile

* replace ioutil.TempDir -> os.MkdirTemp

* replace ioutil.Discard -> io.Discard
2022-08-10 15:37:51 +02:00
Matthew Jacobson
efa0d90093
Alerting: Fix Teams notifier not failing on 200 response with error ()
Team's webhook API does not always use the status code to communicate errors.
There are cases where it returns 200 and an error message in the body.
For example, 429 - Too Many Requests or when the message is too large.
Instead, what we should be looking for is a response body = "1".

https://docs.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/connectors-using?tabs=cURL#send-messages-using-curl-and-powershell
2022-07-14 13:15:18 -04:00
idafurjes
6c43eb0b4d
Split Create User ()
* Split Create User

* Use new create user and User from package user

* Add service to wire

* Making create user work

* Replace user from user pkg

* One more

* Move Insert to orguser Service/Store

* Remove unnecessary conversion

* Cleaunp

* Fix Get User and add fakes

* Fixing get org id for user logic, adding fakes and other adjustments

* Add some tests for ourguser service and store

* Fix insert org logic

* Add comment about deprecation

* Fix after merge with main

* Move orguser service/store to org service/store

* Remove orguser from wire

* Unimplement new Create user and use User from pkg user

* Fix wire generation

* Fix lint

* Fix lint - use only User and CrateUserCommand from user pkg

* Remove User and CreateUserCommand from models

* Fix lint 2
2022-06-28 14:32:25 +02:00
Serge Zaitsev
ae9491c3a7
Chore: Make test tracer noop and return no errors () 2022-06-15 12:40:41 +02:00
Serge Zaitsev
0b55c41d05
Chore: Remove global bus variable ()
* Chore: Remove global bus variable

* fix bus in tests
2022-06-14 16:07:41 +02:00
Kat Yang
31630edf0c
Chore: Remove Wrapf ()
* Chore: Remove Wrapf

* Remove all Wrapf refs

* Remove last Wrapf ref

* Fix lint errors

* Remove Wrap and Wrapf definitions

* Remove unnecessary colon
2022-06-06 22:30:31 +02:00
Kristin Laemmert
bda3dd24e4
chore: remove golang.org/x/net/context in favor of stdlib ()
This PR removes golang.org context imports under pkg/services/* and replaces them with the stdlib context.

Closes 
2022-04-11 08:46:21 -04:00
Serge Zaitsev
18e93c7077
Chore: Remove bus ()
* Chore: Remove bus

* remove unused const
2022-04-08 16:15:06 +02:00
Santiago
4b1af6fb06
Fix empty contact point URLs when template parsing fails ()
* fix empty URLs

* leave URL templating, use fallback

* better fix, new tests cases

* fix linting errors
2022-03-31 15:57:48 -03:00
Serge Zaitsev
4ce7978cd8
Chore: Remove bus from notification service ()
* Chore: Remove bus from notification service

* fix signature

* fix function signature in tests
2022-03-22 09:04:30 +01:00
Alexander Weaver
703d7deeda
Alerting: Add integration tests for dual-stage email templating ()
* Resolve merge conflicts

* Remove cruft from local exploration

* Move integration tests to intercept using new abstraction layer instead of channel

* Fix linter error after rebase
2022-03-01 10:49:49 -06:00
Kat Yang
f582e6c86a
Chore: Remove bus from password ()
* Chore: Remove bus from password

* Refactor: Remove bus from password.go and adjust tests

* remove sqlstore dependency from notifications

* Chore: Remove bus from password

* Refactor: Remove bus from password.go and adjust tests

* remove sqlstore dependency (again)

* remove fmt printf

* fix dependencies in http server

* fix renamed method in tests

Co-authored-by: Serge Zaitsev <serge.zaitsev@grafana.com>
2022-02-03 10:33:46 +01:00
idafurjes
12420260ef
Remove bus from org invite api ()
* Remove bus from org invite api

* Fix lint

* Remove comment
2022-01-31 17:24:52 +01:00
Serge Zaitsev
84a5910e56
Chore: Remove bus from ngalert ()
* pass notification service down to the notifiers

* add ns to all notifiers

* remove bus from ngalert notifiers

* use smaller interfaces for notificationservice

* attempt to fix the tests

* remove unused struct field

* simplify notification service mock

* trying to resolve issues in the tests

* make linter happy

* make linter even happier

* linter, you are annoying
2022-01-26 16:42:40 +01:00
Alexander Weaver
c68eefd398
Alerting: Add abstraction layer and testing hooks in front of SMTP dialer ()
* Add abstraction layer above SMTP communication

* Fix issues with attachments and sync command

* Tests for bad SMTP behavior

* Separate tests between async and sync entry points. Test difference between them

* Return interface so Wire can properly map types

* Address feedback from George
2022-01-13 15:19:15 -06:00
idafurjes
65e60759fb
Rename AddEventListenerCtx to AddEventListener and PublishCtx to Publish () 2022-01-04 09:36:01 +01:00
idafurjes
8e6d6af744
Rename DispatchCtx to Dispatch () 2021-12-28 17:36:22 +01:00
idafurjes
7936c4c522
Rename AddHandlerCtx to AddHandler () 2021-12-28 16:08:07 +01:00
idafurjes
9880a843ed
Add context to notifications () 2021-12-01 17:56:08 +01:00
idafurjes
a65e0be110
Replace AddEventListener with AddEventListenerCtx and Publish with PublishCtx () 2021-11-29 14:23:24 +01:00
Katarina Yang
c4306f9b3e
Chore: add context to login ()
* Chore: add context to login attempt file and tests

* Chore: add context

* Chore: add context to login and login tests

* Chore: continue adding context to login

* Chore: add context to login query
2021-11-08 15:53:51 +01:00
Serge Zaitsev
125e284da2
Chore: Refactor GoConvey in notification service package ()
* refactor goconvey in notification service package

* avoid return after t.skip
2021-10-26 18:08:04 +02:00
Arve Knudsen
78596a6756
Migrate to Wire for dependency injection ()
Fixes 

Co-authored-by: dsotirakis <sotirakis.dim@gmail.com>
Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
Co-authored-by: Ida Furjesova <ida.furjesova@grafana.com>
Co-authored-by: Jack Westbrook <jack.westbrook@gmail.com>
Co-authored-by: Will Browne <wbrowne@users.noreply.github.com>
Co-authored-by: Leon Sorokin <leeoniya@gmail.com>
Co-authored-by: Andrej Ocenas <mr.ocenas@gmail.com>
Co-authored-by: spinillos <selenepinillos@gmail.com>
Co-authored-by: Karl Persson <kalle.persson@grafana.com>
Co-authored-by: Leonard Gram <leo@xlson.com>
2021-08-25 15:11:22 +02:00
Djairho Geuens
4cadbba686
Email: Allow configuration of content types for email notifications ()
* Alerting: Allow configuration of content types for email notifications

* Fix lint error

* Improves email templates

* Improve configuration documentation

Co-authored-by: Diana Payton <52059945+oddlittlebird@users.noreply.github.com>

* Improve code comments

Co-authored-by: Diana Payton <52059945+oddlittlebird@users.noreply.github.com>

* Improve configuration documentation

Co-authored-by: Diana Payton <52059945+oddlittlebird@users.noreply.github.com>

* Improve email template

* Remove unnecessary predeclaration

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>

* Adds handling for unrecognized content type

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>

* Move utility function outside of util package

* Fixes syntax

* Remove unused package

* Fix lint error

* improve email templates

* Fix test

* Alerting: Allow configuration of content types for email notifications

* Fix lint error

* Improves email templates

* Improve configuration documentation

Co-authored-by: Diana Payton <52059945+oddlittlebird@users.noreply.github.com>

* Improve code comments

Co-authored-by: Diana Payton <52059945+oddlittlebird@users.noreply.github.com>

* Improve configuration documentation

Co-authored-by: Diana Payton <52059945+oddlittlebird@users.noreply.github.com>

* Improve email template

* Remove unnecessary predeclaration

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>

* Adds handling for unrecognized content type

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>

* Move utility function outside of util package

* Fixes syntax

* Remove unused package

* Fix lint error

* improve email templates

* Fix test

* Fix comment style

Co-authored-by: Ganesh Vernekar <15064823+codesome@users.noreply.github.com>

* Fix template formatting

* Add test and improve error handling

* Fix test

* Fix formatting

* Fix formatting

* Improve documentation and regenerates txt template

* Update docs/sources/administration/configuration.md

Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>

Co-authored-by: Djairho Geuens <djairho.geuens@ae.be>
Co-authored-by: Diana Payton <52059945+oddlittlebird@users.noreply.github.com>
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
Co-authored-by: Ganesh Vernekar <15064823+codesome@users.noreply.github.com>
Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>
2021-07-19 13:31:51 +03:00
Carl Bergquist
06dc2b24bf
dont consider invalid email address a failed email ()
Signed-off-by: bergquist <carl.bergquist@gmail.com>
2021-05-04 12:07:50 +02:00
Carl Bergquist
58a325a4e4
Instrumentation: Add success rate metrics for email notifications ()
Signed-off-by: bergquist <carl.bergquist@gmail.com>
2021-04-27 11:15:07 +02:00
Ganesh Vernekar
0b788b5ce8
AlertingNG: Notification channel for emails ()
* Email notification channel in ngalert

Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>

* Use existing templating system

Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>

* Update template and add unit tests

Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>
2021-03-18 14:55:11 +00:00
Arve Knudsen
47f13abf7a
Backend: Migrate to using non-global configuration ()
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2021-03-10 12:41:29 +01:00
Arve Knudsen
c2cad26ca9
Chore: Disable default golangci-lint filter ()
* Disable default golangci-lint filter

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>

* Chore: Fix linter warnings

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-12-15 09:32:06 +01:00
Arve Knudsen
3fdf4be529
Chore: Enable more go-ruleguard rules ()
* Chore: Enable more go-ruleguard rules

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-12-14 15:51:59 +01:00
Arve Knudsen
ac09baae7d
Chore: Use Header.Set method instead of Header.Add ()
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-12-14 15:13:01 +01:00
taciomcosta
10ff4eecef
Backend: fix IPv6 address parsing erroneous ()
* Backend: Fix parsing of client IP address

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-11-25 07:55:22 +01:00
Will Browne
d796c61946
Security: Fixes minor security issue with alert notification webhooks that allowed GET & DELETE requests 2020-11-24 10:42:54 +01:00
Arve Knudsen
7897c6b7d5
Chore: Fix staticcheck issues ()
* Chore: Fix issues reported by staticcheck

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>

* Undo changes

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-11-05 11:57:20 +01:00
Arve Knudsen
41d432b5ae
Chore: Enable whitespace linter ()
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-07-06 20:17:28 +02:00
Arve Knudsen
d1e6214a4a
Chore: Enable scopelint Go linter ()
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-06-29 17:04:38 +02:00
Mitsuhiro Tanda
9f82cd4713
Slack: Support use of chat.postMessage ()
* set bearer token if token is provided
* update slack notification document

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-06-26 20:47:06 +02:00
Agnès Toulet
b5b019dfcf
Notifications: fix reply-to option for emails () 2020-06-22 18:56:49 +02:00
Arve Knudsen
07582a8e85
Chore: Fix various spelling errors in back-end code ()
* Chore: Fix various spelling errors in back-end code
Co-authored-by: Sofia Papagiannaki <papagian@users.noreply.github.com>
Co-authored-by: Josh Soref <jsoref@users.noreply.github.com>>
2020-06-01 17:11:25 +02:00
thameezb
16297da298
Email Notifications: Add StartTLSPolicy config flag () 2020-05-13 16:33:40 +02:00
Mario Trangoni
5116420e9a
Fix misspell issues ()
* Fix misspell issues

See,
$ golangci-lint run --timeout 10m --disable-all -E misspell ./...

Signed-off-by: Mario Trangoni <mjtrangoni@gmail.com>

* Fix codespell issues

See,
$ codespell -S './.git*' -L 'uint,thru,pres,unknwon,serie,referer,uptodate,durationm'

Signed-off-by: Mario Trangoni <mjtrangoni@gmail.com>

* ci please?

* non-empty commit - ci?

* Trigger build

Co-authored-by: bergquist <carl.bergquist@gmail.com>
Co-authored-by: Kyle Brandt <kyle@grafana.com>
2020-04-29 21:37:21 +02:00
Carl Bergquist
f9962eabff
chore: avoid aliasing imports in services () 2020-02-29 13:35:15 +01:00
Marcus Efraimsson
0f0772b629
Alerting: Adds support for sending a single email to all recipients in notification channel ()
When an alert is sent by e-mail, the process sends an e-mail to 
each recipient separately. This PR is a single delivery to all recipients.
For companies that use e-mail extensively, this is necessary in order 
not to overload the sending queue.

Replaces 
Fixes 

Co-authored-by: Henrique Oliveira <holiiveira@users.noreply.github.com>
2020-01-10 16:06:33 +01:00
Arve Knudsen
2a78d2a61c
pkg/services: Check errors ()
* pkg/services: Check errors
* pkg/services: Don't treat context.Canceled|context.DeadlineExceeded as error
2019-10-22 14:08:18 +02:00