Prepopulate server roles in Login dialog (#2011)

This commit is contained in:
Karl Burtram
2023-04-17 16:11:49 -07:00
committed by GitHub
parent add216cc1e
commit 54bd06ef98
2 changed files with 3 additions and 2 deletions

View File

@@ -101,8 +101,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
} }
// TODO move this to LoginData // TODO move this to LoginData
// TODO support role assignment for Azure // TODO support role assignment for Azure
prototype.ServerRoles.PopulateServerRoles();
foreach (string role in login.ServerRoles ?? Enumerable.Empty<string>()) foreach (string role in login.ServerRoles ?? Enumerable.Empty<string>())
{ {
prototype.ServerRoles.SetMember(role, true); prototype.ServerRoles.SetMember(role, true);

View File

@@ -1514,6 +1514,7 @@ INNER JOIN sys.sql_logins AS sql_logins
} }
this.serverRoles = new ServerRoles(server, login.Name); this.serverRoles = new ServerRoles(server, login.Name);
this.serverRoles.PopulateServerRoles();
this.databaseRolesCollection = new HybridDictionary(); this.databaseRolesCollection = new HybridDictionary();
if (server.Information.Version.Major == 9 && !string.IsNullOrEmpty(login.Credential)) if (server.Information.Version.Major == 9 && !string.IsNullOrEmpty(login.Credential))
{ {
@@ -1539,6 +1540,7 @@ INNER JOIN sys.sql_logins AS sql_logins
this.defaultLanguage = LoginPrototypeData.DefaultLanguageDisplay; this.defaultLanguage = LoginPrototypeData.DefaultLanguageDisplay;
this.serverRoles = new ServerRoles(server); this.serverRoles = new ServerRoles(server);
this.serverRoles.PopulateServerRoles();
this.databaseRolesCollection = new HybridDictionary(); this.databaseRolesCollection = new HybridDictionary();
this.credentials = new StringCollection(); this.credentials = new StringCollection();
} }