Skip to content

IAdmActivityScopeItem2

The IAdmActivityScopeItem2 interface extends the IAdmActivityScopeItem interface.

Inheritance: The IAdmActivityScopeItem2 interface inherits from the IAdmActivityScopeItem interface.

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.

Boolean 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.

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

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

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

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

# Bind to the Property Pattern
$pattern = $admService.OpenObject($propertyPatternPath, $NULL, $NULL, 0)

# Bind to the user
$user = $admService.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)"
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 adsNS = new AdmNamespace();
        IAdmService admService = adsNS.GetServiceDirectly("localhost");

        // Build ADS path to the Property Pattern
        String propertyPatternsPath = admService.Backend.GetConfigurationContainerPath(
            "PropertyPatterns");
        AdsPath propertyPatternsPathObj = new AdsPath(propertyPatternsPath);
        AdsPath propertyPatternPath = propertyPatternsPathObj.CreateChildPath(
            "CN=" + patternName);

        // Bind to the Property Pattern
        IAdmPropertyPattern pattern = (IAdmPropertyPattern)admService.OpenObject(
            propertyPatternPath.ToString(), null, null, 0);

        // Bind to the user
        IAdmTop user = (IAdmTop)admService.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