Script Repository


Specify access control for Web interface

February 25, 2021
168

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:

  • $webUIConfigurationName - 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.
Edit Remove
PowerShell
[Reflection.Assembly]::LoadWithPartialName("Softerra.Adaxes.Adsi")

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

# Connect to the Adaxes service
$admNS = New-Object "Softerra.Adaxes.Adsi.AdmNamespace"
$admService = $admNS.GetServiceDirectly("localhost")

# Prompt for service account credentials
$credential = Get-Credential

# Get Web Interface configuration
$webuiConfigContainerPath = $admService.Backend.GetConfigurationContainerPath("WebUIConfigurationContainer")
$webuiConfigContainer = $admService.OpenObject($webuiConfigContainerPath, $credential.Username, $credential.GetNetworkCredential().Password, 0)
$configuration = $webuiConfigContainer.GetConfiguration($webUIConfigurationName)

# Set Access Control
$accessControlForUsers = $configuration.AccessControlForUsers
$accessControlForUsers.AccessControlType = "ADM_WEBUI_ACCESSCONTROLTYPE_ALLOWSPECIFIC"
$objReference = New-Object "Softerra.Adaxes.Adsi.AdmObjectReference"
$objReference.ObjectDN = $trusteeDN
$accessControlForUsers.AllowedSpecificItems = @($objReference)
$configuration.AccessControlForUsers = $accessControlForUsers

# Save the changes
$configuration.SetInfo()

Comments ( 0 )
No results found.
Leave a comment