Add Host Folder Permissions ​
POST /api/hostfolderpermissions
To add permissions to a Host Folder record, you use the Hosts API Key. 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.
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/api'
$result = Invoke-Restmethod -Method Post -Uri $PasswordstateURL'/hostfolderpermissions' -ContentType "application/json" -Body $jsonData -Header @{ "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. |
| APIKey | String (NA) | This can either be specified in the HTTP Header, or within the POST Body |
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":"",
"APIKey":"Redacted"
}
]