Skip to content

rule ref

Ryan Newington edited this page Jun 6, 2016 · 1 revision

<rule-ref> element

A rule or rule group only needs to be defined once to be able to be reused in another rule group. The <rule-ref> element is used to refer to a previously defined rule or rule group using its ID.

XML Attribute Description Allowed Values
rule-id The unique ID of the rule being referenced Any ID defined an existing rule or rule-group object

Example

<rule-group id="AccountNameIsPresentAndGidLessThan500" operator="And">
    <rule xsi:type="sshma:rule-AttributePresenceRule" id="AccountNameIsPresent" attribute="accountName" operator="IsPresent"/>
    <rule xsi:type="sshma:rule-SingleValuedAttributeValueRule" id="GidLessThan500" attribute="gid" operator="LessThan" value="500"/>
</rule-group>

<rule-group id="RuleRefExample" operator="And">
    <rule-ref rule-id="AccountNameIsPresentAndGidLessThan500"/>
    <rule xsi:type="sshma:rule-AttributeChangeRule" id="groupAccountNameModified" attribute="accountName" triggers="Add,Update"/>
</rule-group>

The example above re-uses the AccountNameIsPresentAndGidLessThan500 group in the RuleRefExample group, saving from having to re-write the rules out again.