Delete Host Folder Permissions ​
DELETE /userapi/hostfolderpermissions
Deleting a permission on a Host Folder record is possible by submitting a 'DELETE' HTTP Verb to the API. When the permissions are deleted, you will be returned a Http Status Code of 204 - NoContent. Deleting a Host Folder, does not delete any host records from within Passwordstate - it will just remove them from the Host Folder view.
The user executing the API script must be given access to the following:
- On the screen Administration -> Feature Access -> Hosts tab : 'Specify which users are allowed to have access to the main Hosts Menu'
- On the screen Administration -> Feature Access -> Hosts tab : 'Specify which users are allowed to add/edit/delete Folders within the Hosts Menu, as well as manage permissions on these Folders'
- The user must also have access to the Host Folder itself.
Powershell
#JSON data for the object
$Body = @{
FolderID = "12345"
ApplyPermissionsForUserID = "domain\username"
}
$jsonData = $Body | ConvertTo-Json
$PasswordstateURL = 'https://passwordstate/userapi'
$result = Invoke-Restmethod -Method Delete -Uri $PasswordstateURL'/hostfolderpermissions' -ContentType "application/json" -Body $jsonData -Header @{ "UserID" = "<UserID>" ; "APIKey" = "<APIKey>" }| Heading | Data Type | Description |
|---|---|---|
| FolderID | Integer | Unique identifier for the Host Folder record. Created automatically at the time the Host Folder was added. |
| FolderName | String | The name of the Host Folder |
| ApplyPermissionsForUserID | String (100) | The UserID you wish to apply permissions for |
| ApplyPermissionsForSecurityGroupID | Integer | The SecurityGroupID you wish to apply permissions for. You can only specify SecurityGroupID or SecurityGroupName, not both in the same call. |
| ApplyPermissionsForSecurityGroupName | String (NA) | The Security Group Name you wish to apply permissions for You can only specify SecurityGroupID or SecurityGroupName, not both in the same call. |
Special Note: If you specify the value of 0 for ApplyPermissionsForUserID and ApplyPermissionsForSecurityGroupID, then All Users and Security Groups will be deleted access. Equivalent to "All Users and Security Groups" you see in the UI.