Skip to content

Commit

Permalink
✔️ Add function Remove-GuacUserGroupMember
Browse files Browse the repository at this point in the history
  • Loading branch information
UpperM committed Aug 24, 2020
1 parent 9408a93 commit 57d6c0e
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Documentation/UserGroups.md
@@ -1,4 +1,4 @@
# UserGroups
# UserGroups

- [Add-GuacUserGroupConnection](#add-guacusergroupconnection)
- [Add-GuacUserGroupMember](#add-guacusergroupmember)
Expand Down
61 changes: 61 additions & 0 deletions PSGuacamole/Public/UserGroups/Remove-GuacUserGroupMember.ps1
@@ -0,0 +1,61 @@
Function Remove-GuacUserGroupMember()
{
param(
[ValidateNotNullOrEmpty()]
[Parameter(
Position = 0,
Mandatory = $true
)]
[System.String]
$DataSource,

[ValidateNotNullOrEmpty()]
[Parameter(
Position = 1,
Mandatory = $true
)]
[System.String]
$Member,

[ValidateNotNullOrEmpty()]
[Parameter(
Position = 2,
Mandatory = $true
)]
[System.String]
$Group
)

begin
{
$Parameters = @{
"op"= "remove"
"path"= "/"
"value"= "$($Member)"
} | ConvertTo-Json
$Body = "[$($Parameters)]"
$Uri = "$Server/api/session/data/$($DataSource)/userGroups/$Group/memberUsers/?token=$($Token)"
}
process
{

try
{
$RestCall = Invoke-RestMethod -Method PATCH -Uri $Uri -ContentType 'application/json' -Body $Body
}
catch
{
Write-Warning $_.Exception.Message
return $False
}

}
end
{
return $RestCall
}
}

<#
Remove-GuacUserGroupMember -DataSource mysql -Member "john.doe" -Group "test"
#>

0 comments on commit 57d6c0e

Please sign in to comment.