IAdmActivityScopeItem2

The IAdmActivityScopeItem2 interface extends the IAdmActivityScopeItem interface.

Inheritance: IAdmActivityScopeItem

Methods

  • Method

  • Description

  • IsEffectiveForEx()

  • Checks whether the activity scope item includes the given directory object.

Details

IsEffectiveForEx()

Checks whether the activity scope item includes the given directory object.

bool IsEffectiveForEx(IAdmTop targetObject, string holderObjectType)

Parameters

  • targetObject - Specifies the directory object to check whether it is included/excluded by the activity scope item.
  • holderObjectType - Specifies the object class of the Adaxes configuration object for which the activity scope item is defined (e.g. adm-BusinessRule for business rules, adm-PropertyPattern for property patterns, etc.). For more information on Adaxes configuration object types, see Adaxes-specific types.

Remarks

The IsEffectiveForEx method substitutes the IAdmActivityScopeItem::IsEffectiveFor method. Unlike the IsEffectiveFor method, this method correctly handles situations where the assignment scope of a security role includes a business unit, members of which depend on the logged in user.

Examples

The following code sample outputs the number of activity scope items that include or exclude a user from the activity scope of a property pattern.

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

$patternName = "My Pattern"
$userDN = "CN=John Smith,CN=Users,DC=domain,DC=com"

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

# Build ADS path to the property pattern
$propertyPatternsPath = $service.Backend.GetConfigurationContainerPath("PropertyPatterns")
$propertyPatternsPathObj = New-Object "Softerra.Adaxes.Adsi.AdsPath" $propertyPatternsPath
$propertyPatternPath = $propertyPatternsPathObj.CreateChildPath("CN=$patternName")

# Bind to the property pattern
$pattern = $service.OpenObject($propertyPatternPath, $null, $null, 0)

# Bind to the user
$user = $service.OpenObject("Adaxes://$userDN", $null, $null, 0)

# Iterate through activity scope items
$itemCount = 0
foreach ($item in $pattern.ActivityScopeItems)
{
    if ($item.IsEffectiveForEx($user, "adm-PropertyPattern"))
    {
        $itemCount++
    }
}
Write-Host "The user is included into $itemCount activity scope item(s)"
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)
    {
        const string userPath = "Adaxes://CN=John Smith,CN=Users,DC=domain,DC=com";
        const string patternName = "My Pattern";

        // Connect to the Adaxes service
        AdmNamespace ns = new AdmNamespace();
        IAdmService service = ns.GetServiceDirectly("localhost");

        // Build ADS path to the property pattern
        string propertyPatternsPath = service.Backend.GetConfigurationContainerPath(
            "PropertyPatterns");
        AdsPath propertyPatternsPathObj = new AdsPath(propertyPatternsPath);
        AdsPath propertyPatternPath = propertyPatternsPathObj.CreateChildPath(
            "CN=" + patternName);

        // Bind to the property pattern
        IAdmPropertyPattern pattern = (IAdmPropertyPattern)service.OpenObject(
            propertyPatternPath.ToString(), null, null, 0);

        // Bind to the user
        IAdmTop user = (IAdmTop)service.OpenObject(userPath, null, null, 0);

        // Iterate through activity scope items
        int itemCount = 0;
        foreach (IAdmActivityScopeItem2 item in pattern.ActivityScopeItems)
        {
            if (item.IsEffectiveForEx(user, "adm-PropertyPattern"))
            {
                itemCount++;
            }
        }

        Console.WriteLine("The user is included into " + itemCount + " activity scope item(s)");
    }
}

Requirements

Minimum required version: 2014.1

See also