Implement Set-SsoGroup cmdlet
Signed-off-by: Dimitar Milov <dmilov@vmware.com>
This commit is contained in:
@@ -379,6 +379,41 @@ namespace VMware.vSphere.SsoAdminClient
|
||||
}
|
||||
}
|
||||
|
||||
public DataTypes.Group UpdateLocalGroup(DataTypes.Group group, string description)
|
||||
{
|
||||
if (description == null) {
|
||||
description = string.Empty;
|
||||
}
|
||||
|
||||
// Create Authorization Invocation Context
|
||||
var authorizedInvocationContext =
|
||||
CreateAuthorizedInvocationContext();
|
||||
|
||||
// Invoke SSO Admin DeleteLocalPrincipal operation
|
||||
var updatedGroup = authorizedInvocationContext.
|
||||
InvokeOperation(() =>
|
||||
_ssoAdminBindingClient.UpdateLocalGroupDetailsAsync(
|
||||
new ManagedObjectReference
|
||||
{
|
||||
type = "SsoAdminPrincipalManagementService",
|
||||
Value = "principalManagementService"
|
||||
},
|
||||
group.Name,
|
||||
new SsoAdminGroupDetails
|
||||
{
|
||||
description = description
|
||||
})).Result;
|
||||
|
||||
if (updatedGroup != null)
|
||||
{
|
||||
return FindGroup(updatedGroup.name, updatedGroup.domain, authorizedInvocationContext);
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void RemoveLocalGroup(DataTypes.Group group)
|
||||
{
|
||||
|
||||
@@ -127,4 +127,21 @@ Describe "SsoGroup Tests" {
|
||||
Get-SsoGroup -Name $groupName -Domain 'vsphere.local' | Should -Be $null
|
||||
}
|
||||
}
|
||||
|
||||
Context "Set-SsoGroup" {
|
||||
It 'Should update a SsoGroup with new description' {
|
||||
# Arrange
|
||||
$groupName = 'TestGroup4'
|
||||
$expectedDescription = 'Test Description 4'
|
||||
$groupToUpdate = New-SsoGroup -Name $groupName
|
||||
|
||||
# Act
|
||||
$actual = $groupToUpdate | Set-SsoGroup -Description $expectedDescription
|
||||
|
||||
# Assert
|
||||
$actual | Should -Not -Be $null
|
||||
$script:testGroupsToDelete += $actual
|
||||
$actual.Description | Should -Be $expectedDescription
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user