mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-02-16 10:58:30 -05:00
Fix exception creating user with no connect access (#1989)
This commit is contained in:
@@ -130,6 +130,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
|
|||||||
{
|
{
|
||||||
this.defaultLanguageAlias = LanguageUtils.GetLanguageAliasFromDisplayText(userInfo.DefaultLanguage);
|
this.defaultLanguageAlias = LanguageUtils.GetLanguageAliasFromDisplayText(userInfo.DefaultLanguage);
|
||||||
}
|
}
|
||||||
|
this.userType = UserPrototypeData.GetUserTypeFromUserInfo(userInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.LoadRoleMembership(context, userInfo);
|
this.LoadRoleMembership(context, userInfo);
|
||||||
@@ -137,6 +138,19 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
|
|||||||
this.LoadSchemaData(context, userInfo);
|
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()
|
public UserPrototypeData Clone()
|
||||||
{
|
{
|
||||||
UserPrototypeData result = new UserPrototypeData();
|
UserPrototypeData result = new UserPrototypeData();
|
||||||
|
|||||||
Reference in New Issue
Block a user