From 51cffe35e65951693fc3ae462972f74183309c51 Mon Sep 17 00:00:00 2001 From: Jim Wallace Date: Sat, 27 Jul 2019 16:32:58 -0400 Subject: [PATCH 1/6] add membership functions --- .docs/Add-VSTeamMembership.md | 39 ++ .docs/Get-VSTeamMembership.md | 71 +++ .docs/Remove-VSTeamMembership.md | 39 ++ .docs/Test-VSTeamMembership.md | 40 ++ .docs/params/containerDescriptor.md | 9 + .docs/params/memberDescriptor.md | 9 + .docs/synopsis/Add-VSTeamMembership.md | 1 + .docs/synopsis/Get-VSTeamMembership.md | 1 + .docs/synopsis/Remove-VSTeamMembership.md | 1 + .docs/synopsis/Test-VSTeamMembership.md | 1 + .vscode/settings.json | 16 +- CHANGELOG.md | 9 + Merge-File.ps1 | 3 +- Source/Private/callMembershipAPI.ps1 | 33 ++ Source/Private/common.ps1 | 4 + Source/Public/Add-VSTeamMembership.ps1 | 14 + Source/Public/Get-VSTeamMembership.ps1 | 17 + Source/Public/Remove-VSTeamMembership.ps1 | 13 + Source/Public/Test-VSTeamMembership.ps1 | 34 ++ Source/en-US/VSTeam-Help.xml | 609 ++++++++++++++++++---- docs/Add-VSTeamBuildTag.md | 4 +- docs/Add-VSTeamMembership.md | 59 +++ docs/Add-VSTeamRelease.md | 2 +- docs/Get-VSTeamMembership.md | 73 +++ docs/Remove-VSTeam.md | 4 +- docs/Remove-VSTeamAccount.md | 2 +- docs/Remove-VSTeamAgent.md | 2 +- docs/Remove-VSTeamBuild.md | 2 +- docs/Remove-VSTeamBuildDefinition.md | 2 +- docs/Remove-VSTeamBuildTag.md | 4 +- docs/Remove-VSTeamExtension.md | 2 +- docs/Remove-VSTeamGitRepository.md | 2 +- docs/Remove-VSTeamMembership.md | 59 +++ docs/Remove-VSTeamPolicy.md | 2 +- docs/Remove-VSTeamProfile.md | 2 +- docs/Remove-VSTeamProject.md | 2 +- docs/Remove-VSTeamRelease.md | 2 +- docs/Remove-VSTeamReleaseDefinition.md | 2 +- docs/Remove-VSTeamServiceEndpoint.md | 2 +- docs/Remove-VSTeamUserEntitlement.md | 4 +- docs/Set-VSTeamAPIVersion.md | 2 +- docs/Set-VSTeamAccount.md | 2 +- docs/Set-VSTeamAlias.md | 2 +- docs/Set-VSTeamApproval.md | 2 +- docs/Set-VSTeamDefaultProject.md | 2 +- docs/Set-VSTeamEnvironmentStatus.md | 2 +- docs/Set-VSTeamReleaseStatus.md | 2 +- docs/Team.md | 16 + docs/Test-VSTeamMembership.md | 60 +++ docs/Update-VSTeam.md | 4 +- docs/Update-VSTeamBuild.md | 4 +- docs/Update-VSTeamExtension.md | 2 +- docs/Update-VSTeamProfile.md | 2 +- docs/Update-VSTeamProject.md | 2 +- docs/Update-VSTeamRelease.md | 4 +- docs/Update-VSTeamReleaseDefinition.md | 8 +- docs/Update-VSTeamServiceEndpoint.md | 2 +- docs/Update-VSTeamUserEntitlement.md | 2 +- docs/Update-VSTeamWorkItem.md | 2 +- docs/readme.md | 16 + unit/test/membership.Tests.ps1 | 94 ++++ 61 files changed, 1287 insertions(+), 141 deletions(-) create mode 100644 .docs/Add-VSTeamMembership.md create mode 100644 .docs/Get-VSTeamMembership.md create mode 100644 .docs/Remove-VSTeamMembership.md create mode 100644 .docs/Test-VSTeamMembership.md create mode 100644 .docs/params/containerDescriptor.md create mode 100644 .docs/params/memberDescriptor.md create mode 100644 .docs/synopsis/Add-VSTeamMembership.md create mode 100644 .docs/synopsis/Get-VSTeamMembership.md create mode 100644 .docs/synopsis/Remove-VSTeamMembership.md create mode 100644 .docs/synopsis/Test-VSTeamMembership.md create mode 100644 Source/Private/callMembershipAPI.ps1 create mode 100644 Source/Public/Add-VSTeamMembership.ps1 create mode 100644 Source/Public/Get-VSTeamMembership.ps1 create mode 100644 Source/Public/Remove-VSTeamMembership.ps1 create mode 100644 Source/Public/Test-VSTeamMembership.ps1 create mode 100644 docs/Add-VSTeamMembership.md create mode 100644 docs/Get-VSTeamMembership.md create mode 100644 docs/Remove-VSTeamMembership.md create mode 100644 docs/Test-VSTeamMembership.md create mode 100644 unit/test/membership.Tests.ps1 diff --git a/.docs/Add-VSTeamMembership.md b/.docs/Add-VSTeamMembership.md new file mode 100644 index 000000000..33b9eeddf --- /dev/null +++ b/.docs/Add-VSTeamMembership.md @@ -0,0 +1,39 @@ + + +# Add-VSTeamMembership + +## SYNOPSIS + + + +## SYNTAX + +## DESCRIPTION + + + +## EXAMPLES + +## PARAMETERS + + + + + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[Get-VsTeamUser](Get-VsTeamUser.md) + +[Get-VsTeamGroup](Get-VsTeamGroup.md) + +[Get-VsTeamMembership](Get-VsTeamMembership.md) + +[Remove-VsTeamMembership](Remove-VsTeamMembership.md) + +[Test-VsTeamMembership](Test-VsTeamMembership.md) diff --git a/.docs/Get-VSTeamMembership.md b/.docs/Get-VSTeamMembership.md new file mode 100644 index 000000000..78f916243 --- /dev/null +++ b/.docs/Get-VSTeamMembership.md @@ -0,0 +1,71 @@ + + +# Get-VSTeamMembership + +## SYNOPSIS + + + +## SYNTAX + +## DESCRIPTION + + + +## EXAMPLES +### -------------------------- EXAMPLE 1 -------------------------- + +```PowerShell +(Get-VSTeamMembership -MemberDescriptor $user.ID).value | % { Get-VSTeamGroup -Descriptor $_.containerdescriptor } +``` +Get all the groups for a user + +### -------------------------- EXAMPLE 2 -------------------------- +```PowerShell +(Get-VSTeamMembership -ContainerDescriptor $group.id).value | % {Get-VSTeamUser -Descriptor $_.memberDescriptor } +``` + +Get all the members for a group + +## PARAMETERS + +### -ContainerDescriptor + +A container descriptor retrieved by Get-VsTeamGroup + +```yaml +Type: String +Required: True +Parameter Sets: ByContainerId +Position: 0 +``` + +### -MemberDescriptor + +A member descriptor retrieved by Get-VsTeamUser + +```yaml +Type: String +Required: True +Parameter Sets: ByMemberId +Position: 0 +``` + +## INPUTS + +## OUTPUTS + + +## NOTES + +## RELATED LINKS + +[Get-VsTeamUser](Get-VsTeamUser.md) + +[Get-VsTeamGroup](Get-VsTeamGroup.md) + +[Add-VsTeamMembership](Add-VsTeamMembership.md) + +[Remove-VsTeamMembership](Remove-VsTeamMembership.md) + +[Test-VsTeamMembership](Test-VsTeamMembership.md) diff --git a/.docs/Remove-VSTeamMembership.md b/.docs/Remove-VSTeamMembership.md new file mode 100644 index 000000000..0ec9eec38 --- /dev/null +++ b/.docs/Remove-VSTeamMembership.md @@ -0,0 +1,39 @@ + + +# Remove-VSTeamMembership + +## SYNOPSIS + + + +## SYNTAX + +## DESCRIPTION + + + +## EXAMPLES + +## PARAMETERS + + + + + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[Get-VsTeamUser](Get-VsTeamUser.md) + +[Get-VsTeamGroup](Get-VsTeamGroup.md) + +[Add-VsTeamMembership](Add-VsTeamMembership.md) + +[Get-VsTeamMembership](Get-VsTeamMembership.md) + +[Test-VsTeamMembership](Test-VsTeamMembership.md) diff --git a/.docs/Test-VSTeamMembership.md b/.docs/Test-VSTeamMembership.md new file mode 100644 index 000000000..aa403cd87 --- /dev/null +++ b/.docs/Test-VSTeamMembership.md @@ -0,0 +1,40 @@ + + +# Test-VSTeamMembership + +## SYNOPSIS + + + +## SYNTAX + +## DESCRIPTION + + + +## EXAMPLES + +## PARAMETERS + + + + + +## INPUTS + +## OUTPUTS +### $True or $False + +## NOTES + +## RELATED LINKS + +[Get-VsTeamUser](Get-VsTeamUser.md) + +[Get-VsTeamGroup](Get-VsTeamGroup.md) + +[Add-VsTeamMembership](Add-VsTeamMembership.md) + +[Get-VsTeamMembership](Get-VsTeamMembership.md) + +[Remove-VsTeamMembership](Remove-VsTeamMembership.md) diff --git a/.docs/params/containerDescriptor.md b/.docs/params/containerDescriptor.md new file mode 100644 index 000000000..d19e291e9 --- /dev/null +++ b/.docs/params/containerDescriptor.md @@ -0,0 +1,9 @@ +### -ContainerDescriptor + +A container descriptor retrieved by Get-VsTeamGroup + +```yaml +Type: String +Required: True +Position: 1 +``` diff --git a/.docs/params/memberDescriptor.md b/.docs/params/memberDescriptor.md new file mode 100644 index 000000000..73a830f29 --- /dev/null +++ b/.docs/params/memberDescriptor.md @@ -0,0 +1,9 @@ +### -MemberDescriptor + +A member descriptor retrieved by Get-VsTeamUser + +```yaml +Type: String +Required: True +Position: 0 +``` diff --git a/.docs/synopsis/Add-VSTeamMembership.md b/.docs/synopsis/Add-VSTeamMembership.md new file mode 100644 index 000000000..9153feb95 --- /dev/null +++ b/.docs/synopsis/Add-VSTeamMembership.md @@ -0,0 +1 @@ +Adds a membership to a container. \ No newline at end of file diff --git a/.docs/synopsis/Get-VSTeamMembership.md b/.docs/synopsis/Get-VSTeamMembership.md new file mode 100644 index 000000000..9ca63096e --- /dev/null +++ b/.docs/synopsis/Get-VSTeamMembership.md @@ -0,0 +1 @@ +Gets a memberships for a container or member. \ No newline at end of file diff --git a/.docs/synopsis/Remove-VSTeamMembership.md b/.docs/synopsis/Remove-VSTeamMembership.md new file mode 100644 index 000000000..52a7f2227 --- /dev/null +++ b/.docs/synopsis/Remove-VSTeamMembership.md @@ -0,0 +1 @@ +Removes a membership to a container. \ No newline at end of file diff --git a/.docs/synopsis/Test-VSTeamMembership.md b/.docs/synopsis/Test-VSTeamMembership.md new file mode 100644 index 000000000..9a613964c --- /dev/null +++ b/.docs/synopsis/Test-VSTeamMembership.md @@ -0,0 +1 @@ +Tests the membership in a container. \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index c6a1c7061..f5d99a39d 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -48,5 +48,19 @@ "vsrm", "vssgp", "vssps" - ] + ], + "workbench.colorCustomizations": { + "activityBar.background": "#007699", + "activityBar.foreground": "#e7e7e7", + "activityBar.inactiveForeground": "#e7e7e799", + "activityBarBadge.background": "#ff80e2", + "activityBarBadge.foreground": "#15202b", + "titleBar.activeBackground": "#004f66", + "titleBar.inactiveBackground": "#004f6699", + "titleBar.activeForeground": "#e7e7e7", + "titleBar.inactiveForeground": "#e7e7e799", + "statusBar.background": "#004f66", + "statusBarItem.hoverBackground": "#007699", + "statusBar.foreground": "#e7e7e7" + } } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index f5770de8a..bd0845135 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## 6.3.1 + +Added support for the following: + +- Add-VSTeamMembership +- Remove-VSTeamMembership +- Get-VSTeamMembership +- Test-VSTeamMembership + ## 6.3.0 Added support for the following: diff --git a/Merge-File.ps1 b/Merge-File.ps1 index 358bce10b..790103162 100644 --- a/Merge-File.ps1 +++ b/Merge-File.ps1 @@ -102,7 +102,7 @@ function Merge-Format { $fileContents = Get-Content $file $newFileContents = ($fileContents -replace '', '') [xml]$xml = $newFileContents - + $finalXml += $xml.Configuration.ViewDefinitions.InnerXml } @@ -173,6 +173,7 @@ function Merge-Class { process { $usingsSb = New-Object System.Text.StringBuilder $contents = New-Object System.Text.StringBuilder + $usings = @() ForEach ($file in $files) { Write-Verbose -Message "Merging from $file" diff --git a/Source/Private/callMembershipAPI.ps1 b/Source/Private/callMembershipAPI.ps1 new file mode 100644 index 000000000..a458b466d --- /dev/null +++ b/Source/Private/callMembershipAPI.ps1 @@ -0,0 +1,33 @@ + +function _callMembershipAPI { + [CmdletBinding()] + param( + [Parameter(Mandatory = $true)] + [string] $Id, + [ValidateSet('Get', 'Post', 'Patch', 'Delete', 'Options', 'Put', 'Default', 'Head', 'Merge', 'Trace')] + [string] $Method, + [ValidateSet('', 'Up', 'Down')] + [string] $Direction + ) + Set-StrictMode -Version Latest + + # This will throw if this account does not support the graph API + _supportsGraph + + Write-Verbose "Getting members for $Id" + + $query = @{} + if ($Direction) { + $query['direction'] = $Direction + } + + # Call the REST API + $resp = _callAPI -Area 'graph' -Resource 'memberships' ` + -Id $Id ` + -SubDomain "vssps" ` + -Method $Method ` + -Version $([VSTeamVersions]::Graph) ` + -QueryString $query + + return $resp +} \ No newline at end of file diff --git a/Source/Private/common.ps1 b/Source/Private/common.ps1 index 5b1b22011..41631f63b 100644 --- a/Source/Private/common.ps1 +++ b/Source/Private/common.ps1 @@ -8,24 +8,28 @@ $profilesPath = "$HOME/vsteam_profiles.json" # Not all versions support the name features. function _supportsGraph { + _hasAccount if (-not [VSTeamVersions]::Graph) { throw 'This account does not support the graph API.' } } function _supportsFeeds { + _hasAccount if (-not [VSTeamVersions]::Packaging) { throw 'This account does not support packages.' } } function _supportsSecurityNamespace { + _hasAccount if (([VSTeamVersions]::Version -ne "VSTS") -and ([VSTeamVersions]::Version -ne "AzD")) { throw 'Security Namespaces are currently only supported in Azure DevOps Service (Online)' } } function _supportsMemberEntitlementManagement { + _hasAccount if (-not [VSTeamVersions]::MemberEntitlementManagement) { throw 'This account does not support Member Entitlement.' } diff --git a/Source/Public/Add-VSTeamMembership.ps1 b/Source/Public/Add-VSTeamMembership.ps1 new file mode 100644 index 000000000..fd638c97b --- /dev/null +++ b/Source/Public/Add-VSTeamMembership.ps1 @@ -0,0 +1,14 @@ +function Add-VSTeamMembership { + [CmdletBinding()] + param( + [Parameter(Mandatory = $true)] + [string] $MemberDescriptor, + [Parameter(Mandatory = $true)] + [string] $ContainerDescriptor, + [switch] $DontTest + ) + + process { + return _callMembershipAPI -Id "$MemberDescriptor/$ContainerDescriptor" -Method Put + } +} \ No newline at end of file diff --git a/Source/Public/Get-VSTeamMembership.ps1 b/Source/Public/Get-VSTeamMembership.ps1 new file mode 100644 index 000000000..fadca6010 --- /dev/null +++ b/Source/Public/Get-VSTeamMembership.ps1 @@ -0,0 +1,17 @@ +function Get-VSTeamMembership { + [CmdletBinding()] + param( + [Parameter(Mandatory = $true, ValueFromPipeline, ValueFromPipelineByPropertyName,ParameterSetName="ByContainerId")] + [string] $ContainerDescriptor, + [Parameter(Mandatory = $true, ValueFromPipeline, ValueFromPipelineByPropertyName,ParameterSetName="ByMemberId")] + [string] $MemberDescriptor + ) + + process { + if ($MemberDescriptor) { + return _callMembershipAPI -Id $MemberDescriptor -Method Get -Direction Up + } else { + return _callMembershipAPI -Id $ContainerDescriptor -Method Get -Direction Down + } + } +} diff --git a/Source/Public/Remove-VSTeamMembership.ps1 b/Source/Public/Remove-VSTeamMembership.ps1 new file mode 100644 index 000000000..54655c045 --- /dev/null +++ b/Source/Public/Remove-VSTeamMembership.ps1 @@ -0,0 +1,13 @@ +function Remove-VSTeamMembership { + [CmdletBinding()] + param( + [Parameter(Mandatory = $true)] + [string] $MemberDescriptor, + [Parameter(Mandatory = $true)] + [string] $ContainerDescriptor + ) + + process { + return _callMembershipAPI -Id "$MemberDescriptor/$ContainerDescriptor" -Method Delete + } +} diff --git a/Source/Public/Test-VSTeamMembership.ps1 b/Source/Public/Test-VSTeamMembership.ps1 new file mode 100644 index 000000000..429bc0012 --- /dev/null +++ b/Source/Public/Test-VSTeamMembership.ps1 @@ -0,0 +1,34 @@ +function Test-VSTeamMembership { + [CmdletBinding()] + param( + [Parameter(Mandatory = $true, ValueFromPipelineByPropertyName = "MemberDescriptor")] + [string] $MemberDescriptor, + [Parameter(Mandatory = $true, ValueFromPipelineByPropertyName = "ContainerDescriptor")] + [string] $ContainerDescriptor + ) + + process { + Set-StrictMode -Version Latest + + $PrevWarningPreference = $WarningPreference + try { + $WarningPreference = "SilentlyContinue" # avoid 404 warning, since that indicates it doesn't exist + $null = _callMembershipAPI -Id "$MemberDescriptor/$ContainerDescriptor" -Method Head + return $true + } catch { + $WarningPreference = $PrevWarningPreference + $e = $_ + try { + if ($e.Exception -and $e.Exception.Response -and $e.Exception.Response.StatusCode -eq [System.Net.HttpStatusCode]::NotFound) + { + return $false + } + } catch { + Write-Warning "Nested exception $_" + } + throw $e + } finally { + $WarningPreference = $PrevWarningPreference + } + } +} diff --git a/Source/en-US/VSTeam-Help.xml b/Source/en-US/VSTeam-Help.xml index 6d62aca9a..e0aed3ef1 100644 --- a/Source/en-US/VSTeam-Help.xml +++ b/Source/en-US/VSTeam-Help.xml @@ -1174,7 +1174,7 @@ Demo-CI Demo-CI-45 notStarted Confirm - Prompts you for confirmation before running the cmdlet. + Prompts you for confirmation before running the function. SwitchParameter @@ -1185,7 +1185,7 @@ Demo-CI Demo-CI-45 notStarted Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -1250,7 +1250,7 @@ Demo-CI Demo-CI-45 notStarted Confirm - Prompts you for confirmation before running the cmdlet. + Prompts you for confirmation before running the function. SwitchParameter @@ -1262,7 +1262,7 @@ Demo-CI Demo-CI-45 notStarted Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -2154,6 +2154,104 @@ Demo-CI Demo-CI-45 notStarted + + + Add-VSTeamMembership + Add + VSTeamMembership + + Adds a membership to a container. + + + + Adds a membership to a container. + + + + Add-VSTeamMembership + + MemberDescriptor + + A member descriptor retrieved by Get-VsTeamUser + + String + + String + + + None + + + ContainerDescriptor + + A container descriptor retrieved by Get-VsTeamGroup + + String + + String + + + None + + + + + + MemberDescriptor + + A member descriptor retrieved by Get-VsTeamUser + + String + + String + + + None + + + ContainerDescriptor + + A container descriptor retrieved by Get-VsTeamGroup + + String + + String + + + None + + + + + + + + + + + + + Get-VsTeamUser + + + + Get-VsTeamGroup + + + + Get-VsTeamMembership + + + + Remove-VsTeamMembership + + + + Test-VsTeamMembership + + + + Add-VSTeamNuGetEndpoint @@ -3564,7 +3662,7 @@ PS C:\> Add-NuGetEndpoint -EndpointName 'PowerShell Gallery' -NuGetUrl 'https Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -3652,7 +3750,7 @@ PS C:\> Add-NuGetEndpoint -EndpointName 'PowerShell Gallery' -NuGetUrl 'https Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -3776,7 +3874,7 @@ PS C:\> Add-NuGetEndpoint -EndpointName 'PowerShell Gallery' -NuGetUrl 'https Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -9062,6 +9160,122 @@ ID Title Status + + + Get-VSTeamMembership + Get + VSTeamMembership + + Gets a memberships for a container or member. + + + + Gets a memberships for a container or member. + + + + Get-VSTeamMembership + + ContainerDescriptor + + A container descriptor retrieved by Get-VsTeamGroup + + String + + String + + + None + + + + Get-VSTeamMembership + + MemberDescriptor + + A member descriptor retrieved by Get-VsTeamUser + + String + + String + + + None + + + + + + ContainerDescriptor + + A container descriptor retrieved by Get-VsTeamGroup + + String + + String + + + None + + + MemberDescriptor + + A member descriptor retrieved by Get-VsTeamUser + + String + + String + + + None + + + + + + + + + + + + -------------------------- EXAMPLE 1 -------------------------- + (Get-VSTeamMembership -MemberDescriptor $user.ID).value | % { Get-VSTeamGroup -Descriptor $_.containerdescriptor } + + Get all the groups for a user + + + + -------------------------- EXAMPLE 2 -------------------------- + (Get-VSTeamMembership -ContainerDescriptor $group.id).value | % {Get-VSTeamUser -Descriptor $_.memberDescriptor } + + Get all the members for a group + + + + + + Get-VsTeamUser + + + + Get-VsTeamGroup + + + + Add-VsTeamMembership + + + + Remove-VsTeamMembership + + + + Test-VsTeamMembership + + + + Get-VSTeamOption @@ -12704,7 +12918,7 @@ Get-VSTeamVariableGroup @methodParameters Confirm - Prompts you for confirmation before running the cmdlet. + Prompts you for confirmation before running the function. SwitchParameter @@ -12715,7 +12929,7 @@ Get-VSTeamVariableGroup @methodParameters Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -12766,7 +12980,7 @@ Get-VSTeamVariableGroup @methodParameters Confirm - Prompts you for confirmation before running the cmdlet. + Prompts you for confirmation before running the function. SwitchParameter @@ -12778,7 +12992,7 @@ Get-VSTeamVariableGroup @methodParameters Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -12974,7 +13188,7 @@ Get-VSTeamVariableGroup @methodParameters Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -13000,7 +13214,7 @@ Get-VSTeamVariableGroup @methodParameters Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -13075,7 +13289,7 @@ Get-VSTeamVariableGroup @methodParameters Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -13113,7 +13327,7 @@ Get-VSTeamVariableGroup @methodParameters Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -13188,7 +13402,7 @@ Get-VSTeamVariableGroup @methodParameters Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -13230,7 +13444,7 @@ Get-VSTeamVariableGroup @methodParameters Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -13314,7 +13528,7 @@ Get-VSTeamVariableGroup @methodParameters Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -13356,7 +13570,7 @@ Get-VSTeamVariableGroup @methodParameters Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -13472,7 +13686,7 @@ Get-VSTeamVariableGroup @methodParameters Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -13483,7 +13697,7 @@ Get-VSTeamVariableGroup @methodParameters Confirm - Prompts you for confirmation before running the cmdlet. + Prompts you for confirmation before running the function. SwitchParameter @@ -13548,7 +13762,7 @@ Get-VSTeamVariableGroup @methodParameters Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -13560,7 +13774,7 @@ Get-VSTeamVariableGroup @methodParameters Confirm - Prompts you for confirmation before running the cmdlet. + Prompts you for confirmation before running the function. SwitchParameter @@ -13634,7 +13848,7 @@ Get-VSTeamVariableGroup @methodParameters Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -13672,7 +13886,7 @@ Get-VSTeamVariableGroup @methodParameters Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -13802,7 +14016,7 @@ Get-VSTeamVariableGroup @methodParameters Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -13830,7 +14044,7 @@ Get-VSTeamVariableGroup @methodParameters Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -13858,6 +14072,104 @@ Get-VSTeamVariableGroup @methodParameters + + + Remove-VSTeamMembership + Remove + VSTeamMembership + + Removes a membership to a container. + + + + Removes a membership to a container. + + + + Remove-VSTeamMembership + + MemberDescriptor + + A member descriptor retrieved by Get-VsTeamUser + + String + + String + + + None + + + ContainerDescriptor + + A container descriptor retrieved by Get-VsTeamGroup + + String + + String + + + None + + + + + + MemberDescriptor + + A member descriptor retrieved by Get-VsTeamUser + + String + + String + + + None + + + ContainerDescriptor + + A container descriptor retrieved by Get-VsTeamGroup + + String + + String + + + None + + + + + + + + + + + + + Get-VsTeamUser + + + + Get-VsTeamGroup + + + + Add-VsTeamMembership + + + + Get-VsTeamMembership + + + + Test-VsTeamMembership + + + + Remove-VSTeamPolicy @@ -13903,7 +14215,7 @@ Get-VSTeamVariableGroup @methodParameters Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -13944,7 +14256,7 @@ Get-VSTeamVariableGroup @methodParameters Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -14015,7 +14327,7 @@ Get-VSTeamVariableGroup @methodParameters Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -14041,7 +14353,7 @@ Get-VSTeamVariableGroup @methodParameters Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -14107,7 +14419,7 @@ Get-VSTeamVariableGroup @methodParameters Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -14135,7 +14447,7 @@ Get-VSTeamVariableGroup @methodParameters Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -14233,7 +14545,7 @@ Get-VSTeamVariableGroup @methodParameters Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -14275,7 +14587,7 @@ Get-VSTeamVariableGroup @methodParameters Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -14380,7 +14692,7 @@ Get-VSTeamVariableGroup @methodParameters Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -14422,7 +14734,7 @@ Get-VSTeamVariableGroup @methodParameters Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -14524,7 +14836,7 @@ Get-VSTeamVariableGroup @methodParameters Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -14564,7 +14876,7 @@ Get-VSTeamVariableGroup @methodParameters Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -14616,7 +14928,7 @@ Get-VSTeamVariableGroup @methodParameters Confirm - Prompts you for confirmation before running the cmdlet. + Prompts you for confirmation before running the function. SwitchParameter @@ -14627,7 +14939,7 @@ Get-VSTeamVariableGroup @methodParameters Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -14664,7 +14976,7 @@ Get-VSTeamVariableGroup @methodParameters Confirm - Prompts you for confirmation before running the cmdlet. + Prompts you for confirmation before running the function. SwitchParameter @@ -14675,7 +14987,7 @@ Get-VSTeamVariableGroup @methodParameters Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -14700,7 +15012,7 @@ Get-VSTeamVariableGroup @methodParameters Confirm - Prompts you for confirmation before running the cmdlet. + Prompts you for confirmation before running the function. SwitchParameter @@ -14712,7 +15024,7 @@ Get-VSTeamVariableGroup @methodParameters Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -15109,7 +15421,7 @@ Remove-VSTeamVariableGroup @methodParameters Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -15202,7 +15514,7 @@ Remove-VSTeamVariableGroup @methodParameters Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -15283,7 +15595,7 @@ Remove-VSTeamVariableGroup @methodParameters Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -15321,7 +15633,7 @@ Remove-VSTeamVariableGroup @methodParameters Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -15453,7 +15765,7 @@ Remove-VSTeamVariableGroup @methodParameters Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -15561,7 +15873,7 @@ PS demo:\> Get-ChildItem Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -15575,7 +15887,7 @@ PS demo:\> Get-ChildItem Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -15647,7 +15959,7 @@ PS demo:\> Get-ChildItem Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -15695,7 +16007,7 @@ PS demo:\> Get-ChildItem Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -15759,7 +16071,7 @@ PS demo:\> Get-ChildItem Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -15878,7 +16190,7 @@ PS demo:\> Get-ChildItem Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -15958,7 +16270,7 @@ PS demo:\> Get-ChildItem Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -16039,7 +16351,7 @@ PS demo:\> Get-ChildItem Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -16053,7 +16365,7 @@ PS demo:\> Get-ChildItem Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -16222,7 +16534,7 @@ PS demo:\> Get-ChildItem Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -16313,7 +16625,7 @@ PS demo:\> Get-ChildItem Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -16401,7 +16713,7 @@ PS demo:\> Get-ChildItem Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -16455,7 +16767,7 @@ PS demo:\> Get-ChildItem Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -17554,6 +17866,113 @@ PS demo:\> Get-ChildItem + + + Test-VSTeamMembership + Test + VSTeamMembership + + Tests the membership in a container. + + + + Tests the membership in a container. + + + + Test-VSTeamMembership + + MemberDescriptor + + A member descriptor retrieved by Get-VsTeamUser + + String + + String + + + None + + + ContainerDescriptor + + A container descriptor retrieved by Get-VsTeamGroup + + String + + String + + + None + + + + + + MemberDescriptor + + A member descriptor retrieved by Get-VsTeamUser + + String + + String + + + None + + + ContainerDescriptor + + A container descriptor retrieved by Get-VsTeamGroup + + String + + String + + + None + + + + + + + $True or $False + + + + + + + + + + + + + + + Get-VsTeamUser + + + + Get-VsTeamGroup + + + + Add-VsTeamMembership + + + + Get-VsTeamMembership + + + + Remove-VsTeamMembership + + + + Update-VSTeam @@ -17622,7 +18041,7 @@ PS demo:\> Get-ChildItem Confirm - Prompts you for confirmation before running the cmdlet. + Prompts you for confirmation before running the function. SwitchParameter @@ -17633,7 +18052,7 @@ PS demo:\> Get-ChildItem Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -17708,7 +18127,7 @@ PS demo:\> Get-ChildItem Confirm - Prompts you for confirmation before running the cmdlet. + Prompts you for confirmation before running the function. SwitchParameter @@ -17720,7 +18139,7 @@ PS demo:\> Get-ChildItem Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -17840,7 +18259,7 @@ PS demo:\> Get-ChildItem Confirm - Prompts you for confirmation before running the cmdlet. + Prompts you for confirmation before running the function. SwitchParameter @@ -17851,7 +18270,7 @@ PS demo:\> Get-ChildItem Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -17926,7 +18345,7 @@ PS demo:\> Get-ChildItem Confirm - Prompts you for confirmation before running the cmdlet. + Prompts you for confirmation before running the function. SwitchParameter @@ -17938,7 +18357,7 @@ PS demo:\> Get-ChildItem Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -18234,7 +18653,7 @@ PS C:\> Update-VSTeamBuildDefinition -ProjectName Demo -Id 23 -BuildDefinitio Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -18286,7 +18705,7 @@ PS C:\> Update-VSTeamBuildDefinition -ProjectName Demo -Id 23 -BuildDefinitio Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -18565,7 +18984,7 @@ PS C:\> Update-VSTeamBuildDefinition -ProjectName Demo -Id 23 -BuildDefinitio Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -18603,7 +19022,7 @@ PS C:\> Update-VSTeamBuildDefinition -ProjectName Demo -Id 23 -BuildDefinitio Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -18655,7 +19074,7 @@ PS C:\> Update-VSTeamBuildDefinition -ProjectName Demo -Id 23 -BuildDefinitio Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -18774,7 +19193,7 @@ PS C:\> Update-VSTeamBuildDefinition -ProjectName Demo -Id 23 -BuildDefinitio Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -18838,7 +19257,7 @@ PS C:\> Update-VSTeamBuildDefinition -ProjectName Demo -Id 23 -BuildDefinitio Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -18940,7 +19359,7 @@ PS C:\> Update-VSTeamBuildDefinition -ProjectName Demo -Id 23 -BuildDefinitio Confirm - Prompts you for confirmation before running the cmdlet. + Prompts you for confirmation before running the function. SwitchParameter @@ -18951,7 +19370,7 @@ PS C:\> Update-VSTeamBuildDefinition -ProjectName Demo -Id 23 -BuildDefinitio Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -19014,7 +19433,7 @@ PS C:\> Update-VSTeamBuildDefinition -ProjectName Demo -Id 23 -BuildDefinitio Confirm - Prompts you for confirmation before running the cmdlet. + Prompts you for confirmation before running the function. SwitchParameter @@ -19026,7 +19445,7 @@ PS C:\> Update-VSTeamBuildDefinition -ProjectName Demo -Id 23 -BuildDefinitio Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -19133,7 +19552,7 @@ PS C:\> Update-VSTeamRelease -ProjectName project -Id 76 -release $r Confirm - Prompts you for confirmation before running the cmdlet. + Prompts you for confirmation before running the function. SwitchParameter @@ -19144,7 +19563,7 @@ PS C:\> Update-VSTeamRelease -ProjectName project -Id 76 -release $r Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -19195,7 +19614,7 @@ PS C:\> Update-VSTeamRelease -ProjectName project -Id 76 -release $r Confirm - Prompts you for confirmation before running the cmdlet. + Prompts you for confirmation before running the function. SwitchParameter @@ -19206,7 +19625,7 @@ PS C:\> Update-VSTeamRelease -ProjectName project -Id 76 -release $r Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -19269,7 +19688,7 @@ PS C:\> Update-VSTeamRelease -ProjectName project -Id 76 -release $r Confirm - Prompts you for confirmation before running the cmdlet. + Prompts you for confirmation before running the function. SwitchParameter @@ -19281,7 +19700,7 @@ PS C:\> Update-VSTeamRelease -ProjectName project -Id 76 -release $r Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -19398,7 +19817,7 @@ PS C:\> Update-VSTeamReleaseDefinition -ProjectName Demo -ReleaseDefinition $ Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -19450,7 +19869,7 @@ PS C:\> Update-VSTeamReleaseDefinition -ProjectName Demo -ReleaseDefinition $ Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -19560,7 +19979,7 @@ PS C:\> Update-VSTeamReleaseDefinition -ProjectName Demo -ReleaseDefinition $ Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -19604,7 +20023,7 @@ PS C:\> Update-VSTeamReleaseDefinition -ProjectName Demo -ReleaseDefinition $ Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -19660,7 +20079,7 @@ PS C:\> Update-VSTeamReleaseDefinition -ProjectName Demo -ReleaseDefinition $ Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -20123,7 +20542,7 @@ Update-VSTeamVariableGroup @methodParameters Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -20197,7 +20616,7 @@ Update-VSTeamVariableGroup @methodParameters Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter diff --git a/docs/Add-VSTeamBuildTag.md b/docs/Add-VSTeamBuildTag.md index a3f08bceb..af31e3a28 100644 --- a/docs/Add-VSTeamBuildTag.md +++ b/docs/Add-VSTeamBuildTag.md @@ -60,7 +60,7 @@ Accept pipeline input: true (ByPropertyName, ByValue) ### -Confirm -Prompts you for confirmation before running the cmdlet. +Prompts you for confirmation before running the function. ```yaml Type: SwitchParameter @@ -73,7 +73,7 @@ Aliases: cf ### -Force -Forces the command without confirmation +Forces the function without confirmation ```yaml Type: SwitchParameter diff --git a/docs/Add-VSTeamMembership.md b/docs/Add-VSTeamMembership.md new file mode 100644 index 000000000..7b149c031 --- /dev/null +++ b/docs/Add-VSTeamMembership.md @@ -0,0 +1,59 @@ + + + +# Add-VSTeamMembership + +## SYNOPSIS + +Adds a membership to a container. + +## SYNTAX + +## DESCRIPTION + +Adds a membership to a container. + +## EXAMPLES + +## PARAMETERS + +### -MemberDescriptor + +A member descriptor retrieved by Get-VsTeamUser + +```yaml +Type: String +Required: True +Position: 0 +``` + + +### -ContainerDescriptor + +A container descriptor retrieved by Get-VsTeamGroup + +```yaml +Type: String +Required: True +Position: 1 +``` + + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[Get-VsTeamUser](Get-VsTeamUser.md) + +[Get-VsTeamGroup](Get-VsTeamGroup.md) + +[Get-VsTeamMembership](Get-VsTeamMembership.md) + +[Remove-VsTeamMembership](Remove-VsTeamMembership.md) + +[Test-VsTeamMembership](Test-VsTeamMembership.md) + diff --git a/docs/Add-VSTeamRelease.md b/docs/Add-VSTeamRelease.md index f0c15b480..010bb9df0 100644 --- a/docs/Add-VSTeamRelease.md +++ b/docs/Add-VSTeamRelease.md @@ -144,7 +144,7 @@ Accept pipeline input: true (ByPropertyName) ### -Force -Forces the command without confirmation +Forces the function without confirmation ```yaml Type: SwitchParameter diff --git a/docs/Get-VSTeamMembership.md b/docs/Get-VSTeamMembership.md new file mode 100644 index 000000000..5cfb0750c --- /dev/null +++ b/docs/Get-VSTeamMembership.md @@ -0,0 +1,73 @@ + + + +# Get-VSTeamMembership + +## SYNOPSIS + +Gets a memberships for a container or member. + +## SYNTAX + +## DESCRIPTION + +Gets a memberships for a container or member. + +## EXAMPLES +### -------------------------- EXAMPLE 1 -------------------------- + +```PowerShell +(Get-VSTeamMembership -MemberDescriptor $user.ID).value | % { Get-VSTeamGroup -Descriptor $_.containerdescriptor } +``` +Get all the groups for a user + +### -------------------------- EXAMPLE 2 -------------------------- +```PowerShell +(Get-VSTeamMembership -ContainerDescriptor $group.id).value | % {Get-VSTeamUser -Descriptor $_.memberDescriptor } +``` + +Get all the members for a group + +## PARAMETERS + +### -ContainerDescriptor + +A container descriptor retrieved by Get-VsTeamGroup + +```yaml +Type: String +Required: True +Parameter Sets: ByContainerId +Position: 0 +``` + +### -MemberDescriptor + +A member descriptor retrieved by Get-VsTeamUser + +```yaml +Type: String +Required: True +Parameter Sets: ByMemberId +Position: 0 +``` + +## INPUTS + +## OUTPUTS + + +## NOTES + +## RELATED LINKS + +[Get-VsTeamUser](Get-VsTeamUser.md) + +[Get-VsTeamGroup](Get-VsTeamGroup.md) + +[Add-VsTeamMembership](Add-VsTeamMembership.md) + +[Remove-VsTeamMembership](Remove-VsTeamMembership.md) + +[Test-VsTeamMembership](Test-VsTeamMembership.md) + diff --git a/docs/Remove-VSTeam.md b/docs/Remove-VSTeam.md index 950e2bc1f..2fc68f000 100644 --- a/docs/Remove-VSTeam.md +++ b/docs/Remove-VSTeam.md @@ -46,7 +46,7 @@ Accept pipeline input: true (ByPropertyName) ### -Confirm -Prompts you for confirmation before running the cmdlet. +Prompts you for confirmation before running the function. ```yaml Type: SwitchParameter @@ -59,7 +59,7 @@ Aliases: cf ### -Force -Forces the command without confirmation +Forces the function without confirmation ```yaml Type: SwitchParameter diff --git a/docs/Remove-VSTeamAccount.md b/docs/Remove-VSTeamAccount.md index 72910f0bc..9935e2957 100644 --- a/docs/Remove-VSTeamAccount.md +++ b/docs/Remove-VSTeamAccount.md @@ -37,7 +37,7 @@ Type: String ### -Force -Forces the command without confirmation +Forces the function without confirmation ```yaml Type: SwitchParameter diff --git a/docs/Remove-VSTeamAgent.md b/docs/Remove-VSTeamAgent.md index a512ec755..200da853d 100644 --- a/docs/Remove-VSTeamAgent.md +++ b/docs/Remove-VSTeamAgent.md @@ -40,7 +40,7 @@ Accept pipeline input: true (ByPropertyName) ### -Force -Forces the command without confirmation +Forces the function without confirmation ```yaml Type: SwitchParameter diff --git a/docs/Remove-VSTeamBuild.md b/docs/Remove-VSTeamBuild.md index ac2b9f4d5..fba9d923b 100644 --- a/docs/Remove-VSTeamBuild.md +++ b/docs/Remove-VSTeamBuild.md @@ -57,7 +57,7 @@ Accept pipeline input: true (ByPropertyName, ByValue) ### -Force -Forces the command without confirmation +Forces the function without confirmation ```yaml Type: SwitchParameter diff --git a/docs/Remove-VSTeamBuildDefinition.md b/docs/Remove-VSTeamBuildDefinition.md index 49cb4271d..4d5c84e08 100644 --- a/docs/Remove-VSTeamBuildDefinition.md +++ b/docs/Remove-VSTeamBuildDefinition.md @@ -61,7 +61,7 @@ Accept pipeline input: true (ByPropertyName) ### -Force -Forces the command without confirmation +Forces the function without confirmation ```yaml Type: SwitchParameter diff --git a/docs/Remove-VSTeamBuildTag.md b/docs/Remove-VSTeamBuildTag.md index aa7f9d04a..f26d0d858 100644 --- a/docs/Remove-VSTeamBuildTag.md +++ b/docs/Remove-VSTeamBuildTag.md @@ -60,7 +60,7 @@ Accept pipeline input: true (ByPropertyName, ByValue) ### -Force -Forces the command without confirmation +Forces the function without confirmation ```yaml Type: SwitchParameter @@ -72,7 +72,7 @@ Parameter Sets: (All) ### -Confirm -Prompts you for confirmation before running the cmdlet. +Prompts you for confirmation before running the function. ```yaml Type: SwitchParameter diff --git a/docs/Remove-VSTeamExtension.md b/docs/Remove-VSTeamExtension.md index 862f423c5..8a8a29af0 100644 --- a/docs/Remove-VSTeamExtension.md +++ b/docs/Remove-VSTeamExtension.md @@ -37,7 +37,7 @@ Required: True ### -Force -Forces the command without confirmation +Forces the function without confirmation ```yaml Type: SwitchParameter diff --git a/docs/Remove-VSTeamGitRepository.md b/docs/Remove-VSTeamGitRepository.md index 16a150144..6f3a91dcf 100644 --- a/docs/Remove-VSTeamGitRepository.md +++ b/docs/Remove-VSTeamGitRepository.md @@ -41,7 +41,7 @@ Accept pipeline input: true (ByPropertyName) ### -Force -Forces the command without confirmation +Forces the function without confirmation ```yaml Type: SwitchParameter diff --git a/docs/Remove-VSTeamMembership.md b/docs/Remove-VSTeamMembership.md new file mode 100644 index 000000000..c553abec5 --- /dev/null +++ b/docs/Remove-VSTeamMembership.md @@ -0,0 +1,59 @@ + + + +# Remove-VSTeamMembership + +## SYNOPSIS + +Removes a membership to a container. + +## SYNTAX + +## DESCRIPTION + +Removes a membership to a container. + +## EXAMPLES + +## PARAMETERS + +### -MemberDescriptor + +A member descriptor retrieved by Get-VsTeamUser + +```yaml +Type: String +Required: True +Position: 0 +``` + + +### -ContainerDescriptor + +A container descriptor retrieved by Get-VsTeamGroup + +```yaml +Type: String +Required: True +Position: 1 +``` + + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[Get-VsTeamUser](Get-VsTeamUser.md) + +[Get-VsTeamGroup](Get-VsTeamGroup.md) + +[Add-VsTeamMembership](Add-VsTeamMembership.md) + +[Get-VsTeamMembership](Get-VsTeamMembership.md) + +[Test-VsTeamMembership](Test-VsTeamMembership.md) + diff --git a/docs/Remove-VSTeamPolicy.md b/docs/Remove-VSTeamPolicy.md index 4fb658464..c51fc3165 100644 --- a/docs/Remove-VSTeamPolicy.md +++ b/docs/Remove-VSTeamPolicy.md @@ -55,7 +55,7 @@ Accept pipeline input: true (ByPropertyName) ### -Force -Forces the command without confirmation +Forces the function without confirmation ```yaml Type: SwitchParameter diff --git a/docs/Remove-VSTeamProfile.md b/docs/Remove-VSTeamProfile.md index 9dd3e5b9e..9536ac859 100644 --- a/docs/Remove-VSTeamProfile.md +++ b/docs/Remove-VSTeamProfile.md @@ -36,7 +36,7 @@ Required: True ### -Force -Forces the command without confirmation +Forces the function without confirmation ```yaml Type: SwitchParameter diff --git a/docs/Remove-VSTeamProject.md b/docs/Remove-VSTeamProject.md index effc220f8..9b1536231 100644 --- a/docs/Remove-VSTeamProject.md +++ b/docs/Remove-VSTeamProject.md @@ -61,7 +61,7 @@ Accept pipeline input: true (ByPropertyName) ### -Force -Forces the command without confirmation +Forces the function without confirmation ```yaml Type: SwitchParameter diff --git a/docs/Remove-VSTeamRelease.md b/docs/Remove-VSTeamRelease.md index 3ed1ac5b8..453ced42d 100644 --- a/docs/Remove-VSTeamRelease.md +++ b/docs/Remove-VSTeamRelease.md @@ -61,7 +61,7 @@ Accept pipeline input: true (ByPropertyName) ### -Force -Forces the command without confirmation +Forces the function without confirmation ```yaml Type: SwitchParameter diff --git a/docs/Remove-VSTeamReleaseDefinition.md b/docs/Remove-VSTeamReleaseDefinition.md index 247bcaef4..5c5448bfd 100644 --- a/docs/Remove-VSTeamReleaseDefinition.md +++ b/docs/Remove-VSTeamReleaseDefinition.md @@ -61,7 +61,7 @@ Accept pipeline input: true (ByPropertyName) ### -Force -Forces the command without confirmation +Forces the function without confirmation ```yaml Type: SwitchParameter diff --git a/docs/Remove-VSTeamServiceEndpoint.md b/docs/Remove-VSTeamServiceEndpoint.md index b844a1e06..1d8eb91f0 100644 --- a/docs/Remove-VSTeamServiceEndpoint.md +++ b/docs/Remove-VSTeamServiceEndpoint.md @@ -45,7 +45,7 @@ Accept pipeline input: true (ByPropertyName) ### -Force -Forces the command without confirmation +Forces the function without confirmation ```yaml Type: SwitchParameter diff --git a/docs/Remove-VSTeamUserEntitlement.md b/docs/Remove-VSTeamUserEntitlement.md index 6a821294a..a67e2711f 100644 --- a/docs/Remove-VSTeamUserEntitlement.md +++ b/docs/Remove-VSTeamUserEntitlement.md @@ -23,7 +23,7 @@ The delete operation includes unassigning Extensions and Licenses and removing t ### -Confirm -Prompts you for confirmation before running the cmdlet. +Prompts you for confirmation before running the function. ```yaml Type: SwitchParameter @@ -36,7 +36,7 @@ Aliases: cf ### -Force -Forces the command without confirmation +Forces the function without confirmation ```yaml Type: SwitchParameter diff --git a/docs/Set-VSTeamAPIVersion.md b/docs/Set-VSTeamAPIVersion.md index cc60bc6b0..6c9f9c3bb 100644 --- a/docs/Set-VSTeamAPIVersion.md +++ b/docs/Set-VSTeamAPIVersion.md @@ -83,7 +83,7 @@ Parameter Sets: Service ### -Force -Forces the command without confirmation +Forces the function without confirmation ```yaml Type: SwitchParameter diff --git a/docs/Set-VSTeamAccount.md b/docs/Set-VSTeamAccount.md index f1886ccb5..c5fd285f8 100644 --- a/docs/Set-VSTeamAccount.md +++ b/docs/Set-VSTeamAccount.md @@ -197,7 +197,7 @@ Type: String ### -Force -Forces the command without confirmation +Forces the function without confirmation ```yaml Type: SwitchParameter diff --git a/docs/Set-VSTeamAlias.md b/docs/Set-VSTeamAlias.md index 8b0d08e6e..ae026453e 100644 --- a/docs/Set-VSTeamAlias.md +++ b/docs/Set-VSTeamAlias.md @@ -19,7 +19,7 @@ In version 6.0 the default aliases were removed to prevent conflicts with other ### -Force -Forces the command without confirmation +Forces the function without confirmation ```yaml Type: SwitchParameter diff --git a/docs/Set-VSTeamApproval.md b/docs/Set-VSTeamApproval.md index 86b95f997..78f7fd846 100644 --- a/docs/Set-VSTeamApproval.md +++ b/docs/Set-VSTeamApproval.md @@ -92,7 +92,7 @@ Type: String ### -Force -Forces the command without confirmation +Forces the function without confirmation ```yaml Type: SwitchParameter diff --git a/docs/Set-VSTeamDefaultProject.md b/docs/Set-VSTeamDefaultProject.md index cc602af1b..00a9fe1f8 100644 --- a/docs/Set-VSTeamDefaultProject.md +++ b/docs/Set-VSTeamDefaultProject.md @@ -31,7 +31,7 @@ You can now call other functions that require a project name without passing the ### -Force -Forces the command without confirmation +Forces the function without confirmation ```yaml Type: SwitchParameter diff --git a/docs/Set-VSTeamEnvironmentStatus.md b/docs/Set-VSTeamEnvironmentStatus.md index 11aaee13e..3086e1f7c 100644 --- a/docs/Set-VSTeamEnvironmentStatus.md +++ b/docs/Set-VSTeamEnvironmentStatus.md @@ -94,7 +94,7 @@ Type: DateTime ### -Force -Forces the command without confirmation +Forces the function without confirmation ```yaml Type: SwitchParameter diff --git a/docs/Set-VSTeamReleaseStatus.md b/docs/Set-VSTeamReleaseStatus.md index 4bcddd36b..cfc05a98c 100644 --- a/docs/Set-VSTeamReleaseStatus.md +++ b/docs/Set-VSTeamReleaseStatus.md @@ -65,7 +65,7 @@ Type: String ### -Force -Forces the command without confirmation +Forces the function without confirmation ```yaml Type: SwitchParameter diff --git a/docs/Team.md b/docs/Team.md index 325affbeb..0ceb93fc1 100644 --- a/docs/Team.md +++ b/docs/Team.md @@ -59,6 +59,10 @@ Add permissions to a git repository, all repositories in a project, or a specifi Adds connections to Kubernetes clusters +### [Add-VSTeamMembership](Add-VSTeamMembership.md) + +Adds a membership to a container. + ### [Add-VSTeamNuGetEndpoint](Add-VSTeamNuGetEndpoint.md) Adds a new NuGet service endpoint. @@ -212,6 +216,10 @@ Returns all the job requests of an agent. Returns a team member. +### [Get-VSTeamMembership](Get-VSTeamMembership.md) + +Gets a memberships for a container or member. + ### [Get-VSTeamOption](Get-VSTeamOption.md) Returns all the versions of supported APIs of your TFS or VSTS. @@ -344,6 +352,10 @@ Removes a package feed from the account. Removes the Git repository from your Visual Studio Team Services or Team Foundation Server account. +### [Remove-VSTeamMembership](Remove-VSTeamMembership.md) + +Removes a membership to a container. + ### [Remove-VSTeamPolicy](Remove-VSTeamPolicy.md) Removes the specified policy from the specified project. @@ -451,6 +463,10 @@ Opens the release definitions for a team project in the default browser. Opens the work item in the default browser. +### [Test-VSTeamMembership](Test-VSTeamMembership.md) + +Tests the membership in a container. + ### [Update-VSTeam](Update-VSTeam.md) Updates the team name, description or both. diff --git a/docs/Test-VSTeamMembership.md b/docs/Test-VSTeamMembership.md new file mode 100644 index 000000000..8ae6c247b --- /dev/null +++ b/docs/Test-VSTeamMembership.md @@ -0,0 +1,60 @@ + + + +# Test-VSTeamMembership + +## SYNOPSIS + +Tests the membership in a container. + +## SYNTAX + +## DESCRIPTION + +Tests the membership in a container. + +## EXAMPLES + +## PARAMETERS + +### -MemberDescriptor + +A member descriptor retrieved by Get-VsTeamUser + +```yaml +Type: String +Required: True +Position: 0 +``` + + +### -ContainerDescriptor + +A container descriptor retrieved by Get-VsTeamGroup + +```yaml +Type: String +Required: True +Position: 1 +``` + + +## INPUTS + +## OUTPUTS +### $True or $False + +## NOTES + +## RELATED LINKS + +[Get-VsTeamUser](Get-VsTeamUser.md) + +[Get-VsTeamGroup](Get-VsTeamGroup.md) + +[Add-VsTeamMembership](Add-VsTeamMembership.md) + +[Get-VsTeamMembership](Get-VsTeamMembership.md) + +[Remove-VsTeamMembership](Remove-VsTeamMembership.md) + diff --git a/docs/Update-VSTeam.md b/docs/Update-VSTeam.md index 3e71b6796..1ccb48005 100644 --- a/docs/Update-VSTeam.md +++ b/docs/Update-VSTeam.md @@ -63,7 +63,7 @@ Type: String ### -Confirm -Prompts you for confirmation before running the cmdlet. +Prompts you for confirmation before running the function. ```yaml Type: SwitchParameter @@ -76,7 +76,7 @@ Aliases: cf ### -Force -Forces the command without confirmation +Forces the function without confirmation ```yaml Type: SwitchParameter diff --git a/docs/Update-VSTeamBuild.md b/docs/Update-VSTeamBuild.md index e1c6128c5..498f866e8 100644 --- a/docs/Update-VSTeamBuild.md +++ b/docs/Update-VSTeamBuild.md @@ -72,7 +72,7 @@ Accept pipeline input: true (ByPropertyName, ByValue) ### -Confirm -Prompts you for confirmation before running the cmdlet. +Prompts you for confirmation before running the function. ```yaml Type: SwitchParameter @@ -85,7 +85,7 @@ Aliases: cf ### -Force -Forces the command without confirmation +Forces the function without confirmation ```yaml Type: SwitchParameter diff --git a/docs/Update-VSTeamExtension.md b/docs/Update-VSTeamExtension.md index c092d80ec..5a37906ce 100644 --- a/docs/Update-VSTeamExtension.md +++ b/docs/Update-VSTeamExtension.md @@ -49,7 +49,7 @@ Required: True ### -Force -Forces the command without confirmation +Forces the function without confirmation ```yaml Type: SwitchParameter diff --git a/docs/Update-VSTeamProfile.md b/docs/Update-VSTeamProfile.md index d26341a50..5ab6dfe54 100644 --- a/docs/Update-VSTeamProfile.md +++ b/docs/Update-VSTeamProfile.md @@ -77,7 +77,7 @@ Position: 3 ### -Force -Forces the command without confirmation +Forces the function without confirmation ```yaml Type: SwitchParameter diff --git a/docs/Update-VSTeamProject.md b/docs/Update-VSTeamProject.md index a91cbd5bb..65b3e0627 100644 --- a/docs/Update-VSTeamProject.md +++ b/docs/Update-VSTeamProject.md @@ -70,7 +70,7 @@ Accept pipeline input: true (ByPropertyName) ### -Force -Forces the command without confirmation +Forces the function without confirmation ```yaml Type: SwitchParameter diff --git a/docs/Update-VSTeamRelease.md b/docs/Update-VSTeamRelease.md index bac2ce009..ac732bb78 100644 --- a/docs/Update-VSTeamRelease.md +++ b/docs/Update-VSTeamRelease.md @@ -76,7 +76,7 @@ Required: True ### -Confirm -Prompts you for confirmation before running the cmdlet. +Prompts you for confirmation before running the function. ```yaml Type: SwitchParameter @@ -89,7 +89,7 @@ Aliases: cf ### -Force -Forces the command without confirmation +Forces the function without confirmation ```yaml Type: SwitchParameter diff --git a/docs/Update-VSTeamReleaseDefinition.md b/docs/Update-VSTeamReleaseDefinition.md index 78a6e4368..189d8acd9 100644 --- a/docs/Update-VSTeamReleaseDefinition.md +++ b/docs/Update-VSTeamReleaseDefinition.md @@ -61,7 +61,7 @@ Path and file name to the JSON file that contains the definition to be updated. ```yaml Type: String -Required: True +Required: true Parameter Sets: File Position: 1 Accept pipeline input: true (ByPropertyName) @@ -73,7 +73,7 @@ JSON string of release definition. ```yaml Type: String -Required: True +Required: true Parameter Sets: JSON Position: 1 Accept pipeline input: true (ByPropertyName) @@ -81,7 +81,7 @@ Accept pipeline input: true (ByPropertyName) ### -Confirm -Prompts you for confirmation before running the cmdlet. +Prompts you for confirmation before running the function. ```yaml Type: SwitchParameter @@ -94,7 +94,7 @@ Aliases: cf ### -Force -Forces the command without confirmation +Forces the function without confirmation ```yaml Type: SwitchParameter diff --git a/docs/Update-VSTeamServiceEndpoint.md b/docs/Update-VSTeamServiceEndpoint.md index 54bcdbfbc..398618c34 100644 --- a/docs/Update-VSTeamServiceEndpoint.md +++ b/docs/Update-VSTeamServiceEndpoint.md @@ -54,7 +54,7 @@ Accept pipeline input: true (ByPropertyName) ### -Force -Forces the command without confirmation +Forces the function without confirmation ```yaml Type: SwitchParameter diff --git a/docs/Update-VSTeamUserEntitlement.md b/docs/Update-VSTeamUserEntitlement.md index 5b1896f79..18e18ef06 100644 --- a/docs/Update-VSTeamUserEntitlement.md +++ b/docs/Update-VSTeamUserEntitlement.md @@ -55,7 +55,7 @@ Required: True ### -Force -Forces the command without confirmation +Forces the function without confirmation ```yaml Type: SwitchParameter diff --git a/docs/Update-VSTeamWorkItem.md b/docs/Update-VSTeamWorkItem.md index f4aa79cfa..dc57a64fb 100644 --- a/docs/Update-VSTeamWorkItem.md +++ b/docs/Update-VSTeamWorkItem.md @@ -88,7 +88,7 @@ Required: False ### -Force -Forces the command without confirmation +Forces the function without confirmation ```yaml Type: SwitchParameter diff --git a/docs/readme.md b/docs/readme.md index 9e7a1ff3b..6f8da577d 100644 --- a/docs/readme.md +++ b/docs/readme.md @@ -64,6 +64,10 @@ Add permissions to a git repository, all repositories in a project, or a specifi Adds connections to Kubernetes clusters +### [Add-VSTeamMembership](Add-VSTeamMembership.md) + +Adds a membership to a container. + ### [Add-VSTeamNuGetEndpoint](Add-VSTeamNuGetEndpoint.md) Adds a new NuGet service endpoint. @@ -217,6 +221,10 @@ Returns all the job requests of an agent. Returns a team member. +### [Get-VSTeamMembership](Get-VSTeamMembership.md) + +Gets a memberships for a container or member. + ### [Get-VSTeamOption](Get-VSTeamOption.md) Returns all the versions of supported APIs of your TFS or VSTS. @@ -349,6 +357,10 @@ Removes a package feed from the account. Removes the Git repository from your Visual Studio Team Services or Team Foundation Server account. +### [Remove-VSTeamMembership](Remove-VSTeamMembership.md) + +Removes a membership to a container. + ### [Remove-VSTeamPolicy](Remove-VSTeamPolicy.md) Removes the specified policy from the specified project. @@ -456,6 +468,10 @@ Opens the release definitions for a team project in the default browser. Opens the work item in the default browser. +### [Test-VSTeamMembership](Test-VSTeamMembership.md) + +Tests the membership in a container. + ### [Update-VSTeam](Update-VSTeam.md) Updates the team name, description or both. diff --git a/unit/test/membership.Tests.ps1 b/unit/test/membership.Tests.ps1 new file mode 100644 index 000000000..5cc84f4e0 --- /dev/null +++ b/unit/test/membership.Tests.ps1 @@ -0,0 +1,94 @@ +Set-StrictMode -Version Latest + +InModuleScope VSTeam { + + # Set the account to use for testing. A normal user would do this + # using the Set-VSTeamAccount function. + [VSTeamVersions]::Account = 'https://dev.azure.com/test' + + Describe 'Users VSTS' { + # You have to set the version or the api-version will not be added when + # [VSTeamVersions]::Graph = '' + [VSTeamVersions]::Graph = '5.0' + + Context 'Test-VSTeamMembership' { + Mock Invoke-RestMethod { } -Verifiable + + $UserDescriptor = 'aad.OTcyOTJkNzYtMjc3Yi03OTgxLWIzNDMtNTkzYmM3ODZkYjlj' + $GroupDescriptor = 'vssgp.Uy0xLTktMTU1MTM3NDI0NS04NTYwMDk3MjYtNDE5MzQ0MjExNy0yMzkwNzU2MTEwLTI3NDAxNjE4MjEtMC0wLTAtMC0x' + + $result = Test-VSTeamMembership -MemberDescriptor $UserDescriptor -ContainerDescriptor $GroupDescriptor + It 'Should test membership' { + Assert-MockCalled Invoke-RestMethod -Exactly 1 -ParameterFilter { + $Method -eq "Head" + $Uri -like "https://vssps.dev.azure.com/test/_apis/graph/memberships/$UserDescriptor/$GroupDescriptor*" -and + $Uri -like "*api-version=$([VSTeamVersions]::Graph)*" + } + $result | Should Be $true + } + } + + Context 'Add-VSTeamMembership' { + Mock Invoke-RestMethod { } -Verifiable + + $UserDescriptor = 'aad.OTcyOTJkNzYtMjc3Yi03OTgxLWIzNDMtNTkzYmM3ODZkYjlj' + $GroupDescriptor = 'vssgp.Uy0xLTktMTU1MTM3NDI0NS04NTYwMDk3MjYtNDE5MzQ0MjExNy0yMzkwNzU2MTEwLTI3NDAxNjE4MjEtMC0wLTAtMC0x' + + $null = Add-VSTeamMembership -MemberDescriptor $UserDescriptor -ContainerDescriptor $GroupDescriptor + It 'Should add membership' { + Assert-MockCalled Invoke-RestMethod -Exactly 1 -ParameterFilter { + $Method -eq "Put" + $Uri -like "https://vssps.dev.azure.com/test/_apis/graph/memberships/$UserDescriptor/$GroupDescriptor*" -and + $Uri -like "*api-version=$([VSTeamVersions]::Graph)*" + } + } + } + + Context 'Remove-VSTeamMembership' { + Mock Invoke-RestMethod { } -Verifiable + + $UserDescriptor = 'aad.OTcyOTJkNzYtMjc3Yi03OTgxLWIzNDMtNTkzYmM3ODZkYjlj' + $GroupDescriptor = 'vssgp.Uy0xLTktMTU1MTM3NDI0NS04NTYwMDk3MjYtNDE5MzQ0MjExNy0yMzkwNzU2MTEwLTI3NDAxNjE4MjEtMC0wLTAtMC0x' + + $null = Remove-VSTeamMembership -MemberDescriptor $UserDescriptor -ContainerDescriptor $GroupDescriptor + It 'Should remove a membership' { + Assert-MockCalled Invoke-RestMethod -Exactly 1 -ParameterFilter { + $Method -eq "Delete" + $Uri -like "https://vssps.dev.azure.com/test/_apis/graph/memberships/$UserDescriptor/$GroupDescriptor*" -and + $Uri -like "*api-version=$([VSTeamVersions]::Graph)*" + } + } + } + + Context 'Get-VSTeamMembership for Member' { + Mock Invoke-RestMethod { } -Verifiable + + $UserDescriptor = 'aad.OTcyOTJkNzYtMjc3Yi03OTgxLWIzNDMtNTkzYmM3ODZkYjlj' + + $null = Get-VSTeamMembership -MemberDescriptor $UserDescriptor + It "Should get a container's members" { + Assert-MockCalled Invoke-RestMethod -Exactly 1 -ParameterFilter { + $Method -eq "Get" + $Uri -like "https://vssps.dev.azure.com/test/_apis/graph/memberships/$MemberDescriptor*" -and + $Uri -like "*api-version=$([VSTeamVersions]::Graph)*" + } + } + } + + Context 'Get-VSTeamMembership for Group' { + Mock Invoke-RestMethod { } -Verifiable + + $GroupDescriptor = 'vssgp.Uy0xLTktMTU1MTM3NDI0NS04NTYwMDk3MjYtNDE5MzQ0MjExNy0yMzkwNzU2MTEwLTI3NDAxNjE4MjEtMC0wLTAtMC0x' + + $null = Get-VSTeamMembership -ContainerDescriptor $GroupDescriptor + It "Should get a container's members" { + Assert-MockCalled Invoke-RestMethod -Exactly 1 -ParameterFilter { + $Method -eq "Get" + $Uri -like "https://vssps.dev.azure.com/test/_apis/graph/memberships/$GroupDescriptor*" -and + $Uri -like "*api-version=$([VSTeamVersions]::Graph)*" + $Uri -like "*direction=Down*" + } + } + } + } +} \ No newline at end of file From 803cf364c411f07956a9e43045338d39afdaf30e Mon Sep 17 00:00:00 2001 From: Seekatar Date: Sat, 27 Jul 2019 16:32:58 -0400 Subject: [PATCH 2/6] add membership functions --- .docs/Add-VSTeamMembership.md | 39 ++ .docs/Get-VSTeamMembership.md | 71 +++ .docs/Remove-VSTeamMembership.md | 39 ++ .docs/Test-VSTeamMembership.md | 40 ++ .docs/params/containerDescriptor.md | 9 + .docs/params/memberDescriptor.md | 9 + .docs/synopsis/Add-VSTeamMembership.md | 1 + .docs/synopsis/Get-VSTeamMembership.md | 1 + .docs/synopsis/Remove-VSTeamMembership.md | 1 + .docs/synopsis/Test-VSTeamMembership.md | 1 + .vscode/settings.json | 16 +- CHANGELOG.md | 9 + Merge-File.ps1 | 3 +- Source/Private/callMembershipAPI.ps1 | 33 ++ Source/Private/common.ps1 | 4 + Source/Public/Add-VSTeamMembership.ps1 | 14 + Source/Public/Get-VSTeamMembership.ps1 | 17 + Source/Public/Remove-VSTeamMembership.ps1 | 13 + Source/Public/Test-VSTeamMembership.ps1 | 34 ++ Source/en-US/VSTeam-Help.xml | 609 ++++++++++++++++++---- docs/Add-VSTeamBuildTag.md | 4 +- docs/Add-VSTeamMembership.md | 59 +++ docs/Add-VSTeamRelease.md | 2 +- docs/Get-VSTeamMembership.md | 73 +++ docs/Remove-VSTeam.md | 4 +- docs/Remove-VSTeamAccount.md | 2 +- docs/Remove-VSTeamAgent.md | 2 +- docs/Remove-VSTeamBuild.md | 2 +- docs/Remove-VSTeamBuildDefinition.md | 2 +- docs/Remove-VSTeamBuildTag.md | 4 +- docs/Remove-VSTeamExtension.md | 2 +- docs/Remove-VSTeamGitRepository.md | 2 +- docs/Remove-VSTeamMembership.md | 59 +++ docs/Remove-VSTeamPolicy.md | 2 +- docs/Remove-VSTeamProfile.md | 2 +- docs/Remove-VSTeamProject.md | 2 +- docs/Remove-VSTeamRelease.md | 2 +- docs/Remove-VSTeamReleaseDefinition.md | 2 +- docs/Remove-VSTeamServiceEndpoint.md | 2 +- docs/Remove-VSTeamUserEntitlement.md | 4 +- docs/Set-VSTeamAPIVersion.md | 2 +- docs/Set-VSTeamAccount.md | 2 +- docs/Set-VSTeamAlias.md | 2 +- docs/Set-VSTeamApproval.md | 2 +- docs/Set-VSTeamDefaultProject.md | 2 +- docs/Set-VSTeamEnvironmentStatus.md | 2 +- docs/Set-VSTeamReleaseStatus.md | 2 +- docs/Team.md | 16 + docs/Test-VSTeamMembership.md | 60 +++ docs/Update-VSTeam.md | 4 +- docs/Update-VSTeamBuild.md | 4 +- docs/Update-VSTeamExtension.md | 2 +- docs/Update-VSTeamProfile.md | 2 +- docs/Update-VSTeamProject.md | 2 +- docs/Update-VSTeamRelease.md | 4 +- docs/Update-VSTeamReleaseDefinition.md | 8 +- docs/Update-VSTeamServiceEndpoint.md | 2 +- docs/Update-VSTeamUserEntitlement.md | 2 +- docs/Update-VSTeamWorkItem.md | 2 +- docs/readme.md | 16 + unit/test/membership.Tests.ps1 | 94 ++++ 61 files changed, 1287 insertions(+), 141 deletions(-) create mode 100644 .docs/Add-VSTeamMembership.md create mode 100644 .docs/Get-VSTeamMembership.md create mode 100644 .docs/Remove-VSTeamMembership.md create mode 100644 .docs/Test-VSTeamMembership.md create mode 100644 .docs/params/containerDescriptor.md create mode 100644 .docs/params/memberDescriptor.md create mode 100644 .docs/synopsis/Add-VSTeamMembership.md create mode 100644 .docs/synopsis/Get-VSTeamMembership.md create mode 100644 .docs/synopsis/Remove-VSTeamMembership.md create mode 100644 .docs/synopsis/Test-VSTeamMembership.md create mode 100644 Source/Private/callMembershipAPI.ps1 create mode 100644 Source/Public/Add-VSTeamMembership.ps1 create mode 100644 Source/Public/Get-VSTeamMembership.ps1 create mode 100644 Source/Public/Remove-VSTeamMembership.ps1 create mode 100644 Source/Public/Test-VSTeamMembership.ps1 create mode 100644 docs/Add-VSTeamMembership.md create mode 100644 docs/Get-VSTeamMembership.md create mode 100644 docs/Remove-VSTeamMembership.md create mode 100644 docs/Test-VSTeamMembership.md create mode 100644 unit/test/membership.Tests.ps1 diff --git a/.docs/Add-VSTeamMembership.md b/.docs/Add-VSTeamMembership.md new file mode 100644 index 000000000..33b9eeddf --- /dev/null +++ b/.docs/Add-VSTeamMembership.md @@ -0,0 +1,39 @@ + + +# Add-VSTeamMembership + +## SYNOPSIS + + + +## SYNTAX + +## DESCRIPTION + + + +## EXAMPLES + +## PARAMETERS + + + + + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[Get-VsTeamUser](Get-VsTeamUser.md) + +[Get-VsTeamGroup](Get-VsTeamGroup.md) + +[Get-VsTeamMembership](Get-VsTeamMembership.md) + +[Remove-VsTeamMembership](Remove-VsTeamMembership.md) + +[Test-VsTeamMembership](Test-VsTeamMembership.md) diff --git a/.docs/Get-VSTeamMembership.md b/.docs/Get-VSTeamMembership.md new file mode 100644 index 000000000..78f916243 --- /dev/null +++ b/.docs/Get-VSTeamMembership.md @@ -0,0 +1,71 @@ + + +# Get-VSTeamMembership + +## SYNOPSIS + + + +## SYNTAX + +## DESCRIPTION + + + +## EXAMPLES +### -------------------------- EXAMPLE 1 -------------------------- + +```PowerShell +(Get-VSTeamMembership -MemberDescriptor $user.ID).value | % { Get-VSTeamGroup -Descriptor $_.containerdescriptor } +``` +Get all the groups for a user + +### -------------------------- EXAMPLE 2 -------------------------- +```PowerShell +(Get-VSTeamMembership -ContainerDescriptor $group.id).value | % {Get-VSTeamUser -Descriptor $_.memberDescriptor } +``` + +Get all the members for a group + +## PARAMETERS + +### -ContainerDescriptor + +A container descriptor retrieved by Get-VsTeamGroup + +```yaml +Type: String +Required: True +Parameter Sets: ByContainerId +Position: 0 +``` + +### -MemberDescriptor + +A member descriptor retrieved by Get-VsTeamUser + +```yaml +Type: String +Required: True +Parameter Sets: ByMemberId +Position: 0 +``` + +## INPUTS + +## OUTPUTS + + +## NOTES + +## RELATED LINKS + +[Get-VsTeamUser](Get-VsTeamUser.md) + +[Get-VsTeamGroup](Get-VsTeamGroup.md) + +[Add-VsTeamMembership](Add-VsTeamMembership.md) + +[Remove-VsTeamMembership](Remove-VsTeamMembership.md) + +[Test-VsTeamMembership](Test-VsTeamMembership.md) diff --git a/.docs/Remove-VSTeamMembership.md b/.docs/Remove-VSTeamMembership.md new file mode 100644 index 000000000..0ec9eec38 --- /dev/null +++ b/.docs/Remove-VSTeamMembership.md @@ -0,0 +1,39 @@ + + +# Remove-VSTeamMembership + +## SYNOPSIS + + + +## SYNTAX + +## DESCRIPTION + + + +## EXAMPLES + +## PARAMETERS + + + + + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[Get-VsTeamUser](Get-VsTeamUser.md) + +[Get-VsTeamGroup](Get-VsTeamGroup.md) + +[Add-VsTeamMembership](Add-VsTeamMembership.md) + +[Get-VsTeamMembership](Get-VsTeamMembership.md) + +[Test-VsTeamMembership](Test-VsTeamMembership.md) diff --git a/.docs/Test-VSTeamMembership.md b/.docs/Test-VSTeamMembership.md new file mode 100644 index 000000000..aa403cd87 --- /dev/null +++ b/.docs/Test-VSTeamMembership.md @@ -0,0 +1,40 @@ + + +# Test-VSTeamMembership + +## SYNOPSIS + + + +## SYNTAX + +## DESCRIPTION + + + +## EXAMPLES + +## PARAMETERS + + + + + +## INPUTS + +## OUTPUTS +### $True or $False + +## NOTES + +## RELATED LINKS + +[Get-VsTeamUser](Get-VsTeamUser.md) + +[Get-VsTeamGroup](Get-VsTeamGroup.md) + +[Add-VsTeamMembership](Add-VsTeamMembership.md) + +[Get-VsTeamMembership](Get-VsTeamMembership.md) + +[Remove-VsTeamMembership](Remove-VsTeamMembership.md) diff --git a/.docs/params/containerDescriptor.md b/.docs/params/containerDescriptor.md new file mode 100644 index 000000000..d19e291e9 --- /dev/null +++ b/.docs/params/containerDescriptor.md @@ -0,0 +1,9 @@ +### -ContainerDescriptor + +A container descriptor retrieved by Get-VsTeamGroup + +```yaml +Type: String +Required: True +Position: 1 +``` diff --git a/.docs/params/memberDescriptor.md b/.docs/params/memberDescriptor.md new file mode 100644 index 000000000..73a830f29 --- /dev/null +++ b/.docs/params/memberDescriptor.md @@ -0,0 +1,9 @@ +### -MemberDescriptor + +A member descriptor retrieved by Get-VsTeamUser + +```yaml +Type: String +Required: True +Position: 0 +``` diff --git a/.docs/synopsis/Add-VSTeamMembership.md b/.docs/synopsis/Add-VSTeamMembership.md new file mode 100644 index 000000000..9153feb95 --- /dev/null +++ b/.docs/synopsis/Add-VSTeamMembership.md @@ -0,0 +1 @@ +Adds a membership to a container. \ No newline at end of file diff --git a/.docs/synopsis/Get-VSTeamMembership.md b/.docs/synopsis/Get-VSTeamMembership.md new file mode 100644 index 000000000..9ca63096e --- /dev/null +++ b/.docs/synopsis/Get-VSTeamMembership.md @@ -0,0 +1 @@ +Gets a memberships for a container or member. \ No newline at end of file diff --git a/.docs/synopsis/Remove-VSTeamMembership.md b/.docs/synopsis/Remove-VSTeamMembership.md new file mode 100644 index 000000000..52a7f2227 --- /dev/null +++ b/.docs/synopsis/Remove-VSTeamMembership.md @@ -0,0 +1 @@ +Removes a membership to a container. \ No newline at end of file diff --git a/.docs/synopsis/Test-VSTeamMembership.md b/.docs/synopsis/Test-VSTeamMembership.md new file mode 100644 index 000000000..9a613964c --- /dev/null +++ b/.docs/synopsis/Test-VSTeamMembership.md @@ -0,0 +1 @@ +Tests the membership in a container. \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index c6a1c7061..f5d99a39d 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -48,5 +48,19 @@ "vsrm", "vssgp", "vssps" - ] + ], + "workbench.colorCustomizations": { + "activityBar.background": "#007699", + "activityBar.foreground": "#e7e7e7", + "activityBar.inactiveForeground": "#e7e7e799", + "activityBarBadge.background": "#ff80e2", + "activityBarBadge.foreground": "#15202b", + "titleBar.activeBackground": "#004f66", + "titleBar.inactiveBackground": "#004f6699", + "titleBar.activeForeground": "#e7e7e7", + "titleBar.inactiveForeground": "#e7e7e799", + "statusBar.background": "#004f66", + "statusBarItem.hoverBackground": "#007699", + "statusBar.foreground": "#e7e7e7" + } } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index f5770de8a..bd0845135 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## 6.3.1 + +Added support for the following: + +- Add-VSTeamMembership +- Remove-VSTeamMembership +- Get-VSTeamMembership +- Test-VSTeamMembership + ## 6.3.0 Added support for the following: diff --git a/Merge-File.ps1 b/Merge-File.ps1 index 358bce10b..790103162 100644 --- a/Merge-File.ps1 +++ b/Merge-File.ps1 @@ -102,7 +102,7 @@ function Merge-Format { $fileContents = Get-Content $file $newFileContents = ($fileContents -replace '', '') [xml]$xml = $newFileContents - + $finalXml += $xml.Configuration.ViewDefinitions.InnerXml } @@ -173,6 +173,7 @@ function Merge-Class { process { $usingsSb = New-Object System.Text.StringBuilder $contents = New-Object System.Text.StringBuilder + $usings = @() ForEach ($file in $files) { Write-Verbose -Message "Merging from $file" diff --git a/Source/Private/callMembershipAPI.ps1 b/Source/Private/callMembershipAPI.ps1 new file mode 100644 index 000000000..a458b466d --- /dev/null +++ b/Source/Private/callMembershipAPI.ps1 @@ -0,0 +1,33 @@ + +function _callMembershipAPI { + [CmdletBinding()] + param( + [Parameter(Mandatory = $true)] + [string] $Id, + [ValidateSet('Get', 'Post', 'Patch', 'Delete', 'Options', 'Put', 'Default', 'Head', 'Merge', 'Trace')] + [string] $Method, + [ValidateSet('', 'Up', 'Down')] + [string] $Direction + ) + Set-StrictMode -Version Latest + + # This will throw if this account does not support the graph API + _supportsGraph + + Write-Verbose "Getting members for $Id" + + $query = @{} + if ($Direction) { + $query['direction'] = $Direction + } + + # Call the REST API + $resp = _callAPI -Area 'graph' -Resource 'memberships' ` + -Id $Id ` + -SubDomain "vssps" ` + -Method $Method ` + -Version $([VSTeamVersions]::Graph) ` + -QueryString $query + + return $resp +} \ No newline at end of file diff --git a/Source/Private/common.ps1 b/Source/Private/common.ps1 index 5b1b22011..41631f63b 100644 --- a/Source/Private/common.ps1 +++ b/Source/Private/common.ps1 @@ -8,24 +8,28 @@ $profilesPath = "$HOME/vsteam_profiles.json" # Not all versions support the name features. function _supportsGraph { + _hasAccount if (-not [VSTeamVersions]::Graph) { throw 'This account does not support the graph API.' } } function _supportsFeeds { + _hasAccount if (-not [VSTeamVersions]::Packaging) { throw 'This account does not support packages.' } } function _supportsSecurityNamespace { + _hasAccount if (([VSTeamVersions]::Version -ne "VSTS") -and ([VSTeamVersions]::Version -ne "AzD")) { throw 'Security Namespaces are currently only supported in Azure DevOps Service (Online)' } } function _supportsMemberEntitlementManagement { + _hasAccount if (-not [VSTeamVersions]::MemberEntitlementManagement) { throw 'This account does not support Member Entitlement.' } diff --git a/Source/Public/Add-VSTeamMembership.ps1 b/Source/Public/Add-VSTeamMembership.ps1 new file mode 100644 index 000000000..fd638c97b --- /dev/null +++ b/Source/Public/Add-VSTeamMembership.ps1 @@ -0,0 +1,14 @@ +function Add-VSTeamMembership { + [CmdletBinding()] + param( + [Parameter(Mandatory = $true)] + [string] $MemberDescriptor, + [Parameter(Mandatory = $true)] + [string] $ContainerDescriptor, + [switch] $DontTest + ) + + process { + return _callMembershipAPI -Id "$MemberDescriptor/$ContainerDescriptor" -Method Put + } +} \ No newline at end of file diff --git a/Source/Public/Get-VSTeamMembership.ps1 b/Source/Public/Get-VSTeamMembership.ps1 new file mode 100644 index 000000000..fadca6010 --- /dev/null +++ b/Source/Public/Get-VSTeamMembership.ps1 @@ -0,0 +1,17 @@ +function Get-VSTeamMembership { + [CmdletBinding()] + param( + [Parameter(Mandatory = $true, ValueFromPipeline, ValueFromPipelineByPropertyName,ParameterSetName="ByContainerId")] + [string] $ContainerDescriptor, + [Parameter(Mandatory = $true, ValueFromPipeline, ValueFromPipelineByPropertyName,ParameterSetName="ByMemberId")] + [string] $MemberDescriptor + ) + + process { + if ($MemberDescriptor) { + return _callMembershipAPI -Id $MemberDescriptor -Method Get -Direction Up + } else { + return _callMembershipAPI -Id $ContainerDescriptor -Method Get -Direction Down + } + } +} diff --git a/Source/Public/Remove-VSTeamMembership.ps1 b/Source/Public/Remove-VSTeamMembership.ps1 new file mode 100644 index 000000000..54655c045 --- /dev/null +++ b/Source/Public/Remove-VSTeamMembership.ps1 @@ -0,0 +1,13 @@ +function Remove-VSTeamMembership { + [CmdletBinding()] + param( + [Parameter(Mandatory = $true)] + [string] $MemberDescriptor, + [Parameter(Mandatory = $true)] + [string] $ContainerDescriptor + ) + + process { + return _callMembershipAPI -Id "$MemberDescriptor/$ContainerDescriptor" -Method Delete + } +} diff --git a/Source/Public/Test-VSTeamMembership.ps1 b/Source/Public/Test-VSTeamMembership.ps1 new file mode 100644 index 000000000..429bc0012 --- /dev/null +++ b/Source/Public/Test-VSTeamMembership.ps1 @@ -0,0 +1,34 @@ +function Test-VSTeamMembership { + [CmdletBinding()] + param( + [Parameter(Mandatory = $true, ValueFromPipelineByPropertyName = "MemberDescriptor")] + [string] $MemberDescriptor, + [Parameter(Mandatory = $true, ValueFromPipelineByPropertyName = "ContainerDescriptor")] + [string] $ContainerDescriptor + ) + + process { + Set-StrictMode -Version Latest + + $PrevWarningPreference = $WarningPreference + try { + $WarningPreference = "SilentlyContinue" # avoid 404 warning, since that indicates it doesn't exist + $null = _callMembershipAPI -Id "$MemberDescriptor/$ContainerDescriptor" -Method Head + return $true + } catch { + $WarningPreference = $PrevWarningPreference + $e = $_ + try { + if ($e.Exception -and $e.Exception.Response -and $e.Exception.Response.StatusCode -eq [System.Net.HttpStatusCode]::NotFound) + { + return $false + } + } catch { + Write-Warning "Nested exception $_" + } + throw $e + } finally { + $WarningPreference = $PrevWarningPreference + } + } +} diff --git a/Source/en-US/VSTeam-Help.xml b/Source/en-US/VSTeam-Help.xml index 6d62aca9a..e0aed3ef1 100644 --- a/Source/en-US/VSTeam-Help.xml +++ b/Source/en-US/VSTeam-Help.xml @@ -1174,7 +1174,7 @@ Demo-CI Demo-CI-45 notStarted Confirm - Prompts you for confirmation before running the cmdlet. + Prompts you for confirmation before running the function. SwitchParameter @@ -1185,7 +1185,7 @@ Demo-CI Demo-CI-45 notStarted Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -1250,7 +1250,7 @@ Demo-CI Demo-CI-45 notStarted Confirm - Prompts you for confirmation before running the cmdlet. + Prompts you for confirmation before running the function. SwitchParameter @@ -1262,7 +1262,7 @@ Demo-CI Demo-CI-45 notStarted Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -2154,6 +2154,104 @@ Demo-CI Demo-CI-45 notStarted + + + Add-VSTeamMembership + Add + VSTeamMembership + + Adds a membership to a container. + + + + Adds a membership to a container. + + + + Add-VSTeamMembership + + MemberDescriptor + + A member descriptor retrieved by Get-VsTeamUser + + String + + String + + + None + + + ContainerDescriptor + + A container descriptor retrieved by Get-VsTeamGroup + + String + + String + + + None + + + + + + MemberDescriptor + + A member descriptor retrieved by Get-VsTeamUser + + String + + String + + + None + + + ContainerDescriptor + + A container descriptor retrieved by Get-VsTeamGroup + + String + + String + + + None + + + + + + + + + + + + + Get-VsTeamUser + + + + Get-VsTeamGroup + + + + Get-VsTeamMembership + + + + Remove-VsTeamMembership + + + + Test-VsTeamMembership + + + + Add-VSTeamNuGetEndpoint @@ -3564,7 +3662,7 @@ PS C:\> Add-NuGetEndpoint -EndpointName 'PowerShell Gallery' -NuGetUrl 'https Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -3652,7 +3750,7 @@ PS C:\> Add-NuGetEndpoint -EndpointName 'PowerShell Gallery' -NuGetUrl 'https Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -3776,7 +3874,7 @@ PS C:\> Add-NuGetEndpoint -EndpointName 'PowerShell Gallery' -NuGetUrl 'https Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -9062,6 +9160,122 @@ ID Title Status + + + Get-VSTeamMembership + Get + VSTeamMembership + + Gets a memberships for a container or member. + + + + Gets a memberships for a container or member. + + + + Get-VSTeamMembership + + ContainerDescriptor + + A container descriptor retrieved by Get-VsTeamGroup + + String + + String + + + None + + + + Get-VSTeamMembership + + MemberDescriptor + + A member descriptor retrieved by Get-VsTeamUser + + String + + String + + + None + + + + + + ContainerDescriptor + + A container descriptor retrieved by Get-VsTeamGroup + + String + + String + + + None + + + MemberDescriptor + + A member descriptor retrieved by Get-VsTeamUser + + String + + String + + + None + + + + + + + + + + + + -------------------------- EXAMPLE 1 -------------------------- + (Get-VSTeamMembership -MemberDescriptor $user.ID).value | % { Get-VSTeamGroup -Descriptor $_.containerdescriptor } + + Get all the groups for a user + + + + -------------------------- EXAMPLE 2 -------------------------- + (Get-VSTeamMembership -ContainerDescriptor $group.id).value | % {Get-VSTeamUser -Descriptor $_.memberDescriptor } + + Get all the members for a group + + + + + + Get-VsTeamUser + + + + Get-VsTeamGroup + + + + Add-VsTeamMembership + + + + Remove-VsTeamMembership + + + + Test-VsTeamMembership + + + + Get-VSTeamOption @@ -12704,7 +12918,7 @@ Get-VSTeamVariableGroup @methodParameters Confirm - Prompts you for confirmation before running the cmdlet. + Prompts you for confirmation before running the function. SwitchParameter @@ -12715,7 +12929,7 @@ Get-VSTeamVariableGroup @methodParameters Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -12766,7 +12980,7 @@ Get-VSTeamVariableGroup @methodParameters Confirm - Prompts you for confirmation before running the cmdlet. + Prompts you for confirmation before running the function. SwitchParameter @@ -12778,7 +12992,7 @@ Get-VSTeamVariableGroup @methodParameters Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -12974,7 +13188,7 @@ Get-VSTeamVariableGroup @methodParameters Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -13000,7 +13214,7 @@ Get-VSTeamVariableGroup @methodParameters Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -13075,7 +13289,7 @@ Get-VSTeamVariableGroup @methodParameters Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -13113,7 +13327,7 @@ Get-VSTeamVariableGroup @methodParameters Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -13188,7 +13402,7 @@ Get-VSTeamVariableGroup @methodParameters Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -13230,7 +13444,7 @@ Get-VSTeamVariableGroup @methodParameters Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -13314,7 +13528,7 @@ Get-VSTeamVariableGroup @methodParameters Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -13356,7 +13570,7 @@ Get-VSTeamVariableGroup @methodParameters Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -13472,7 +13686,7 @@ Get-VSTeamVariableGroup @methodParameters Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -13483,7 +13697,7 @@ Get-VSTeamVariableGroup @methodParameters Confirm - Prompts you for confirmation before running the cmdlet. + Prompts you for confirmation before running the function. SwitchParameter @@ -13548,7 +13762,7 @@ Get-VSTeamVariableGroup @methodParameters Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -13560,7 +13774,7 @@ Get-VSTeamVariableGroup @methodParameters Confirm - Prompts you for confirmation before running the cmdlet. + Prompts you for confirmation before running the function. SwitchParameter @@ -13634,7 +13848,7 @@ Get-VSTeamVariableGroup @methodParameters Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -13672,7 +13886,7 @@ Get-VSTeamVariableGroup @methodParameters Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -13802,7 +14016,7 @@ Get-VSTeamVariableGroup @methodParameters Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -13830,7 +14044,7 @@ Get-VSTeamVariableGroup @methodParameters Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -13858,6 +14072,104 @@ Get-VSTeamVariableGroup @methodParameters + + + Remove-VSTeamMembership + Remove + VSTeamMembership + + Removes a membership to a container. + + + + Removes a membership to a container. + + + + Remove-VSTeamMembership + + MemberDescriptor + + A member descriptor retrieved by Get-VsTeamUser + + String + + String + + + None + + + ContainerDescriptor + + A container descriptor retrieved by Get-VsTeamGroup + + String + + String + + + None + + + + + + MemberDescriptor + + A member descriptor retrieved by Get-VsTeamUser + + String + + String + + + None + + + ContainerDescriptor + + A container descriptor retrieved by Get-VsTeamGroup + + String + + String + + + None + + + + + + + + + + + + + Get-VsTeamUser + + + + Get-VsTeamGroup + + + + Add-VsTeamMembership + + + + Get-VsTeamMembership + + + + Test-VsTeamMembership + + + + Remove-VSTeamPolicy @@ -13903,7 +14215,7 @@ Get-VSTeamVariableGroup @methodParameters Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -13944,7 +14256,7 @@ Get-VSTeamVariableGroup @methodParameters Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -14015,7 +14327,7 @@ Get-VSTeamVariableGroup @methodParameters Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -14041,7 +14353,7 @@ Get-VSTeamVariableGroup @methodParameters Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -14107,7 +14419,7 @@ Get-VSTeamVariableGroup @methodParameters Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -14135,7 +14447,7 @@ Get-VSTeamVariableGroup @methodParameters Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -14233,7 +14545,7 @@ Get-VSTeamVariableGroup @methodParameters Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -14275,7 +14587,7 @@ Get-VSTeamVariableGroup @methodParameters Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -14380,7 +14692,7 @@ Get-VSTeamVariableGroup @methodParameters Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -14422,7 +14734,7 @@ Get-VSTeamVariableGroup @methodParameters Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -14524,7 +14836,7 @@ Get-VSTeamVariableGroup @methodParameters Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -14564,7 +14876,7 @@ Get-VSTeamVariableGroup @methodParameters Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -14616,7 +14928,7 @@ Get-VSTeamVariableGroup @methodParameters Confirm - Prompts you for confirmation before running the cmdlet. + Prompts you for confirmation before running the function. SwitchParameter @@ -14627,7 +14939,7 @@ Get-VSTeamVariableGroup @methodParameters Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -14664,7 +14976,7 @@ Get-VSTeamVariableGroup @methodParameters Confirm - Prompts you for confirmation before running the cmdlet. + Prompts you for confirmation before running the function. SwitchParameter @@ -14675,7 +14987,7 @@ Get-VSTeamVariableGroup @methodParameters Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -14700,7 +15012,7 @@ Get-VSTeamVariableGroup @methodParameters Confirm - Prompts you for confirmation before running the cmdlet. + Prompts you for confirmation before running the function. SwitchParameter @@ -14712,7 +15024,7 @@ Get-VSTeamVariableGroup @methodParameters Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -15109,7 +15421,7 @@ Remove-VSTeamVariableGroup @methodParameters Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -15202,7 +15514,7 @@ Remove-VSTeamVariableGroup @methodParameters Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -15283,7 +15595,7 @@ Remove-VSTeamVariableGroup @methodParameters Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -15321,7 +15633,7 @@ Remove-VSTeamVariableGroup @methodParameters Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -15453,7 +15765,7 @@ Remove-VSTeamVariableGroup @methodParameters Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -15561,7 +15873,7 @@ PS demo:\> Get-ChildItem Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -15575,7 +15887,7 @@ PS demo:\> Get-ChildItem Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -15647,7 +15959,7 @@ PS demo:\> Get-ChildItem Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -15695,7 +16007,7 @@ PS demo:\> Get-ChildItem Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -15759,7 +16071,7 @@ PS demo:\> Get-ChildItem Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -15878,7 +16190,7 @@ PS demo:\> Get-ChildItem Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -15958,7 +16270,7 @@ PS demo:\> Get-ChildItem Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -16039,7 +16351,7 @@ PS demo:\> Get-ChildItem Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -16053,7 +16365,7 @@ PS demo:\> Get-ChildItem Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -16222,7 +16534,7 @@ PS demo:\> Get-ChildItem Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -16313,7 +16625,7 @@ PS demo:\> Get-ChildItem Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -16401,7 +16713,7 @@ PS demo:\> Get-ChildItem Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -16455,7 +16767,7 @@ PS demo:\> Get-ChildItem Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -17554,6 +17866,113 @@ PS demo:\> Get-ChildItem + + + Test-VSTeamMembership + Test + VSTeamMembership + + Tests the membership in a container. + + + + Tests the membership in a container. + + + + Test-VSTeamMembership + + MemberDescriptor + + A member descriptor retrieved by Get-VsTeamUser + + String + + String + + + None + + + ContainerDescriptor + + A container descriptor retrieved by Get-VsTeamGroup + + String + + String + + + None + + + + + + MemberDescriptor + + A member descriptor retrieved by Get-VsTeamUser + + String + + String + + + None + + + ContainerDescriptor + + A container descriptor retrieved by Get-VsTeamGroup + + String + + String + + + None + + + + + + + $True or $False + + + + + + + + + + + + + + + Get-VsTeamUser + + + + Get-VsTeamGroup + + + + Add-VsTeamMembership + + + + Get-VsTeamMembership + + + + Remove-VsTeamMembership + + + + Update-VSTeam @@ -17622,7 +18041,7 @@ PS demo:\> Get-ChildItem Confirm - Prompts you for confirmation before running the cmdlet. + Prompts you for confirmation before running the function. SwitchParameter @@ -17633,7 +18052,7 @@ PS demo:\> Get-ChildItem Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -17708,7 +18127,7 @@ PS demo:\> Get-ChildItem Confirm - Prompts you for confirmation before running the cmdlet. + Prompts you for confirmation before running the function. SwitchParameter @@ -17720,7 +18139,7 @@ PS demo:\> Get-ChildItem Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -17840,7 +18259,7 @@ PS demo:\> Get-ChildItem Confirm - Prompts you for confirmation before running the cmdlet. + Prompts you for confirmation before running the function. SwitchParameter @@ -17851,7 +18270,7 @@ PS demo:\> Get-ChildItem Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -17926,7 +18345,7 @@ PS demo:\> Get-ChildItem Confirm - Prompts you for confirmation before running the cmdlet. + Prompts you for confirmation before running the function. SwitchParameter @@ -17938,7 +18357,7 @@ PS demo:\> Get-ChildItem Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -18234,7 +18653,7 @@ PS C:\> Update-VSTeamBuildDefinition -ProjectName Demo -Id 23 -BuildDefinitio Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -18286,7 +18705,7 @@ PS C:\> Update-VSTeamBuildDefinition -ProjectName Demo -Id 23 -BuildDefinitio Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -18565,7 +18984,7 @@ PS C:\> Update-VSTeamBuildDefinition -ProjectName Demo -Id 23 -BuildDefinitio Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -18603,7 +19022,7 @@ PS C:\> Update-VSTeamBuildDefinition -ProjectName Demo -Id 23 -BuildDefinitio Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -18655,7 +19074,7 @@ PS C:\> Update-VSTeamBuildDefinition -ProjectName Demo -Id 23 -BuildDefinitio Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -18774,7 +19193,7 @@ PS C:\> Update-VSTeamBuildDefinition -ProjectName Demo -Id 23 -BuildDefinitio Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -18838,7 +19257,7 @@ PS C:\> Update-VSTeamBuildDefinition -ProjectName Demo -Id 23 -BuildDefinitio Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -18940,7 +19359,7 @@ PS C:\> Update-VSTeamBuildDefinition -ProjectName Demo -Id 23 -BuildDefinitio Confirm - Prompts you for confirmation before running the cmdlet. + Prompts you for confirmation before running the function. SwitchParameter @@ -18951,7 +19370,7 @@ PS C:\> Update-VSTeamBuildDefinition -ProjectName Demo -Id 23 -BuildDefinitio Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -19014,7 +19433,7 @@ PS C:\> Update-VSTeamBuildDefinition -ProjectName Demo -Id 23 -BuildDefinitio Confirm - Prompts you for confirmation before running the cmdlet. + Prompts you for confirmation before running the function. SwitchParameter @@ -19026,7 +19445,7 @@ PS C:\> Update-VSTeamBuildDefinition -ProjectName Demo -Id 23 -BuildDefinitio Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -19133,7 +19552,7 @@ PS C:\> Update-VSTeamRelease -ProjectName project -Id 76 -release $r Confirm - Prompts you for confirmation before running the cmdlet. + Prompts you for confirmation before running the function. SwitchParameter @@ -19144,7 +19563,7 @@ PS C:\> Update-VSTeamRelease -ProjectName project -Id 76 -release $r Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -19195,7 +19614,7 @@ PS C:\> Update-VSTeamRelease -ProjectName project -Id 76 -release $r Confirm - Prompts you for confirmation before running the cmdlet. + Prompts you for confirmation before running the function. SwitchParameter @@ -19206,7 +19625,7 @@ PS C:\> Update-VSTeamRelease -ProjectName project -Id 76 -release $r Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -19269,7 +19688,7 @@ PS C:\> Update-VSTeamRelease -ProjectName project -Id 76 -release $r Confirm - Prompts you for confirmation before running the cmdlet. + Prompts you for confirmation before running the function. SwitchParameter @@ -19281,7 +19700,7 @@ PS C:\> Update-VSTeamRelease -ProjectName project -Id 76 -release $r Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -19398,7 +19817,7 @@ PS C:\> Update-VSTeamReleaseDefinition -ProjectName Demo -ReleaseDefinition $ Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -19450,7 +19869,7 @@ PS C:\> Update-VSTeamReleaseDefinition -ProjectName Demo -ReleaseDefinition $ Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -19560,7 +19979,7 @@ PS C:\> Update-VSTeamReleaseDefinition -ProjectName Demo -ReleaseDefinition $ Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -19604,7 +20023,7 @@ PS C:\> Update-VSTeamReleaseDefinition -ProjectName Demo -ReleaseDefinition $ Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -19660,7 +20079,7 @@ PS C:\> Update-VSTeamReleaseDefinition -ProjectName Demo -ReleaseDefinition $ Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -20123,7 +20542,7 @@ Update-VSTeamVariableGroup @methodParameters Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter @@ -20197,7 +20616,7 @@ Update-VSTeamVariableGroup @methodParameters Force - Forces the command without confirmation + Forces the function without confirmation SwitchParameter diff --git a/docs/Add-VSTeamBuildTag.md b/docs/Add-VSTeamBuildTag.md index a3f08bceb..af31e3a28 100644 --- a/docs/Add-VSTeamBuildTag.md +++ b/docs/Add-VSTeamBuildTag.md @@ -60,7 +60,7 @@ Accept pipeline input: true (ByPropertyName, ByValue) ### -Confirm -Prompts you for confirmation before running the cmdlet. +Prompts you for confirmation before running the function. ```yaml Type: SwitchParameter @@ -73,7 +73,7 @@ Aliases: cf ### -Force -Forces the command without confirmation +Forces the function without confirmation ```yaml Type: SwitchParameter diff --git a/docs/Add-VSTeamMembership.md b/docs/Add-VSTeamMembership.md new file mode 100644 index 000000000..7b149c031 --- /dev/null +++ b/docs/Add-VSTeamMembership.md @@ -0,0 +1,59 @@ + + + +# Add-VSTeamMembership + +## SYNOPSIS + +Adds a membership to a container. + +## SYNTAX + +## DESCRIPTION + +Adds a membership to a container. + +## EXAMPLES + +## PARAMETERS + +### -MemberDescriptor + +A member descriptor retrieved by Get-VsTeamUser + +```yaml +Type: String +Required: True +Position: 0 +``` + + +### -ContainerDescriptor + +A container descriptor retrieved by Get-VsTeamGroup + +```yaml +Type: String +Required: True +Position: 1 +``` + + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[Get-VsTeamUser](Get-VsTeamUser.md) + +[Get-VsTeamGroup](Get-VsTeamGroup.md) + +[Get-VsTeamMembership](Get-VsTeamMembership.md) + +[Remove-VsTeamMembership](Remove-VsTeamMembership.md) + +[Test-VsTeamMembership](Test-VsTeamMembership.md) + diff --git a/docs/Add-VSTeamRelease.md b/docs/Add-VSTeamRelease.md index f0c15b480..010bb9df0 100644 --- a/docs/Add-VSTeamRelease.md +++ b/docs/Add-VSTeamRelease.md @@ -144,7 +144,7 @@ Accept pipeline input: true (ByPropertyName) ### -Force -Forces the command without confirmation +Forces the function without confirmation ```yaml Type: SwitchParameter diff --git a/docs/Get-VSTeamMembership.md b/docs/Get-VSTeamMembership.md new file mode 100644 index 000000000..5cfb0750c --- /dev/null +++ b/docs/Get-VSTeamMembership.md @@ -0,0 +1,73 @@ + + + +# Get-VSTeamMembership + +## SYNOPSIS + +Gets a memberships for a container or member. + +## SYNTAX + +## DESCRIPTION + +Gets a memberships for a container or member. + +## EXAMPLES +### -------------------------- EXAMPLE 1 -------------------------- + +```PowerShell +(Get-VSTeamMembership -MemberDescriptor $user.ID).value | % { Get-VSTeamGroup -Descriptor $_.containerdescriptor } +``` +Get all the groups for a user + +### -------------------------- EXAMPLE 2 -------------------------- +```PowerShell +(Get-VSTeamMembership -ContainerDescriptor $group.id).value | % {Get-VSTeamUser -Descriptor $_.memberDescriptor } +``` + +Get all the members for a group + +## PARAMETERS + +### -ContainerDescriptor + +A container descriptor retrieved by Get-VsTeamGroup + +```yaml +Type: String +Required: True +Parameter Sets: ByContainerId +Position: 0 +``` + +### -MemberDescriptor + +A member descriptor retrieved by Get-VsTeamUser + +```yaml +Type: String +Required: True +Parameter Sets: ByMemberId +Position: 0 +``` + +## INPUTS + +## OUTPUTS + + +## NOTES + +## RELATED LINKS + +[Get-VsTeamUser](Get-VsTeamUser.md) + +[Get-VsTeamGroup](Get-VsTeamGroup.md) + +[Add-VsTeamMembership](Add-VsTeamMembership.md) + +[Remove-VsTeamMembership](Remove-VsTeamMembership.md) + +[Test-VsTeamMembership](Test-VsTeamMembership.md) + diff --git a/docs/Remove-VSTeam.md b/docs/Remove-VSTeam.md index 950e2bc1f..2fc68f000 100644 --- a/docs/Remove-VSTeam.md +++ b/docs/Remove-VSTeam.md @@ -46,7 +46,7 @@ Accept pipeline input: true (ByPropertyName) ### -Confirm -Prompts you for confirmation before running the cmdlet. +Prompts you for confirmation before running the function. ```yaml Type: SwitchParameter @@ -59,7 +59,7 @@ Aliases: cf ### -Force -Forces the command without confirmation +Forces the function without confirmation ```yaml Type: SwitchParameter diff --git a/docs/Remove-VSTeamAccount.md b/docs/Remove-VSTeamAccount.md index 72910f0bc..9935e2957 100644 --- a/docs/Remove-VSTeamAccount.md +++ b/docs/Remove-VSTeamAccount.md @@ -37,7 +37,7 @@ Type: String ### -Force -Forces the command without confirmation +Forces the function without confirmation ```yaml Type: SwitchParameter diff --git a/docs/Remove-VSTeamAgent.md b/docs/Remove-VSTeamAgent.md index a512ec755..200da853d 100644 --- a/docs/Remove-VSTeamAgent.md +++ b/docs/Remove-VSTeamAgent.md @@ -40,7 +40,7 @@ Accept pipeline input: true (ByPropertyName) ### -Force -Forces the command without confirmation +Forces the function without confirmation ```yaml Type: SwitchParameter diff --git a/docs/Remove-VSTeamBuild.md b/docs/Remove-VSTeamBuild.md index ac2b9f4d5..fba9d923b 100644 --- a/docs/Remove-VSTeamBuild.md +++ b/docs/Remove-VSTeamBuild.md @@ -57,7 +57,7 @@ Accept pipeline input: true (ByPropertyName, ByValue) ### -Force -Forces the command without confirmation +Forces the function without confirmation ```yaml Type: SwitchParameter diff --git a/docs/Remove-VSTeamBuildDefinition.md b/docs/Remove-VSTeamBuildDefinition.md index 49cb4271d..4d5c84e08 100644 --- a/docs/Remove-VSTeamBuildDefinition.md +++ b/docs/Remove-VSTeamBuildDefinition.md @@ -61,7 +61,7 @@ Accept pipeline input: true (ByPropertyName) ### -Force -Forces the command without confirmation +Forces the function without confirmation ```yaml Type: SwitchParameter diff --git a/docs/Remove-VSTeamBuildTag.md b/docs/Remove-VSTeamBuildTag.md index aa7f9d04a..f26d0d858 100644 --- a/docs/Remove-VSTeamBuildTag.md +++ b/docs/Remove-VSTeamBuildTag.md @@ -60,7 +60,7 @@ Accept pipeline input: true (ByPropertyName, ByValue) ### -Force -Forces the command without confirmation +Forces the function without confirmation ```yaml Type: SwitchParameter @@ -72,7 +72,7 @@ Parameter Sets: (All) ### -Confirm -Prompts you for confirmation before running the cmdlet. +Prompts you for confirmation before running the function. ```yaml Type: SwitchParameter diff --git a/docs/Remove-VSTeamExtension.md b/docs/Remove-VSTeamExtension.md index 862f423c5..8a8a29af0 100644 --- a/docs/Remove-VSTeamExtension.md +++ b/docs/Remove-VSTeamExtension.md @@ -37,7 +37,7 @@ Required: True ### -Force -Forces the command without confirmation +Forces the function without confirmation ```yaml Type: SwitchParameter diff --git a/docs/Remove-VSTeamGitRepository.md b/docs/Remove-VSTeamGitRepository.md index 16a150144..6f3a91dcf 100644 --- a/docs/Remove-VSTeamGitRepository.md +++ b/docs/Remove-VSTeamGitRepository.md @@ -41,7 +41,7 @@ Accept pipeline input: true (ByPropertyName) ### -Force -Forces the command without confirmation +Forces the function without confirmation ```yaml Type: SwitchParameter diff --git a/docs/Remove-VSTeamMembership.md b/docs/Remove-VSTeamMembership.md new file mode 100644 index 000000000..c553abec5 --- /dev/null +++ b/docs/Remove-VSTeamMembership.md @@ -0,0 +1,59 @@ + + + +# Remove-VSTeamMembership + +## SYNOPSIS + +Removes a membership to a container. + +## SYNTAX + +## DESCRIPTION + +Removes a membership to a container. + +## EXAMPLES + +## PARAMETERS + +### -MemberDescriptor + +A member descriptor retrieved by Get-VsTeamUser + +```yaml +Type: String +Required: True +Position: 0 +``` + + +### -ContainerDescriptor + +A container descriptor retrieved by Get-VsTeamGroup + +```yaml +Type: String +Required: True +Position: 1 +``` + + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[Get-VsTeamUser](Get-VsTeamUser.md) + +[Get-VsTeamGroup](Get-VsTeamGroup.md) + +[Add-VsTeamMembership](Add-VsTeamMembership.md) + +[Get-VsTeamMembership](Get-VsTeamMembership.md) + +[Test-VsTeamMembership](Test-VsTeamMembership.md) + diff --git a/docs/Remove-VSTeamPolicy.md b/docs/Remove-VSTeamPolicy.md index 4fb658464..c51fc3165 100644 --- a/docs/Remove-VSTeamPolicy.md +++ b/docs/Remove-VSTeamPolicy.md @@ -55,7 +55,7 @@ Accept pipeline input: true (ByPropertyName) ### -Force -Forces the command without confirmation +Forces the function without confirmation ```yaml Type: SwitchParameter diff --git a/docs/Remove-VSTeamProfile.md b/docs/Remove-VSTeamProfile.md index 9dd3e5b9e..9536ac859 100644 --- a/docs/Remove-VSTeamProfile.md +++ b/docs/Remove-VSTeamProfile.md @@ -36,7 +36,7 @@ Required: True ### -Force -Forces the command without confirmation +Forces the function without confirmation ```yaml Type: SwitchParameter diff --git a/docs/Remove-VSTeamProject.md b/docs/Remove-VSTeamProject.md index effc220f8..9b1536231 100644 --- a/docs/Remove-VSTeamProject.md +++ b/docs/Remove-VSTeamProject.md @@ -61,7 +61,7 @@ Accept pipeline input: true (ByPropertyName) ### -Force -Forces the command without confirmation +Forces the function without confirmation ```yaml Type: SwitchParameter diff --git a/docs/Remove-VSTeamRelease.md b/docs/Remove-VSTeamRelease.md index 3ed1ac5b8..453ced42d 100644 --- a/docs/Remove-VSTeamRelease.md +++ b/docs/Remove-VSTeamRelease.md @@ -61,7 +61,7 @@ Accept pipeline input: true (ByPropertyName) ### -Force -Forces the command without confirmation +Forces the function without confirmation ```yaml Type: SwitchParameter diff --git a/docs/Remove-VSTeamReleaseDefinition.md b/docs/Remove-VSTeamReleaseDefinition.md index 247bcaef4..5c5448bfd 100644 --- a/docs/Remove-VSTeamReleaseDefinition.md +++ b/docs/Remove-VSTeamReleaseDefinition.md @@ -61,7 +61,7 @@ Accept pipeline input: true (ByPropertyName) ### -Force -Forces the command without confirmation +Forces the function without confirmation ```yaml Type: SwitchParameter diff --git a/docs/Remove-VSTeamServiceEndpoint.md b/docs/Remove-VSTeamServiceEndpoint.md index b844a1e06..1d8eb91f0 100644 --- a/docs/Remove-VSTeamServiceEndpoint.md +++ b/docs/Remove-VSTeamServiceEndpoint.md @@ -45,7 +45,7 @@ Accept pipeline input: true (ByPropertyName) ### -Force -Forces the command without confirmation +Forces the function without confirmation ```yaml Type: SwitchParameter diff --git a/docs/Remove-VSTeamUserEntitlement.md b/docs/Remove-VSTeamUserEntitlement.md index 6a821294a..a67e2711f 100644 --- a/docs/Remove-VSTeamUserEntitlement.md +++ b/docs/Remove-VSTeamUserEntitlement.md @@ -23,7 +23,7 @@ The delete operation includes unassigning Extensions and Licenses and removing t ### -Confirm -Prompts you for confirmation before running the cmdlet. +Prompts you for confirmation before running the function. ```yaml Type: SwitchParameter @@ -36,7 +36,7 @@ Aliases: cf ### -Force -Forces the command without confirmation +Forces the function without confirmation ```yaml Type: SwitchParameter diff --git a/docs/Set-VSTeamAPIVersion.md b/docs/Set-VSTeamAPIVersion.md index cc60bc6b0..6c9f9c3bb 100644 --- a/docs/Set-VSTeamAPIVersion.md +++ b/docs/Set-VSTeamAPIVersion.md @@ -83,7 +83,7 @@ Parameter Sets: Service ### -Force -Forces the command without confirmation +Forces the function without confirmation ```yaml Type: SwitchParameter diff --git a/docs/Set-VSTeamAccount.md b/docs/Set-VSTeamAccount.md index f1886ccb5..c5fd285f8 100644 --- a/docs/Set-VSTeamAccount.md +++ b/docs/Set-VSTeamAccount.md @@ -197,7 +197,7 @@ Type: String ### -Force -Forces the command without confirmation +Forces the function without confirmation ```yaml Type: SwitchParameter diff --git a/docs/Set-VSTeamAlias.md b/docs/Set-VSTeamAlias.md index 8b0d08e6e..ae026453e 100644 --- a/docs/Set-VSTeamAlias.md +++ b/docs/Set-VSTeamAlias.md @@ -19,7 +19,7 @@ In version 6.0 the default aliases were removed to prevent conflicts with other ### -Force -Forces the command without confirmation +Forces the function without confirmation ```yaml Type: SwitchParameter diff --git a/docs/Set-VSTeamApproval.md b/docs/Set-VSTeamApproval.md index 86b95f997..78f7fd846 100644 --- a/docs/Set-VSTeamApproval.md +++ b/docs/Set-VSTeamApproval.md @@ -92,7 +92,7 @@ Type: String ### -Force -Forces the command without confirmation +Forces the function without confirmation ```yaml Type: SwitchParameter diff --git a/docs/Set-VSTeamDefaultProject.md b/docs/Set-VSTeamDefaultProject.md index cc602af1b..00a9fe1f8 100644 --- a/docs/Set-VSTeamDefaultProject.md +++ b/docs/Set-VSTeamDefaultProject.md @@ -31,7 +31,7 @@ You can now call other functions that require a project name without passing the ### -Force -Forces the command without confirmation +Forces the function without confirmation ```yaml Type: SwitchParameter diff --git a/docs/Set-VSTeamEnvironmentStatus.md b/docs/Set-VSTeamEnvironmentStatus.md index 11aaee13e..3086e1f7c 100644 --- a/docs/Set-VSTeamEnvironmentStatus.md +++ b/docs/Set-VSTeamEnvironmentStatus.md @@ -94,7 +94,7 @@ Type: DateTime ### -Force -Forces the command without confirmation +Forces the function without confirmation ```yaml Type: SwitchParameter diff --git a/docs/Set-VSTeamReleaseStatus.md b/docs/Set-VSTeamReleaseStatus.md index 4bcddd36b..cfc05a98c 100644 --- a/docs/Set-VSTeamReleaseStatus.md +++ b/docs/Set-VSTeamReleaseStatus.md @@ -65,7 +65,7 @@ Type: String ### -Force -Forces the command without confirmation +Forces the function without confirmation ```yaml Type: SwitchParameter diff --git a/docs/Team.md b/docs/Team.md index 325affbeb..0ceb93fc1 100644 --- a/docs/Team.md +++ b/docs/Team.md @@ -59,6 +59,10 @@ Add permissions to a git repository, all repositories in a project, or a specifi Adds connections to Kubernetes clusters +### [Add-VSTeamMembership](Add-VSTeamMembership.md) + +Adds a membership to a container. + ### [Add-VSTeamNuGetEndpoint](Add-VSTeamNuGetEndpoint.md) Adds a new NuGet service endpoint. @@ -212,6 +216,10 @@ Returns all the job requests of an agent. Returns a team member. +### [Get-VSTeamMembership](Get-VSTeamMembership.md) + +Gets a memberships for a container or member. + ### [Get-VSTeamOption](Get-VSTeamOption.md) Returns all the versions of supported APIs of your TFS or VSTS. @@ -344,6 +352,10 @@ Removes a package feed from the account. Removes the Git repository from your Visual Studio Team Services or Team Foundation Server account. +### [Remove-VSTeamMembership](Remove-VSTeamMembership.md) + +Removes a membership to a container. + ### [Remove-VSTeamPolicy](Remove-VSTeamPolicy.md) Removes the specified policy from the specified project. @@ -451,6 +463,10 @@ Opens the release definitions for a team project in the default browser. Opens the work item in the default browser. +### [Test-VSTeamMembership](Test-VSTeamMembership.md) + +Tests the membership in a container. + ### [Update-VSTeam](Update-VSTeam.md) Updates the team name, description or both. diff --git a/docs/Test-VSTeamMembership.md b/docs/Test-VSTeamMembership.md new file mode 100644 index 000000000..8ae6c247b --- /dev/null +++ b/docs/Test-VSTeamMembership.md @@ -0,0 +1,60 @@ + + + +# Test-VSTeamMembership + +## SYNOPSIS + +Tests the membership in a container. + +## SYNTAX + +## DESCRIPTION + +Tests the membership in a container. + +## EXAMPLES + +## PARAMETERS + +### -MemberDescriptor + +A member descriptor retrieved by Get-VsTeamUser + +```yaml +Type: String +Required: True +Position: 0 +``` + + +### -ContainerDescriptor + +A container descriptor retrieved by Get-VsTeamGroup + +```yaml +Type: String +Required: True +Position: 1 +``` + + +## INPUTS + +## OUTPUTS +### $True or $False + +## NOTES + +## RELATED LINKS + +[Get-VsTeamUser](Get-VsTeamUser.md) + +[Get-VsTeamGroup](Get-VsTeamGroup.md) + +[Add-VsTeamMembership](Add-VsTeamMembership.md) + +[Get-VsTeamMembership](Get-VsTeamMembership.md) + +[Remove-VsTeamMembership](Remove-VsTeamMembership.md) + diff --git a/docs/Update-VSTeam.md b/docs/Update-VSTeam.md index 3e71b6796..1ccb48005 100644 --- a/docs/Update-VSTeam.md +++ b/docs/Update-VSTeam.md @@ -63,7 +63,7 @@ Type: String ### -Confirm -Prompts you for confirmation before running the cmdlet. +Prompts you for confirmation before running the function. ```yaml Type: SwitchParameter @@ -76,7 +76,7 @@ Aliases: cf ### -Force -Forces the command without confirmation +Forces the function without confirmation ```yaml Type: SwitchParameter diff --git a/docs/Update-VSTeamBuild.md b/docs/Update-VSTeamBuild.md index e1c6128c5..498f866e8 100644 --- a/docs/Update-VSTeamBuild.md +++ b/docs/Update-VSTeamBuild.md @@ -72,7 +72,7 @@ Accept pipeline input: true (ByPropertyName, ByValue) ### -Confirm -Prompts you for confirmation before running the cmdlet. +Prompts you for confirmation before running the function. ```yaml Type: SwitchParameter @@ -85,7 +85,7 @@ Aliases: cf ### -Force -Forces the command without confirmation +Forces the function without confirmation ```yaml Type: SwitchParameter diff --git a/docs/Update-VSTeamExtension.md b/docs/Update-VSTeamExtension.md index c092d80ec..5a37906ce 100644 --- a/docs/Update-VSTeamExtension.md +++ b/docs/Update-VSTeamExtension.md @@ -49,7 +49,7 @@ Required: True ### -Force -Forces the command without confirmation +Forces the function without confirmation ```yaml Type: SwitchParameter diff --git a/docs/Update-VSTeamProfile.md b/docs/Update-VSTeamProfile.md index d26341a50..5ab6dfe54 100644 --- a/docs/Update-VSTeamProfile.md +++ b/docs/Update-VSTeamProfile.md @@ -77,7 +77,7 @@ Position: 3 ### -Force -Forces the command without confirmation +Forces the function without confirmation ```yaml Type: SwitchParameter diff --git a/docs/Update-VSTeamProject.md b/docs/Update-VSTeamProject.md index a91cbd5bb..65b3e0627 100644 --- a/docs/Update-VSTeamProject.md +++ b/docs/Update-VSTeamProject.md @@ -70,7 +70,7 @@ Accept pipeline input: true (ByPropertyName) ### -Force -Forces the command without confirmation +Forces the function without confirmation ```yaml Type: SwitchParameter diff --git a/docs/Update-VSTeamRelease.md b/docs/Update-VSTeamRelease.md index bac2ce009..ac732bb78 100644 --- a/docs/Update-VSTeamRelease.md +++ b/docs/Update-VSTeamRelease.md @@ -76,7 +76,7 @@ Required: True ### -Confirm -Prompts you for confirmation before running the cmdlet. +Prompts you for confirmation before running the function. ```yaml Type: SwitchParameter @@ -89,7 +89,7 @@ Aliases: cf ### -Force -Forces the command without confirmation +Forces the function without confirmation ```yaml Type: SwitchParameter diff --git a/docs/Update-VSTeamReleaseDefinition.md b/docs/Update-VSTeamReleaseDefinition.md index 78a6e4368..189d8acd9 100644 --- a/docs/Update-VSTeamReleaseDefinition.md +++ b/docs/Update-VSTeamReleaseDefinition.md @@ -61,7 +61,7 @@ Path and file name to the JSON file that contains the definition to be updated. ```yaml Type: String -Required: True +Required: true Parameter Sets: File Position: 1 Accept pipeline input: true (ByPropertyName) @@ -73,7 +73,7 @@ JSON string of release definition. ```yaml Type: String -Required: True +Required: true Parameter Sets: JSON Position: 1 Accept pipeline input: true (ByPropertyName) @@ -81,7 +81,7 @@ Accept pipeline input: true (ByPropertyName) ### -Confirm -Prompts you for confirmation before running the cmdlet. +Prompts you for confirmation before running the function. ```yaml Type: SwitchParameter @@ -94,7 +94,7 @@ Aliases: cf ### -Force -Forces the command without confirmation +Forces the function without confirmation ```yaml Type: SwitchParameter diff --git a/docs/Update-VSTeamServiceEndpoint.md b/docs/Update-VSTeamServiceEndpoint.md index 54bcdbfbc..398618c34 100644 --- a/docs/Update-VSTeamServiceEndpoint.md +++ b/docs/Update-VSTeamServiceEndpoint.md @@ -54,7 +54,7 @@ Accept pipeline input: true (ByPropertyName) ### -Force -Forces the command without confirmation +Forces the function without confirmation ```yaml Type: SwitchParameter diff --git a/docs/Update-VSTeamUserEntitlement.md b/docs/Update-VSTeamUserEntitlement.md index 5b1896f79..18e18ef06 100644 --- a/docs/Update-VSTeamUserEntitlement.md +++ b/docs/Update-VSTeamUserEntitlement.md @@ -55,7 +55,7 @@ Required: True ### -Force -Forces the command without confirmation +Forces the function without confirmation ```yaml Type: SwitchParameter diff --git a/docs/Update-VSTeamWorkItem.md b/docs/Update-VSTeamWorkItem.md index f4aa79cfa..dc57a64fb 100644 --- a/docs/Update-VSTeamWorkItem.md +++ b/docs/Update-VSTeamWorkItem.md @@ -88,7 +88,7 @@ Required: False ### -Force -Forces the command without confirmation +Forces the function without confirmation ```yaml Type: SwitchParameter diff --git a/docs/readme.md b/docs/readme.md index 9e7a1ff3b..6f8da577d 100644 --- a/docs/readme.md +++ b/docs/readme.md @@ -64,6 +64,10 @@ Add permissions to a git repository, all repositories in a project, or a specifi Adds connections to Kubernetes clusters +### [Add-VSTeamMembership](Add-VSTeamMembership.md) + +Adds a membership to a container. + ### [Add-VSTeamNuGetEndpoint](Add-VSTeamNuGetEndpoint.md) Adds a new NuGet service endpoint. @@ -217,6 +221,10 @@ Returns all the job requests of an agent. Returns a team member. +### [Get-VSTeamMembership](Get-VSTeamMembership.md) + +Gets a memberships for a container or member. + ### [Get-VSTeamOption](Get-VSTeamOption.md) Returns all the versions of supported APIs of your TFS or VSTS. @@ -349,6 +357,10 @@ Removes a package feed from the account. Removes the Git repository from your Visual Studio Team Services or Team Foundation Server account. +### [Remove-VSTeamMembership](Remove-VSTeamMembership.md) + +Removes a membership to a container. + ### [Remove-VSTeamPolicy](Remove-VSTeamPolicy.md) Removes the specified policy from the specified project. @@ -456,6 +468,10 @@ Opens the release definitions for a team project in the default browser. Opens the work item in the default browser. +### [Test-VSTeamMembership](Test-VSTeamMembership.md) + +Tests the membership in a container. + ### [Update-VSTeam](Update-VSTeam.md) Updates the team name, description or both. diff --git a/unit/test/membership.Tests.ps1 b/unit/test/membership.Tests.ps1 new file mode 100644 index 000000000..5cc84f4e0 --- /dev/null +++ b/unit/test/membership.Tests.ps1 @@ -0,0 +1,94 @@ +Set-StrictMode -Version Latest + +InModuleScope VSTeam { + + # Set the account to use for testing. A normal user would do this + # using the Set-VSTeamAccount function. + [VSTeamVersions]::Account = 'https://dev.azure.com/test' + + Describe 'Users VSTS' { + # You have to set the version or the api-version will not be added when + # [VSTeamVersions]::Graph = '' + [VSTeamVersions]::Graph = '5.0' + + Context 'Test-VSTeamMembership' { + Mock Invoke-RestMethod { } -Verifiable + + $UserDescriptor = 'aad.OTcyOTJkNzYtMjc3Yi03OTgxLWIzNDMtNTkzYmM3ODZkYjlj' + $GroupDescriptor = 'vssgp.Uy0xLTktMTU1MTM3NDI0NS04NTYwMDk3MjYtNDE5MzQ0MjExNy0yMzkwNzU2MTEwLTI3NDAxNjE4MjEtMC0wLTAtMC0x' + + $result = Test-VSTeamMembership -MemberDescriptor $UserDescriptor -ContainerDescriptor $GroupDescriptor + It 'Should test membership' { + Assert-MockCalled Invoke-RestMethod -Exactly 1 -ParameterFilter { + $Method -eq "Head" + $Uri -like "https://vssps.dev.azure.com/test/_apis/graph/memberships/$UserDescriptor/$GroupDescriptor*" -and + $Uri -like "*api-version=$([VSTeamVersions]::Graph)*" + } + $result | Should Be $true + } + } + + Context 'Add-VSTeamMembership' { + Mock Invoke-RestMethod { } -Verifiable + + $UserDescriptor = 'aad.OTcyOTJkNzYtMjc3Yi03OTgxLWIzNDMtNTkzYmM3ODZkYjlj' + $GroupDescriptor = 'vssgp.Uy0xLTktMTU1MTM3NDI0NS04NTYwMDk3MjYtNDE5MzQ0MjExNy0yMzkwNzU2MTEwLTI3NDAxNjE4MjEtMC0wLTAtMC0x' + + $null = Add-VSTeamMembership -MemberDescriptor $UserDescriptor -ContainerDescriptor $GroupDescriptor + It 'Should add membership' { + Assert-MockCalled Invoke-RestMethod -Exactly 1 -ParameterFilter { + $Method -eq "Put" + $Uri -like "https://vssps.dev.azure.com/test/_apis/graph/memberships/$UserDescriptor/$GroupDescriptor*" -and + $Uri -like "*api-version=$([VSTeamVersions]::Graph)*" + } + } + } + + Context 'Remove-VSTeamMembership' { + Mock Invoke-RestMethod { } -Verifiable + + $UserDescriptor = 'aad.OTcyOTJkNzYtMjc3Yi03OTgxLWIzNDMtNTkzYmM3ODZkYjlj' + $GroupDescriptor = 'vssgp.Uy0xLTktMTU1MTM3NDI0NS04NTYwMDk3MjYtNDE5MzQ0MjExNy0yMzkwNzU2MTEwLTI3NDAxNjE4MjEtMC0wLTAtMC0x' + + $null = Remove-VSTeamMembership -MemberDescriptor $UserDescriptor -ContainerDescriptor $GroupDescriptor + It 'Should remove a membership' { + Assert-MockCalled Invoke-RestMethod -Exactly 1 -ParameterFilter { + $Method -eq "Delete" + $Uri -like "https://vssps.dev.azure.com/test/_apis/graph/memberships/$UserDescriptor/$GroupDescriptor*" -and + $Uri -like "*api-version=$([VSTeamVersions]::Graph)*" + } + } + } + + Context 'Get-VSTeamMembership for Member' { + Mock Invoke-RestMethod { } -Verifiable + + $UserDescriptor = 'aad.OTcyOTJkNzYtMjc3Yi03OTgxLWIzNDMtNTkzYmM3ODZkYjlj' + + $null = Get-VSTeamMembership -MemberDescriptor $UserDescriptor + It "Should get a container's members" { + Assert-MockCalled Invoke-RestMethod -Exactly 1 -ParameterFilter { + $Method -eq "Get" + $Uri -like "https://vssps.dev.azure.com/test/_apis/graph/memberships/$MemberDescriptor*" -and + $Uri -like "*api-version=$([VSTeamVersions]::Graph)*" + } + } + } + + Context 'Get-VSTeamMembership for Group' { + Mock Invoke-RestMethod { } -Verifiable + + $GroupDescriptor = 'vssgp.Uy0xLTktMTU1MTM3NDI0NS04NTYwMDk3MjYtNDE5MzQ0MjExNy0yMzkwNzU2MTEwLTI3NDAxNjE4MjEtMC0wLTAtMC0x' + + $null = Get-VSTeamMembership -ContainerDescriptor $GroupDescriptor + It "Should get a container's members" { + Assert-MockCalled Invoke-RestMethod -Exactly 1 -ParameterFilter { + $Method -eq "Get" + $Uri -like "https://vssps.dev.azure.com/test/_apis/graph/memberships/$GroupDescriptor*" -and + $Uri -like "*api-version=$([VSTeamVersions]::Graph)*" + $Uri -like "*direction=Down*" + } + } + } + } +} \ No newline at end of file From 7ca95fe4e4f0abab99182ae754ed596f76521bcd Mon Sep 17 00:00:00 2001 From: Donovan Brown Date: Sun, 28 Jul 2019 18:17:45 -0500 Subject: [PATCH 3/6] Updated version and change log. --- CHANGELOG.md | 2 +- Source/VSTeam.psd1 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bd0845135..4fddfca6a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ## 6.3.1 -Added support for the following: +Merged [Pull Request](https://github.com/DarqueWarrior/vsteam/pull/178) from [Jim W](https://github.com/Seekatar) which included the following: - Add-VSTeamMembership - Remove-VSTeamMembership diff --git a/Source/VSTeam.psd1 b/Source/VSTeam.psd1 index 9a8ca4309..fbf6a42e1 100644 --- a/Source/VSTeam.psd1 +++ b/Source/VSTeam.psd1 @@ -12,7 +12,7 @@ RootModule = 'VSTeam.psm1' # Version number of this module. - ModuleVersion = '6.3.0' + ModuleVersion = '6.3.1' # Supported PSEditions # CompatiblePSEditions = @() From e192937e4248db2a68c58f6ddfda7e6da1267863 Mon Sep 17 00:00:00 2001 From: Seekatar Date: Mon, 29 Jul 2019 07:13:30 -0400 Subject: [PATCH 4/6] Add should process to Remove-VSTeamMembership --- Source/Public/Remove-VSTeamMembership.ps1 | 9 ++++++--- unit/test/membership.Tests.ps1 | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Source/Public/Remove-VSTeamMembership.ps1 b/Source/Public/Remove-VSTeamMembership.ps1 index 54655c045..094783d13 100644 --- a/Source/Public/Remove-VSTeamMembership.ps1 +++ b/Source/Public/Remove-VSTeamMembership.ps1 @@ -1,13 +1,16 @@ function Remove-VSTeamMembership { - [CmdletBinding()] + [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "High")] param( [Parameter(Mandatory = $true)] [string] $MemberDescriptor, [Parameter(Mandatory = $true)] - [string] $ContainerDescriptor + [string] $ContainerDescriptor, + [switch] $Force ) process { - return _callMembershipAPI -Id "$MemberDescriptor/$ContainerDescriptor" -Method Delete + if ($Force -or $PSCmdlet.ShouldProcess("$MemberDescriptor/$ContainerDescriptor", "Delete Membership")) { + return _callMembershipAPI -Id "$MemberDescriptor/$ContainerDescriptor" -Method Delete + } } } diff --git a/unit/test/membership.Tests.ps1 b/unit/test/membership.Tests.ps1 index 5cc84f4e0..2a35913fe 100644 --- a/unit/test/membership.Tests.ps1 +++ b/unit/test/membership.Tests.ps1 @@ -50,7 +50,7 @@ InModuleScope VSTeam { $UserDescriptor = 'aad.OTcyOTJkNzYtMjc3Yi03OTgxLWIzNDMtNTkzYmM3ODZkYjlj' $GroupDescriptor = 'vssgp.Uy0xLTktMTU1MTM3NDI0NS04NTYwMDk3MjYtNDE5MzQ0MjExNy0yMzkwNzU2MTEwLTI3NDAxNjE4MjEtMC0wLTAtMC0x' - $null = Remove-VSTeamMembership -MemberDescriptor $UserDescriptor -ContainerDescriptor $GroupDescriptor + $null = Remove-VSTeamMembership -MemberDescriptor $UserDescriptor -ContainerDescriptor $GroupDescriptor -Force It 'Should remove a membership' { Assert-MockCalled Invoke-RestMethod -Exactly 1 -ParameterFilter { $Method -eq "Delete" From 936cbbe1b0978c70598b0a3af900f52516edfe46 Mon Sep 17 00:00:00 2001 From: Seekatar Date: Thu, 1 Aug 2019 06:39:24 -0400 Subject: [PATCH 5/6] Hopefully fix random UT error --- unit/test/membership.Tests.ps1 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/unit/test/membership.Tests.ps1 b/unit/test/membership.Tests.ps1 index 2a35913fe..584f0e018 100644 --- a/unit/test/membership.Tests.ps1 +++ b/unit/test/membership.Tests.ps1 @@ -67,6 +67,9 @@ InModuleScope VSTeam { $null = Get-VSTeamMembership -MemberDescriptor $UserDescriptor It "Should get a container's members" { + # This should stop the call to cache projects + [VSTeamProjectCache]::timestamp = (Get-Date).Minute + Assert-MockCalled Invoke-RestMethod -Exactly 1 -ParameterFilter { $Method -eq "Get" $Uri -like "https://vssps.dev.azure.com/test/_apis/graph/memberships/$MemberDescriptor*" -and @@ -82,6 +85,9 @@ InModuleScope VSTeam { $null = Get-VSTeamMembership -ContainerDescriptor $GroupDescriptor It "Should get a container's members" { + # This should stop the call to cache projects + [VSTeamProjectCache]::timestamp = (Get-Date).Minute + Assert-MockCalled Invoke-RestMethod -Exactly 1 -ParameterFilter { $Method -eq "Get" $Uri -like "https://vssps.dev.azure.com/test/_apis/graph/memberships/$GroupDescriptor*" -and From f454a2219e5edd5ffdf5f655e931399901193f36 Mon Sep 17 00:00:00 2001 From: Donovan Brown Date: Tue, 6 Aug 2019 15:51:40 -0500 Subject: [PATCH 6/6] Adding a few examples. --- .docs/Add-VSTeamMembership.md | 10 ++++++++++ .docs/Get-VSTeamGroup.md | 8 ++++++++ .docs/Get-VSTeamMembership.md | 6 ++++-- .docs/Remove-VSTeamMembership.md | 10 ++++++++++ .docs/Test-VSTeamMembership.md | 3 ++- CHANGELOG.md | 8 ++++---- Source/en-US/VSTeam-Help.xml | 4 ++-- docs/Get-VSTeamMembership.md | 6 ++++-- docs/Test-VSTeamMembership.md | 3 ++- 9 files changed, 46 insertions(+), 12 deletions(-) diff --git a/.docs/Add-VSTeamMembership.md b/.docs/Add-VSTeamMembership.md index 33b9eeddf..2140f9c08 100644 --- a/.docs/Add-VSTeamMembership.md +++ b/.docs/Add-VSTeamMembership.md @@ -14,6 +14,16 @@ ## EXAMPLES +### -------------------------- EXAMPLE 1 -------------------------- + +```PowerShell +PS C:\> $user = Get-VSTeamUser | ? DisplayName -eq 'Test User' +PS C:\> $group = Get-VSTeamGroup | ? DisplayName -eq 'Endpoint Administrators' +PS C:\> Add-VSTeamMembership -MemberDescriptor $user.Descriptor -ContainerDescriptor $group.Descriptor +``` + +Adds Test User to the Endpoint Administrators group. + ## PARAMETERS diff --git a/.docs/Get-VSTeamGroup.md b/.docs/Get-VSTeamGroup.md index ea8d0efef..4887500a6 100644 --- a/.docs/Get-VSTeamGroup.md +++ b/.docs/Get-VSTeamGroup.md @@ -14,6 +14,14 @@ ## EXAMPLES +### -------------------------- EXAMPLE 1 -------------------------- + +```PowerShell +PS C:\> $group = Get-VSTeamGroup | ? DisplayName -eq 'Endpoint Administrators' +``` + +Assigns Endpoint Administrators group to $group variable. + ## PARAMETERS diff --git a/.docs/Get-VSTeamMembership.md b/.docs/Get-VSTeamMembership.md index 78f916243..11a212579 100644 --- a/.docs/Get-VSTeamMembership.md +++ b/.docs/Get-VSTeamMembership.md @@ -13,14 +13,17 @@ ## EXAMPLES + ### -------------------------- EXAMPLE 1 -------------------------- ```PowerShell -(Get-VSTeamMembership -MemberDescriptor $user.ID).value | % { Get-VSTeamGroup -Descriptor $_.containerdescriptor } +(Get-VSTeamMembership -MemberDescriptor $user.ID).value | % { Get-VSTeamGroup -Descriptor $_.containerDescriptor } ``` + Get all the groups for a user ### -------------------------- EXAMPLE 2 -------------------------- + ```PowerShell (Get-VSTeamMembership -ContainerDescriptor $group.id).value | % {Get-VSTeamUser -Descriptor $_.memberDescriptor } ``` @@ -55,7 +58,6 @@ Position: 0 ## OUTPUTS - ## NOTES ## RELATED LINKS diff --git a/.docs/Remove-VSTeamMembership.md b/.docs/Remove-VSTeamMembership.md index 0ec9eec38..1399e2e43 100644 --- a/.docs/Remove-VSTeamMembership.md +++ b/.docs/Remove-VSTeamMembership.md @@ -14,6 +14,16 @@ ## EXAMPLES +### -------------------------- EXAMPLE 1 -------------------------- + +```PowerShell +PS C:\> $user = Get-VSTeamUser | ? DisplayName -eq 'Test User' +PS C:\> $group = Get-VSTeamGroup | ? DisplayName -eq 'Endpoint Administrators' +PS C:\> Remove-VSTeamMembership -MemberDescriptor $user.Descriptor -ContainerDescriptor $group.Descriptor +``` + +Removes Test User from the Endpoint Administrators group. + ## PARAMETERS diff --git a/.docs/Test-VSTeamMembership.md b/.docs/Test-VSTeamMembership.md index aa403cd87..5dc960705 100644 --- a/.docs/Test-VSTeamMembership.md +++ b/.docs/Test-VSTeamMembership.md @@ -23,7 +23,8 @@ ## INPUTS ## OUTPUTS -### $True or $False + +### System.Boolean ## NOTES diff --git a/CHANGELOG.md b/CHANGELOG.md index 4fddfca6a..35ce33928 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,10 +30,10 @@ Updated help to refer to Add-VSTeamProfile instead of Set-VSTeamProfile Added support for Get-VSTeamJobRequest. The provider was extended to show the Job Request under the Agent. - Account - - Agent Pools - - Pool1 - - Agent1 - - JobRequest1 + - Agent Pools + - Pool1 + - Agent1 + - JobRequest1 ## 6.2.7 diff --git a/Source/en-US/VSTeam-Help.xml b/Source/en-US/VSTeam-Help.xml index e0aed3ef1..521647033 100644 --- a/Source/en-US/VSTeam-Help.xml +++ b/Source/en-US/VSTeam-Help.xml @@ -9240,7 +9240,7 @@ ID Title Status -------------------------- EXAMPLE 1 -------------------------- - (Get-VSTeamMembership -MemberDescriptor $user.ID).value | % { Get-VSTeamGroup -Descriptor $_.containerdescriptor } + (Get-VSTeamMembership -MemberDescriptor $user.ID).value | % { Get-VSTeamGroup -Descriptor $_.containerDescriptor } Get all the groups for a user @@ -17937,7 +17937,7 @@ PS demo:\> Get-ChildItem - $True or $False + System.Boolean diff --git a/docs/Get-VSTeamMembership.md b/docs/Get-VSTeamMembership.md index 5cfb0750c..92f2b3fef 100644 --- a/docs/Get-VSTeamMembership.md +++ b/docs/Get-VSTeamMembership.md @@ -14,14 +14,17 @@ Gets a memberships for a container or member. Gets a memberships for a container or member. ## EXAMPLES + ### -------------------------- EXAMPLE 1 -------------------------- ```PowerShell -(Get-VSTeamMembership -MemberDescriptor $user.ID).value | % { Get-VSTeamGroup -Descriptor $_.containerdescriptor } +(Get-VSTeamMembership -MemberDescriptor $user.ID).value | % { Get-VSTeamGroup -Descriptor $_.containerDescriptor } ``` + Get all the groups for a user ### -------------------------- EXAMPLE 2 -------------------------- + ```PowerShell (Get-VSTeamMembership -ContainerDescriptor $group.id).value | % {Get-VSTeamUser -Descriptor $_.memberDescriptor } ``` @@ -56,7 +59,6 @@ Position: 0 ## OUTPUTS - ## NOTES ## RELATED LINKS diff --git a/docs/Test-VSTeamMembership.md b/docs/Test-VSTeamMembership.md index 8ae6c247b..d4ac7fc31 100644 --- a/docs/Test-VSTeamMembership.md +++ b/docs/Test-VSTeamMembership.md @@ -42,7 +42,8 @@ Position: 1 ## INPUTS ## OUTPUTS -### $True or $False + +### System.Boolean ## NOTES