diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2025-01-27 10:17:36 +0200 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2025-01-27 10:17:36 +0200 |
| commit | a712332e02b8346de626e267b3cba3f819fd3743 (patch) | |
| tree | 4d613806740b6fce84054b51fc8690bebea972ec /Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs | |
| parent | e204e6ac5d04114778b5b836a3e3707e819ad349 (diff) | |
| download | Tango-a712332e02b8346de626e267b3cba3f819fd3743.tar.gz Tango-a712332e02b8346de626e267b3cba3f819fd3743.zip | |
Allow SMS notifications.
Diffstat (limited to 'Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs')
| -rw-r--r-- | Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs index 57bdc2fbf..d1a56138e 100644 --- a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs +++ b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs @@ -842,6 +842,21 @@ namespace Tango.MachineService.Controllers { var response = new SendSMSResponse(); + using (ObservablesContext db = ObservablesWebContext.CreateContext()) + { + var machine = db.Machines.SingleOrDefault(x => x.Guid == RequestToken.Object.MachineGuid); + + if (machine == null) + { + throw new AuthenticationException("The specified machine could not be found."); + } + + if (!machine.AllowSmsNotifications) + { + throw new Exception("This machine is not allowed to send text messages. Please contact your administrator."); + } + } + if (MachineServiceConfig.TWILIO_ENABLE_SMS) { if (MachineServiceConfig.TWILIO_ENABLE_ALPHA_SENDER) |
