From 956f9ea033553136ebf199fff30f288dc26fbeb0 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Wed, 21 Feb 2018 20:21:57 +0200 Subject: Working on machine studio update center.. --- .../Tango.MachineStudio.UpdateService.csproj | 142 +++++++++++++++++++++ 1 file changed, 142 insertions(+) create mode 100644 Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService/Tango.MachineStudio.UpdateService.csproj (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService/Tango.MachineStudio.UpdateService.csproj') diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService/Tango.MachineStudio.UpdateService.csproj b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService/Tango.MachineStudio.UpdateService.csproj new file mode 100644 index 000000000..c9400b2d1 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService/Tango.MachineStudio.UpdateService.csproj @@ -0,0 +1,142 @@ + + + + Debug + AnyCPU + + + 2.0 + {CC6D62E9-C300-42F3-B452-79966E902B10} + {349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} + Library + Properties + Tango.MachineStudio.UpdateService + Tango.MachineStudio.UpdateService + v4.6 + True + true + true + + + + + + + + true + full + false + ..\..\Build\Debug\Web\Machine Studio Update Service\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\ + TRACE + prompt + 4 + + + + ..\..\packages\EntityFramework.6.0.0\lib\net45\EntityFramework.dll + + + ..\..\packages\EntityFramework.6.0.0\lib\net45\EntityFramework.SqlServer.dll + + + + + + + + + + + + + + + + + + + + + + + + + + + + MachineStudioUpdateService.svc + + + + + + + + + + + Web.config + + + Web.config + + + + + {a34ee0f0-649d-41c8-8489-b6f1cc6924ee} + Tango.Core + + + {4206ac58-3b57-4699-8835-90bf6db01a61} + Tango.Integration + + + {bc932dbd-7cdb-488c-99e4-f02cf441f55e} + Tango.Logging + + + {cb0b0aa2-bb24-4bca-a720-45e397684e12} + Tango.MachineStudio.Common + + + + 10.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + + + + + + True + True + 65206 + / + http://localhost:53044/ + False + False + + + False + + + + + + \ No newline at end of file -- cgit v1.3.1 From fadf83a50071ffba21db05eceff10c51c18f5fb3 Mon Sep 17 00:00:00 2001 From: Roy Date: Fri, 23 Feb 2018 12:03:18 +0200 Subject: Machine Studio Update & Publish. Improved user roles & permissions structure. Added permission for version publish. --- Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 8388608 -> 8388608 bytes .../DataCaptureModule.cs | 2 +- .../Tango.MachineStudio.Stubs/StubsModule.cs | 2 +- .../Tango.MachineStudio.Publisher/MainWindow.xaml | 22 +++++----- .../Tango.MachineStudio.Publisher/MainWindowVM.cs | 10 ++++- .../DefaultAuthenticationProvider.cs | 7 ++- .../Tango.MachineStudio.UI.csproj | 4 ++ .../MachineStudioUpdateService.svc.cs | 6 +-- .../Tango.MachineStudio.UpdateService.csproj | 4 +- .../Web.Release.config | 2 +- .../Tango.MachineStudio.Updater/MainWindow.xaml.cs | 5 ++- .../Templates/ObservablesContextCodeFile.cshtml | 29 +------------ .../Observables/Enumerations/Permissions.cs | 24 +++++++++++ .../Observables/Enumerations/Roles.cs | 20 +++++++-- .../Observables/ObservablesContext.cs | 34 +-------------- .../Observables/ObservablesContextExtension.cs | 48 +++++++++++++++++++++ .../Tango.Integration/Tango.Integration.csproj | 1 + Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj | 6 +++ .../MachineStudioSettings/MachineStudio.cs | 2 +- .../Utilities/Tango.UITests/MainWindow.xaml | 1 - 21 files changed, 140 insertions(+), 89 deletions(-) create mode 100644 Software/Visual_Studio/Tango.Integration/Observables/ObservablesContextExtension.cs (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService/Tango.MachineStudio.UpdateService.csproj') diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index 9f4b4ca30..2535145b6 100644 Binary files a/Software/DB/Tango.mdf and b/Software/DB/Tango.mdf differ diff --git a/Software/DB/Tango_log.ldf b/Software/DB/Tango_log.ldf index 81e9f8578..24e3fbc9c 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/DataCaptureModule.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/DataCaptureModule.cs index ee650dc13..b138af4f3 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/DataCaptureModule.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/DataCaptureModule.cs @@ -69,7 +69,7 @@ namespace Tango.MachineStudio.DataCapture { get { - return Permissions.RunTechnicianModule; + return Permissions.RunDataCaptureModule; } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/StubsModule.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/StubsModule.cs index 817c68b49..4dd0bdff1 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/StubsModule.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/StubsModule.cs @@ -41,7 +41,7 @@ namespace Tango.MachineStudio.Stubs /// /// Gets the permission required to see and load this module. /// - public override Permissions Permission => Permissions.RunSynchronizationModule; + public override Permissions Permission => Permissions.RunStubsModule; /// /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher/MainWindow.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher/MainWindow.xaml index 9f592ca6d..ab7e503ff 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher/MainWindow.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher/MainWindow.xaml @@ -26,28 +26,28 @@ - - - Latest Version: + + + Remote Version: - - Current Version: + + Local Version: - + Email: - + - + Password: - + - Comments - + Comments + diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher/MainWindowVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher/MainWindowVM.cs index 2ceb36994..34d2f1b1f 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher/MainWindowVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher/MainWindowVM.cs @@ -12,6 +12,7 @@ using System.Threading.Tasks; using System.Windows; using Tango.Core.Commands; using Tango.Core.Cryptography; +using Tango.Core.Helpers; using Tango.MachineStudio.Common.Update; using Tango.Settings; using Tango.SharedUI; @@ -121,6 +122,7 @@ namespace Tango.MachineStudio.Publisher Task.Factory.StartNew(() => { IsUpdating = true; + String tempFile = String.Empty; try { @@ -132,7 +134,7 @@ namespace Tango.MachineStudio.Publisher Comments = Comments, }); - String tempFile = Path.Combine(Path.GetTempPath(), response.FileName); + tempFile = Path.Combine(Path.GetTempPath(), response.FileName); using (ZipFile zip = new ZipFile()) { @@ -174,6 +176,11 @@ namespace Tango.MachineStudio.Publisher } } + _client.NotifyUploadCompleted(new UploadCompletedRequest() + { + Token = response.Token, + }); + UpdateVersions(); } catch (Exception ex) @@ -183,6 +190,7 @@ namespace Tango.MachineStudio.Publisher finally { IsUpdating = false; + PathHelper.TryDeleteFile(tempFile); } }); } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs index 82aba268d..110e4d148 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs @@ -50,7 +50,12 @@ namespace Tango.MachineStudio.UI.Authentication if (user == null) { - throw new AuthenticationException("Login failed for user " + email); + throw new AuthenticationException("Invalid credentials for " + email); + } + + if (!user.HasPermission(Permissions.RunMachineStudio)) + { + throw new AuthenticationException("It seems like you do not have sufficient privileges to run Machine Studio. Please contact your administrator."); } CurrentUser = user; diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj index 61ea92566..4cfa99a9b 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj @@ -363,6 +363,10 @@ {cb0b0aa2-bb24-4bca-a720-45e397684e12} Tango.MachineStudio.Common + + {844787ce-f409-4f18-bccc-f3809ecb86f3} + Tango.MachineStudio.Updater + diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService/MachineStudioUpdateService.svc.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService/MachineStudioUpdateService.svc.cs index e573a0d77..bf737c7a9 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService/MachineStudioUpdateService.svc.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService/MachineStudioUpdateService.svc.cs @@ -31,7 +31,7 @@ namespace Tango.MachineStudio.UpdateService private static List _pendingUploads; - MachineStudioUpdateService() + static MachineStudioUpdateService() { _pendingUploads = new List(); } @@ -50,7 +50,7 @@ namespace Tango.MachineStudio.UpdateService var user = db.Users.SingleOrDefault(x => x.Email.ToLower() == request.Email.ToLower() && x.Password == request.Password); - if (user != null) + if (user != null && user.HasPermission(Permissions.RunMachineStudio)) { var latestVersion = db.MachineStudioVersions.FirstOrDefault(); Version currentVersion = Version.Parse(request.Version); @@ -93,7 +93,7 @@ namespace Tango.MachineStudio.UpdateService var user = db.Users.SingleOrDefault(x => x.Email.ToLower() == request.Email.ToLower() && x.Password == request.Password); - if (user != null) + if (user != null && user.HasPermission(Permissions.PublishMachineStudioVersion)) { var latestVersion = db.MachineStudioVersions.FirstOrDefault(); Version currentVersion = Version.Parse(request.Version); diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService/Tango.MachineStudio.UpdateService.csproj b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService/Tango.MachineStudio.UpdateService.csproj index c9400b2d1..0b4d78195 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService/Tango.MachineStudio.UpdateService.csproj +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService/Tango.MachineStudio.UpdateService.csproj @@ -26,7 +26,7 @@ true full false - ..\..\Build\Debug\Web\Machine Studio Update Service\ + bin\ DEBUG;TRACE prompt 4 @@ -118,7 +118,7 @@ - True + False True 65206 / diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService/Web.Release.config b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService/Web.Release.config index da6e960b8..d2da57796 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService/Web.Release.config +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService/Web.Release.config @@ -15,7 +15,7 @@ --> - + - + diff --git a/Software/Visual_Studio/Tango.Integration/Observables/ObservablesContextExtension.cs b/Software/Visual_Studio/Tango.Integration/Observables/ObservablesContextExtension.cs index e6618eae2..9484520c5 100644 --- a/Software/Visual_Studio/Tango.Integration/Observables/ObservablesContextExtension.cs +++ b/Software/Visual_Studio/Tango.Integration/Observables/ObservablesContextExtension.cs @@ -19,7 +19,7 @@ namespace Tango.Integration.Observables { if (!isFile) { - return String.Format("Data Source={0};Initial Catalog=Tango;User Id=Developer;Password=1111;", source); + return String.Format("Data Source={0};Initial Catalog=Tango;Integrated Security=True;", source); } else { @@ -42,7 +42,7 @@ namespace Tango.Integration.Observables /// public static ObservablesContext CreateDefaultForWeb() { - return new ObservablesContext("localhost\\SQLEXPRESS", false); + return new ObservablesContext("localhost\\SQLTWINE", false); } } } diff --git a/Software/Visual_Studio/Tango.Settings/DataBase.cs b/Software/Visual_Studio/Tango.Settings/DataBase.cs index 4e5213b3f..22bbfe9a9 100644 --- a/Software/Visual_Studio/Tango.Settings/DataBase.cs +++ b/Software/Visual_Studio/Tango.Settings/DataBase.cs @@ -17,17 +17,12 @@ namespace Tango.Settings /// public String SQLServerAddress { get; set; } - /// - /// Gets or sets a value indicating whether to delete a record from database instead of setting IsDeleted to 'true'. - /// - public bool DeleteForReal { get; set; } - /// /// Initializes a new instance of the class. /// public DataBase() { - SQLServerAddress = "localhost\\SQLEXPRESS"; + SQLServerAddress = "twine01\\SQLTWINE"; } } } diff --git a/Software/Visual_Studio/Tango.Settings/MachineStudioSettings/MachineStudio.cs b/Software/Visual_Studio/Tango.Settings/MachineStudioSettings/MachineStudio.cs index bfec7af3f..ecaa15153 100644 --- a/Software/Visual_Studio/Tango.Settings/MachineStudioSettings/MachineStudio.cs +++ b/Software/Visual_Studio/Tango.Settings/MachineStudioSettings/MachineStudio.cs @@ -74,7 +74,7 @@ namespace Tango.Settings.MachineStudioSettings StubsModule = new StubsModule(); TechnicianModule = new TechnicianModule(); DeveloperModule = new DeveloperModule(); - UpdateServiceAddress = "http://localhost:65206/MachineStudioUpdateService.svc"; + UpdateServiceAddress = "http://twine01/MachineStudioUpdateService/MachineStudioUpdateService.svc"; } } } -- cgit v1.3.1