diff options
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) |
