From fe7a307bb2a3cea82c4b4f7a340c9f4672880914 Mon Sep 17 00:00:00 2001 From: Rob Reynolds Date: Tue, 29 Aug 2017 13:45:50 -0500 Subject: [PATCH] (GH-432) Admin only repositories Set up an admin only repository to be set and configured by ChocolateyGUI. --- Source/ChocolateyGui.Shared/Models/ChocolateySource.cs | 4 ++++ Source/ChocolateyGui.Subprocess/ChocolateyService.cs | 1 + Source/ChocolateyGui/Views/SettingsView.xaml | 1 + 3 files changed, 6 insertions(+) diff --git a/Source/ChocolateyGui.Shared/Models/ChocolateySource.cs b/Source/ChocolateyGui.Shared/Models/ChocolateySource.cs index 6e34dee14..cb335cde8 100644 --- a/Source/ChocolateyGui.Shared/Models/ChocolateySource.cs +++ b/Source/ChocolateyGui.Shared/Models/ChocolateySource.cs @@ -40,6 +40,8 @@ public class ChocolateySource : IEquatable public bool AllowSelfService { get; set; } + public bool VisibleToAdminsOnly { get; set; } + public bool Equals(ChocolateySource other) { if (ReferenceEquals(null, other)) @@ -62,6 +64,7 @@ public bool Equals(ChocolateySource other) && string.Equals(CertificatePassword, other.CertificatePassword) && BypassProxy == other.BypassProxy && AllowSelfService == other.AllowSelfService + && VisibleToAdminsOnly == other.VisibleToAdminsOnly ; } @@ -99,6 +102,7 @@ public override int GetHashCode() hashCode = (hashCode * 397) ^ (CertificatePassword?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ BypassProxy.GetHashCode(); hashCode = (hashCode * 397) ^ AllowSelfService.GetHashCode(); + hashCode = (hashCode * 397) ^ VisibleToAdminsOnly.GetHashCode(); return hashCode; } } diff --git a/Source/ChocolateyGui.Subprocess/ChocolateyService.cs b/Source/ChocolateyGui.Subprocess/ChocolateyService.cs index 16b9b2069..dab567c58 100644 --- a/Source/ChocolateyGui.Subprocess/ChocolateyService.cs +++ b/Source/ChocolateyGui.Subprocess/ChocolateyService.cs @@ -421,6 +421,7 @@ public async Task AddSource(ChocolateySource source) config.SourceCommand.Priority = source.Priority; config.SourceCommand.BypassProxy = source.BypassProxy; config.SourceCommand.AllowSelfService = source.AllowSelfService; + config.SourceCommand.VisibleToAdminsOnly = source.VisibleToAdminsOnly; }); await choco.RunAsync(operationContext.GetCancellationToken()); diff --git a/Source/ChocolateyGui/Views/SettingsView.xaml b/Source/ChocolateyGui/Views/SettingsView.xaml index eef9b053c..8e89fa9c2 100644 --- a/Source/ChocolateyGui/Views/SettingsView.xaml +++ b/Source/ChocolateyGui/Views/SettingsView.xaml @@ -116,6 +116,7 @@ +