From 8288c4759dc15ed8b49267097b205f6631a6cf97 Mon Sep 17 00:00:00 2001 From: Schwirg László Date: Mon, 30 Sep 2024 16:07:39 +0200 Subject: [PATCH] v1.29.1.0 --- Vrh.Log4Pro.MaintenanceConsole/Manager - SQLDataBaseManager.cs | 19 ++++++++----------- Vrh.Log4Pro.MaintenanceConsole/Properties/AssemblyInfo.cs | 4 ++-- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/Vrh.Log4Pro.MaintenanceConsole/Manager - SQLDataBaseManager.cs b/Vrh.Log4Pro.MaintenanceConsole/Manager - SQLDataBaseManager.cs index 0857744..1387ea7 100644 --- a/Vrh.Log4Pro.MaintenanceConsole/Manager - SQLDataBaseManager.cs +++ b/Vrh.Log4Pro.MaintenanceConsole/Manager - SQLDataBaseManager.cs @@ -330,7 +330,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.SQLDataBaseManagerNS if (string.IsNullOrWhiteSpace(selectedserverloginkey)) { ColorConsole.WriteLine(prefix: $"Enter the parameters for creating server login: {sqld.DBName}. Format:", bracket: "()", text: "LOGINNAME[,PASSWORD][,GRANTORUSER[,GRANTORUSERPASSWORD]]", f: ConsoleColor.Yellow); - ColorConsole.WriteLine(prefix: " ", text: "LOGINNAME", bracket: "", suffix: $": server login name"); + ColorConsole.WriteLine(prefix: " ", text: "LOGINNAME", bracket: "", suffix: $": server login name;"); ColorConsole.WriteLine(prefix: " ", text: "PASSWORD", bracket: "", suffix: $": password for login; empty=windows login is created, non empty=sql login is created"); ColorConsole.WriteLine(prefix: " ", text: "GRANTORUSER", bracket: "", suffix: $": name of the user in behalf the login is created (that logs in the sql server); default:current user with windows authentication"); ColorConsole.WriteLine(prefix: " ", text: "GRANTORUSERPASSWORD", bracket: "", suffix: $": password for GRANTORUSER;default:empy (windows authentication is used with GRANTORUSER)"); @@ -338,7 +338,6 @@ namespace Vrh.Log4Pro.MaintenanceConsole.SQLDataBaseManagerNS var createuseroptions = ColorConsole.ReadLine($"EX=exit.", ConsoleColor.Yellow, suffix: " --> "); if (createuseroptions.ToUpper() == "EX") { return o; } - SQLDataBase.ServerLogin SRVRLogin = CheckParametersInteractive(sqld.DBName, createuseroptions); if (SRVRLogin==null) goto getparametersloop; ServerLoginsToExecuteList.Add(SRVRLogin); @@ -379,8 +378,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.SQLDataBaseManagerNS if (string.IsNullOrWhiteSpace(SRVRLogin_loginpsw)) { ColorConsole.WriteLine("ERROR! PASSWORD, if set, may not be empty!", ConsoleColor.Red); return null; } } - LoginType SRVRLogin_logintype = LoginType.WindowsUser; - if (string.IsNullOrWhiteSpace(SRVRLogin_grantoruserloginname) && string.IsNullOrWhiteSpace(SRVRLogin_grantoruserpsw)) { SRVRLogin_logintype = LoginType.SqlLogin; } + LoginType SRVRLogin_logintype = string.IsNullOrWhiteSpace(SRVRLogin_loginpsw) ? LoginType.WindowsUser : LoginType.SqlLogin; bool SRVRLogin_removeaction = false; string SRVRLogin_defaultdb = "master"; @@ -409,15 +407,13 @@ namespace Vrh.Log4Pro.MaintenanceConsole.SQLDataBaseManagerNS string SRVRLogin_defaultdb = optionList[4]; if (string.IsNullOrWhiteSpace(SRVRLogin_loginname)) { ColorConsole.WriteLine("ERROR! LOGIN NAME is mandatory!", ConsoleColor.Red); return null; } - if (string.IsNullOrWhiteSpace(SRVRLogin_loginpsw)) { ColorConsole.WriteLine("ERROR! LOGIN PASSWORD is mandatory!", ConsoleColor.Red); return null; } if (!string.IsNullOrWhiteSpace(SRVRLogin_grantoruserloginname) && string.IsNullOrWhiteSpace(SRVRLogin_grantoruserpsw) || string.IsNullOrWhiteSpace(SRVRLogin_grantoruserloginname) && !string.IsNullOrWhiteSpace(SRVRLogin_grantoruserpsw)) { ColorConsole.WriteLine("ERROR! GRANTORUSER/GRANTORUSERPASSWORD, both must be empty or both must be non-empty!", ConsoleColor.Red); return null; } if (string.IsNullOrWhiteSpace(SRVRLogin_defaultdb)) { SRVRLogin_defaultdb="master"; } - LoginType SRVRLogin_logintype = LoginType.WindowsUser; - if (string.IsNullOrWhiteSpace(SRVRLogin_grantoruserloginname) && string.IsNullOrWhiteSpace(SRVRLogin_grantoruserpsw)) { SRVRLogin_logintype = LoginType.SqlLogin; } + LoginType SRVRLogin_logintype = string.IsNullOrWhiteSpace(SRVRLogin_loginpsw) ? LoginType.WindowsUser : LoginType.SqlLogin; bool SRVRLogin_removeaction = false; @@ -439,8 +435,9 @@ namespace Vrh.Log4Pro.MaintenanceConsole.SQLDataBaseManagerNS try { string removeactionText = srvrlogintoexecute.Remove ? "REMOVE" : "CREATE"; - string passwordtext = srvrlogintoexecute.LoginType == LoginType.WindowsUser ? "" : $", password:{srvrlogintoexecute.LoginPassword}"; - string SRVRLogin_fulldesignation = $"db={srvrlogintoexecute.Db},login name={srvrlogintoexecute.LoginName},login type: {srvrlogintoexecute.LoginType}{passwordtext}"; + string passwordtext = srvrlogintoexecute.LoginType == LoginType.WindowsUser ? "" : $" (psw:{srvrlogintoexecute.LoginPassword})"; + string grantorusertext = !string.IsNullOrWhiteSpace(srvrlogintoexecute.GrantorUserLoginName) && !string.IsNullOrWhiteSpace(srvrlogintoexecute.GrantorUserLoginPassword) ? $",grantor user:{srvrlogintoexecute.GrantorUserLoginName} (psw:{srvrlogintoexecute.GrantorUserLoginPassword})" : ""; + string SRVRLogin_fulldesignation = $"db={srvrlogintoexecute.Db},login type: {srvrlogintoexecute.LoginType},login name={srvrlogintoexecute.LoginName}{passwordtext}{grantorusertext}"; if (!allconfirmed) { ColorConsole.WriteLine(); @@ -2469,7 +2466,7 @@ GO public static class LoginName { public static class Values { public const string DEFAULT = ""; } } public static class LoginPassword { public static class Values { public const string DEFAULT = ""; } } public static class GrantorLoginName { public static class Values { public const string DEFAULT = ""; } } - public static class GrantorLoginPsw { public static class Values { public const string DEFAULT = ""; } } + public static class GrantorLoginPassword { public static class Values { public const string DEFAULT = ""; } } public static class DefaultDatabase{ public static class Values { public const string DEFAULT = ""; } } } } @@ -2635,7 +2632,7 @@ GO LoginName = GetValue(nameof(XmlStructure.SQLDataBase.ServerLogins.ServerLogin.Attributes.LoginName), dbusrXml, XmlStructure.SQLDataBase.ServerLogins.ServerLogin.Attributes.LoginName.Values.DEFAULT); LoginPassword = GetValue(nameof(XmlStructure.SQLDataBase.ServerLogins.ServerLogin.Attributes.LoginPassword), dbusrXml, XmlStructure.SQLDataBase.ServerLogins.ServerLogin.Attributes.LoginPassword.Values.DEFAULT); GrantorUserLoginName = GetValue(nameof(XmlStructure.SQLDataBase.ServerLogins.ServerLogin.Attributes.GrantorLoginName), dbusrXml, XmlStructure.SQLDataBase.ServerLogins.ServerLogin.Attributes.GrantorLoginName.Values.DEFAULT); - GrantorUserLoginPassword = GetValue(nameof(XmlStructure.SQLDataBase.ServerLogins.ServerLogin.Attributes.GrantorLoginPsw), dbusrXml, XmlStructure.SQLDataBase.ServerLogins.ServerLogin.Attributes.GrantorLoginPsw.Values.DEFAULT); + GrantorUserLoginPassword = GetValue(nameof(XmlStructure.SQLDataBase.ServerLogins.ServerLogin.Attributes.GrantorLoginPassword), dbusrXml, XmlStructure.SQLDataBase.ServerLogins.ServerLogin.Attributes.GrantorLoginPassword.Values.DEFAULT); DefaultDatabase = GetValue(nameof(XmlStructure.SQLDataBase.ServerLogins.ServerLogin.Attributes.DefaultDatabase), dbusrXml, XmlStructure.SQLDataBase.ServerLogins.ServerLogin.Attributes.DefaultDatabase.Values.DEFAULT); } #endregion constructors diff --git a/Vrh.Log4Pro.MaintenanceConsole/Properties/AssemblyInfo.cs b/Vrh.Log4Pro.MaintenanceConsole/Properties/AssemblyInfo.cs index 695667b..8f952c8 100644 --- a/Vrh.Log4Pro.MaintenanceConsole/Properties/AssemblyInfo.cs +++ b/Vrh.Log4Pro.MaintenanceConsole/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.29.0.0")] -[assembly: AssemblyFileVersion("1.29.0.0")] +[assembly: AssemblyVersion("1.29.1.0")] +[assembly: AssemblyFileVersion("1.29.1.0")] -- libgit2 0.21.2