From b424d459029b219747803c1240c61d871b083b4f Mon Sep 17 00:00:00 2001 From: Karl Burtram Date: Wed, 8 Mar 2023 17:38:21 -0800 Subject: [PATCH] Apply UI values regardless of add or edit code path (#1926) --- .../Security/UserData.cs | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/Microsoft.SqlTools.ServiceLayer/Security/UserData.cs b/src/Microsoft.SqlTools.ServiceLayer/Security/UserData.cs index dfba4a3f..f088cad9 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/Security/UserData.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/Security/UserData.cs @@ -109,23 +109,23 @@ namespace Microsoft.SqlTools.ServiceLayer.Security this.isSchemaOwned = new Dictionary(); this.isMember = new Dictionary(); + // load user properties from SMO object if (!context.IsNewObject) { this.LoadUserData(context); } - else + + // apply user properties provided by client + if (userInfo != null) { - if (userInfo != null) + this.name = userInfo.Name; + this.mappedLoginName = userInfo.LoginName; + this.defaultSchemaName = userInfo.DefaultSchema; + if (!string.IsNullOrEmpty(userInfo.Password)) { - this.name = userInfo.Name; - this.mappedLoginName = userInfo.LoginName; - this.defaultSchemaName = userInfo.DefaultSchema; - if (!string.IsNullOrEmpty(userInfo.Password)) - { - this.password = DatabaseUtils.GetReadOnlySecureString(userInfo.Password); - } - } - } + this.password = DatabaseUtils.GetReadOnlySecureString(userInfo.Password); + } + } this.LoadRoleMembership(context, userInfo);