mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-02-16 18:47:57 -05:00
Fix 'Contained DB' property check exception on SQL DB (#1979)
This commit is contained in:
@@ -152,9 +152,13 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
|
|||||||
defaultSchema = defaultSchemaPrototype.DefaultSchema;
|
defaultSchema = defaultSchemaPrototype.DefaultSchema;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ServerConnection serverConnection = dataContainer.ServerConnection;
|
||||||
|
bool isSqlAzure = serverConnection.DatabaseEngineType == DatabaseEngineType.SqlAzureDatabase;
|
||||||
|
bool supportsContainedUser = isSqlAzure || UserActions.IsParentDatabaseContained(parentDb);
|
||||||
|
|
||||||
// set default alias to <default> if needed
|
// set default alias to <default> if needed
|
||||||
if (string.IsNullOrEmpty(defaultLanguageAlias)
|
if (string.IsNullOrEmpty(defaultLanguageAlias)
|
||||||
&& parentDb.ContainmentType != ContainmentType.None
|
&& supportsContainedUser
|
||||||
&& LanguageUtils.IsDefaultLanguageSupported(dataContainer.Server))
|
&& LanguageUtils.IsDefaultLanguageSupported(dataContainer.Server))
|
||||||
{
|
{
|
||||||
defaultLanguageAlias = SR.DefaultLanguagePlaceholder;
|
defaultLanguageAlias = SR.DefaultLanguagePlaceholder;
|
||||||
@@ -198,7 +202,6 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ServerConnection serverConnection = dataContainer.ServerConnection;
|
|
||||||
UserViewInfo userViewInfo = new UserViewInfo()
|
UserViewInfo userViewInfo = new UserViewInfo()
|
||||||
{
|
{
|
||||||
ObjectInfo = new UserInfo()
|
ObjectInfo = new UserInfo()
|
||||||
@@ -214,7 +217,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
|
|||||||
DefaultLanguage = SecurityService.FormatLanguageDisplay(
|
DefaultLanguage = SecurityService.FormatLanguageDisplay(
|
||||||
languageOptions.FirstOrDefault(o => o?.Language.Name == defaultLanguageAlias || o?.Language.Alias == defaultLanguageAlias, null)),
|
languageOptions.FirstOrDefault(o => o?.Language.Name == defaultLanguageAlias || o?.Language.Alias == defaultLanguageAlias, null)),
|
||||||
},
|
},
|
||||||
SupportContainedUser = UserActions.IsParentDatabaseContained(parentDb), // support for these will be added later
|
SupportContainedUser = supportsContainedUser,
|
||||||
SupportWindowsAuthentication = false,
|
SupportWindowsAuthentication = false,
|
||||||
SupportAADAuthentication = false,
|
SupportAADAuthentication = false,
|
||||||
SupportSQLAuthentication = true,
|
SupportSQLAuthentication = true,
|
||||||
|
|||||||
Reference in New Issue
Block a user