aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio
diff options
context:
space:
mode:
authorRoy <roy.mail.net@gmail.com>2018-02-23 12:03:18 +0200
committerRoy <roy.mail.net@gmail.com>2018-02-23 12:03:18 +0200
commitfadf83a50071ffba21db05eceff10c51c18f5fb3 (patch)
tree9a568aae8d298bfbc2135afaff0b91f9de711793 /Software/Visual_Studio/MachineStudio
parent042b4d3e7b0af729792ca20e086756c36d2f5768 (diff)
downloadTango-fadf83a50071ffba21db05eceff10c51c18f5fb3.tar.gz
Tango-fadf83a50071ffba21db05eceff10c51c18f5fb3.zip
Machine Studio Update & Publish.
Improved user roles & permissions structure. Added permission for version publish.
Diffstat (limited to 'Software/Visual_Studio/MachineStudio')
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/DataCaptureModule.cs2
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/StubsModule.cs2
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher/MainWindow.xaml22
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher/MainWindowVM.cs10
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs7
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj4
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService/MachineStudioUpdateService.svc.cs6
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService/Tango.MachineStudio.UpdateService.csproj4
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService/Web.Release.config2
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Updater/MainWindow.xaml.cs5
10 files changed, 42 insertions, 22 deletions
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
/// <summary>
/// Gets the permission required to see and load this module.
/// </summary>
- public override Permissions Permission => Permissions.RunSynchronizationModule;
+ public override Permissions Permission => Permissions.RunStubsModule;
/// <summary>
/// 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 @@
<Grid Grid.Row="1" Margin="10">
<DockPanel>
- <StackPanel DockPanel.Dock="Top" HorizontalAlignment="Center" Margin="0 20 0 0" x:Name="stackDetails">
- <TextBlock FontSize="16" HorizontalAlignment="Center">
- <Run>Latest Version:</Run>
+ <StackPanel DockPanel.Dock="Top" HorizontalAlignment="Left" Margin="0 20 0 0" x:Name="stackDetails">
+ <TextBlock FontSize="16">
+ <Run>Remote Version:</Run>
<Run Text="{Binding LatestVersion}" FontStyle="Italic" FontWeight="SemiBold"></Run>
</TextBlock>
- <TextBlock Margin="0 10 0 0" FontSize="16" HorizontalAlignment="Center">
- <Run>Current Version:</Run>
+ <TextBlock Margin="0 10 0 0" FontSize="16" >
+ <Run>Local Version:</Run>
<Run Text="{Binding CurrentVersion}" FontStyle="Italic" FontWeight="SemiBold"></Run>
</TextBlock>
- <StackPanel Margin="0 10 0 0" Orientation="Horizontal" HorizontalAlignment="Center">
+ <StackPanel Margin="0 20 0 0" Orientation="Horizontal" >
<TextBlock FontSize="16">Email:</TextBlock>
- <TextBox Margin="5 0 0 0" Width="200" BorderThickness="0 0 0 1" Text="{Binding Email,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBox>
+ <TextBox Margin="5 0 0 0" Width="230" BorderThickness="0 0 0 1" Text="{Binding Email,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBox>
</StackPanel>
- <StackPanel Margin="0 10 0 0" Orientation="Horizontal" HorizontalAlignment="Center">
+ <StackPanel Margin="0 10 0 0" Orientation="Horizontal">
<TextBlock FontSize="16">Password:</TextBlock>
- <TextBox Margin="5 0 0 0" Width="230" BorderThickness="0 0 0 1" Text="{Binding Password,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBox>
+ <TextBox Margin="5 0 0 0" Width="200" BorderThickness="0 0 0 1" Text="{Binding Password,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBox>
</StackPanel>
- <TextBlock FontSize="16" HorizontalAlignment="Center" Margin="0 20 0 0">Comments</TextBlock>
- <TextBox Height="70" Margin="0 5 0 0" AcceptsReturn="True" TextWrapping="Wrap" Text="{Binding Comments,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBox>
+ <TextBlock FontSize="16" Margin="0 20 0 0">Comments</TextBlock>
+ <TextBox Height="70" Margin="0 5 0 0" Width="500" AcceptsReturn="True" TextWrapping="Wrap" Text="{Binding Comments,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBox>
</StackPanel>
<Grid DockPanel.Dock="Bottom">
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 @@
<Project>{cb0b0aa2-bb24-4bca-a720-45e397684e12}</Project>
<Name>Tango.MachineStudio.Common</Name>
</ProjectReference>
+ <ProjectReference Include="..\Tango.MachineStudio.Updater\Tango.MachineStudio.Updater.csproj">
+ <Project>{844787ce-f409-4f18-bccc-f3809ecb86f3}</Project>
+ <Name>Tango.MachineStudio.Updater</Name>
+ </ProjectReference>
</ItemGroup>
<ItemGroup>
<Resource Include="Images\design.png" />
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<PendingUpload> _pendingUploads;
- MachineStudioUpdateService()
+ static MachineStudioUpdateService()
{
_pendingUploads = new List<PendingUpload>();
}
@@ -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 @@
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
- <OutputPath>..\..\Build\Debug\Web\Machine Studio Update Service\</OutputPath>
+ <OutputPath>bin\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
@@ -118,7 +118,7 @@
<VisualStudio>
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
<WebProjectProperties>
- <UseIIS>True</UseIIS>
+ <UseIIS>False</UseIIS>
<AutoAssignPort>True</AutoAssignPort>
<DevelopmentServerPort>65206</DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath>
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 @@
</connectionStrings>
-->
<system.web>
- <compilation xdt:Transform="RemoveAttributes(debug)" />
+ <!--<compilation xdt:Transform="RemoveAttributes(debug)" />-->
<!--
In the example below, the "Replace" transform will replace the entire
<customErrors> section of your web.config file.
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Updater/MainWindow.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Updater/MainWindow.xaml.cs
index e0e9e7f0d..a0c6928d2 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Updater/MainWindow.xaml.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Updater/MainWindow.xaml.cs
@@ -99,7 +99,10 @@ namespace Tango.MachineStudio.Updater
}
catch (Exception ex)
{
- ShowError("Could not create file " + Path.GetFileName(newPath) + Environment.NewLine + ex.Message);
+ if (!newPath.ToLower().Contains("updater.exe"))
+ {
+ ShowError("Could not create file " + Path.GetFileName(newPath) + Environment.NewLine + ex.Message);
+ }
}
}
}