Added registry check to allow system admins to disable uploads

This commit is contained in:
Erik Tönsfeldt 2021-09-14 13:25:46 +02:00
parent 53b5855d1d
commit feedbe6ce4
4 changed files with 35 additions and 0 deletions

View file

@ -3117,5 +3117,16 @@ public static string YourAntiVirusSoftwareOrTheControlledFolderAccessFeatureInWi
"ShareX", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Your system admin disabled the upload feature..
/// </summary>
public static string YourSystemAdminDisabledTheUploadFeature
{
get
{
return ResourceManager.GetString("YourSystemAdminDisabledTheUploadFeature", resourceCulture);
}
}
}
}

View file

@ -568,4 +568,10 @@ Soll ShareX neu gestartet werden?</value>
<data name="AboutForm_AboutForm_Language_fa_IR" xml:space="preserve">
<value>Persisch</value>
</data>
<data name="ThisFeatureWillNotWorkWhenDisableUploadOptionIsEnabled" xml:space="preserve">
<value>Diese Funktion funktioniert nicht, wenn die "DisableUpload"-Option eingeschaltet wurde!</value>
</data>
<data name="YourSystemAdminDisabledTheUploadFeature" xml:space="preserve">
<value>Ihr Systemadministrator hat diese Funktion ausgeschaltet.</value>
</data>
</root>

View file

@ -1097,4 +1097,7 @@ Please run ShareX as administrator to change personal folder path.</value>
<data name="Discord" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\resources\discord.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="YourSystemAdminDisabledTheUploadFeature" xml:space="preserve">
<value>Your system admin disabled the upload feature.</value>
</data>
</root>

View file

@ -1797,6 +1797,21 @@ public static void ShowNotificationTip(string text, string title = "ShareX", int
public static bool IsUploadAllowed()
{
bool isDisabled = false;
try {
isDisabled = RegistryHelpers.CheckRegistry("SOFTWARE\\ShareX", "DisableUpload", "true", Microsoft.Win32.RegistryHive.LocalMachine);
}
catch(Exception e) {
DebugHelper.WriteException(e);
}
if (isDisabled)
{
MessageBox.Show(Resources.YourSystemAdminDisabledTheUploadFeature, "ShareX",
MessageBoxButtons.OK, MessageBoxIcon.Information);
return false;
}
if (Program.Settings.DisableUpload)
{
MessageBox.Show(Resources.ThisFeatureWillNotWorkWhenDisableUploadOptionIsEnabled, "ShareX",