mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-17 01:25:40 -05:00
Support scripting for Users (#2002)
* WIP 1 * WIP2 * Fix merge break * Support alter existing object
This commit is contained in:
@@ -165,7 +165,8 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Security
|
||||
DatabaseUserType userType,
|
||||
string userName = null,
|
||||
string loginName = null,
|
||||
string databaseName = "master")
|
||||
string databaseName = "master",
|
||||
bool scriptUser = false)
|
||||
{
|
||||
string contextId = System.Guid.NewGuid().ToString();
|
||||
var initializeViewRequestParams = new InitializeUserViewParams
|
||||
@@ -181,6 +182,25 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Security
|
||||
.Returns(Task.FromResult(new UserViewInfo()));
|
||||
|
||||
await service.HandleInitializeUserViewRequest(initializeViewRequestParams, initializeUserViewContext.Object);
|
||||
|
||||
if (scriptUser)
|
||||
{
|
||||
var scriptParams = new ScriptUserParams
|
||||
{
|
||||
ContextId = contextId,
|
||||
User = SecurityTestUtils.GetTestUserInfo(userType, userName, loginName)
|
||||
};
|
||||
|
||||
var scriptUserContext = new Mock<RequestContext<string>>();
|
||||
scriptUserContext.Setup(x => x.SendResult(It.IsAny<string>()))
|
||||
.Returns(Task.FromResult(new object()));
|
||||
|
||||
await service.HandleScriptUserRequest(scriptParams, scriptUserContext.Object);
|
||||
|
||||
// verify the result
|
||||
scriptUserContext.Verify(x => x.SendResult(It.Is<string>
|
||||
(p => p.Contains("CREATE USER"))));
|
||||
}
|
||||
|
||||
var userParams = new CreateUserParams
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user