Fix exception creating user with no connect access (#1989)

This commit is contained in:
Karl Burtram
2023-04-04 18:21:28 -07:00
committed by GitHub
parent 7f65b9c5ee
commit b48f1f2833

View File

@@ -130,6 +130,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
{
this.defaultLanguageAlias = LanguageUtils.GetLanguageAliasFromDisplayText(userInfo.DefaultLanguage);
}
this.userType = UserPrototypeData.GetUserTypeFromUserInfo(userInfo);
}
this.LoadRoleMembership(context, userInfo);
@@ -137,6 +138,19 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
this.LoadSchemaData(context, userInfo);
}
public static UserType GetUserTypeFromUserInfo(UserInfo userInfo)
{
UserType userType = UserType.SqlLogin;
switch (userInfo.Type)
{
case DatabaseUserType.NoConnectAccess:
userType = UserType.NoLogin;
break;
// all the other user types are using SqlLogin
}
return userType;
}
public UserPrototypeData Clone()
{
UserPrototypeData result = new UserPrototypeData();