mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-03-26 06:40:30 -04:00
remove auth type from user (#22905)
* remove auth type from user * vbump sts
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as nls from 'vscode-nls';
|
||||
import { ObjectManagement } from 'mssql';
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
// Object Types
|
||||
@@ -167,10 +168,11 @@ export const OldPasswordCannotBeEmptyError = localize('objectManagement.login.ol
|
||||
|
||||
// User
|
||||
export const UserTypeText = localize('objectManagement.user.type', "Type");
|
||||
export const UserWithLoginText = localize('objectManagement.user.userWithLogin', "User with login");
|
||||
export const UserWithWindowsGroupLoginText = localize('objectManagement.user.userWithGroupLogin', "User with Windows group login");
|
||||
export const ContainedUserText = localize('objectManagement.user.containedUser', "Contained user");
|
||||
export const UserWithNoConnectAccess = localize('objectManagement.user.userWithNoConnectAccess', "User with no connect access");
|
||||
export const UserType_LoginMapped = localize('objectManagement.user.loginMapped', "Mapped to a server login");
|
||||
export const UserType_WindowsUser = localize('objectManagement.user.windowsUser', "Mapped to a Windows user/group");
|
||||
export const UserType_SqlAuthentication = localize('objectManagement.user.sqlAuth', "Authenticate with password");
|
||||
export const UserType_AADAuthentication = localize('objectManagement.user.aadAuth', "Authenticate with Azure Active Directory");
|
||||
export const UserType_NoLoginAccess = localize('objectManagement.user.noLogin', "No Login Access");
|
||||
export const DefaultSchemaText = localize('objectManagement.user.defaultSchemaLabel', "Default schema");
|
||||
export const LoginText = localize('objectManagement.user.loginLabel', "Login");
|
||||
export const OwnedSchemaSectionHeader = localize('objectManagement.user.ownedSchemasLabel', "Owned Schemas");
|
||||
@@ -193,3 +195,72 @@ export const LoadingObjectsText = localize('objectManagement.loadingObjectsLabel
|
||||
export function LoadingObjectsCompletedText(count: number): string {
|
||||
return localize('objectManagement.loadingObjectsCompletedLabel', "Loading objects completed, {0} objects found", count);
|
||||
}
|
||||
|
||||
// Util functions
|
||||
|
||||
export function getNodeTypeDisplayName(type: string, inTitle: boolean = false): string {
|
||||
switch (type) {
|
||||
case ObjectManagement.NodeType.ApplicationRole:
|
||||
return inTitle ? ApplicationRoleTypeDisplayNameInTitle : ApplicationRoleTypeDisplayName;
|
||||
case ObjectManagement.NodeType.DatabaseRole:
|
||||
return inTitle ? DatabaseRoleTypeDisplayNameInTitle : DatabaseRoleTypeDisplayName;
|
||||
case ObjectManagement.NodeType.ServerLevelLogin:
|
||||
return inTitle ? LoginTypeDisplayNameInTitle : LoginTypeDisplayName;
|
||||
case ObjectManagement.NodeType.ServerLevelServerRole:
|
||||
return inTitle ? ServerRoleTypeDisplayNameInTitle : ServerRoleTypeDisplayName;
|
||||
case ObjectManagement.NodeType.User:
|
||||
return inTitle ? UserTypeDisplayNameInTitle : UserTypeDisplayName;
|
||||
case ObjectManagement.NodeType.Table:
|
||||
return TableTypeDisplayName;
|
||||
case ObjectManagement.NodeType.View:
|
||||
return ViewTypeDisplayName;
|
||||
case ObjectManagement.NodeType.Column:
|
||||
return ColumnTypeDisplayName;
|
||||
case ObjectManagement.NodeType.Database:
|
||||
return DatabaseTypeDisplayName;
|
||||
default:
|
||||
throw new Error(`Unknown node type: ${type}`);
|
||||
}
|
||||
}
|
||||
|
||||
const AuthencationTypeDisplayNameMap = new Map<ObjectManagement.AuthenticationType, string>();
|
||||
AuthencationTypeDisplayNameMap.set(ObjectManagement.AuthenticationType.Windows, WindowsAuthenticationTypeDisplayText);
|
||||
AuthencationTypeDisplayNameMap.set(ObjectManagement.AuthenticationType.Sql, SQLAuthenticationTypeDisplayText);
|
||||
AuthencationTypeDisplayNameMap.set(ObjectManagement.AuthenticationType.AzureActiveDirectory, AADAuthenticationTypeDisplayText);
|
||||
|
||||
export function getAuthenticationTypeDisplayName(authType: ObjectManagement.AuthenticationType): string {
|
||||
if (AuthencationTypeDisplayNameMap.has(authType)) {
|
||||
return AuthencationTypeDisplayNameMap.get(authType);
|
||||
}
|
||||
throw new Error(`Unknown authentication type: ${authType}`);
|
||||
}
|
||||
|
||||
export function getAuthenticationTypeByDisplayName(displayName: string): ObjectManagement.AuthenticationType {
|
||||
for (let [key, value] of AuthencationTypeDisplayNameMap.entries()) {
|
||||
if (value === displayName)
|
||||
return key;
|
||||
}
|
||||
throw new Error(`Unknown authentication type display name: ${displayName}`);
|
||||
}
|
||||
|
||||
const UserTypeDisplayNameMap = new Map<ObjectManagement.UserType, string>();
|
||||
UserTypeDisplayNameMap.set(ObjectManagement.UserType.LoginMapped, UserType_LoginMapped);
|
||||
UserTypeDisplayNameMap.set(ObjectManagement.UserType.WindowsUser, UserType_WindowsUser);
|
||||
UserTypeDisplayNameMap.set(ObjectManagement.UserType.SqlAuthentication, UserType_SqlAuthentication);
|
||||
UserTypeDisplayNameMap.set(ObjectManagement.UserType.AADAuthentication, UserType_AADAuthentication);
|
||||
UserTypeDisplayNameMap.set(ObjectManagement.UserType.NoLoginAccess, UserType_NoLoginAccess);
|
||||
|
||||
export function getUserTypeDisplayName(userType: ObjectManagement.UserType): string {
|
||||
if (UserTypeDisplayNameMap.has(userType)) {
|
||||
return UserTypeDisplayNameMap.get(userType);
|
||||
}
|
||||
throw new Error(`Unknown user type: ${userType}`);
|
||||
}
|
||||
|
||||
export function getUserTypeByDisplayName(displayName: string): ObjectManagement.UserType {
|
||||
for (let [key, value] of UserTypeDisplayNameMap.entries()) {
|
||||
if (value === displayName)
|
||||
return key;
|
||||
}
|
||||
throw new Error(`Unknown user type display name: ${displayName}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user