(ctx context.Context, rep repo.RepositoryWriter, authz auth.AuthorizationInfo, req *grpcapi.SendNotificationRequest)
| 505 | } |
| 506 | |
| 507 | func (s *Server) handleSendNotificationRequest(ctx context.Context, rep repo.RepositoryWriter, authz auth.AuthorizationInfo, req *grpcapi.SendNotificationRequest) *grpcapi.SessionResponse { |
| 508 | ctx, span := tracer.Start(ctx, "GRPCSession.SendNotification") |
| 509 | defer span.End() |
| 510 | |
| 511 | if authz.ContentAccessLevel() < auth.AccessLevelAppend { |
| 512 | return accessDeniedResponse() |
| 513 | } |
| 514 | |
| 515 | eventArgs, err := notifydata.UnmarshalEventArgs(req.GetEventArgs(), req.GetEventArgsType()) |
| 516 | if err != nil { |
| 517 | return errorResponse(err) |
| 518 | } |
| 519 | |
| 520 | if err := notification.SendInternal(ctx, rep, |
| 521 | req.GetTemplateName(), |
| 522 | eventArgs, |
| 523 | notification.Severity(req.GetSeverity()), |
| 524 | s.options.NotifyTemplateOptions); err != nil { |
| 525 | return errorResponse(err) |
| 526 | } |
| 527 | |
| 528 | return &grpcapi.SessionResponse{ |
| 529 | Response: &grpcapi.SessionResponse_SendNotification{ |
| 530 | SendNotification: &grpcapi.SendNotificationResponse{}, |
| 531 | }, |
| 532 | } |
| 533 | } |
| 534 | |
| 535 | func accessDeniedResponse() *grpcapi.SessionResponse { |
| 536 | return &grpcapi.SessionResponse{ |
no test coverage detected