Sample Attachment Configuration Rule: Contractor Work Authorization Form

The sample attachment configuration rule shown below enforces a requirement that any time access is requested for a contractor identity, a Contractor Authorization Form must be attached to the request.

Copy
Sample Attachment Configuration Rule
 <?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE sailpoint PUBLIC "sailpoint.dtd" "sailpoint.dtd">
<sailpoint>
<Rule language="beanshell" name="Contractor Work Auth Rule" type="AttachmentConfig">
    <Description>Returns configs for contractor work authorization.</Description>
    <Signature returnType="java.util.List">
      <Inputs>
        <Argument name="log">
          <Description>
          </Description>
        </Argument>
        <Argument name="context">
          <Description>
          </Description>
        </Argument>
        <Argument name="requester" type="sailpoint.object.Identity">
          <Description>
          </Description>
        </Argument>
        <Argument name="requestee" type="sailpoint.object.Identity">
          <Description>
          </Description>
        </Argument>
        <Argument name="requestedItem" type="sailpoint.object.SailPointObject">
          <Description>
          </Description>
        </Argument>
        <Argument name="action" type="java.lang.String">
          <Description>
          </Description>
        </Argument>
      </Inputs>
      <Returns>
        <Argument name="configList">
          <Description>
          </Description>
        </Argument>
      </Returns>
    </Signature>
    <Source>
      import sailpoint.object.*;
      import java.util.*;
      import sailpoint.service.*;
      import sailpoint.tools.Util;

      // Result is always a list of AttachmentConfigDTOs. The list may be empty but shouldn't be null.
      List result = new ArrayList();

      if (requestee != null) {
          String employeeType = requestee.getType();
          if (Util.nullSafeEq(employeeType, "contractor")  && Util.nullSafeEq(action, "add")) {
              result.add(new AttachmentConfigDTO(true, "Please attach signed work authorization form."));
          }
      }    

      return result;
    </Source>
  </Rule>
  </sailpoint>

The following sections explain some specific areas of the rule's elements and BeanShell code: