IAdmPropertyPatternContainer
The IAdmPropertyPatternContainer interface represents the container where property patterns are stored. The container is located at the Adaxes Configuration Server (AD LDS).
Inheritance: IAdmTop
Methods
-
Method
-
Description
-
GetEffectivePropertyPatterns()
-
Returns an array of GUIDs of the property patterns effective for the given object.
-
GetEffectivePropertyPatternsEx()
-
Returns an array of GUIDs of the property patterns effective for multiple objects.
Details
GetEffectivePropertyPatterns()
Returns an array of GUIDs of the property patterns effective for the given object.
Byte[][] GetEffectivePropertyPatterns(IAdmTop targetObject)
Parameters
The targetObject parameter specifies the directory object to get effective property patterns for.
Return value
Each GUID is represented as an array of 16 bytes (Byte[]), and the method returns an array of arrays of byte (Byte[][]).
Using the GUIDs, you can bind to the property patterns. For more information on how to use GUIDs to bind to directory objects, see Binding to ADSI objects.
Examples
The following code sample outputs names and descriptions of property patterns effective for a user.
- PowerShell
-
[Reflection.Assembly]::LoadWithPartialName("Softerra.Adaxes.Adsi") # Connect to the Adaxes service $ns = New-Object "Softerra.Adaxes.Adsi.AdmNamespace" $service = $ns.GetServiceDirectly("localhost") # Bind to the 'Property Patterns' container $propertyPatternsPath = $service.Backend.GetConfigurationContainerPath("PropertyPatterns") $propertyPatternsContainer = $service.OpenObject($propertyPatternsPath, $null, $null, 0) # Bind to the user $userDN = "CN=John Smith,CN=Users,DC=domain,DC=com" $user = $service.OpenObject("Adaxes://$userDN", $null, $null, 0) # Get effective property patterns $propertyPatternsGuidsBytes = $propertyPatternsContainer.GetEffectivePropertyPatterns($user) Write-Host "Property patterns effective for the user:" foreach ($guidBytes in $propertyPatternsGuidsBytes) { # Bind to the property pattern $guid = [Guid]$guidBytes $patternPath = "Adaxes://<GUID=$guid>" $pattern = $service.OpenObject($patternPath, $null, $null, 0) # Output information about the property pattern Write-Host "`tName:" $pattern.PatternName Write-Host "`tDescription:" $pattern.Description Write-Host }
- C#
-
using System; using Softerra.Adaxes.Adsi; using Softerra.Adaxes.Interop.Adsi; using Softerra.Adaxes.Interop.Adsi.PersistentObjects; using Softerra.Adaxes.Interop.Adsi.PropertyPatterns; class Program { static void Main(string[] args) { // Connect to the Adaxes service AdmNamespace ns = new AdmNamespace(); IAdmService2 service = (IAdmService2)ns.GetServiceDirectly("localhost"); // Bind to the 'Property Patterns' container string propertyPatternsPath = service.Backend.GetConfigurationContainerPath( "PropertyPatterns"); IAdmPropertyPatternContainer propertyPatternsContainer = (IAdmPropertyPatternContainer)service.OpenObject(propertyPatternsPath, null, null, 0); // Bind to the user const string userPath = "Adaxes://CN=John Smith,CN=Users,DC=domain,DC=com"; IAdmTop user = (IAdmTop)service.OpenObject(userPath, null, null, 0); // Get effective property patterns object[] propertyPatternsGuidsBytes = (object[])propertyPatternsContainer.GetEffectivePropertyPatterns(user); Console.WriteLine("Property patterns effective for the user:"); foreach (byte[] guidBytes in propertyPatternsGuidsBytes) { //Bind to the property pattern string guid = new Guid(guidBytes).ToString("B"); string patternPath = string.Format("Adaxes://<GUID={0}>", guid); IAdmPropertyPattern pattern = (IAdmPropertyPattern)service.OpenObject( patternPath, null, null, 0); // Output information about the property pattern Console.WriteLine("\tName: " + pattern.PatternName); Console.WriteLine("\tDescription: " + pattern.Description); Console.WriteLine(); } } }
GetEffectivePropertyPatternsEx()
Returns an array of GUIDs of the property patterns effective for multiple objects. The method returns only property patterns effective for all the given objects. If a property pattern is not effective for at least one of the objects, the property pattern will not be returned.
Byte[][] GetEffectivePropertyPatternsEx(string[] targetObjectPaths)
Parameters
The targetObjectPaths parameter specifies an array of ADS paths of the objects to get effective property patterns for.
Return value
Each GUID is represented as an array of 16 bytes (Byte[]), and the method returns an array of arrays of byte (Byte[][]).
Using the GUIDs, you can bind to the property patterns. For more information on how to use GUIDs to bind to directory objects, see Binding to ADSI objects.
Examples
The following code sample outputs names and descriptions of property patterns effective for multiple users.
- PowerShell
-
[Reflection.Assembly]::LoadWithPartialName("Softerra.Adaxes.Adsi") # Connect to the Adaxes service $ns = New-Object "Softerra.Adaxes.Adsi.AdmNamespace" $service = $ns.GetServiceDirectly("localhost") # Bind to the 'Property Patterns' container $propertyPatternsPath = $service.Backend.GetConfigurationContainerPath("PropertyPatterns") $propertyPatternsContainer = $service.OpenObject($propertyPatternsPath, $null, $null, 0) # User paths $user1 = "Adaxes://CN=John Smith,CN=Users,DC=company,DC=com" $user2 = "Adaxes://CN=Bob Jones,CN=Users,DC=company,DC=com" $userPaths = @($user1, $user2) # Get effective property patterns $propertyPatternsGuidsBytes = $propertyPatternsContainer.GetEffectivePropertyPatternsEx($userPaths) Write-Host "Property patterns effective for the users:" foreach ($guidBytes in $propertyPatternsGuidsBytes) { # Bint to the property pattern $guid = [Guid]$guidBytes $patternPath = "Adaxes://<GUID=$guid>" $pattern = $service.OpenObject($patternPath, $null, $null, 0) # Output information about the property pattern Write-Host "`tName:" $pattern.PatternName Write-Host "`tDescription:" $pattern.Description Write-Host }
- C#
-
using System; using Softerra.Adaxes.Adsi; using Softerra.Adaxes.Interop.Adsi.PersistentObjects; using Softerra.Adaxes.Interop.Adsi.PropertyPatterns; class Program { static void Main(string[] args) { // Connect to the Adaxes service AdmNamespace ns = new AdmNamespace(); IAdmService2 service = (IAdmService2)ns.GetServiceDirectly("localhost"); // Bind to the 'Property Patterns' container string propertyPatternsPath = service.Backend.GetConfigurationContainerPath( "PropertyPatterns"); IAdmPropertyPatternContainer propertyPatternsContainer = (IAdmPropertyPatternContainer)service.OpenObject(propertyPatternsPath, null, null, 0); // User paths const string user1 = "Adaxes://CN=John Smith,CN=Users,DC=company,DC=com"; const string user2 = "Adaxes://CN=Bob Jones,CN=Users,DC=company,DC=com"; string[] userPaths = { user1, user2 }; // Get effective property patterns object[] propertyPatternsGuidsBytes = (object[])propertyPatternsContainer.GetEffectivePropertyPatternsEx(userPaths); Console.WriteLine("Property patterns effective for the user:"); foreach (byte[] guidBytes in propertyPatternsGuidsBytes) { // Bind to the property pattern string guid = new Guid(guidBytes).ToString("B"); string patternPath = string.Format("Adaxes://<GUID={0}>", guid); IAdmPropertyPattern pattern = (IAdmPropertyPattern)service.OpenObject( patternPath, null, null, 0); // Output information about the property pattern Console.WriteLine("\tName: " + pattern.PatternName); Console.WriteLine("\tDescription: " + pattern.Description); Console.WriteLine(); } } }
Requirements
Minimum required version: 2009.1