Versions Compared

Key

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

...

Code Block
languagephp
titleExample Schema Defition
public $attributes = array(
  'testPerson' => array(
    'objectclass' => array(
      'required'    => true
    ),
    'attributes' => array(
      'testDescription' => array(
        'required'    => true,
        'multiple'    => false
      ),
      'erpNumber' => array(
        'required'     => false,
        'multiple'     => false,
        'extendedtype' => 'identifier_types',
        'defaulttype'  => 'employeenumber'
      )
    )
  )
);

 

assemblePluginAttributes()

When the LDAP Provisioner is assembling an LDAP record, it will call the plugin's assemblePluginAttributes to do the work necessary to build the attributes for the plugin's schema. This function is passed an array of configured attributes and an array of provisioning data, and is expected to return an array of attributes.

The return array is keyed on the attribute name, with the attribute value being one of

  • A simple string, for single valued attributes
  • An array of strings, for multi valued attributes
  • An empty array, if there is no value for the attribute (do not set the attribute to null), even if the attribute would otherwise be single valued

 

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;
}