From a712332e02b8346de626e267b3cba3f819fd3743 Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Mon, 27 Jan 2025 10:17:36 +0200 Subject: Allow SMS notifications. --- .../Web/Tango.MachineService/Controllers/PPCController.cs | 15 +++++++++++++++ .../Web/Tango.MachineService/Properties/AssemblyInfo.cs | 2 +- .../Web/Tango.MachineService/Tango.MachineService.csproj | 6 +----- 3 files changed, 17 insertions(+), 6 deletions(-) (limited to 'Software/Visual_Studio/Web') 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) diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Properties/AssemblyInfo.cs b/Software/Visual_Studio/Web/Tango.MachineService/Properties/AssemblyInfo.cs index 63cc1a253..7eb0e1e90 100644 --- a/Software/Visual_Studio/Web/Tango.MachineService/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/Web/Tango.MachineService/Properties/AssemblyInfo.cs @@ -24,4 +24,4 @@ using System.Runtime.InteropServices; // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("3.0.24.0")] +[assembly: AssemblyVersion("3.0.25.0")] diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Tango.MachineService.csproj b/Software/Visual_Studio/Web/Tango.MachineService/Tango.MachineService.csproj index e011cf63c..a027b9f53 100644 --- a/Software/Visual_Studio/Web/Tango.MachineService/Tango.MachineService.csproj +++ b/Software/Visual_Studio/Web/Tango.MachineService/Tango.MachineService.csproj @@ -454,10 +454,6 @@ {e4927038-348d-4295-aaf4-861c58cb3943} Tango.PMR - - {7ada4e86-cad7-4968-a210-3a8a9e5153ab} - Tango.Synchronization - {74e700b0-1156-4126-be40-ee450d3c3026} Tango.Transport @@ -510,7 +506,7 @@ False - + -- cgit v1.3.1