We use cookies to improve your experience.
By your continued use of this site you accept such use.
For more details please see our privacy policy and cookies policy.

Script repository

Specify access control for Web interface

July 04, 2023 Views: 918

The script sets a user or group as the only allowed access control trustee for a Web interface. Execute the script in Windows PowerShell on the computer where Adaxes service is installed. When prompted, specify the credentials of the Adaxes service account (specified during Adaxes installation).

Parameters:

  • $webApplicationName - Specifies the name of the Web interface whose configuration will be updated.
  • $trusteeDN - Specifies the distinguished name (DN) of a user or security group that will be the only allowed access control trustee for a Web interface. For infomration on how to get the DN of a directory object, see Get the DN of a directory object.
  • $serviceHost - Specifies the host name of the computer where Adaxes service is installed.
Edit Remove
PowerShell
[Reflection.Assembly]::LoadWithPartialName("Softerra.Adaxes.Adsi")

$webApplicationName = "HelpDesk" # TODO: modify me
$serviceHost = "localhost" # TODO: modify me
$trusteeDN = "CN=John Smith,OU=Users,DC=company,DC=com" # TODO: modify me

# Connect to the Adaxes service
$ns = New-Object "Softerra.Adaxes.Adsi.AdmNamespace"
$service = $ns.GetServiceDirectly($serviceHost)

# Prompt for credentials.
$credential = Get-Credential

# Get trustee Guid
$trustee = $service.OpenObject("Adaxes://$trusteeDN", $credential.UserName, $credential.GetNetworkCredential().Password, 0)
$trusteeGuid = [Guid]$trustee.Get("objectGuid")

# Get WebUI configuration
$webuiConfigPath = $service.Backend.GetConfigurationContainerPath("WebUIConfigurationContainer")
$webuiConfigContainer = $service.OpenObject($webuiConfigPath, $credential.UserName, $credential.GetNetworkCredential().Password, 0)
$config = $webuiConfigContainer.GetConfig($webApplicationName)

# Update accessControlForUsers
$json = '{"accessControlForUsers": {"type": 1, "allowedSpecificItems": [{"referenceType": 0, "Key": "' + $trusteeGuid + '"}]}}'
$config.FromJson('{elements: ["accessControlForUsers"]}', $json)
Comments 0
Leave a comment
Loading...

Got questions?

Support Questions & Answers