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);