diff --git a/CHANGELOG.md b/CHANGELOG.md
index 35ce33928..02d290d85 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,16 @@
# Changelog
+## 6.3.2
+
+Add PSDrive support for memberships
+
+- Memberships
+ - Groups
+ - Group1
+ - Users
+ - User1
+
+
## 6.3.1
Merged [Pull Request](https://github.com/DarqueWarrior/vsteam/pull/178) from [Jim W](https://github.com/Seekatar) which included the following:
diff --git a/Source/Classes/VSTeamAccount.ps1 b/Source/Classes/VSTeamAccount.ps1
index 0bfb6aebc..b7987bd41 100644
--- a/Source/Classes/VSTeamAccount.ps1
+++ b/Source/Classes/VSTeamAccount.ps1
@@ -15,20 +15,28 @@ class VSTeamAccount : SHiPSDirectory {
}
[object[]] GetChildItem() {
- $poolsAndProjects = @(
+ $topLevelFolders = @(
[VSTeamPools]::new('Agent Pools'),
[VSTeamExtensions]::new('Extensions')
- [VSTeamFeeds]::new('Feeds')
)
+ # Don't show directories not supported by the server
+ if (_testFeedSupport) {
+ $topLevelFolders += [VSTeamFeeds]::new('Feeds')
+ }
+
+ if(_testGraphSupport) {
+ $topLevelFolders += [VSTeamPermissions]::new('Permissions')
+ }
+
$items = Get-VSTeamProject | Sort-Object Name
foreach ($item in $items) {
$item.AddTypeName('Team.Provider.Project')
- $poolsAndProjects += $item
+ $topLevelFolders += $item
}
- return $poolsAndProjects
+ return $topLevelFolders
}
[void] hidden AddTypeName(
diff --git a/Source/Classes/VSTeamGroups.ps1 b/Source/Classes/VSTeamGroups.ps1
new file mode 100644
index 000000000..548e35f91
--- /dev/null
+++ b/Source/Classes/VSTeamGroups.ps1
@@ -0,0 +1,29 @@
+using namespace Microsoft.PowerShell.SHiPS
+
+[SHiPSProvider(UseCache = $true)]
+[SHiPSProvider(BuiltinProgress = $false)]
+class VSTeamGroups : VSTeamDirectory {
+
+ # Default constructor
+ VSTeamGroups(
+ [string]$Name
+ ) : base($Name, $null) {
+ $this.AddTypeName('Team.Groups')
+
+ $this.DisplayMode = 'd-r-s-'
+ }
+
+ [object[]] GetChildItem() {
+ $Groups = Get-VSTeamGroup -ErrorAction SilentlyContinue | Sort-Object name
+
+ $objs = @()
+
+ foreach ($Group in $Groups) {
+ $Group.AddTypeName('Team.Provider.Group')
+
+ $objs += $Group
+ }
+
+ return $objs
+ }
+}
\ No newline at end of file
diff --git a/Source/Classes/VSTeamPermissions.ps1 b/Source/Classes/VSTeamPermissions.ps1
new file mode 100644
index 000000000..66226effe
--- /dev/null
+++ b/Source/Classes/VSTeamPermissions.ps1
@@ -0,0 +1,24 @@
+using namespace Microsoft.PowerShell.SHiPS
+
+[SHiPSProvider(UseCache = $true)]
+[SHiPSProvider(BuiltinProgress = $false)]
+class VSTeamPermissions : VSTeamDirectory {
+
+ # Default constructor
+ VSTeamPermissions(
+ [string]$Name
+ ) : base($Name, $null) {
+ $this.AddTypeName('Team.Permissions')
+
+ $this.DisplayMode = 'd-r-s-'
+ }
+
+ [object[]] GetChildItem() {
+ $groupsAndUsers = @(
+ [VSTeamGroups]::new('Groups'),
+ [VSTeamUsers]::new('Users')
+ )
+
+ return $groupsAndUsers
+ }
+}
\ No newline at end of file
diff --git a/Source/Classes/VSTeamUsers.ps1 b/Source/Classes/VSTeamUsers.ps1
new file mode 100644
index 000000000..4517c76a0
--- /dev/null
+++ b/Source/Classes/VSTeamUsers.ps1
@@ -0,0 +1,29 @@
+using namespace Microsoft.PowerShell.SHiPS
+
+[SHiPSProvider(UseCache = $true)]
+[SHiPSProvider(BuiltinProgress = $false)]
+class VSTeamUsers : VSTeamDirectory {
+
+ # Default constructor
+ VSTeamUsers(
+ [string]$Name
+ ) : base($Name, $null) {
+ $this.AddTypeName('Team.Users')
+
+ $this.DisplayMode = 'd-r-s-'
+ }
+
+ [object[]] GetChildItem() {
+ $Users = Get-VSTeamUser -ErrorAction SilentlyContinue | Sort-Object name
+
+ $objs = @()
+
+ foreach ($User in $Users) {
+ $User.AddTypeName('Team.Provider.User')
+
+ $objs += $User
+ }
+
+ return $objs
+ }
+}
\ No newline at end of file
diff --git a/Source/Classes/_classes.json b/Source/Classes/_classes.json
index 4b22f265b..23ab01714 100644
--- a/Source/Classes/_classes.json
+++ b/Source/Classes/_classes.json
@@ -34,6 +34,9 @@
"VSTeamBuildDefinition.ps1",
"VSTeamExtension.ps1",
"VSTeamFeed.ps1",
+ "VSTeamUsers.ps1",
+ "VSTeamGroups.ps1",
+ "VSTeamPermissions.ps1",
"VSTeamProcess.ps1",
"VSTeamRef.ps1",
"VSTeamTeam.ps1",
diff --git a/Source/Private/common.ps1 b/Source/Private/common.ps1
index 41631f63b..b756b75de 100644
--- a/Source/Private/common.ps1
+++ b/Source/Private/common.ps1
@@ -9,18 +9,34 @@ $profilesPath = "$HOME/vsteam_profiles.json"
function _supportsGraph {
_hasAccount
- if (-not [VSTeamVersions]::Graph) {
+ if ($false -eq $(_testGraphSupport)) {
throw 'This account does not support the graph API.'
}
}
+function _testGraphSupport {
+ if (-not [VSTeamVersions]::Graph) {
+ return $false
+ }
+
+ return $true
+}
+
function _supportsFeeds {
_hasAccount
- if (-not [VSTeamVersions]::Packaging) {
+ if ($false -eq $(_testFeedSupport)) {
throw 'This account does not support packages.'
}
}
+function _testFeedSupport {
+ if (-not [VSTeamVersions]::Packaging) {
+ return $false
+ }
+
+ return $true
+}
+
function _supportsSecurityNamespace {
_hasAccount
if (([VSTeamVersions]::Version -ne "VSTS") -and ([VSTeamVersions]::Version -ne "AzD")) {
diff --git a/Source/en-US/about_vsteam_provider.help.txt b/Source/en-US/about_vsteam_provider.help.txt
index 5c290e302..68e8e8b68 100644
--- a/Source/en-US/about_vsteam_provider.help.txt
+++ b/Source/en-US/about_vsteam_provider.help.txt
@@ -11,6 +11,17 @@ SHORT DESCRIPTION
- Agent1
- JobRequest1
- JobRequest2
+ - Extensions
+ - Extension1
+ - Extension2
+ - Feeds
+ - Feed1
+ - Feed2
+ - Memberships
+ - Groups
+ - Group1
+ - Users
+ - User1
- Project1
- Project2
- Builds
@@ -33,10 +44,10 @@ SHORT DESCRIPTION
- Ref2
LONG DESCRIPTION
- You use the New-PSDrive cmdlet to mount a drive to your account.
+ You use the New-PSDrive cmdlet to mount a drive to your account.
You can also use the -Drive parameter of Set-VSTeamAccount to have
- the required command written to the console so you can copy and
+ the required command written to the console so you can copy and
paste the command.
The provider caches the results. To force a round trip to skip the
@@ -49,7 +60,7 @@ EXAMPLES
Get-ChildItem
Set-VSTeamAccount -Profile '[profileName]' -Drive '[driveName]'
-
+
To map a drive run the following command:
New-PSDrive -Name driveName -PSProvider SHiPS -Root 'VSTeam#VSTeamAccount'
diff --git a/Source/formats/Team.Build.TableView.ps1xml b/Source/formats/Team.Build.TableView.ps1xml
index 628c730ad..14a9fa177 100644
--- a/Source/formats/Team.Build.TableView.ps1xml
+++ b/Source/formats/Team.Build.TableView.ps1xml
@@ -1 +1,48 @@
-Team.Build.TableViewTeam.Provider.BuildVSTeamBuildDisplayModenamestatusresultBuildDefinition
+
+
+
+
+ Team.PSDrive.Default.TableView
+
+ Microsoft.PowerShell.SHiPS.SHiPSDirectory
+ Team.Account
+ Team.Pool
+ Team.Queues
+ Team.Pools
+ Team.Provider.Pools
+ Team.Builds
+ Team.BuildDefinitions
+ Team.Releases
+ Team.Repositories
+ Team.Teams
+ Team.Permissions
+ Team.Provider.Group
+ Team.Provider.User
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ DisplayMode
+
+
+ Name
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Source/formats/Team.PSDrive.Default.TableView.ps1xml b/Source/formats/Team.PSDrive.Default.TableView.ps1xml
index 487aa7255..79e3ee4f6 100644
--- a/Source/formats/Team.PSDrive.Default.TableView.ps1xml
+++ b/Source/formats/Team.PSDrive.Default.TableView.ps1xml
@@ -1 +1,48 @@
-Team.PSDrive.Default.TableViewMicrosoft.PowerShell.SHiPS.SHiPSDirectoryTeam.AccountTeam.PoolTeam.QueuesTeam.PoolsTeam.Provider.PoolsTeam.BuildsTeam.BuildDefinitionsTeam.ReleasesTeam.RepositoriesTeam.TeamsDisplayModeName
+
+
+
+
+ Team.PSDrive.Default.TableView
+
+ Microsoft.PowerShell.SHiPS.SHiPSDirectory
+ Team.Account
+ Team.Pool
+ Team.Queues
+ Team.Pools
+ Team.Provider.Pools
+ Team.Builds
+ Team.BuildDefinitions
+ Team.Releases
+ Team.Repositories
+ Team.Teams
+ Team.Permissions
+ Team.Groups
+ Team.Users
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ DisplayMode
+
+
+ Name
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/unit/test/teamspsdrive.Tests.ps1 b/unit/test/teamspsdrive.Tests.ps1
index 2853497ab..e3ed06419 100644
--- a/unit/test/teamspsdrive.Tests.ps1
+++ b/unit/test/teamspsdrive.Tests.ps1
@@ -110,7 +110,7 @@ InModuleScope VSTeam {
}
}
}
-
+
Describe 'VSTS Build Definition' {
# Mock the call to Get-Projects by the dynamic parameter for ProjectName
Mock Invoke-RestMethod { return @() } -ParameterFilter {
@@ -209,7 +209,8 @@ InModuleScope VSTeam {
# Skip 0 because that will be Agent Pools
# Skip 1 because that will be Extensions
# Skip 2 because that will be Feeds
- $project = $account.GetChildItem()[3]
+ # Skip 3 because that will be Permissions
+ $project = $account.GetChildItem()[4]
It 'Should return projects' {
$project | Should Not Be $null
@@ -538,5 +539,29 @@ InModuleScope VSTeam {
$team | Should Not Be $null
}
}
+
+ Context 'Permissions' {
+ Set-StrictMode -Version Latest
+ Mock Get-VSTeamGroup { return [VSTeamGroup]::new(@{})}
+ Mock Get-VSTeamUser { return [VSTeamGroup]::new(@{})}
+
+ $permissions = [VSTeamPermissions]::new('Permissions')
+
+ It 'Should create Permissions' {
+ $permissions | Should Not Be $null
+ $permissions.GetChildItem().Count | Should Be 2
+ }
+
+ $groups = $permissions.GetChildItem()[0]
+ $users = $permissions.GetChildItem()[1]
+
+ It 'Should return groups' {
+ $groups | Should Not Be $null
+ }
+
+ It 'Should return users' {
+ $users | Should Not Be $null
+ }
+ }
}
}
\ No newline at end of file