IAdmBusinessRule
The IAdmBusinessRule interface represents a business rule, custom command, or scheduled task.
Inheritance: IAdmTop
Methods
-
Method
-
Description
-
IsInScope()
-
Checks whether the given directory object is affected by the business rule.
Properties
-
Property
-
Description
-
RuleName
-
Gets the name of the business rule.
-
Description
-
Gets or sets an optional description for the business rule.
-
ObjectType
-
Gets or sets the type of directory objects to which the business rule is applied.
-
OperationType
-
Gets or sets the type of the operation that will trigger the business rule.
-
ExecutionMoment
-
Gets or sets a value that indicates when the business rule is to be executed.
-
ConditionedActions
-
Gets conditions and actions defined for the business rule.
-
ActivityScopeItems
-
Gets a collection of scope items that represent the activity scope of the business rule.
-
Disabled
-
Gets or sets a value that indicates whether the business rule is disabled.
Details
IsInScope()
Checks whether the given directory object is affected by the business rule.
Boolean IsInScope(IAdmTop object)
Parameters
The object parameter is the directory object to be checked.
Examples
The following code sample checks whether a user is affected by a business rule.
- PowerShell
-
[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 user $userDN = "CN=John Smith,CN=Users,DC=domain,DC=com" $user = $admService.OpenObject("Adaxes://$userDN", $NULL, $NULL, 0) # Bind to the business rule $businessRulesPath = $admService.Backend.GetConfigurationContainerPath( "BusinessRules") $businessRulesPathObj = New-Object "Softerra.Adaxes.Adsi.AdsPath" ` $businessRulesPath $myRuleAdsPath = $businessRulesPathObj.CreateChildPath( ` "CN=My Rule") $rule = $admService.OpenObject($myRuleAdsPath, $NULL, $NULL, 0) if ($rule.IsInScope($user)) { Write-Host "The business rule affects" $user.Get("name") } else { Write-Host "The business rule does not affect" $user.Get("name") }
- C#
-
using System; using Softerra.Adaxes.Adsi; using Softerra.Adaxes.Interop.Adsi; using Softerra.Adaxes.Interop.Adsi.BusinessRules; using Softerra.Adaxes.Interop.Adsi.PersistentObjects; class Program { static void Main(string[] args) { // Connect to the Adaxes service AdmNamespace adsNS = new AdmNamespace(); IAdmService admService = adsNS.GetServiceDirectly("localhost"); // 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); // Bind to the business rule String businessRulesPath = admService.Backend.GetConfigurationContainerPath( "BusinessRules"); AdsPath businessRulesPathObj = new AdsPath(businessRulesPath); AdsPath myRuleAdsPath = businessRulesPathObj.CreateChildPath("CN=My Rule"); IAdmBusinessRule rule = (IAdmBusinessRule) admService.OpenObject(myRuleAdsPath.ToString(), null, null, 0); if (rule.IsInScope(user)) { Console.WriteLine("The business rule affects {0}", user.Get("name")); } else { Console.WriteLine("The business rule does not affect {0}", user.Get("name")); } } }
RuleName
Gets the name of the business rule.
- Type:
- String
- Access:
- Read-only
Description
Gets or sets an optional description for the business rule.
- Type:
- String
- Access:
- Read/Write
ObjectType
Gets or sets the type of directory objects to which the business rule is applied. The property must be set to a string that contains the name of an object class as defined in the Active Directory schema (e.g. "user", "group", "computer", "organizationalUnit", etc.).
- Type:
- String
- Access:
- Read/Write
Remarks
To specify an additional object type, use IAdmBusinessRule2::AdditionalObjectType.
OperationType
Gets or sets the type of the operation that will trigger the business rule. List of possible values.
- Type:
- String
- Access:
- Read/Write
ExecutionMoment
Gets or sets a value that indicates when the business rule is to be executed. A business rule can be executed before or after the triggering operation.
- Type:
- ADM_BUSINESSRULEEXECMOMENT_ENUM
- Access:
- Read/Write
ConditionedActions
Gets conditions and actions defined for the business rule. Each item in the collection is a set of actions and conditions. A set of actions and conditions is represented by the IAdmBusinessRuleConditionedActions interface.
- Type:
- IAdmCollection
- Access:
- Read-only
ActivityScopeItems
Gets a collection of scope items that represent the activity scope of the business rule. A scope item is represented by the IAdmActivityScopeItem interface.
- Type:
- IAdmCollection
- Access:
- Read-only
Disabled
Gets or sets a value that indicates whether the business rule is disabled.
- Type:
- Boolean
- Access:
- Read/Write
Requirements
Minimum required version: 2009.1