Add Host Folder Permissions ​
POST /userapi/hostfolderpermissions
Permissions are required on Host Folders, so users can see any nested Host Folders, or nested Host records - to be used in conjunction with the Remote Session Launcher features in Passwordstate.
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'
Adding permissions can be achieved as per the example below, using the following parameter descriptions:
Powershell
#JSON data for the object
$Body = @{
FolderID = "12345"
ApplyPermissionsForUserID = "domain\username"
}
$jsonData = $Body | ConvertTo-Json
$PasswordstateURL = 'https://passwordstate/userapi'
$result = Invoke-Restmethod -Method Post -Uri $PasswordstateURL'/hostfolderpermissions' -ContentType "application/json" -Body $jsonData -Header @{ "UserID" = "<UserID>" ; "APIKey" = "<APIKey>" }
Write-Output $result| 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 granted access. Equivalent to "All Users and Security Groups" you see in the UI.
Json
# Response
HTTP/1.1 200
[
{
"FolderID":"12345",
"FolderName":"Microsoft Database Servers",
"ApplyPermissionsForUserID":"domain\\username",
"ApplyPermissionsForSecurityGroupID":"",
"ApplyPermissionsForSecurityGroupName":""
}
]