diff options
| author | Mirta <mirta@twine-s.com> | 2020-12-30 16:39:52 +0200 |
|---|---|---|
| committer | Mirta <mirta@twine-s.com> | 2020-12-30 16:39:52 +0200 |
| commit | 00a491d93733d4625ad329b2ba8237f445364b3f (patch) | |
| tree | 4b24c6fa78d7648f4bb7cefafa464bb0b063fec4 /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles | |
| parent | 124ad4150f80c6846fdee41dbbda9848c105f6e5 (diff) | |
| download | Tango-00a491d9.tar.gz Tango-00a491d9.zip | |
merge
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles')
11 files changed, 21 insertions, 359 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Converters/RoleEnumToVisibleConverter.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Converters/RoleEnumToVisibleConverter.cs deleted file mode 100644 index 350257fdd..000000000 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Converters/RoleEnumToVisibleConverter.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Globalization; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Data; -using Tango.BL.Enumerations; - -namespace Tango.MachineStudio.UsersAndRoles.Converters -{ - public class RoleEnumToVisibleConverter : IValueConverter - { - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) - { - if(value.GetType().IsEnum && Enum.IsDefined(typeof(Roles), value)) - { - Roles roleEnum = (Roles)value; - if (roleEnum.ToString().StartsWith("FSE")) - return Visibility.Collapsed; - } - - return Visibility.Visible; - } - - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) - { - throw new NotImplementedException(); - } - } -} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Images/login.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Images/login.png Binary files differdeleted file mode 100644 index 9f7d0b9ba..000000000 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Images/login.png +++ /dev/null diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Tango.MachineStudio.UsersAndRoles.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Tango.MachineStudio.UsersAndRoles.csproj index 687544c1b..82376b751 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Tango.MachineStudio.UsersAndRoles.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Tango.MachineStudio.UsersAndRoles.csproj @@ -49,9 +49,6 @@ <Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> <HintPath>..\..\..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath> </Reference> - <Reference Include="SimpleValidator, Version=0.6.1.0, Culture=neutral, processorArchitecture=MSIL"> - <HintPath>..\..\..\packages\SimpleValidator.0.6.1.0\lib\net40\SimpleValidator.dll</HintPath> - </Reference> <Reference Include="System" /> <Reference Include="System.ComponentModel.DataAnnotations" /> <Reference Include="System.Data" /> @@ -75,7 +72,6 @@ <Compile Include="..\..\..\Versioning\GlobalVersionInfo.cs"> <Link>GlobalVersionInfo.cs</Link> </Compile> - <Compile Include="Converters\RoleEnumToVisibleConverter.cs" /> <Compile Include="Navigation\UsersAndRolesNavigationManager.cs" /> <Compile Include="Navigation\UsersAndRolesNavigationView.cs" /> <Compile Include="Providers\PlaceAddress.cs" /> @@ -84,7 +80,6 @@ <Compile Include="UsersAndRolesModule.cs" /> <Compile Include="ViewModelLocator.cs" /> <Compile Include="ViewModels\MainViewVM.cs" /> - <Compile Include="ViewModels\UserCreationDialogVM.cs" /> <Compile Include="Views\AddressView.xaml.cs"> <DependentUpon>AddressView.xaml</DependentUpon> </Compile> @@ -100,9 +95,6 @@ <Compile Include="Views\OrganizationSelectionView.xaml.cs"> <DependentUpon>OrganizationSelectionView.xaml</DependentUpon> </Compile> - <Compile Include="Views\UserCreationDialog.xaml.cs"> - <DependentUpon>UserCreationDialog.xaml</DependentUpon> - </Compile> <Compile Include="Views\UserManagementView.xaml.cs"> <DependentUpon>UserManagementView.xaml</DependentUpon> </Compile> @@ -128,9 +120,7 @@ <Generator>ResXFileCodeGenerator</Generator> <LastGenOutput>Resources.Designer.cs</LastGenOutput> </EmbeddedResource> - <None Include="app.config"> - <SubType>Designer</SubType> - </None> + <None Include="app.config" /> <None Include="packages.config" /> <None Include="Properties\Settings.settings"> <Generator>SettingsSingleFileGenerator</Generator> @@ -196,10 +186,6 @@ <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> </Page> - <Page Include="Views\UserCreationDialog.xaml"> - <SubType>Designer</SubType> - <Generator>MSBuild:Compile</Generator> - </Page> <Page Include="Views\UserManagementView.xaml"> <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> @@ -224,9 +210,6 @@ <ItemGroup> <Resource Include="Images\roles.png" /> </ItemGroup> - <ItemGroup> - <Resource Include="Images\login.png" /> - </ItemGroup> <ItemGroup /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <ProjectExtensions> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/ViewModels/MainViewVM.cs index 16395d6bc..a46d5f456 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/ViewModels/MainViewVM.cs @@ -15,10 +15,6 @@ using Tango.MachineStudio.UsersAndRoles.Providers; using Tango.SharedUI; using System.Data.Entity; using Tango.BL.Builders; -using Tango.BL.ActionLogs; -using Tango.BL.DTO; -using Tango.BL.Enumerations; -using Tango.MachineStudio.Common.Authentication; namespace Tango.MachineStudio.UsersAndRoles.ViewModels { @@ -29,10 +25,6 @@ namespace Tango.MachineStudio.UsersAndRoles.ViewModels private ObservablesContext _userContext; private UsersAndRolesNavigationManager _navigation; private INotificationProvider _notification; - private IActionLogManager _actionLogManager; - private OrganizationDTO _organizationBeforeSave; - private IAuthenticationProvider _authenticationProvider; - private UserDTO _userBeforeSave; private ObservableCollection<Organization> _organizations; public ObservableCollection<Organization> Organizations @@ -113,21 +105,6 @@ namespace Tango.MachineStudio.UsersAndRoles.ViewModels } } - private bool _showDeleted; - public bool ShowDeleted - { - get { return _showDeleted; } - set - { - _showDeleted = value; - if (_showDeleted) - { - //ShowDeletedUsers(); - } - } - } - - public RelayCommand ManageOrganizationCommand { get; set; } public RelayCommand BackToOrganizationsCommand { get; set; } @@ -146,18 +123,14 @@ namespace Tango.MachineStudio.UsersAndRoles.ViewModels public RelayCommand SaveManagedUserCommand { get; set; } - public RelayCommand RestoreAndSaveManagedUserCommand { get; set; } - public RelayCommand AddUserCommand { get; set; } public RelayCommand RemoveUserCommand { get; set; } - public MainViewVM(UsersAndRolesNavigationManager navigation, INotificationProvider notification, IActionLogManager actionLogManager, IAuthenticationProvider authenticationProvider) + public MainViewVM(UsersAndRolesNavigationManager navigation, INotificationProvider notification) { _navigation = navigation; _notification = notification; - _actionLogManager = actionLogManager; - _authenticationProvider = authenticationProvider; ManageOrganizationCommand = new RelayCommand(LoadSelectedOrganization, () => SelectedOrganization != null); BackToOrganizationsCommand = new RelayCommand(BackToOrganizations); @@ -168,10 +141,8 @@ namespace Tango.MachineStudio.UsersAndRoles.ViewModels BackToManagedOrganizationCommand = new RelayCommand(BackToManagedOrganization); RemoveRoleCommand = new RelayCommand<Role>(RemoveUserRole); SaveManagedUserCommand = new RelayCommand(SaveManagedUser); - RestoreAndSaveManagedUserCommand = new RelayCommand(RestoreAndSaveManagedUser); AddUserCommand = new RelayCommand(AddNewUser); RemoveUserCommand = new RelayCommand(RemoveSelectedUser, () => SelectedUser != null); - _showDeleted = false; } public override void OnApplicationReady() @@ -193,7 +164,6 @@ namespace Tango.MachineStudio.UsersAndRoles.ViewModels org.Contact = new Contact(); _organizationsContext.Organizations.Add(org); await org.SaveAsync(_organizationsContext); - _actionLogManager.InsertLog(ActionLogType.OrganizationCreated, _authenticationProvider.CurrentUser, org.Name, org, "Organization created using Machine Studio."); Organizations = _organizationsContext.Organizations.ToObservableCollection(); SelectedOrganization = org; LoadSelectedOrganization(); @@ -208,7 +178,6 @@ namespace Tango.MachineStudio.UsersAndRoles.ViewModels using (_notification.PushTaskItem("Removing organization...")) { await SelectedOrganization.DeleteCascadeAsync(_organizationsContext); - _actionLogManager.InsertLog(ActionLogType.OrganizationDeleted, _authenticationProvider.CurrentUser, SelectedOrganization.Name, SelectedOrganization, "Organization deleted using Machine Studio."); await LoadOrganizations(); } } @@ -218,13 +187,7 @@ namespace Tango.MachineStudio.UsersAndRoles.ViewModels { using (_notification.PushTaskItem("Saving organization address and contact...")) { - var organizationAfter = OrganizationDTO.FromObservable(ManagedOrganization); - await ManagedOrganization.SaveAsync(_manageContext); - _actionLogManager.InsertLog(ActionLogType.OrganizationSaved, _authenticationProvider.CurrentUser, ManagedOrganization.Name, _organizationBeforeSave, organizationAfter, "Organization saved using Machine Studio."); - - _organizationBeforeSave = organizationAfter; - await LoadOrganizations(); SelectedOrganization = Organizations.SingleOrDefault(x => x.Guid == ManagedOrganization.Guid); } @@ -239,10 +202,8 @@ namespace Tango.MachineStudio.UsersAndRoles.ViewModels _userContext = ObservablesContext.CreateDefault(); Roles = new RolesCollectionBuilder(_userContext).SetAll().WithPermission().Build(); - ManagedUser = new UserBuilder(_userContext).WithDeleted().Set(SelectedUser.Guid).WithRolesAndPermissions().Build(); + ManagedUser = new UserBuilder(_userContext).Set(SelectedUser.Guid).WithRolesAndPermissions().Build(); ManagedUserRoles = ManagedUser.Roles.ToObservableCollection(); - - _userBeforeSave = UserDTO.FromObservable(ManagedUser); }); _navigation.NavigateTo(UsersAndRolesNavigationView.UserManagementView); @@ -274,11 +235,6 @@ namespace Tango.MachineStudio.UsersAndRoles.ViewModels try { ManagedUser.Validate(_userContext); - - if (ManagedUser.Roles.GroupBy(x => x.RoleEnum).Any(x => x.Count() > 1)) - { - throw new InvalidOperationException("Cannot save user with duplicate roles."); - } } catch (Exception ex) { @@ -288,45 +244,11 @@ namespace Tango.MachineStudio.UsersAndRoles.ViewModels using (_notification.PushTaskItem("Saving user details...")) { - var userAfter = UserDTO.FromObservable(ManagedUser); await ManagedUser.SaveAsync(_userContext); - _actionLogManager.InsertLog(ActionLogType.UserSaved, _authenticationProvider.CurrentUser, ManagedUser.Email, _userBeforeSave, userAfter, "User saved using Machine Studio."); - _userBeforeSave = userAfter; LoadSelectedOrganization(); } } - private async void RestoreAndSaveManagedUser() - { - try - { - ManagedUser.Validate(_userContext); - - if (ManagedUser.Roles.GroupBy(x => x.RoleEnum).Any(x => x.Count() > 1)) - { - throw new InvalidOperationException("Cannot save user with duplicate roles."); - } - } - catch (Exception ex) - { - _notification.ShowError(ex.Message); - return; - } - if (_notification.ShowQuestion("Are you sure you wish to re-activate this account?")) - { - using (_notification.PushTaskItem("Saving user details...")) - { - ManagedUser.Deleted = false; - - var userAfter = UserDTO.FromObservable(ManagedUser); - await ManagedUser.SaveAsync(_userContext); - _actionLogManager.InsertLog(ActionLogType.UserRestored, _authenticationProvider.CurrentUser, ManagedUser.Email, _userBeforeSave, userAfter, "User restored using Machine Studio."); - _userBeforeSave = userAfter; - LoadSelectedOrganization(); - } - } - } - private async void LoadSelectedOrganization() { using (_notification.PushTaskItem("Loading organization...")) @@ -335,9 +257,7 @@ namespace Tango.MachineStudio.UsersAndRoles.ViewModels { _manageContext = ObservablesContext.CreateDefault(); - ManagedOrganization = new OrganizationBuilder(_manageContext).Set(SelectedOrganization.Guid).WithUsers(true).Build(); - - _organizationBeforeSave = OrganizationDTO.FromObservable(ManagedOrganization); + ManagedOrganization = new OrganizationBuilder(_manageContext).Set(SelectedOrganization.Guid).WithUsers().Build(); }); _navigation.NavigateTo(UsersAndRolesNavigationView.OrganizationManagementView); @@ -374,25 +294,25 @@ namespace Tango.MachineStudio.UsersAndRoles.ViewModels using (_notification.PushTaskItem("Removing user...")) { await SelectedUser.DeleteCascadeAsync(_manageContext); - _actionLogManager.InsertLog(ActionLogType.UserDeleted, _authenticationProvider.CurrentUser, SelectedUser.Email, SelectedUser, "User deleted using Machine Studio."); LoadSelectedOrganization(); } } } - private void AddNewUser() + private async void AddNewUser() { - _notification.ShowModalDialog<UserCreationDialogVM>(async (vm) => + String email = _notification.ShowTextInput("Enter user email", "email"); + + if (!String.IsNullOrWhiteSpace(email)) { User user = new User(); - user.Email = vm.Email; - user.Password = User.GetPasswordHash(vm.Password); - user.PasswordChangeRequired = true; + user.Email = email; + user.Password = "1111"; user.Contact = new Contact() { - FirstName = vm.FirstName, - LastName = vm.LastName, - Email = vm.Email, + FirstName = "Twine", + LastName = "User", + Email = email, }; user.Address = new Address(); @@ -403,25 +323,9 @@ namespace Tango.MachineStudio.UsersAndRoles.ViewModels Role = _manageContext.Roles.SingleOrDefault(x => x.Code == (int)BL.Enumerations.Roles.User) }); - user.UsersRoles.Add(new UsersRole() - { - User = user, - Role = _manageContext.Roles.SingleOrDefault(x => x.Code == (int)BL.Enumerations.Roles.MachineStudioUser) - }); - - user.UsersRoles.Add(new UsersRole() - { - User = user, - Role = _manageContext.Roles.SingleOrDefault(x => x.Code == (int)BL.Enumerations.Roles.PPCUser) - }); - try { - if (!user.Validate(_manageContext)) - { - _notification.ShowError(String.Join(Environment.NewLine, user.ValidationErrors)); - return; - } + user.Validate(_manageContext); } catch (Exception ex) { @@ -434,13 +338,10 @@ namespace Tango.MachineStudio.UsersAndRoles.ViewModels using (_notification.PushTaskItem("Adding new user...")) { await ManagedOrganization.SaveAsync(_manageContext); - _actionLogManager.InsertLog(ActionLogType.UserCreated, _authenticationProvider.CurrentUser, user.Email, user, "User created using Machine Studio."); await LoadOrganizations(); SelectedOrganization = Organizations.SingleOrDefault(x => x.Guid == ManagedOrganization.Guid); - SelectedUser = user; - LoadSelectedUser(); } - }); + } } private void SetUserPlace(Place place) diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/ViewModels/UserCreationDialogVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/ViewModels/UserCreationDialogVM.cs deleted file mode 100644 index 08762ac96..000000000 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/ViewModels/UserCreationDialogVM.cs +++ /dev/null @@ -1,74 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using SimpleValidator.Extensions; -using Tango.SharedUI; - -namespace Tango.MachineStudio.UsersAndRoles.ViewModels -{ - public class UserCreationDialogVM : DialogViewVM - { - private static Random rnd = new Random(); - - private String _email; - [Required(ErrorMessage = "Email is required")] - [EmailAddress(ErrorMessage = "Please provide a valid email")] - public String Email - { - get { return _email; } - set { _email = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); } - } - - private String _password; - public String Password - { - get { return _password; } - set { _password = value; RaisePropertyChangedAuto(); } - } - - private String _firstName; - [Required(ErrorMessage = "First name is required")] - public String FirstName - { - get { return _firstName; } - set { _firstName = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); } - } - - private String _lastName; - [Required(ErrorMessage = "Last name is required")] - public String LastName - { - get { return _lastName; } - set { _lastName = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); } - } - - protected override void Accept() - { - if (Validate()) - { - base.Accept(); - } - } - - public override void OnShow() - { - base.OnShow(); - Password = GetRandomPassword(4); - } - - private String GetRandomPassword(int count) - { - String pass = String.Empty; - - for (int i = 0; i < count; i++) - { - pass += rnd.Next(0, 9).ToString(); - } - - return pass; - } - } -} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Views/OrganizationManagementView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Views/OrganizationManagementView.xaml index a14d59949..d5a5d41d7 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Views/OrganizationManagementView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Views/OrganizationManagementView.xaml @@ -82,10 +82,6 @@ </Button> </StackPanel> </Grid> - <StackPanel Orientation="Horizontal" DockPanel.Dock="Bottom" VerticalAlignment="Center" Margin="0 10 0 5" HorizontalAlignment="Left"> - <CheckBox Name="cbShowDeleted" IsChecked="{Binding ShowDeleted}" VerticalAlignment="Center"></CheckBox> - <TextBlock Margin="10 0 0 0" VerticalAlignment="Center" Text="Show deleted accounts" FontSize="16" FontWeight="Normal"></TextBlock> - </StackPanel> <Grid DockPanel.Dock="Bottom"> <StackPanel VerticalAlignment="Center" Orientation="Horizontal" HorizontalAlignment="Left" Margin="0 0 0 0"> <Button Margin="0 0 10 0" MinWidth="160" Height="50" Background="{StaticResource RedBrush300}" BorderBrush="{StaticResource RedBrush300}" Command="{Binding RemoveUserCommand}"> @@ -117,28 +113,6 @@ <Setter Property="BorderThickness" Value="0"/> <Setter Property="FocusVisualStyle" Value="{x:Null}"/> <Setter Property="VerticalContentAlignment" Value="Center"></Setter> - <Setter Property="Visibility" Value="Visible" /> - <Style.Triggers> - <MultiDataTrigger> - <MultiDataTrigger.Conditions> - <Condition Binding="{Binding ElementName=cbShowDeleted, Path=IsChecked}" Value="False"/> - <Condition Binding="{Binding Deleted}" Value="True"/> - </MultiDataTrigger.Conditions> - <MultiDataTrigger.Setters> - <Setter Property="Visibility" Value="Collapsed" /> - </MultiDataTrigger.Setters> - </MultiDataTrigger> - <MultiDataTrigger> - <MultiDataTrigger.Conditions> - <Condition Binding="{Binding ElementName=cbShowDeleted, Path=IsChecked}" Value="true"/> - <Condition Binding="{Binding Deleted}" Value="True"/> - </MultiDataTrigger.Conditions> - <MultiDataTrigger.Setters> - <Setter Property="Visibility" Value="Visible" /> - <Setter Property="Foreground" Value="{StaticResource RedBrush100}" /> - </MultiDataTrigger.Setters> - </MultiDataTrigger> - </Style.Triggers> </Style> </DataGrid.CellStyle> <DataGrid.Columns> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Views/UserCreationDialog.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Views/UserCreationDialog.xaml deleted file mode 100644 index 7433d3768..000000000 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Views/UserCreationDialog.xaml +++ /dev/null @@ -1,53 +0,0 @@ -<UserControl x:Class="Tango.MachineStudio.UsersAndRoles.Views.UserCreationDialog" - xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" - xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:d="http://schemas.microsoft.com/expression/blend/2008" - xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" - xmlns:global="clr-namespace:Tango.MachineStudio.UsersAndRoles" - xmlns:vm="clr-namespace:Tango.MachineStudio.UsersAndRoles.ViewModels" - xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" - xmlns:local="clr-namespace:Tango.MachineStudio.UsersAndRoles.Views" - mc:Ignorable="d" - d:DesignHeight="400" d:DesignWidth="700" Height="400" Width="700" Background="{StaticResource WhiteBackgroundBrush}" d:DataContext="{d:DesignInstance Type=vm:UserCreationDialogVM, IsDesignTimeCreatable=False}"> - <Grid Margin="10"> - <DockPanel> - <Grid DockPanel.Dock="Top"> - <StackPanel Orientation="Horizontal"> - <Grid> - <Image Source="../Images/login.png" Width="80" RenderOptions.BitmapScalingMode="Fant"></Image> - <materialDesign:PackIcon HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0 0 -14 -10" Kind="PlusCircle" Foreground="#15C315" Width="42" Height="42" /> - </Grid> - <TextBlock Margin="30 0 0 0" VerticalAlignment="Bottom" FontSize="22">NEW USER</TextBlock> - </StackPanel> - </Grid> - - <Grid DockPanel.Dock="Bottom"> - <StackPanel Orientation="Horizontal" VerticalAlignment="Bottom" HorizontalAlignment="Right" DockPanel.Dock="Bottom"> - <Button Command="{Binding CloseCommand}" Width="140" Height="40" Margin="0 0 10 0"> - CANCEL - </Button> - <Button Command="{Binding OKCommand}" IsDefault="True" Width="140" Height="40"> - CREATE - </Button> - </StackPanel> - </Grid> - - <Grid> - <StackPanel Width="400" HorizontalAlignment="Center" Margin="20"> - <controls:TableGrid RowHeight="40"> - <TextBlock>EMAIL</TextBlock> - <TextBox Text="{Binding Email,UpdateSourceTrigger=LostFocus,NotifyOnValidationError=True,ValidatesOnDataErrors=True,ValidatesOnNotifyDataErrors=True}"></TextBox> - <TextBlock>FIRST NAME</TextBlock> - <TextBox Text="{Binding FirstName,UpdateSourceTrigger=LostFocus,NotifyOnValidationError=True,ValidatesOnDataErrors=True,ValidatesOnNotifyDataErrors=True}"></TextBox> - <TextBlock>LAST NAME</TextBlock> - <TextBox Text="{Binding LastName,UpdateSourceTrigger=LostFocus,NotifyOnValidationError=True,ValidatesOnDataErrors=True,ValidatesOnNotifyDataErrors=True}"></TextBox> - </controls:TableGrid> - - <TextBox Margin="0 -15 0 0" Style="{x:Null}" BorderThickness="0" FontSize="30" HorizontalAlignment="Center" Text="{Binding Password}" IsReadOnly="True"></TextBox> - <TextBlock HorizontalAlignment="Center" Margin="0 5 0 0" Foreground="{StaticResource GrayBrush}">Provide this password to the user</TextBlock> - </StackPanel> - </Grid> - </DockPanel> - </Grid> -</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Views/UserCreationDialog.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Views/UserCreationDialog.xaml.cs deleted file mode 100644 index cfa389ed1..000000000 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Views/UserCreationDialog.xaml.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; - -namespace Tango.MachineStudio.UsersAndRoles.Views -{ - /// <summary> - /// Interaction logic for UserCreationDialog.xaml - /// </summary> - public partial class UserCreationDialog : UserControl - { - public UserCreationDialog() - { - InitializeComponent(); - } - } -} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Views/UserManagementView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Views/UserManagementView.xaml index 2a8621e5c..bb003f525 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Views/UserManagementView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Views/UserManagementView.xaml @@ -14,15 +14,11 @@ xmlns:entities="clr-namespace:Tango.BL.Entities;assembly=Tango.BL" xmlns:local="clr-namespace:Tango.MachineStudio.UsersAndRoles.Views" xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" - xmlns:localconverters="clr-namespace:Tango.MachineStudio.UsersAndRoles.Converters" mc:Ignorable="d" d:DesignHeight="1080" d:DesignWidth="1920" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}"> <UserControl.Resources> <providers:PlacesProvider x:Key="PlacesProvider" /> - <converters:BooleanToVisibilityConverter x:Key="BoolToVisibilityConverter"></converters:BooleanToVisibilityConverter> - <converters:BooleanToVisibilityInverseConverter x:Key="BooleanToVisibilityInverseConverter"></converters:BooleanToVisibilityInverseConverter> - <localconverters:RoleEnumToVisibleConverter x:Key="RoleEnumToVisibleConverter"/> </UserControl.Resources> <Grid> @@ -52,7 +48,7 @@ <StackPanel> <TextBlock FontSize="16" FontWeight="SemiBold">LOGIN</TextBlock> <Border Width="300" BorderThickness="1" BorderBrush="Gray" Margin="0 5 0 0" Padding="15 5" Height="150" Background="{StaticResource TransparentBackgroundBrush500}"> - <local:UserView VerticalAlignment="Top" Margin="0 15 0 0" FontSize="10" DataContext="{Binding ManagedUser}" /> + <local:UserView FontSize="10" DataContext="{Binding ManagedUser}" /> </Border> </StackPanel> <StackPanel Margin="10 0 0 0"> @@ -78,18 +74,12 @@ </Grid> </Grid> <Grid DockPanel.Dock="Bottom"> - <Button Margin="0 10 0 0" MinWidth="200" Height="60" Command="{Binding SaveManagedUserCommand}" HorizontalAlignment="Right" Visibility="{Binding Path=ManagedUser.Deleted, Converter={StaticResource BooleanToVisibilityInverseConverter}}"> + <Button Margin="0 10 0 0" MinWidth="200" Height="60" Command="{Binding SaveManagedUserCommand}" HorizontalAlignment="Right"> <StackPanel Orientation="Horizontal"> <TextBlock FontSize="18" VerticalAlignment="Center">SAVE</TextBlock> <materialDesign:PackIcon Margin="5 0 0 0" Kind="ContentSave" Width="30" Height="30" /> </StackPanel> </Button> - <Button Margin="0 10 0 0" MinWidth="200" Height="60" Background="{StaticResource OrangeBrush300}" BorderBrush="{StaticResource OrangeBrush300}" Command="{Binding RestoreAndSaveManagedUserCommand}" HorizontalAlignment="Right" Visibility="{Binding Path=ManagedUser.Deleted, Converter={StaticResource BoolToVisibilityConverter}}"> - <StackPanel Orientation="Horizontal"> - <TextBlock FontSize="18" VerticalAlignment="Center" Text="RESTORE & SAVE"/> - <materialDesign:PackIcon Margin="5 0 0 0" Kind="ContentSave" Width="30" Height="30" /> - </StackPanel> - </Button> </Grid> <Grid> <DockPanel Margin="0 20 0 0"> @@ -105,7 +95,7 @@ </ListBox.ItemsPanel> <ListBox.ItemTemplate> <DataTemplate DataType="{x:Type entities:Role}"> - <Grid Visibility="{Binding RoleEnum, Converter={StaticResource RoleEnumToVisibleConverter}}"> + <Grid> <Grid.ToolTip> <StackPanel Background="Transparent"> <TextBlock Text="{Binding Description}" FontSize="10" Margin="0 0 0 10"></TextBlock> @@ -177,7 +167,7 @@ <ListBox ItemsSource="{Binding Roles}" ItemContainerStyle="{StaticResource basicListBoxItem}" HorizontalContentAlignment="Stretch" Background="Transparent"> <ListBox.ItemTemplate> <DataTemplate> - <Grid Background="Transparent" IsHitTestVisible="True" Style="{StaticResource draggableGrid}" dragAndDrop:DragAndDropService.DraggableBorderBrush="{StaticResource AccentColorBrush}" dragAndDrop:DragAndDropService.Draggable="True" dragAndDrop:DragAndDropService.DraggingSurface="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DraggingSurface}" Visibility="{Binding RoleEnum, Converter={StaticResource RoleEnumToVisibleConverter}}"> + <Grid Background="Transparent" IsHitTestVisible="True" Style="{StaticResource draggableGrid}" dragAndDrop:DragAndDropService.DraggableBorderBrush="{StaticResource AccentColorBrush}" dragAndDrop:DragAndDropService.Draggable="True" dragAndDrop:DragAndDropService.DraggingSurface="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DraggingSurface}"> <Grid.ToolTip> <StackPanel Background="Transparent"> <TextBlock Text="{Binding Description}" FontSize="10" Margin="0 0 0 10"></TextBlock> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Views/UserView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Views/UserView.xaml index 37f649a7a..0858d7e08 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Views/UserView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Views/UserView.xaml @@ -16,6 +16,8 @@ <controls:TableGrid> <TextBlock Text="EMAIL"></TextBlock> <TextBox Text="{Binding Email}"></TextBox> + <TextBlock Text="PASSWORD"></TextBlock> + <PasswordBox MaxLength="30" pass:PasswordHelper.Attach="True" pass:PasswordHelper.Password="{Binding PasswordGateWay,Mode=TwoWay}"></PasswordBox> </controls:TableGrid> </Grid> </UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/packages.config b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/packages.config index 8696cb880..fe4f26e87 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/packages.config +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/packages.config @@ -7,5 +7,4 @@ <package id="MaterialDesignColors" version="1.1.2" targetFramework="net46" /> <package id="MaterialDesignThemes" version="2.3.1.953" targetFramework="net46" /> <package id="Newtonsoft.Json" version="9.0.1" targetFramework="net461" /> - <package id="SimpleValidator" version="0.6.1.0" targetFramework="net461" /> </packages>
\ No newline at end of file |
