/** * Returns meta data that is interpreted by parent class * * @return array array with meta data */ function get_metaData() { $return = array(); // manages host accounts $return["account_types"] = array("host"); // upload fields $return['upload_columns'] = array( array( 'name' => 'ieee802Device_mac', 'description' => _('MAC address'), 'help' => 'mac', 'example' => '00:01:02:DE:EF:18' ) ); return $return; } |
/** * In this function the LDAP account is built up. * * @param array $rawAccounts list of hash arrays (name => value) from user input * @param array $partialAccounts list of hash arrays (name => value) which are later added to LDAP * @param array $ids list of IDs for column position (e.g. "posixAccount_uid" => 5) * @return array list of error messages if any */ function build_uploadAccounts($rawAccounts, $ids, &$partialAccounts) { $messages = array(); for ($i = 0; $i < sizeof($rawAccounts); $i++) { // add object class if (!in_array("ieee802Device", $partialAccounts[$i]['objectClass'])) $partialAccounts[$i]['objectClass'][] = "ieee802Device"; // add MACs if ($rawAccounts[$i][$ids['ieee802Device_mac']] != "") { $macs = explode(',', $rawAccounts[$i][$ids['ieee802Device_mac']]); // check format for ($m = 0; $m < sizeof($macs); $m++) { if (get_preg($macs[$m], 'macAddress')) { $partialAccounts[$i]['macAddress'][] = $macs[$m]; } else { $errMsg = $this->messages['mac'][1]; array_push($errMsg, array($i)); $messages[] = $errMsg; } } } } return $messages; } |