Skip to content

IAdmPropertyPatternContainer

The IAdmPropertyPatternContainer interface represents the container where Property Patterns are stored. The container is located at the Adaxes Configuration Server (AD LDS).

Inheritance: The IAdmPropertyPatternContainer interface inherits from the IAdmTop interface.

Methods

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 AD objects, see Binding to ADSI objects.

Examples

The following code sample outputs names and descriptions of Property Patterns effective for a user.

[Reflection.Assembly]::LoadWithPartialName("Softerra.Adaxes.Adsi")

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

# Bind to the 'Property Patterns' container
$propertyPatternsPath = $admService.Backend.GetConfigurationContainerPath("PropertyPatterns")
$propertyPatternsContainer = $admService.OpenObject($propertyPatternsPath, $NULL, $NULL, 0)

# Bind to the user
$userDN = "CN=John Smith,CN=Users,DC=domain,DC=com"
$user = $admService.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 = $admService.OpenObject($patternPath, $NULL, $NULL, 0)

    # Output information about the Property Pattern
    Write-Host "`tName:" $pattern.PatternName
    Write-Host "`tDescription:" $pattern.Description
    Write-Host
}
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 adsNS = new AdmNamespace();
         IAdmService2 admService = (IAdmService2)adsNS.GetServiceDirectly("localhost");

         // Bind to the 'Property Patterns' container
         String propertyPatternsPath = admService.Backend.GetConfigurationContainerPath(
             "PropertyPatterns");
         IAdmPropertyPatternContainer propertyPatternsContainer =
             (IAdmPropertyPatternContainer)admService.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)admService.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)admService.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 AD objects, see Binding to ADSI objects.

Examples

The following code sample outputs names and descriptions of Property Patterns effective for multiple users.

[Reflection.Assembly]::LoadWithPartialName("Softerra.Adaxes.Adsi")

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

# Bind to the 'Property Patterns' container
$propertyPatternsPath = $admService.Backend.GetConfigurationContainerPath("PropertyPatterns")
$propertyPatternsContainer = $admService.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 = $admService.OpenObject($patternPath, $NULL, $NULL, 0)

    # Output information about the Property Pattern
    Write-Host "`tName:" $pattern.PatternName
    Write-Host "`tDescription:" $pattern.Description
    Write-Host
}
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 adsNS = new AdmNamespace();
        IAdmService2 admService = (IAdmService2)adsNS.GetServiceDirectly("localhost");

        // Bind to the 'Property Patterns' container
        String propertyPatternsPath = admService.Backend.GetConfigurationContainerPath(
            "PropertyPatterns");
        IAdmPropertyPatternContainer propertyPatternsContainer =
            (IAdmPropertyPatternContainer)admService.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)admService.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

See also