diff options
| author | Roy <Roy.mail.net@gmail.com> | 2022-10-27 18:58:41 +0300 |
|---|---|---|
| committer | Roy <Roy.mail.net@gmail.com> | 2022-10-27 18:58:41 +0300 |
| commit | 1383a3210016e5f9c14aa232cd9bd53005774483 (patch) | |
| tree | 697c80780a55753ea5076fd8246c5bc8f7fe093a /Software/Visual_Studio | |
| parent | 3f32716c553a5f13770c38b3a49c81259ac4ba08 (diff) | |
| download | Tango-1383a3210016e5f9c14aa232cd9bd53005774483.tar.gz Tango-1383a3210016e5f9c14aa232cd9bd53005774483.zip | |
Implemented Twine Studio user management.
Diffstat (limited to 'Software/Visual_Studio')
6 files changed, 26 insertions, 10 deletions
diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.UsersAndRoles/Models/RoleModel.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.UsersAndRoles/Models/RoleModel.cs index 4d3eb9885..36195e093 100644 --- a/Software/Visual_Studio/FSE/Modules/Tango.FSE.UsersAndRoles/Models/RoleModel.cs +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.UsersAndRoles/Models/RoleModel.cs @@ -11,6 +11,8 @@ namespace Tango.FSE.UsersAndRoles.Models { public class RoleModel : ExtendedObject { + public event EventHandler<bool> SelectedChanged; + private Role _role; public Role Role { @@ -29,7 +31,7 @@ namespace Tango.FSE.UsersAndRoles.Models public bool IsSelected { get { return _isSelected; } - set { _isSelected = value; RaisePropertyChangedAuto(); } + set { _isSelected = value; SelectedChanged?.Invoke(this, value); RaisePropertyChangedAuto(); } } private bool _isVisible; diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.UsersAndRoles/ViewModels/UserDetailsViewVM.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.UsersAndRoles/ViewModels/UserDetailsViewVM.cs index 846704f0e..78731ad15 100644 --- a/Software/Visual_Studio/FSE/Modules/Tango.FSE.UsersAndRoles/ViewModels/UserDetailsViewVM.cs +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.UsersAndRoles/ViewModels/UserDetailsViewVM.cs @@ -153,6 +153,8 @@ namespace Tango.FSE.UsersAndRoles.ViewModels GeneratePassword(); } + CanSetRemoteMachineAccess = CurrentUser.HasRole(Roles.FSEAdministrator); + _requiresLoading = false; } @@ -188,7 +190,7 @@ namespace Tango.FSE.UsersAndRoles.ViewModels bool user_is_current_user_and_fse_admin_and_not_twine_admin = user.Guid == CurrentUser.Guid && user.HasRole(Roles.FSEAdministrator) && !user.HasRole(Roles.FSETwineAdministrator); var collection = new RolesCollection(); - collection.Add(new RoleModel(roles.SingleOrDefault(x => x.RoleEnum == Roles.FSETechnician)) { IsSelected = isNew }); + collection.Add(new RoleModel(roles.SingleOrDefault(x => x.RoleEnum == Roles.FSETechnician)) { IsSelected = isNew}); collection.Add(new RoleModel(roles.SingleOrDefault(x => x.RoleEnum == Roles.FSEAdvancedTechnician), Roles.FSETechnician)); collection.Add(new RoleModel(roles.SingleOrDefault(x => x.RoleEnum == Roles.FSEAdministrator), Roles.FSETechnician, Roles.FSEAdvancedTechnician) { IsEnabled = !user_is_current_user_and_fse_admin_and_not_twine_admin }); @@ -202,6 +204,7 @@ namespace Tango.FSE.UsersAndRoles.ViewModels collection.Add(new RoleModel(roles.SingleOrDefault(x => x.RoleEnum == Roles.FSETwineDeveloper), Roles.FSETechnician, Roles.FSEAdvancedTechnician, Roles.FSETwineTechnician) { IsVisible = CurrentUser.HasRole(Roles.FSETwineDeveloper) }); } + collection.Add(new RoleModel(roles.SingleOrDefault(x => x.RoleEnum == Roles.TwineStudioUser))); collection.ToList().ForEach(x => x.IsSelected = user.FSERoles.Any(y => y.Code == x.Role.Code)); RolesCollection = collection; @@ -218,8 +221,6 @@ namespace Tango.FSE.UsersAndRoles.ViewModels InitRolesCollection(User, roles); - CanSetRemoteMachineAccess = CurrentUser.HasRole(Roles.FSEAdministrator); - Validate(); } catch (Exception ex) diff --git a/Software/Visual_Studio/FSE/Tango.FSE.BL/Services/OrganizationsService.cs b/Software/Visual_Studio/FSE/Tango.FSE.BL/Services/OrganizationsService.cs index 1c2337a0b..417f1bd2f 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.BL/Services/OrganizationsService.cs +++ b/Software/Visual_Studio/FSE/Tango.FSE.BL/Services/OrganizationsService.cs @@ -76,7 +76,7 @@ namespace Tango.FSE.BL.Services using (ObservablesContext db = ObservablesContext.CreateDefault()) { return db.Roles - .Where(x => x.Name.StartsWith("FSE")) + .Where(x => x.Code >= 1000 && x.Code < 3000) //Only FSE & Twine Studio .Include(x => x.RolesPermissions) .Include(x => x.RolesPermissions.Select(y => y.Permission)) .ToList(); diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/HotFolder/DefaultHotFolderService.cs b/Software/Visual_Studio/FSE/Tango.FSE.UI/HotFolder/DefaultHotFolderService.cs index fe9d36389..77ad2fb52 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.UI/HotFolder/DefaultHotFolderService.cs +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/HotFolder/DefaultHotFolderService.cs @@ -41,12 +41,15 @@ namespace Tango.FSE.UI.HotFolder Enabled = settings.EnableHotFolder; - String defaultPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), - "Twine", "Tango", "Hot Folder", BuildProvider.Build.ToDescription()); + if (Enabled) + { + String defaultPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), + "Twine", "Tango", "Hot Folder", BuildProvider.Build.ToDescription()); - HotFolderPath = settings.HotFolderPath.IsNotNullOrEmpty() ? settings.HotFolderPath : defaultPath; + HotFolderPath = settings.HotFolderPath.IsNotNullOrEmpty() ? settings.HotFolderPath : defaultPath; - MachineProvider.MachineConnected += MachineProvider_MachineConnected; + MachineProvider.MachineConnected += MachineProvider_MachineConnected; + } } private void MachineProvider_MachineConnected(object sender, MachineConnectedEventArgs e) diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs index ba7499cc1..cb90442eb 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs @@ -340,6 +340,11 @@ namespace Tango.PPC.Common } /// <summary> + /// Gets or sets a value indicating whether to enable remote job uploads. + /// </summary> + public bool EnableRemoteJobUpload { get; set; } + + /// <summary> /// Gets the machine service address. /// </summary> /// <returns></returns> @@ -404,6 +409,7 @@ namespace Tango.PPC.Common DefaultTabColorSpace = ColorSpaces.CMYK; ScreenSaverStartDuration = 5; EnableScreenSaver = true; + EnableRemoteJobUpload = true; } } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/RemoteJobUpload/DefaultRemoteJobUploadService.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/RemoteJobUpload/DefaultRemoteJobUploadService.cs index 2883c7086..e7a13a0fc 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/RemoteJobUpload/DefaultRemoteJobUploadService.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/RemoteJobUpload/DefaultRemoteJobUploadService.cs @@ -30,7 +30,11 @@ namespace Tango.PPC.Common.RemoteJobUpload public event EventHandler<RemoteJobReceivedEventArgs> JobReceived; - public bool Enabled { get; set; } = true; + public bool Enabled + { + get { return _settings.EnableRemoteJobUpload; } + set { _settings.EnableRemoteJobUpload = value; } + } public DefaultRemoteJobUploadService(IPPCExternalBridgeService externalBridge) { |
