Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagephp
titleSample Attribute Assembly
linenumberstrue
public function assemblePluginAttributes($configuredAttributes, $provisioningData) {
  $attrs = array();
  
  foreach($configuredAttributes as $attr => $cfg) {
    switch($attr) {
      case 'erpNumber':
        $attrs[$attr] = array();
        foreach($provisioningData['Identifier'] as $m) {
          if(isset($m['type'])
             && $m['type'] == $cfg['type']
             && $m['status'] == StatusEnum::Active) {
            $attrs[$attr] = $m['identifier'];
            break;
          }
        }
        break;
      case 'testDescription':
        $attrs[$attr] = "This is a test description";
        break;
      // else we don't know what this attribute is
    }
  }
  
  return $attrs;
} 
Warning
titleOnly Return Configured Attributes

assemblePluginAttributes() is expected to return an array whose keys correspond to the keys of $configuredAttributes. Any keys returned that are not present in $configuredAttributes will be ignored by the LDAP Provisioner when constructing the LDAP record.