mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
move object management interfaces (#23358)
This commit is contained in:
436
extensions/mssql/src/mssql.d.ts
vendored
436
extensions/mssql/src/mssql.d.ts
vendored
@@ -916,13 +916,6 @@ declare module 'mssql' {
|
|||||||
name: string;
|
name: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Base interface for all the security principal objects. e.g. Login, Server Role, Database Role...
|
|
||||||
*/
|
|
||||||
export interface SecurityPrincipalObject extends SqlObject {
|
|
||||||
securablePermissions: SecurablePermissions[];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base interface for the object view information.
|
* Base interface for the object view information.
|
||||||
*/
|
*/
|
||||||
@@ -933,419 +926,6 @@ declare module 'mssql' {
|
|||||||
objectInfo: T;
|
objectInfo: T;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Securable type metadata.
|
|
||||||
*/
|
|
||||||
export interface SecurableTypeMetadata {
|
|
||||||
/**
|
|
||||||
* Name of the securable type.
|
|
||||||
*/
|
|
||||||
name: string;
|
|
||||||
/**
|
|
||||||
* Display name of the securable type.
|
|
||||||
*/
|
|
||||||
displayName: string;
|
|
||||||
/**
|
|
||||||
* Permissions supported by the securable type.
|
|
||||||
*/
|
|
||||||
permissions: PermissionMetadata[];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Permission metadata.
|
|
||||||
*/
|
|
||||||
export interface PermissionMetadata {
|
|
||||||
/**
|
|
||||||
* Name of the permission.
|
|
||||||
*/
|
|
||||||
name: string;
|
|
||||||
/**
|
|
||||||
* Display name of the permission.
|
|
||||||
*/
|
|
||||||
displayName: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Base interface for security principal object's view information.
|
|
||||||
*/
|
|
||||||
export interface SecurityPrincipalViewInfo<T extends SecurityPrincipalObject> extends ObjectViewInfo<T> {
|
|
||||||
/**
|
|
||||||
* The securable types that the security principal object can be granted permissions on.
|
|
||||||
*/
|
|
||||||
supportedSecurableTypes: SecurableTypeMetadata[];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Base interface for database level security principal object's view information.
|
|
||||||
*/
|
|
||||||
export interface DatabaseLevelPrincipalViewInfo<T extends SecurityPrincipalObject> extends SecurityPrincipalViewInfo<T> {
|
|
||||||
/**
|
|
||||||
* The schemas in the database.
|
|
||||||
*/
|
|
||||||
schemas: string[];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Server level login.
|
|
||||||
*/
|
|
||||||
export interface Login extends SecurityPrincipalObject {
|
|
||||||
/**
|
|
||||||
* Authentication type.
|
|
||||||
*/
|
|
||||||
authenticationType: AuthenticationType;
|
|
||||||
/**
|
|
||||||
* Password for the login.
|
|
||||||
* Only applicable when the authentication type is 'Sql'.
|
|
||||||
*/
|
|
||||||
password: string | undefined;
|
|
||||||
/**
|
|
||||||
* Old password of the login.
|
|
||||||
* Only applicable when the authentication type is 'Sql'.
|
|
||||||
* The old password is required when updating the login's own password and it doesn't have the 'ALTER ANY LOGIN' permission.
|
|
||||||
*/
|
|
||||||
oldPassword: string | undefined;
|
|
||||||
/**
|
|
||||||
* Whether the password complexity policy is enforced.
|
|
||||||
* Only applicable when the authentication type is 'Sql'.
|
|
||||||
*/
|
|
||||||
enforcePasswordPolicy: boolean | undefined;
|
|
||||||
/**
|
|
||||||
* Whether the password expiration policy is enforced.
|
|
||||||
* Only applicable when the authentication type is 'Sql'.
|
|
||||||
*/
|
|
||||||
enforcePasswordExpiration: boolean | undefined;
|
|
||||||
/**
|
|
||||||
* Whether SQL Server should prompt for an updated password when the next the login is used.
|
|
||||||
* Only applicable when the authentication type is 'Sql'.
|
|
||||||
*/
|
|
||||||
mustChangePassword: boolean | undefined;
|
|
||||||
/**
|
|
||||||
* Whether the login is locked out due to password policy violation.
|
|
||||||
* Only applicable when the authentication type is 'Sql'.
|
|
||||||
*/
|
|
||||||
isLockedOut: boolean;
|
|
||||||
/**
|
|
||||||
* The default database for the login.
|
|
||||||
*/
|
|
||||||
defaultDatabase: string;
|
|
||||||
/**
|
|
||||||
* The default language for the login.
|
|
||||||
*/
|
|
||||||
defaultLanguage: string;
|
|
||||||
/**
|
|
||||||
* The server roles of the login.
|
|
||||||
*/
|
|
||||||
serverRoles: string[];
|
|
||||||
/**
|
|
||||||
* The database users the login is mapped to.
|
|
||||||
*/
|
|
||||||
userMapping: ServerLoginUserInfo[];
|
|
||||||
/**
|
|
||||||
* Whether the login is enabled.
|
|
||||||
*/
|
|
||||||
isEnabled: boolean;
|
|
||||||
/**
|
|
||||||
* Whether the connect permission is granted to the login.
|
|
||||||
*/
|
|
||||||
connectPermission: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The authentication types.
|
|
||||||
*/
|
|
||||||
export const enum AuthenticationType {
|
|
||||||
Windows = 'Windows',
|
|
||||||
Sql = 'Sql',
|
|
||||||
AzureActiveDirectory = 'AAD'
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The user mapping information for login.
|
|
||||||
*/
|
|
||||||
export interface ServerLoginUserInfo {
|
|
||||||
/**
|
|
||||||
* Target database name.
|
|
||||||
*/
|
|
||||||
database: string;
|
|
||||||
/**
|
|
||||||
* User name.
|
|
||||||
*/
|
|
||||||
user: string;
|
|
||||||
/**
|
|
||||||
* Default schema of the user.
|
|
||||||
*/
|
|
||||||
defaultSchema: string;
|
|
||||||
/**
|
|
||||||
* Databases roles of the user.
|
|
||||||
*/
|
|
||||||
databaseRoles: string[];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The information required to render the login view.
|
|
||||||
*/
|
|
||||||
export interface LoginViewInfo extends SecurityPrincipalViewInfo<Login> {
|
|
||||||
/**
|
|
||||||
* The authentication types supported by the server.
|
|
||||||
*/
|
|
||||||
authenticationTypes: AuthenticationType[];
|
|
||||||
/**
|
|
||||||
* Whether the locked out state can be changed.
|
|
||||||
*/
|
|
||||||
canEditLockedOutState: boolean;
|
|
||||||
/**
|
|
||||||
* Name of the databases in the server.
|
|
||||||
*/
|
|
||||||
databases: string[];
|
|
||||||
/**
|
|
||||||
* Available languages in the server.
|
|
||||||
*/
|
|
||||||
languages: string[];
|
|
||||||
/**
|
|
||||||
* All server roles in the server.
|
|
||||||
*/
|
|
||||||
serverRoles: string[];
|
|
||||||
/**
|
|
||||||
* Whether advanced password options are supported.
|
|
||||||
* Advanced password options: check policy, check expiration, must change, unlock.
|
|
||||||
* Notes: 2 options to control the advanced options because Analytics Platform supports advanced options but does not support advanced options.
|
|
||||||
*/
|
|
||||||
supportAdvancedPasswordOptions: boolean;
|
|
||||||
/**
|
|
||||||
* Whether advanced options are supported.
|
|
||||||
* Advanced options: default database, default language and connect permission.
|
|
||||||
*/
|
|
||||||
supportAdvancedOptions: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The permission information a principal has on a securable.
|
|
||||||
*/
|
|
||||||
export interface SecurablePermissionItem {
|
|
||||||
/**
|
|
||||||
* name of the permission.
|
|
||||||
*/
|
|
||||||
permission: string;
|
|
||||||
/**
|
|
||||||
* Name of the grantor.
|
|
||||||
*/
|
|
||||||
grantor: string;
|
|
||||||
/**
|
|
||||||
* Whether the permission is granted or denied. Undefined means not specified.
|
|
||||||
*/
|
|
||||||
grant?: boolean;
|
|
||||||
/**
|
|
||||||
* Whether the pincipal can grant this permission to other principals.
|
|
||||||
* The value will be ignored if the grant property is set to false.
|
|
||||||
*/
|
|
||||||
withGrant?: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The permissions a principal has over a securable.
|
|
||||||
*/
|
|
||||||
export interface SecurablePermissions {
|
|
||||||
/**
|
|
||||||
* The securable name.
|
|
||||||
*/
|
|
||||||
name: string;
|
|
||||||
/**
|
|
||||||
* The securable type.
|
|
||||||
*/
|
|
||||||
type: string;
|
|
||||||
/**
|
|
||||||
* The schema name of the object if applicable.
|
|
||||||
*/
|
|
||||||
schema?: string;
|
|
||||||
/**
|
|
||||||
* The permissions.
|
|
||||||
*/
|
|
||||||
permissions: SecurablePermissionItem[];
|
|
||||||
/**
|
|
||||||
* The effective permissions. Includes all permissions granted to the principal, including those granted through role memberships.
|
|
||||||
*/
|
|
||||||
effectivePermissions: string[];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Extend property for objects.
|
|
||||||
*/
|
|
||||||
export interface ExtendedProperty {
|
|
||||||
/**
|
|
||||||
* Name of the property.
|
|
||||||
*/
|
|
||||||
name: string;
|
|
||||||
/**
|
|
||||||
* Value of the property.
|
|
||||||
*/
|
|
||||||
value: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* User types.
|
|
||||||
*/
|
|
||||||
export const enum UserType {
|
|
||||||
/**
|
|
||||||
* Mapped to a server login.
|
|
||||||
*/
|
|
||||||
LoginMapped = 'LoginMapped',
|
|
||||||
/**
|
|
||||||
* Mapped to a Windows user or group.
|
|
||||||
*/
|
|
||||||
WindowsUser = 'WindowsUser',
|
|
||||||
/**
|
|
||||||
* Authenticate with password.
|
|
||||||
*/
|
|
||||||
SqlAuthentication = 'SqlAuthentication',
|
|
||||||
/**
|
|
||||||
* Authenticate with Azure Active Directory.
|
|
||||||
*/
|
|
||||||
AADAuthentication = 'AADAuthentication',
|
|
||||||
/**
|
|
||||||
* User that cannot authenticate.
|
|
||||||
*/
|
|
||||||
NoLoginAccess = 'NoLoginAccess'
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Database user.
|
|
||||||
*/
|
|
||||||
export interface User extends SecurityPrincipalObject {
|
|
||||||
/**
|
|
||||||
* Type of the user.
|
|
||||||
*/
|
|
||||||
type: UserType;
|
|
||||||
/**
|
|
||||||
* Default schema of the user.
|
|
||||||
*/
|
|
||||||
defaultSchema: string | undefined;
|
|
||||||
/**
|
|
||||||
* Schemas owned by the user.
|
|
||||||
*/
|
|
||||||
ownedSchemas: string[];
|
|
||||||
/**
|
|
||||||
* Database roles that the user belongs to.
|
|
||||||
*/
|
|
||||||
databaseRoles: string[];
|
|
||||||
/**
|
|
||||||
* The name of the server login associated with the user.
|
|
||||||
* Only applicable when the user type is 'WithLogin'.
|
|
||||||
*/
|
|
||||||
loginName: string | undefined;
|
|
||||||
/**
|
|
||||||
* The default language of the user.
|
|
||||||
* Only applicable when the user type is 'Contained'.
|
|
||||||
*/
|
|
||||||
defaultLanguage: string | undefined;
|
|
||||||
/**
|
|
||||||
* Password of the user.
|
|
||||||
* Only applicable when the user type is 'Contained' and the authentication type is 'Sql'.
|
|
||||||
*/
|
|
||||||
password: string | undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The information required to render the user view.
|
|
||||||
*/
|
|
||||||
export interface UserViewInfo extends DatabaseLevelPrincipalViewInfo<User> {
|
|
||||||
/**
|
|
||||||
* All user types supported by the database.
|
|
||||||
*/
|
|
||||||
userTypes: UserType[];
|
|
||||||
/**
|
|
||||||
* All languages supported by the database.
|
|
||||||
*/
|
|
||||||
languages: string[];
|
|
||||||
/**
|
|
||||||
* Name of all the logins in the server.
|
|
||||||
*/
|
|
||||||
logins: string[];
|
|
||||||
/**
|
|
||||||
* Name of all the database roles.
|
|
||||||
*/
|
|
||||||
databaseRoles: string[];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Interface representing the server role object.
|
|
||||||
*/
|
|
||||||
export interface ServerRoleInfo extends SecurityPrincipalObject {
|
|
||||||
/**
|
|
||||||
* Name of the server principal that owns the server role.
|
|
||||||
*/
|
|
||||||
owner: string;
|
|
||||||
/**
|
|
||||||
* Name of the server principals that are members of the server role.
|
|
||||||
*/
|
|
||||||
members: string[];
|
|
||||||
/**
|
|
||||||
* Server roles that the server role is a member of.
|
|
||||||
*/
|
|
||||||
memberships: string[];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Interface representing the information required to render the server role view.
|
|
||||||
*/
|
|
||||||
export interface ServerRoleViewInfo extends SecurityPrincipalViewInfo<ServerRoleInfo> {
|
|
||||||
/**
|
|
||||||
* Whether the server role is a fixed role.
|
|
||||||
*/
|
|
||||||
isFixedRole: boolean;
|
|
||||||
/**
|
|
||||||
* List of all the server roles.
|
|
||||||
*/
|
|
||||||
serverRoles: string[];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Interface representing the application role object.
|
|
||||||
*/
|
|
||||||
export interface ApplicationRoleInfo extends SecurityPrincipalObject {
|
|
||||||
/**
|
|
||||||
* Default schema of the application role.
|
|
||||||
*/
|
|
||||||
defaultSchema: string;
|
|
||||||
/**
|
|
||||||
* Schemas owned by the application role.
|
|
||||||
*/
|
|
||||||
ownedSchemas: string[];
|
|
||||||
/**
|
|
||||||
* Password of the application role.
|
|
||||||
*/
|
|
||||||
password: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Interface representing the information required to render the application role view.
|
|
||||||
*/
|
|
||||||
export interface ApplicationRoleViewInfo extends DatabaseLevelPrincipalViewInfo<ApplicationRoleInfo> {
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Interface representing the database role object.
|
|
||||||
*/
|
|
||||||
export interface DatabaseRoleInfo extends SecurityPrincipalObject {
|
|
||||||
/**
|
|
||||||
* Name of the database principal that owns the database role.
|
|
||||||
*/
|
|
||||||
owner: string;
|
|
||||||
/**
|
|
||||||
* Schemas owned by the database role.
|
|
||||||
*/
|
|
||||||
ownedSchemas: string[];
|
|
||||||
/**
|
|
||||||
* Name of the user or database role that are members of the database role.
|
|
||||||
*/
|
|
||||||
members: string[];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Interface representing the information required to render the database role view.
|
|
||||||
*/
|
|
||||||
export interface DatabaseRoleViewInfo extends DatabaseLevelPrincipalViewInfo<DatabaseRoleInfo> {
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface representing an item in the search result.
|
* Interface representing an item in the search result.
|
||||||
*/
|
*/
|
||||||
@@ -1363,22 +943,6 @@ declare module 'mssql' {
|
|||||||
*/
|
*/
|
||||||
schema: string | undefined;
|
schema: string | undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Database extends SqlObject {
|
|
||||||
owner?: string;
|
|
||||||
collationName?: string;
|
|
||||||
recoveryModel?: string;
|
|
||||||
compatibilityLevel?: string;
|
|
||||||
containmentType?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface DatabaseViewInfo extends ObjectViewInfo<Database> {
|
|
||||||
loginNames: string[];
|
|
||||||
collationNames: string[];
|
|
||||||
compatibilityLevels: string[];
|
|
||||||
containmentTypes: string[];
|
|
||||||
recoveryModels: string[];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IObjectManagementService {
|
export interface IObjectManagementService {
|
||||||
|
|||||||
441
extensions/mssql/src/objectManagement/interfaces.ts
Normal file
441
extensions/mssql/src/objectManagement/interfaces.ts
Normal file
@@ -0,0 +1,441 @@
|
|||||||
|
/*---------------------------------------------------------------------------------------------
|
||||||
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
import { ObjectManagement } from 'mssql';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Base interface for all the security principal objects. e.g. Login, Server Role, Database Role...
|
||||||
|
*/
|
||||||
|
export interface SecurityPrincipalObject extends ObjectManagement.SqlObject {
|
||||||
|
securablePermissions: SecurablePermissions[];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Securable type metadata.
|
||||||
|
*/
|
||||||
|
export interface SecurableTypeMetadata {
|
||||||
|
/**
|
||||||
|
* Name of the securable type.
|
||||||
|
*/
|
||||||
|
name: string;
|
||||||
|
/**
|
||||||
|
* Display name of the securable type.
|
||||||
|
*/
|
||||||
|
displayName: string;
|
||||||
|
/**
|
||||||
|
* Permissions supported by the securable type.
|
||||||
|
*/
|
||||||
|
permissions: PermissionMetadata[];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Permission metadata.
|
||||||
|
*/
|
||||||
|
export interface PermissionMetadata {
|
||||||
|
/**
|
||||||
|
* Name of the permission.
|
||||||
|
*/
|
||||||
|
name: string;
|
||||||
|
/**
|
||||||
|
* Display name of the permission.
|
||||||
|
*/
|
||||||
|
displayName: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Base interface for security principal object's view information.
|
||||||
|
*/
|
||||||
|
export interface SecurityPrincipalViewInfo<T extends SecurityPrincipalObject> extends ObjectManagement.ObjectViewInfo<T> {
|
||||||
|
/**
|
||||||
|
* The securable types that the security principal object can be granted permissions on.
|
||||||
|
*/
|
||||||
|
supportedSecurableTypes: SecurableTypeMetadata[];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Base interface for database level security principal object's view information.
|
||||||
|
*/
|
||||||
|
export interface DatabaseLevelPrincipalViewInfo<T extends SecurityPrincipalObject> extends SecurityPrincipalViewInfo<T> {
|
||||||
|
/**
|
||||||
|
* The schemas in the database.
|
||||||
|
*/
|
||||||
|
schemas: string[];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Server level login.
|
||||||
|
*/
|
||||||
|
export interface Login extends SecurityPrincipalObject {
|
||||||
|
/**
|
||||||
|
* Authentication type.
|
||||||
|
*/
|
||||||
|
authenticationType: AuthenticationType;
|
||||||
|
/**
|
||||||
|
* Password for the login.
|
||||||
|
* Only applicable when the authentication type is 'Sql'.
|
||||||
|
*/
|
||||||
|
password: string | undefined;
|
||||||
|
/**
|
||||||
|
* Old password of the login.
|
||||||
|
* Only applicable when the authentication type is 'Sql'.
|
||||||
|
* The old password is required when updating the login's own password and it doesn't have the 'ALTER ANY LOGIN' permission.
|
||||||
|
*/
|
||||||
|
oldPassword: string | undefined;
|
||||||
|
/**
|
||||||
|
* Whether the password complexity policy is enforced.
|
||||||
|
* Only applicable when the authentication type is 'Sql'.
|
||||||
|
*/
|
||||||
|
enforcePasswordPolicy: boolean | undefined;
|
||||||
|
/**
|
||||||
|
* Whether the password expiration policy is enforced.
|
||||||
|
* Only applicable when the authentication type is 'Sql'.
|
||||||
|
*/
|
||||||
|
enforcePasswordExpiration: boolean | undefined;
|
||||||
|
/**
|
||||||
|
* Whether SQL Server should prompt for an updated password when the next the login is used.
|
||||||
|
* Only applicable when the authentication type is 'Sql'.
|
||||||
|
*/
|
||||||
|
mustChangePassword: boolean | undefined;
|
||||||
|
/**
|
||||||
|
* Whether the login is locked out due to password policy violation.
|
||||||
|
* Only applicable when the authentication type is 'Sql'.
|
||||||
|
*/
|
||||||
|
isLockedOut: boolean;
|
||||||
|
/**
|
||||||
|
* The default database for the login.
|
||||||
|
*/
|
||||||
|
defaultDatabase: string;
|
||||||
|
/**
|
||||||
|
* The default language for the login.
|
||||||
|
*/
|
||||||
|
defaultLanguage: string;
|
||||||
|
/**
|
||||||
|
* The server roles of the login.
|
||||||
|
*/
|
||||||
|
serverRoles: string[];
|
||||||
|
/**
|
||||||
|
* The database users the login is mapped to.
|
||||||
|
*/
|
||||||
|
userMapping: ServerLoginUserInfo[];
|
||||||
|
/**
|
||||||
|
* Whether the login is enabled.
|
||||||
|
*/
|
||||||
|
isEnabled: boolean;
|
||||||
|
/**
|
||||||
|
* Whether the connect permission is granted to the login.
|
||||||
|
*/
|
||||||
|
connectPermission: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The authentication types.
|
||||||
|
*/
|
||||||
|
export const enum AuthenticationType {
|
||||||
|
Windows = 'Windows',
|
||||||
|
Sql = 'Sql',
|
||||||
|
AzureActiveDirectory = 'AAD'
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The user mapping information for login.
|
||||||
|
*/
|
||||||
|
export interface ServerLoginUserInfo {
|
||||||
|
/**
|
||||||
|
* Target database name.
|
||||||
|
*/
|
||||||
|
database: string;
|
||||||
|
/**
|
||||||
|
* User name.
|
||||||
|
*/
|
||||||
|
user: string;
|
||||||
|
/**
|
||||||
|
* Default schema of the user.
|
||||||
|
*/
|
||||||
|
defaultSchema: string;
|
||||||
|
/**
|
||||||
|
* Databases roles of the user.
|
||||||
|
*/
|
||||||
|
databaseRoles: string[];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The information required to render the login view.
|
||||||
|
*/
|
||||||
|
export interface LoginViewInfo extends SecurityPrincipalViewInfo<Login> {
|
||||||
|
/**
|
||||||
|
* The authentication types supported by the server.
|
||||||
|
*/
|
||||||
|
authenticationTypes: AuthenticationType[];
|
||||||
|
/**
|
||||||
|
* Whether the locked out state can be changed.
|
||||||
|
*/
|
||||||
|
canEditLockedOutState: boolean;
|
||||||
|
/**
|
||||||
|
* Name of the databases in the server.
|
||||||
|
*/
|
||||||
|
databases: string[];
|
||||||
|
/**
|
||||||
|
* Available languages in the server.
|
||||||
|
*/
|
||||||
|
languages: string[];
|
||||||
|
/**
|
||||||
|
* All server roles in the server.
|
||||||
|
*/
|
||||||
|
serverRoles: string[];
|
||||||
|
/**
|
||||||
|
* Whether advanced password options are supported.
|
||||||
|
* Advanced password options: check policy, check expiration, must change, unlock.
|
||||||
|
* Notes: 2 options to control the advanced options because Analytics Platform supports advanced options but does not support advanced options.
|
||||||
|
*/
|
||||||
|
supportAdvancedPasswordOptions: boolean;
|
||||||
|
/**
|
||||||
|
* Whether advanced options are supported.
|
||||||
|
* Advanced options: default database, default language and connect permission.
|
||||||
|
*/
|
||||||
|
supportAdvancedOptions: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The permission information a principal has on a securable.
|
||||||
|
*/
|
||||||
|
export interface SecurablePermissionItem {
|
||||||
|
/**
|
||||||
|
* name of the permission.
|
||||||
|
*/
|
||||||
|
permission: string;
|
||||||
|
/**
|
||||||
|
* Name of the grantor.
|
||||||
|
*/
|
||||||
|
grantor: string;
|
||||||
|
/**
|
||||||
|
* Whether the permission is granted or denied. Undefined means not specified.
|
||||||
|
*/
|
||||||
|
grant?: boolean;
|
||||||
|
/**
|
||||||
|
* Whether the pincipal can grant this permission to other principals.
|
||||||
|
* The value will be ignored if the grant property is set to false.
|
||||||
|
*/
|
||||||
|
withGrant?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The permissions a principal has over a securable.
|
||||||
|
*/
|
||||||
|
export interface SecurablePermissions {
|
||||||
|
/**
|
||||||
|
* The securable name.
|
||||||
|
*/
|
||||||
|
name: string;
|
||||||
|
/**
|
||||||
|
* The securable type.
|
||||||
|
*/
|
||||||
|
type: string;
|
||||||
|
/**
|
||||||
|
* The schema name of the object if applicable.
|
||||||
|
*/
|
||||||
|
schema?: string;
|
||||||
|
/**
|
||||||
|
* The permissions.
|
||||||
|
*/
|
||||||
|
permissions: SecurablePermissionItem[];
|
||||||
|
/**
|
||||||
|
* The effective permissions. Includes all permissions granted to the principal, including those granted through role memberships.
|
||||||
|
*/
|
||||||
|
effectivePermissions: string[];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extend property for objects.
|
||||||
|
*/
|
||||||
|
export interface ExtendedProperty {
|
||||||
|
/**
|
||||||
|
* Name of the property.
|
||||||
|
*/
|
||||||
|
name: string;
|
||||||
|
/**
|
||||||
|
* Value of the property.
|
||||||
|
*/
|
||||||
|
value: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* User types.
|
||||||
|
*/
|
||||||
|
export const enum UserType {
|
||||||
|
/**
|
||||||
|
* Mapped to a server login.
|
||||||
|
*/
|
||||||
|
LoginMapped = 'LoginMapped',
|
||||||
|
/**
|
||||||
|
* Mapped to a Windows user or group.
|
||||||
|
*/
|
||||||
|
WindowsUser = 'WindowsUser',
|
||||||
|
/**
|
||||||
|
* Authenticate with password.
|
||||||
|
*/
|
||||||
|
SqlAuthentication = 'SqlAuthentication',
|
||||||
|
/**
|
||||||
|
* Authenticate with Azure Active Directory.
|
||||||
|
*/
|
||||||
|
AADAuthentication = 'AADAuthentication',
|
||||||
|
/**
|
||||||
|
* User that cannot authenticate.
|
||||||
|
*/
|
||||||
|
NoLoginAccess = 'NoLoginAccess'
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Database user.
|
||||||
|
*/
|
||||||
|
export interface User extends SecurityPrincipalObject {
|
||||||
|
/**
|
||||||
|
* Type of the user.
|
||||||
|
*/
|
||||||
|
type: UserType;
|
||||||
|
/**
|
||||||
|
* Default schema of the user.
|
||||||
|
*/
|
||||||
|
defaultSchema: string | undefined;
|
||||||
|
/**
|
||||||
|
* Schemas owned by the user.
|
||||||
|
*/
|
||||||
|
ownedSchemas: string[];
|
||||||
|
/**
|
||||||
|
* Database roles that the user belongs to.
|
||||||
|
*/
|
||||||
|
databaseRoles: string[];
|
||||||
|
/**
|
||||||
|
* The name of the server login associated with the user.
|
||||||
|
* Only applicable when the user type is 'WithLogin'.
|
||||||
|
*/
|
||||||
|
loginName: string | undefined;
|
||||||
|
/**
|
||||||
|
* The default language of the user.
|
||||||
|
* Only applicable when the user type is 'Contained'.
|
||||||
|
*/
|
||||||
|
defaultLanguage: string | undefined;
|
||||||
|
/**
|
||||||
|
* Password of the user.
|
||||||
|
* Only applicable when the user type is 'Contained' and the authentication type is 'Sql'.
|
||||||
|
*/
|
||||||
|
password: string | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The information required to render the user view.
|
||||||
|
*/
|
||||||
|
export interface UserViewInfo extends DatabaseLevelPrincipalViewInfo<User> {
|
||||||
|
/**
|
||||||
|
* All user types supported by the database.
|
||||||
|
*/
|
||||||
|
userTypes: UserType[];
|
||||||
|
/**
|
||||||
|
* All languages supported by the database.
|
||||||
|
*/
|
||||||
|
languages: string[];
|
||||||
|
/**
|
||||||
|
* Name of all the logins in the server.
|
||||||
|
*/
|
||||||
|
logins: string[];
|
||||||
|
/**
|
||||||
|
* Name of all the database roles.
|
||||||
|
*/
|
||||||
|
databaseRoles: string[];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interface representing the server role object.
|
||||||
|
*/
|
||||||
|
export interface ServerRoleInfo extends SecurityPrincipalObject {
|
||||||
|
/**
|
||||||
|
* Name of the server principal that owns the server role.
|
||||||
|
*/
|
||||||
|
owner: string;
|
||||||
|
/**
|
||||||
|
* Name of the server principals that are members of the server role.
|
||||||
|
*/
|
||||||
|
members: string[];
|
||||||
|
/**
|
||||||
|
* Server roles that the server role is a member of.
|
||||||
|
*/
|
||||||
|
memberships: string[];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interface representing the information required to render the server role view.
|
||||||
|
*/
|
||||||
|
export interface ServerRoleViewInfo extends SecurityPrincipalViewInfo<ServerRoleInfo> {
|
||||||
|
/**
|
||||||
|
* Whether the server role is a fixed role.
|
||||||
|
*/
|
||||||
|
isFixedRole: boolean;
|
||||||
|
/**
|
||||||
|
* List of all the server roles.
|
||||||
|
*/
|
||||||
|
serverRoles: string[];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interface representing the application role object.
|
||||||
|
*/
|
||||||
|
export interface ApplicationRoleInfo extends SecurityPrincipalObject {
|
||||||
|
/**
|
||||||
|
* Default schema of the application role.
|
||||||
|
*/
|
||||||
|
defaultSchema: string;
|
||||||
|
/**
|
||||||
|
* Schemas owned by the application role.
|
||||||
|
*/
|
||||||
|
ownedSchemas: string[];
|
||||||
|
/**
|
||||||
|
* Password of the application role.
|
||||||
|
*/
|
||||||
|
password: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interface representing the information required to render the application role view.
|
||||||
|
*/
|
||||||
|
export interface ApplicationRoleViewInfo extends DatabaseLevelPrincipalViewInfo<ApplicationRoleInfo> {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interface representing the database role object.
|
||||||
|
*/
|
||||||
|
export interface DatabaseRoleInfo extends SecurityPrincipalObject {
|
||||||
|
/**
|
||||||
|
* Name of the database principal that owns the database role.
|
||||||
|
*/
|
||||||
|
owner: string;
|
||||||
|
/**
|
||||||
|
* Schemas owned by the database role.
|
||||||
|
*/
|
||||||
|
ownedSchemas: string[];
|
||||||
|
/**
|
||||||
|
* Name of the user or database role that are members of the database role.
|
||||||
|
*/
|
||||||
|
members: string[];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interface representing the information required to render the database role view.
|
||||||
|
*/
|
||||||
|
export interface DatabaseRoleViewInfo extends DatabaseLevelPrincipalViewInfo<DatabaseRoleInfo> {
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Database extends ObjectManagement.SqlObject {
|
||||||
|
owner?: string;
|
||||||
|
collationName?: string;
|
||||||
|
recoveryModel?: string;
|
||||||
|
compatibilityLevel?: string;
|
||||||
|
containmentType?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DatabaseViewInfo extends ObjectManagement.ObjectViewInfo<Database> {
|
||||||
|
loginNames: string[];
|
||||||
|
collationNames: string[];
|
||||||
|
compatibilityLevels: string[];
|
||||||
|
containmentTypes: string[];
|
||||||
|
recoveryModels: string[];
|
||||||
|
}
|
||||||
@@ -6,6 +6,7 @@
|
|||||||
import * as nls from 'vscode-nls';
|
import * as nls from 'vscode-nls';
|
||||||
import { ObjectManagement } from 'mssql';
|
import { ObjectManagement } from 'mssql';
|
||||||
import { ObjectTypeInfo } from './ui/findObjectDialog';
|
import { ObjectTypeInfo } from './ui/findObjectDialog';
|
||||||
|
import { AuthenticationType, UserType } from './interfaces';
|
||||||
const localize = nls.loadMessageBundle();
|
const localize = nls.loadMessageBundle();
|
||||||
|
|
||||||
// Object Types
|
// Object Types
|
||||||
@@ -242,19 +243,19 @@ export function getNodeTypeDisplayName(type: string, inTitle: boolean = false):
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const AuthencationTypeDisplayNameMap = new Map<ObjectManagement.AuthenticationType, string>();
|
const AuthencationTypeDisplayNameMap = new Map<AuthenticationType, string>();
|
||||||
AuthencationTypeDisplayNameMap.set(ObjectManagement.AuthenticationType.Windows, WindowsAuthenticationTypeDisplayText);
|
AuthencationTypeDisplayNameMap.set(AuthenticationType.Windows, WindowsAuthenticationTypeDisplayText);
|
||||||
AuthencationTypeDisplayNameMap.set(ObjectManagement.AuthenticationType.Sql, SQLAuthenticationTypeDisplayText);
|
AuthencationTypeDisplayNameMap.set(AuthenticationType.Sql, SQLAuthenticationTypeDisplayText);
|
||||||
AuthencationTypeDisplayNameMap.set(ObjectManagement.AuthenticationType.AzureActiveDirectory, AADAuthenticationTypeDisplayText);
|
AuthencationTypeDisplayNameMap.set(AuthenticationType.AzureActiveDirectory, AADAuthenticationTypeDisplayText);
|
||||||
|
|
||||||
export function getAuthenticationTypeDisplayName(authType: ObjectManagement.AuthenticationType): string {
|
export function getAuthenticationTypeDisplayName(authType: AuthenticationType): string {
|
||||||
if (AuthencationTypeDisplayNameMap.has(authType)) {
|
if (AuthencationTypeDisplayNameMap.has(authType)) {
|
||||||
return AuthencationTypeDisplayNameMap.get(authType);
|
return AuthencationTypeDisplayNameMap.get(authType);
|
||||||
}
|
}
|
||||||
throw new Error(`Unknown authentication type: ${authType}`);
|
throw new Error(`Unknown authentication type: ${authType}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getAuthenticationTypeByDisplayName(displayName: string): ObjectManagement.AuthenticationType {
|
export function getAuthenticationTypeByDisplayName(displayName: string): AuthenticationType {
|
||||||
for (let [key, value] of AuthencationTypeDisplayNameMap.entries()) {
|
for (let [key, value] of AuthencationTypeDisplayNameMap.entries()) {
|
||||||
if (value === displayName)
|
if (value === displayName)
|
||||||
return key;
|
return key;
|
||||||
@@ -262,21 +263,21 @@ export function getAuthenticationTypeByDisplayName(displayName: string): ObjectM
|
|||||||
throw new Error(`Unknown authentication type display name: ${displayName}`);
|
throw new Error(`Unknown authentication type display name: ${displayName}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const UserTypeDisplayNameMap = new Map<ObjectManagement.UserType, string>();
|
const UserTypeDisplayNameMap = new Map<UserType, string>();
|
||||||
UserTypeDisplayNameMap.set(ObjectManagement.UserType.LoginMapped, UserType_LoginMapped);
|
UserTypeDisplayNameMap.set(UserType.LoginMapped, UserType_LoginMapped);
|
||||||
UserTypeDisplayNameMap.set(ObjectManagement.UserType.WindowsUser, UserType_WindowsUser);
|
UserTypeDisplayNameMap.set(UserType.WindowsUser, UserType_WindowsUser);
|
||||||
UserTypeDisplayNameMap.set(ObjectManagement.UserType.SqlAuthentication, UserType_SqlAuthentication);
|
UserTypeDisplayNameMap.set(UserType.SqlAuthentication, UserType_SqlAuthentication);
|
||||||
UserTypeDisplayNameMap.set(ObjectManagement.UserType.AADAuthentication, UserType_AADAuthentication);
|
UserTypeDisplayNameMap.set(UserType.AADAuthentication, UserType_AADAuthentication);
|
||||||
UserTypeDisplayNameMap.set(ObjectManagement.UserType.NoLoginAccess, UserType_NoLoginAccess);
|
UserTypeDisplayNameMap.set(UserType.NoLoginAccess, UserType_NoLoginAccess);
|
||||||
|
|
||||||
export function getUserTypeDisplayName(userType: ObjectManagement.UserType): string {
|
export function getUserTypeDisplayName(userType: UserType): string {
|
||||||
if (UserTypeDisplayNameMap.has(userType)) {
|
if (UserTypeDisplayNameMap.has(userType)) {
|
||||||
return UserTypeDisplayNameMap.get(userType);
|
return UserTypeDisplayNameMap.get(userType);
|
||||||
}
|
}
|
||||||
throw new Error(`Unknown user type: ${userType}`);
|
throw new Error(`Unknown user type: ${userType}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getUserTypeByDisplayName(displayName: string): ObjectManagement.UserType {
|
export function getUserTypeByDisplayName(displayName: string): UserType {
|
||||||
for (let [key, value] of UserTypeDisplayNameMap.entries()) {
|
for (let [key, value] of UserTypeDisplayNameMap.entries()) {
|
||||||
if (value === displayName)
|
if (value === displayName)
|
||||||
return key;
|
return key;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
import { ApplicationRoleViewInfo, AuthenticationType, DatabaseRoleViewInfo, LoginViewInfo, SecurablePermissions, SecurableTypeMetadata, ServerRoleViewInfo, User, UserType, UserViewInfo } from './interfaces';
|
||||||
import * as Utils from '../utils';
|
import * as Utils from '../utils';
|
||||||
import * as constants from '../constants';
|
import * as constants from '../constants';
|
||||||
import * as contracts from '../contracts';
|
import * as contracts from '../contracts';
|
||||||
@@ -67,7 +67,7 @@ export class ObjectManagementService extends BaseService implements IObjectManag
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const ServerLevelSecurableTypes: ObjectManagement.SecurableTypeMetadata[] = [
|
const ServerLevelSecurableTypes: SecurableTypeMetadata[] = [
|
||||||
{
|
{
|
||||||
name: 'Server',
|
name: 'Server',
|
||||||
displayName: 'Server',
|
displayName: 'Server',
|
||||||
@@ -94,7 +94,7 @@ const ServerLevelSecurableTypes: ObjectManagement.SecurableTypeMetadata[] = [
|
|||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
const DatabaseLevelSecurableTypes: ObjectManagement.SecurableTypeMetadata[] = [
|
const DatabaseLevelSecurableTypes: SecurableTypeMetadata[] = [
|
||||||
{
|
{
|
||||||
name: 'AggregateFunction',
|
name: 'AggregateFunction',
|
||||||
displayName: 'Aggregate Function',
|
displayName: 'Aggregate Function',
|
||||||
@@ -137,7 +137,7 @@ const DatabaseLevelSecurableTypes: ObjectManagement.SecurableTypeMetadata[] = [
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
const ServerLevelPermissions: ObjectManagement.SecurablePermissions[] = [
|
const ServerLevelPermissions: SecurablePermissions[] = [
|
||||||
{
|
{
|
||||||
name: 'Server',
|
name: 'Server',
|
||||||
type: 'Server',
|
type: 'Server',
|
||||||
@@ -158,7 +158,7 @@ const ServerLevelPermissions: ObjectManagement.SecurablePermissions[] = [
|
|||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
const DatabaseLevelPermissions: ObjectManagement.SecurablePermissions[] = [
|
const DatabaseLevelPermissions: SecurablePermissions[] = [
|
||||||
{
|
{
|
||||||
name: 'table1',
|
name: 'table1',
|
||||||
type: 'Table',
|
type: 'Table',
|
||||||
@@ -238,16 +238,16 @@ export class TestObjectManagementService implements IObjectManagementService {
|
|||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
|
|
||||||
private getLoginView(isNewObject: boolean, name: string): ObjectManagement.LoginViewInfo {
|
private getLoginView(isNewObject: boolean, name: string): LoginViewInfo {
|
||||||
const serverRoles = ['sysadmin', 'public', 'bulkadmin', 'dbcreator', 'diskadmin', 'processadmin', 'securityadmin', 'serveradmin'];
|
const serverRoles = ['sysadmin', 'public', 'bulkadmin', 'dbcreator', 'diskadmin', 'processadmin', 'securityadmin', 'serveradmin'];
|
||||||
const languages = ['<default>', 'English'];
|
const languages = ['<default>', 'English'];
|
||||||
const databases = ['master', 'db1', 'db2'];
|
const databases = ['master', 'db1', 'db2'];
|
||||||
let login: ObjectManagement.LoginViewInfo;
|
let login: LoginViewInfo;
|
||||||
if (isNewObject) {
|
if (isNewObject) {
|
||||||
login = <ObjectManagement.LoginViewInfo>{
|
login = <LoginViewInfo>{
|
||||||
objectInfo: {
|
objectInfo: {
|
||||||
name: '',
|
name: '',
|
||||||
authenticationType: ObjectManagement.AuthenticationType.Sql,
|
authenticationType: AuthenticationType.Sql,
|
||||||
enforcePasswordPolicy: true,
|
enforcePasswordPolicy: true,
|
||||||
enforcePasswordExpiration: true,
|
enforcePasswordExpiration: true,
|
||||||
mustChangePassword: true,
|
mustChangePassword: true,
|
||||||
@@ -259,7 +259,7 @@ export class TestObjectManagementService implements IObjectManagementService {
|
|||||||
isLockedOut: false,
|
isLockedOut: false,
|
||||||
securablePermissions: []
|
securablePermissions: []
|
||||||
},
|
},
|
||||||
authenticationTypes: [ObjectManagement.AuthenticationType.Sql, ObjectManagement.AuthenticationType.Windows],
|
authenticationTypes: [AuthenticationType.Sql, AuthenticationType.Windows],
|
||||||
supportAdvancedOptions: true,
|
supportAdvancedOptions: true,
|
||||||
supportAdvancedPasswordOptions: true,
|
supportAdvancedPasswordOptions: true,
|
||||||
canEditLockedOutState: false,
|
canEditLockedOutState: false,
|
||||||
@@ -269,10 +269,10 @@ export class TestObjectManagementService implements IObjectManagementService {
|
|||||||
supportedSecurableTypes: ServerLevelSecurableTypes
|
supportedSecurableTypes: ServerLevelSecurableTypes
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
login = <ObjectManagement.LoginViewInfo>{
|
login = <LoginViewInfo>{
|
||||||
objectInfo: {
|
objectInfo: {
|
||||||
name: name,
|
name: name,
|
||||||
authenticationType: ObjectManagement.AuthenticationType.Sql,
|
authenticationType: AuthenticationType.Sql,
|
||||||
enforcePasswordPolicy: true,
|
enforcePasswordPolicy: true,
|
||||||
enforcePasswordExpiration: true,
|
enforcePasswordExpiration: true,
|
||||||
mustChangePassword: true,
|
mustChangePassword: true,
|
||||||
@@ -285,7 +285,7 @@ export class TestObjectManagementService implements IObjectManagementService {
|
|||||||
password: '******************',
|
password: '******************',
|
||||||
securablePermissions: ServerLevelPermissions
|
securablePermissions: ServerLevelPermissions
|
||||||
},
|
},
|
||||||
authenticationTypes: [ObjectManagement.AuthenticationType.Sql, ObjectManagement.AuthenticationType.Windows],
|
authenticationTypes: [AuthenticationType.Sql, AuthenticationType.Windows],
|
||||||
supportAdvancedOptions: true,
|
supportAdvancedOptions: true,
|
||||||
supportAdvancedPasswordOptions: true,
|
supportAdvancedPasswordOptions: true,
|
||||||
canEditLockedOutState: false,
|
canEditLockedOutState: false,
|
||||||
@@ -298,8 +298,8 @@ export class TestObjectManagementService implements IObjectManagementService {
|
|||||||
return login;
|
return login;
|
||||||
}
|
}
|
||||||
|
|
||||||
private getUserView(isNewObject: boolean, name: string): ObjectManagement.UserViewInfo {
|
private getUserView(isNewObject: boolean, name: string): UserViewInfo {
|
||||||
let viewInfo: ObjectManagement.UserViewInfo;
|
let viewInfo: UserViewInfo;
|
||||||
const languages = ['<default>', 'English'];
|
const languages = ['<default>', 'English'];
|
||||||
const schemas = ['dbo', 'sys', 'alanren'];
|
const schemas = ['dbo', 'sys', 'alanren'];
|
||||||
const logins = ['sa', 'alanren', 'alanren@microsoft.com'];
|
const logins = ['sa', 'alanren', 'alanren@microsoft.com'];
|
||||||
@@ -307,12 +307,12 @@ export class TestObjectManagementService implements IObjectManagementService {
|
|||||||
|
|
||||||
if (isNewObject) {
|
if (isNewObject) {
|
||||||
viewInfo = {
|
viewInfo = {
|
||||||
objectInfo: <ObjectManagement.User>{
|
objectInfo: <User>{
|
||||||
name: '',
|
name: '',
|
||||||
type: ObjectManagement.UserType.LoginMapped,
|
type: UserType.LoginMapped,
|
||||||
defaultSchema: 'dbo',
|
defaultSchema: 'dbo',
|
||||||
defaultLanguage: '<default>',
|
defaultLanguage: '<default>',
|
||||||
authenticationType: ObjectManagement.AuthenticationType.Sql,
|
authenticationType: AuthenticationType.Sql,
|
||||||
loginName: 'sa',
|
loginName: 'sa',
|
||||||
ownedSchemas: [],
|
ownedSchemas: [],
|
||||||
databaseRoles: [],
|
databaseRoles: [],
|
||||||
@@ -324,18 +324,18 @@ export class TestObjectManagementService implements IObjectManagementService {
|
|||||||
logins: logins,
|
logins: logins,
|
||||||
databaseRoles: databaseRoles,
|
databaseRoles: databaseRoles,
|
||||||
userTypes: [
|
userTypes: [
|
||||||
ObjectManagement.UserType.LoginMapped,
|
UserType.LoginMapped,
|
||||||
ObjectManagement.UserType.AADAuthentication,
|
UserType.AADAuthentication,
|
||||||
ObjectManagement.UserType.SqlAuthentication,
|
UserType.SqlAuthentication,
|
||||||
ObjectManagement.UserType.NoLoginAccess
|
UserType.NoLoginAccess
|
||||||
],
|
],
|
||||||
supportedSecurableTypes: DatabaseLevelSecurableTypes
|
supportedSecurableTypes: DatabaseLevelSecurableTypes
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
viewInfo = {
|
viewInfo = {
|
||||||
objectInfo: <ObjectManagement.User>{
|
objectInfo: <User>{
|
||||||
name: name,
|
name: name,
|
||||||
type: ObjectManagement.UserType.LoginMapped,
|
type: UserType.LoginMapped,
|
||||||
defaultSchema: 'dbo',
|
defaultSchema: 'dbo',
|
||||||
defaultLanguage: '<default>',
|
defaultLanguage: '<default>',
|
||||||
loginName: 'sa',
|
loginName: 'sa',
|
||||||
@@ -348,10 +348,10 @@ export class TestObjectManagementService implements IObjectManagementService {
|
|||||||
logins: logins,
|
logins: logins,
|
||||||
databaseRoles: databaseRoles,
|
databaseRoles: databaseRoles,
|
||||||
userTypes: [
|
userTypes: [
|
||||||
ObjectManagement.UserType.LoginMapped,
|
UserType.LoginMapped,
|
||||||
ObjectManagement.UserType.AADAuthentication,
|
UserType.AADAuthentication,
|
||||||
ObjectManagement.UserType.SqlAuthentication,
|
UserType.SqlAuthentication,
|
||||||
ObjectManagement.UserType.NoLoginAccess
|
UserType.NoLoginAccess
|
||||||
],
|
],
|
||||||
supportedSecurableTypes: DatabaseLevelSecurableTypes
|
supportedSecurableTypes: DatabaseLevelSecurableTypes
|
||||||
};
|
};
|
||||||
@@ -359,8 +359,8 @@ export class TestObjectManagementService implements IObjectManagementService {
|
|||||||
return viewInfo;
|
return viewInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
private getServerRoleView(isNewObject: boolean, name: string): ObjectManagement.ServerRoleViewInfo {
|
private getServerRoleView(isNewObject: boolean, name: string): ServerRoleViewInfo {
|
||||||
return isNewObject ? <ObjectManagement.ServerRoleViewInfo>{
|
return isNewObject ? <ServerRoleViewInfo>{
|
||||||
objectInfo: {
|
objectInfo: {
|
||||||
name: '',
|
name: '',
|
||||||
members: [],
|
members: [],
|
||||||
@@ -371,7 +371,7 @@ export class TestObjectManagementService implements IObjectManagementService {
|
|||||||
isFixedRole: false,
|
isFixedRole: false,
|
||||||
serverRoles: ['ServerLevelServerRole 1', 'ServerLevelServerRole 2', 'ServerLevelServerRole 3', 'ServerLevelServerRole 4'],
|
serverRoles: ['ServerLevelServerRole 1', 'ServerLevelServerRole 2', 'ServerLevelServerRole 3', 'ServerLevelServerRole 4'],
|
||||||
supportedSecurableTypes: ServerLevelSecurableTypes
|
supportedSecurableTypes: ServerLevelSecurableTypes
|
||||||
} : <ObjectManagement.ServerRoleViewInfo>{
|
} : <ServerRoleViewInfo>{
|
||||||
objectInfo: {
|
objectInfo: {
|
||||||
name: 'ServerLevelServerRole 1',
|
name: 'ServerLevelServerRole 1',
|
||||||
members: ['ServerLevelLogin 1', 'ServerLevelServerRole 2'],
|
members: ['ServerLevelLogin 1', 'ServerLevelServerRole 2'],
|
||||||
@@ -385,8 +385,8 @@ export class TestObjectManagementService implements IObjectManagementService {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private getApplicationRoleView(isNewObject: boolean, name: string): ObjectManagement.ApplicationRoleViewInfo {
|
private getApplicationRoleView(isNewObject: boolean, name: string): ApplicationRoleViewInfo {
|
||||||
return isNewObject ? <ObjectManagement.ApplicationRoleViewInfo>{
|
return isNewObject ? <ApplicationRoleViewInfo>{
|
||||||
objectInfo: {
|
objectInfo: {
|
||||||
name: '',
|
name: '',
|
||||||
defaultSchema: 'dbo',
|
defaultSchema: 'dbo',
|
||||||
@@ -395,7 +395,7 @@ export class TestObjectManagementService implements IObjectManagementService {
|
|||||||
},
|
},
|
||||||
schemas: ['dbo', 'sys', 'admin'],
|
schemas: ['dbo', 'sys', 'admin'],
|
||||||
supportedSecurableTypes: []
|
supportedSecurableTypes: []
|
||||||
} : <ObjectManagement.ApplicationRoleViewInfo>{
|
} : <ApplicationRoleViewInfo>{
|
||||||
objectInfo: {
|
objectInfo: {
|
||||||
name: 'app role1',
|
name: 'app role1',
|
||||||
password: '******************',
|
password: '******************',
|
||||||
@@ -408,8 +408,8 @@ export class TestObjectManagementService implements IObjectManagementService {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private getDatabaseRoleView(isNewObject: boolean, name: string): ObjectManagement.DatabaseRoleViewInfo {
|
private getDatabaseRoleView(isNewObject: boolean, name: string): DatabaseRoleViewInfo {
|
||||||
return isNewObject ? <ObjectManagement.DatabaseRoleViewInfo>{
|
return isNewObject ? <DatabaseRoleViewInfo>{
|
||||||
objectInfo: {
|
objectInfo: {
|
||||||
name: '',
|
name: '',
|
||||||
owner: '',
|
owner: '',
|
||||||
@@ -419,7 +419,7 @@ export class TestObjectManagementService implements IObjectManagementService {
|
|||||||
},
|
},
|
||||||
schemas: ['dbo', 'sys', 'admin'],
|
schemas: ['dbo', 'sys', 'admin'],
|
||||||
supportedSecurableTypes: DatabaseLevelSecurableTypes
|
supportedSecurableTypes: DatabaseLevelSecurableTypes
|
||||||
} : <ObjectManagement.DatabaseRoleViewInfo>{
|
} : <DatabaseRoleViewInfo>{
|
||||||
objectInfo: {
|
objectInfo: {
|
||||||
name: 'db role1',
|
name: 'db role1',
|
||||||
owner: '',
|
owner: '',
|
||||||
|
|||||||
@@ -4,14 +4,15 @@
|
|||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
import * as azdata from 'azdata';
|
import * as azdata from 'azdata';
|
||||||
import { ObjectManagementDialogOptions } from './objectManagementDialogBase';
|
import { ObjectManagementDialogOptions } from './objectManagementDialogBase';
|
||||||
import { IObjectManagementService, ObjectManagement } from 'mssql';
|
import { IObjectManagementService } from 'mssql';
|
||||||
import * as localizedConstants from '../localizedConstants';
|
import * as localizedConstants from '../localizedConstants';
|
||||||
import { AlterApplicationRoleDocUrl, CreateApplicationRoleDocUrl } from '../constants';
|
import { AlterApplicationRoleDocUrl, CreateApplicationRoleDocUrl } from '../constants';
|
||||||
import { isValidSQLPassword } from '../utils';
|
import { isValidSQLPassword } from '../utils';
|
||||||
import { DefaultMaxTableRowCount } from '../../ui/dialogBase';
|
import { DefaultMaxTableRowCount } from '../../ui/dialogBase';
|
||||||
import { PrincipalDialogBase } from './principalDialogBase';
|
import { PrincipalDialogBase } from './principalDialogBase';
|
||||||
|
import { ApplicationRoleInfo, ApplicationRoleViewInfo } from '../interfaces';
|
||||||
|
|
||||||
export class ApplicationRoleDialog extends PrincipalDialogBase<ObjectManagement.ApplicationRoleInfo, ObjectManagement.ApplicationRoleViewInfo> {
|
export class ApplicationRoleDialog extends PrincipalDialogBase<ApplicationRoleInfo, ApplicationRoleViewInfo> {
|
||||||
// Sections
|
// Sections
|
||||||
private generalSection: azdata.GroupContainer;
|
private generalSection: azdata.GroupContainer;
|
||||||
private ownedSchemasSection: azdata.GroupContainer;
|
private ownedSchemasSection: azdata.GroupContainer;
|
||||||
|
|||||||
@@ -5,11 +5,12 @@
|
|||||||
|
|
||||||
import * as azdata from 'azdata';
|
import * as azdata from 'azdata';
|
||||||
import { ObjectManagementDialogBase, ObjectManagementDialogOptions } from './objectManagementDialogBase';
|
import { ObjectManagementDialogBase, ObjectManagementDialogOptions } from './objectManagementDialogBase';
|
||||||
import { IObjectManagementService, ObjectManagement } from 'mssql';
|
import { IObjectManagementService } from 'mssql';
|
||||||
import * as localizedConstants from '../localizedConstants';
|
import * as localizedConstants from '../localizedConstants';
|
||||||
import { CreateDatabaseDocUrl } from '../constants';
|
import { CreateDatabaseDocUrl } from '../constants';
|
||||||
|
import { Database, DatabaseViewInfo } from '../interfaces';
|
||||||
|
|
||||||
export class DatabaseDialog extends ObjectManagementDialogBase<ObjectManagement.Database, ObjectManagement.DatabaseViewInfo> {
|
export class DatabaseDialog extends ObjectManagementDialogBase<Database, DatabaseViewInfo> {
|
||||||
private _nameInput: azdata.InputBoxComponent;
|
private _nameInput: azdata.InputBoxComponent;
|
||||||
|
|
||||||
constructor(objectManagementService: IObjectManagementService, options: ObjectManagementDialogOptions) {
|
constructor(objectManagementService: IObjectManagementService, options: ObjectManagementDialogOptions) {
|
||||||
|
|||||||
@@ -10,8 +10,9 @@ import { AlterDatabaseRoleDocUrl, CreateDatabaseRoleDocUrl } from '../constants'
|
|||||||
import { FindObjectDialog } from './findObjectDialog';
|
import { FindObjectDialog } from './findObjectDialog';
|
||||||
import { DefaultMaxTableRowCount } from '../../ui/dialogBase';
|
import { DefaultMaxTableRowCount } from '../../ui/dialogBase';
|
||||||
import { PrincipalDialogBase } from './principalDialogBase';
|
import { PrincipalDialogBase } from './principalDialogBase';
|
||||||
|
import { DatabaseRoleInfo, DatabaseRoleViewInfo } from '../interfaces';
|
||||||
|
|
||||||
export class DatabaseRoleDialog extends PrincipalDialogBase<ObjectManagement.DatabaseRoleInfo, ObjectManagement.DatabaseRoleViewInfo> {
|
export class DatabaseRoleDialog extends PrincipalDialogBase<DatabaseRoleInfo, DatabaseRoleViewInfo> {
|
||||||
// Sections
|
// Sections
|
||||||
private generalSection: azdata.GroupContainer;
|
private generalSection: azdata.GroupContainer;
|
||||||
private ownedSchemasSection: azdata.GroupContainer;
|
private ownedSchemasSection: azdata.GroupContainer;
|
||||||
|
|||||||
@@ -5,15 +5,16 @@
|
|||||||
import * as azdata from 'azdata';
|
import * as azdata from 'azdata';
|
||||||
import * as vscode from 'vscode';
|
import * as vscode from 'vscode';
|
||||||
import { ObjectManagementDialogOptions } from './objectManagementDialogBase';
|
import { ObjectManagementDialogOptions } from './objectManagementDialogBase';
|
||||||
import { IObjectManagementService, ObjectManagement } from 'mssql';
|
import { IObjectManagementService } from 'mssql';
|
||||||
import * as objectManagementLoc from '../localizedConstants';
|
import * as objectManagementLoc from '../localizedConstants';
|
||||||
import * as uiLoc from '../../ui/localizedConstants';
|
import * as uiLoc from '../../ui/localizedConstants';
|
||||||
import { AlterLoginDocUrl, CreateLoginDocUrl, PublicServerRoleName } from '../constants';
|
import { AlterLoginDocUrl, CreateLoginDocUrl, PublicServerRoleName } from '../constants';
|
||||||
import { isValidSQLPassword } from '../utils';
|
import { isValidSQLPassword } from '../utils';
|
||||||
import { DefaultMaxTableRowCount } from '../../ui/dialogBase';
|
import { DefaultMaxTableRowCount } from '../../ui/dialogBase';
|
||||||
import { PrincipalDialogBase } from './principalDialogBase';
|
import { PrincipalDialogBase } from './principalDialogBase';
|
||||||
|
import { AuthenticationType, Login, LoginViewInfo } from '../interfaces';
|
||||||
|
|
||||||
export class LoginDialog extends PrincipalDialogBase<ObjectManagement.Login, ObjectManagement.LoginViewInfo> {
|
export class LoginDialog extends PrincipalDialogBase<Login, LoginViewInfo> {
|
||||||
private generalSection: azdata.GroupContainer;
|
private generalSection: azdata.GroupContainer;
|
||||||
private sqlAuthSection: azdata.GroupContainer;
|
private sqlAuthSection: azdata.GroupContainer;
|
||||||
private serverRoleSection: azdata.GroupContainer;
|
private serverRoleSection: azdata.GroupContainer;
|
||||||
@@ -46,7 +47,7 @@ export class LoginDialog extends PrincipalDialogBase<ObjectManagement.Login, Obj
|
|||||||
// Empty password is only allowed when advanced password options are supported and the password policy check is off.
|
// Empty password is only allowed when advanced password options are supported and the password policy check is off.
|
||||||
// To match the SSMS behavior, a warning is shown to the user.
|
// To match the SSMS behavior, a warning is shown to the user.
|
||||||
if (this.viewInfo.supportAdvancedPasswordOptions
|
if (this.viewInfo.supportAdvancedPasswordOptions
|
||||||
&& this.objectInfo.authenticationType === ObjectManagement.AuthenticationType.Sql
|
&& this.objectInfo.authenticationType === AuthenticationType.Sql
|
||||||
&& !this.objectInfo.password
|
&& !this.objectInfo.password
|
||||||
&& !this.objectInfo.enforcePasswordPolicy) {
|
&& !this.objectInfo.enforcePasswordPolicy) {
|
||||||
const result = await vscode.window.showWarningMessage(objectManagementLoc.BlankPasswordConfirmationText, { modal: true }, uiLoc.YesText);
|
const result = await vscode.window.showWarningMessage(objectManagementLoc.BlankPasswordConfirmationText, { modal: true }, uiLoc.YesText);
|
||||||
@@ -57,7 +58,7 @@ export class LoginDialog extends PrincipalDialogBase<ObjectManagement.Login, Obj
|
|||||||
|
|
||||||
protected override async validateInput(): Promise<string[]> {
|
protected override async validateInput(): Promise<string[]> {
|
||||||
const errors = await super.validateInput();
|
const errors = await super.validateInput();
|
||||||
if (this.objectInfo.authenticationType === ObjectManagement.AuthenticationType.Sql) {
|
if (this.objectInfo.authenticationType === AuthenticationType.Sql) {
|
||||||
if (!this.objectInfo.password && !(this.viewInfo.supportAdvancedPasswordOptions && !this.objectInfo.enforcePasswordPolicy)) {
|
if (!this.objectInfo.password && !(this.viewInfo.supportAdvancedPasswordOptions && !this.objectInfo.enforcePasswordPolicy)) {
|
||||||
errors.push(objectManagementLoc.PasswordCannotBeEmptyError);
|
errors.push(objectManagementLoc.PasswordCannotBeEmptyError);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import { FindObjectDialog, FindObjectDialogResult } from './findObjectDialog';
|
|||||||
import { deepClone } from '../../util/objects';
|
import { deepClone } from '../../util/objects';
|
||||||
import { DefaultTableWidth, getTableHeight } from '../../ui/dialogBase';
|
import { DefaultTableWidth, getTableHeight } from '../../ui/dialogBase';
|
||||||
import { ObjectSelectionMethod, ObjectSelectionMethodDialog } from './objectSelectionMethodDialog';
|
import { ObjectSelectionMethod, ObjectSelectionMethodDialog } from './objectSelectionMethodDialog';
|
||||||
|
import { DatabaseLevelPrincipalViewInfo, SecurablePermissionItem, SecurablePermissions, SecurityPrincipalObject, SecurityPrincipalViewInfo } from '../interfaces';
|
||||||
|
|
||||||
const GrantColumnIndex = 2;
|
const GrantColumnIndex = 2;
|
||||||
const WithGrantColumnIndex = 3;
|
const WithGrantColumnIndex = 3;
|
||||||
@@ -25,14 +26,14 @@ export interface PrincipalDialogOptions extends ObjectManagementDialogOptions {
|
|||||||
/**
|
/**
|
||||||
* Base class for security principal dialogs such as user, role, etc.
|
* Base class for security principal dialogs such as user, role, etc.
|
||||||
*/
|
*/
|
||||||
export abstract class PrincipalDialogBase<ObjectInfoType extends mssql.ObjectManagement.SecurityPrincipalObject, ViewInfoType extends mssql.ObjectManagement.SecurityPrincipalViewInfo<ObjectInfoType>> extends ObjectManagementDialogBase<ObjectInfoType, ViewInfoType> {
|
export abstract class PrincipalDialogBase<ObjectInfoType extends SecurityPrincipalObject, ViewInfoType extends SecurityPrincipalViewInfo<ObjectInfoType>> extends ObjectManagementDialogBase<ObjectInfoType, ViewInfoType> {
|
||||||
protected securableTable: azdata.TableComponent;
|
protected securableTable: azdata.TableComponent;
|
||||||
protected permissionTable: azdata.TableComponent;
|
protected permissionTable: azdata.TableComponent;
|
||||||
protected effectivePermissionTable: azdata.TableComponent;
|
protected effectivePermissionTable: azdata.TableComponent;
|
||||||
protected securableSection: azdata.GroupContainer;
|
protected securableSection: azdata.GroupContainer;
|
||||||
protected explicitPermissionTableLabel: azdata.TextComponent;
|
protected explicitPermissionTableLabel: azdata.TextComponent;
|
||||||
protected effectivePermissionTableLabel: azdata.TextComponent;
|
protected effectivePermissionTableLabel: azdata.TextComponent;
|
||||||
private securablePermissions: mssql.ObjectManagement.SecurablePermissions[] = [];
|
private securablePermissions: SecurablePermissions[] = [];
|
||||||
|
|
||||||
constructor(objectManagementService: mssql.IObjectManagementService, private readonly dialogOptions: PrincipalDialogOptions) {
|
constructor(objectManagementService: mssql.IObjectManagementService, private readonly dialogOptions: PrincipalDialogOptions) {
|
||||||
super(objectManagementService, dialogOptions);
|
super(objectManagementService, dialogOptions);
|
||||||
@@ -82,7 +83,7 @@ export abstract class PrincipalDialogBase<ObjectInfoType extends mssql.ObjectMan
|
|||||||
this.disposables.push(this.permissionTable.onCellAction(async (arg: azdata.ICheckboxCellActionEventArgs) => {
|
this.disposables.push(this.permissionTable.onCellAction(async (arg: azdata.ICheckboxCellActionEventArgs) => {
|
||||||
const permissionName = this.permissionTable.data[arg.row][0];
|
const permissionName = this.permissionTable.data[arg.row][0];
|
||||||
const securable = this.securablePermissions[this.securableTable.selectedRows[0]];
|
const securable = this.securablePermissions[this.securableTable.selectedRows[0]];
|
||||||
let permission: mssql.ObjectManagement.SecurablePermissionItem = securable.permissions.find(securablePermission => securablePermission.permission === permissionName);
|
let permission: SecurablePermissionItem = securable.permissions.find(securablePermission => securablePermission.permission === permissionName);
|
||||||
if (!permission) {
|
if (!permission) {
|
||||||
permission = {
|
permission = {
|
||||||
permission: permissionName,
|
permission: permissionName,
|
||||||
@@ -126,7 +127,7 @@ export abstract class PrincipalDialogBase<ObjectInfoType extends mssql.ObjectMan
|
|||||||
if (this.dialogOptions.isDatabaseLevelPrincipal) {
|
if (this.dialogOptions.isDatabaseLevelPrincipal) {
|
||||||
const methodDialog = new ObjectSelectionMethodDialog({
|
const methodDialog = new ObjectSelectionMethodDialog({
|
||||||
objectTypes: this.viewInfo.supportedSecurableTypes,
|
objectTypes: this.viewInfo.supportedSecurableTypes,
|
||||||
schemas: (<mssql.ObjectManagement.DatabaseLevelPrincipalViewInfo<mssql.ObjectManagement.SecurityPrincipalObject>><unknown>this.viewInfo).schemas,
|
schemas: (<DatabaseLevelPrincipalViewInfo<SecurityPrincipalObject>><unknown>this.viewInfo).schemas,
|
||||||
});
|
});
|
||||||
await methodDialog.open();
|
await methodDialog.open();
|
||||||
const methodResult = await methodDialog.waitForClose();
|
const methodResult = await methodDialog.waitForClose();
|
||||||
|
|||||||
@@ -9,8 +9,9 @@ import * as localizedConstants from '../localizedConstants';
|
|||||||
import { AlterServerRoleDocUrl, CreateServerRoleDocUrl } from '../constants';
|
import { AlterServerRoleDocUrl, CreateServerRoleDocUrl } from '../constants';
|
||||||
import { FindObjectDialog } from './findObjectDialog';
|
import { FindObjectDialog } from './findObjectDialog';
|
||||||
import { PrincipalDialogBase } from './principalDialogBase';
|
import { PrincipalDialogBase } from './principalDialogBase';
|
||||||
|
import { ServerRoleInfo, ServerRoleViewInfo } from '../interfaces';
|
||||||
|
|
||||||
export class ServerRoleDialog extends PrincipalDialogBase<ObjectManagement.ServerRoleInfo, ObjectManagement.ServerRoleViewInfo> {
|
export class ServerRoleDialog extends PrincipalDialogBase<ServerRoleInfo, ServerRoleViewInfo> {
|
||||||
// Sections
|
// Sections
|
||||||
private generalSection: azdata.GroupContainer;
|
private generalSection: azdata.GroupContainer;
|
||||||
private membershipSection: azdata.GroupContainer;
|
private membershipSection: azdata.GroupContainer;
|
||||||
|
|||||||
@@ -4,14 +4,15 @@
|
|||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
import * as azdata from 'azdata';
|
import * as azdata from 'azdata';
|
||||||
import { ObjectManagementDialogOptions } from './objectManagementDialogBase';
|
import { ObjectManagementDialogOptions } from './objectManagementDialogBase';
|
||||||
import { IObjectManagementService, ObjectManagement } from 'mssql';
|
import { IObjectManagementService } from 'mssql';
|
||||||
import * as localizedConstants from '../localizedConstants';
|
import * as localizedConstants from '../localizedConstants';
|
||||||
import { AlterUserDocUrl, CreateUserDocUrl } from '../constants';
|
import { AlterUserDocUrl, CreateUserDocUrl } from '../constants';
|
||||||
import { isValidSQLPassword } from '../utils';
|
import { isValidSQLPassword } from '../utils';
|
||||||
import { DefaultMaxTableRowCount } from '../../ui/dialogBase';
|
import { DefaultMaxTableRowCount } from '../../ui/dialogBase';
|
||||||
import { PrincipalDialogBase } from './principalDialogBase';
|
import { PrincipalDialogBase } from './principalDialogBase';
|
||||||
|
import { User, UserType, UserViewInfo } from '../interfaces';
|
||||||
|
|
||||||
export class UserDialog extends PrincipalDialogBase<ObjectManagement.User, ObjectManagement.UserViewInfo> {
|
export class UserDialog extends PrincipalDialogBase<User, UserViewInfo> {
|
||||||
private generalSection: azdata.GroupContainer;
|
private generalSection: azdata.GroupContainer;
|
||||||
private ownedSchemaSection: azdata.GroupContainer;
|
private ownedSchemaSection: azdata.GroupContainer;
|
||||||
private membershipSection: azdata.GroupContainer;
|
private membershipSection: azdata.GroupContainer;
|
||||||
@@ -45,7 +46,7 @@ export class UserDialog extends PrincipalDialogBase<ObjectManagement.User, Objec
|
|||||||
|
|
||||||
protected override async validateInput(): Promise<string[]> {
|
protected override async validateInput(): Promise<string[]> {
|
||||||
const errors = await super.validateInput();
|
const errors = await super.validateInput();
|
||||||
if (this.objectInfo.type === ObjectManagement.UserType.SqlAuthentication) {
|
if (this.objectInfo.type === UserType.SqlAuthentication) {
|
||||||
if (!this.objectInfo.password) {
|
if (!this.objectInfo.password) {
|
||||||
errors.push(localizedConstants.PasswordCannotBeEmptyError);
|
errors.push(localizedConstants.PasswordCannotBeEmptyError);
|
||||||
}
|
}
|
||||||
@@ -56,7 +57,7 @@ export class UserDialog extends PrincipalDialogBase<ObjectManagement.User, Objec
|
|||||||
&& (this.options.isNewObject || this.objectInfo.password !== this.originalObjectInfo.password)) {
|
&& (this.options.isNewObject || this.objectInfo.password !== this.originalObjectInfo.password)) {
|
||||||
errors.push(localizedConstants.InvalidPasswordError);
|
errors.push(localizedConstants.InvalidPasswordError);
|
||||||
}
|
}
|
||||||
} else if (this.objectInfo.type === ObjectManagement.UserType.LoginMapped && !this.objectInfo.loginName) {
|
} else if (this.objectInfo.type === UserType.LoginMapped && !this.objectInfo.loginName) {
|
||||||
errors.push(localizedConstants.LoginNotSelectedError);
|
errors.push(localizedConstants.LoginNotSelectedError);
|
||||||
}
|
}
|
||||||
return errors;
|
return errors;
|
||||||
@@ -148,18 +149,18 @@ export class UserDialog extends PrincipalDialogBase<ObjectManagement.User, Objec
|
|||||||
this.removeItem(this.generalSection, this.confirmPasswordContainer);
|
this.removeItem(this.generalSection, this.confirmPasswordContainer);
|
||||||
this.removeItem(this.formContainer, this.advancedSection);
|
this.removeItem(this.formContainer, this.advancedSection);
|
||||||
switch (this.objectInfo.type) {
|
switch (this.objectInfo.type) {
|
||||||
case ObjectManagement.UserType.LoginMapped:
|
case UserType.LoginMapped:
|
||||||
this.addItem(this.generalSection, this.loginContainer);
|
this.addItem(this.generalSection, this.loginContainer);
|
||||||
break;
|
break;
|
||||||
case ObjectManagement.UserType.AADAuthentication:
|
case UserType.AADAuthentication:
|
||||||
this.addItem(this.formContainer, this.advancedSection);
|
this.addItem(this.formContainer, this.advancedSection);
|
||||||
break;
|
break;
|
||||||
case ObjectManagement.UserType.SqlAuthentication:
|
case UserType.SqlAuthentication:
|
||||||
this.addItem(this.generalSection, this.passwordContainer);
|
this.addItem(this.generalSection, this.passwordContainer);
|
||||||
this.addItem(this.generalSection, this.confirmPasswordContainer);
|
this.addItem(this.generalSection, this.confirmPasswordContainer);
|
||||||
this.addItem(this.formContainer, this.advancedSection);
|
this.addItem(this.formContainer, this.advancedSection);
|
||||||
break;
|
break;
|
||||||
case ObjectManagement.UserType.WindowsUser:
|
case UserType.WindowsUser:
|
||||||
if (this.objectInfo.loginName) {
|
if (this.objectInfo.loginName) {
|
||||||
this.addItem(this.generalSection, this.loginContainer);
|
this.addItem(this.generalSection, this.loginContainer);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user