Commit 45283d57b587414b9c529a0347754e263323275e
1 parent
edc813b5
- beépülők frissítése
Showing
4 changed files
with
14 additions
and
10 deletions
Show diff stats
Vrh.Log4Pro.MaintenanceConsole/Manager - UserManager.cs
@@ -152,9 +152,13 @@ namespace Vrh.Log4Pro.MaintenanceConsole.UserManagerNS | @@ -152,9 +152,13 @@ namespace Vrh.Log4Pro.MaintenanceConsole.UserManagerNS | ||
152 | private static object CreateAdminusers(object parameter, object o) | 152 | private static object CreateAdminusers(object parameter, object o) |
153 | { | 153 | { |
154 | var config = (parameter as Menu.ExecutorParameter).GetConfig<Log4ProUserManagerXmlProcessor>(); | 154 | var config = (parameter as Menu.ExecutorParameter).GetConfig<Log4ProUserManagerXmlProcessor>(); |
155 | - try | 155 | + var adminun = ColorConsole.ReadLine($"Enter administrator name:", ConsoleColor.Yellow); |
156 | + if (adminun.ToUpper() == "EX") { return null; } | ||
157 | + var adminpsw = ColorConsole.ReadLine($"Enter administrator password:", ConsoleColor.Yellow); | ||
158 | + if (adminpsw.ToUpper() == "EX") { return null; } | ||
159 | + try | ||
156 | { | 160 | { |
157 | - MembershipTools.Users.CreateAdminRolesAndUsers(); | 161 | + MembershipTools.Users.CreateAdminRolesAndUsers(adminpsw); |
158 | ColorConsole.WriteLine($"Creating admin users was successful!", ConsoleColor.Green); | 162 | ColorConsole.WriteLine($"Creating admin users was successful!", ConsoleColor.Green); |
159 | } | 163 | } |
160 | catch (Exception ex) { ColorConsole.WriteLine(ex.Message, ConsoleColor.Red); } | 164 | catch (Exception ex) { ColorConsole.WriteLine(ex.Message, ConsoleColor.Red); } |
Vrh.Log4Pro.MaintenanceConsole/Tools - Membership.cs
@@ -47,9 +47,8 @@ namespace Vrh.Log4Pro.MaintenanceConsole.ToolsNS | @@ -47,9 +47,8 @@ namespace Vrh.Log4Pro.MaintenanceConsole.ToolsNS | ||
47 | public const string ROLENAME_ADMINISTRATOR = "Administrator"; | 47 | public const string ROLENAME_ADMINISTRATOR = "Administrator"; |
48 | public const string ROLENAME_ADMIN = "Admin"; | 48 | public const string ROLENAME_ADMIN = "Admin"; |
49 | public const string USERNAME_ADMINISTRATOR = "Administrator"; | 49 | public const string USERNAME_ADMINISTRATOR = "Administrator"; |
50 | - public const string PASSWORD_ADMINISTRATOR = "Admin123"; | ||
51 | public const string USERNAME_ADMIN = "Admin"; | 50 | public const string USERNAME_ADMIN = "Admin"; |
52 | - public const string PASSWORD_ADMIN = "Admin123"; | 51 | + public const string PASSWORD_ADMINISTRATOR = "Admin123"; |
53 | public static readonly string[] SYSTEMUSERNAMELIST = new string[] { ROLENAME_ADMIN, USERNAME_ADMINISTRATOR }; | 52 | public static readonly string[] SYSTEMUSERNAMELIST = new string[] { ROLENAME_ADMIN, USERNAME_ADMINISTRATOR }; |
54 | public static readonly DateTime NEVERONLINE = new DateTime(2000, 1, 1); | 53 | public static readonly DateTime NEVERONLINE = new DateTime(2000, 1, 1); |
55 | } | 54 | } |
@@ -119,7 +118,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.ToolsNS | @@ -119,7 +118,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.ToolsNS | ||
119 | } | 118 | } |
120 | #endregion ellenőrzések | 119 | #endregion ellenőrzések |
121 | 120 | ||
122 | - CreateAdminRolesAndUsers(); | 121 | + CreateAdminRolesAndUsers(username,password); |
123 | MembershipUser user = Membership.GetUser(username); | 122 | MembershipUser user = Membership.GetUser(username); |
124 | if (user == null) | 123 | if (user == null) |
125 | { | 124 | { |
@@ -177,8 +176,9 @@ namespace Vrh.Log4Pro.MaintenanceConsole.ToolsNS | @@ -177,8 +176,9 @@ namespace Vrh.Log4Pro.MaintenanceConsole.ToolsNS | ||
177 | } | 176 | } |
178 | #endregion Create | 177 | #endregion Create |
179 | #region CreateAdminRolesAndUsers | 178 | #region CreateAdminRolesAndUsers |
180 | - public static void CreateAdminRolesAndUsers() | 179 | + public static void CreateAdminRolesAndUsers(string adminun=null, string adminpsw=null) |
181 | { | 180 | { |
181 | + if (string.IsNullOrWhiteSpace(adminpsw)) adminun = Constants.USERNAME_ADMIN; | ||
182 | MembershipUser user; | 182 | MembershipUser user; |
183 | if (!System.Web.Security.Roles.RoleExists(Constants.ROLENAME_ADMINISTRATOR)) { System.Web.Security.Roles.CreateRole(Constants.ROLENAME_ADMINISTRATOR); } | 183 | if (!System.Web.Security.Roles.RoleExists(Constants.ROLENAME_ADMINISTRATOR)) { System.Web.Security.Roles.CreateRole(Constants.ROLENAME_ADMINISTRATOR); } |
184 | if (!System.Web.Security.Roles.RoleExists(Constants.ROLENAME_ADMIN)) { System.Web.Security.Roles.CreateRole(Constants.ROLENAME_ADMIN); } | 184 | if (!System.Web.Security.Roles.RoleExists(Constants.ROLENAME_ADMIN)) { System.Web.Security.Roles.CreateRole(Constants.ROLENAME_ADMIN); } |
@@ -186,7 +186,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.ToolsNS | @@ -186,7 +186,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.ToolsNS | ||
186 | user = Membership.GetUser(Constants.USERNAME_ADMIN); | 186 | user = Membership.GetUser(Constants.USERNAME_ADMIN); |
187 | if (user == null) | 187 | if (user == null) |
188 | { | 188 | { |
189 | - user = Membership.CreateUser(Constants.USERNAME_ADMIN, Constants.PASSWORD_ADMIN); | 189 | + user = Membership.CreateUser(Constants.USERNAME_ADMIN, Constants.PASSWORD_ADMINISTRATOR); |
190 | } | 190 | } |
191 | if (!System.Web.Security.Roles.IsUserInRole(Constants.USERNAME_ADMIN, Constants.ROLENAME_ADMINISTRATOR)) { System.Web.Security.Roles.AddUserToRole(Constants.USERNAME_ADMIN, Constants.ROLENAME_ADMINISTRATOR); } | 191 | if (!System.Web.Security.Roles.IsUserInRole(Constants.USERNAME_ADMIN, Constants.ROLENAME_ADMINISTRATOR)) { System.Web.Security.Roles.AddUserToRole(Constants.USERNAME_ADMIN, Constants.ROLENAME_ADMINISTRATOR); } |
192 | if (!System.Web.Security.Roles.IsUserInRole(Constants.USERNAME_ADMIN, Constants.ROLENAME_ADMIN)) { System.Web.Security.Roles.AddUserToRole(Constants.USERNAME_ADMIN, Constants.ROLENAME_ADMIN); } | 192 | if (!System.Web.Security.Roles.IsUserInRole(Constants.USERNAME_ADMIN, Constants.ROLENAME_ADMIN)) { System.Web.Security.Roles.AddUserToRole(Constants.USERNAME_ADMIN, Constants.ROLENAME_ADMIN); } |
Vrh.Log4Pro.MaintenanceConsole/Vrh.Log4Pro.MaintenanceConsole.csproj
@@ -359,8 +359,8 @@ | @@ -359,8 +359,8 @@ | ||
359 | <Reference Include="Vrh.Web.Providers, Version=2.0.2.0, Culture=neutral, processorArchitecture=MSIL"> | 359 | <Reference Include="Vrh.Web.Providers, Version=2.0.2.0, Culture=neutral, processorArchitecture=MSIL"> |
360 | <HintPath>..\packages\VRH.Web.Providers.2.0.2\lib\net452\Vrh.Web.Providers.dll</HintPath> | 360 | <HintPath>..\packages\VRH.Web.Providers.2.0.2\lib\net452\Vrh.Web.Providers.dll</HintPath> |
361 | </Reference> | 361 | </Reference> |
362 | - <Reference Include="Vrh.XmlProcessing, Version=1.31.0.0, Culture=neutral, processorArchitecture=MSIL"> | ||
363 | - <HintPath>..\packages\Vrh.XmlProcessing.1.31.0\lib\net45\Vrh.XmlProcessing.dll</HintPath> | 362 | + <Reference Include="Vrh.XmlProcessing, Version=1.32.0.0, Culture=neutral, processorArchitecture=MSIL"> |
363 | + <HintPath>..\packages\Vrh.XmlProcessing.1.32.0\lib\net45\Vrh.XmlProcessing.dll</HintPath> | ||
364 | </Reference> | 364 | </Reference> |
365 | <Reference Include="WindowsBase" /> | 365 | <Reference Include="WindowsBase" /> |
366 | </ItemGroup> | 366 | </ItemGroup> |
Vrh.Log4Pro.MaintenanceConsole/packages.config
@@ -75,5 +75,5 @@ | @@ -75,5 +75,5 @@ | ||
75 | <package id="System.Xml.XDocument" version="4.0.11" targetFramework="net472" /> | 75 | <package id="System.Xml.XDocument" version="4.0.11" targetFramework="net472" /> |
76 | <package id="VRH.Common" version="3.0.0" targetFramework="net472" /> | 76 | <package id="VRH.Common" version="3.0.0" targetFramework="net472" /> |
77 | <package id="VRH.Web.Providers" version="2.0.2" targetFramework="net472" /> | 77 | <package id="VRH.Web.Providers" version="2.0.2" targetFramework="net472" /> |
78 | - <package id="Vrh.XmlProcessing" version="1.31.0" targetFramework="net472" /> | 78 | + <package id="Vrh.XmlProcessing" version="1.32.0" targetFramework="net472" /> |
79 | </packages> | 79 | </packages> |
80 | \ No newline at end of file | 80 | \ No newline at end of file |