Apply UI values regardless of add or edit code path (#1926)

This commit is contained in:
Karl Burtram
2023-03-08 17:38:21 -08:00
committed by GitHub
parent 94becba176
commit b424d45902

View File

@@ -109,23 +109,23 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
this.isSchemaOwned = new Dictionary<string, bool>(); this.isSchemaOwned = new Dictionary<string, bool>();
this.isMember = new Dictionary<string, bool>(); this.isMember = new Dictionary<string, bool>();
// load user properties from SMO object
if (!context.IsNewObject) if (!context.IsNewObject)
{ {
this.LoadUserData(context); 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.password = DatabaseUtils.GetReadOnlySecureString(userInfo.Password);
this.mappedLoginName = userInfo.LoginName; }
this.defaultSchemaName = userInfo.DefaultSchema; }
if (!string.IsNullOrEmpty(userInfo.Password))
{
this.password = DatabaseUtils.GetReadOnlySecureString(userInfo.Password);
}
}
}
this.LoadRoleMembership(context, userInfo); this.LoadRoleMembership(context, userInfo);