Changeset View
Changeset View
Standalone View
Standalone View
lib/kolab_api_service.php
Show First 20 Lines • Show All 91 Lines • ▼ Show 20 Lines | abstract class kolab_api_service | ||||
* | * | ||||
* @param string $object_name Name of the object (user, group, etc.) | * @param string $object_name Name of the object (user, group, etc.) | ||||
* @param array $attributes Array of attributes and values | * @param array $attributes Array of attributes and values | ||||
* | * | ||||
* @return int Object type identifier | * @return int Object type identifier | ||||
*/ | */ | ||||
protected function object_type_id($object_name, $attributes) | protected function object_type_id($object_name, $attributes) | ||||
{ | { | ||||
if ($object_name == 'domain') return 1; | if ($object_name == 'domain') { | ||||
$root_dn = $this->conf->get('kolab_wap', 'hosted_root_dn'); | |||||
return $root_dn && strpos((string) $attributes['inetdomainbasedn'], ",$root_dn") ? 2 : 1; | |||||
} | |||||
$object_class = $attributes['objectclass']; | $object_class = $attributes['objectclass']; | ||||
if (empty($object_class)) { | if (empty($object_class)) { | ||||
return null; | return null; | ||||
} | } | ||||
$object_types = $this->object_types($object_name); | $object_types = $this->object_types($object_name); | ||||
▲ Show 20 Lines • Show All 157 Lines • ▼ Show 20 Lines | protected function object_types($object_name) | ||||
// get list of object types | // get list of object types | ||||
if ($object_name == 'domain') { | if ($object_name == 'domain') { | ||||
$object_types = array( | $object_types = array( | ||||
'1' => array( | '1' => array( | ||||
'key' => 'default', | 'key' => 'default', | ||||
'attributes' => kolab_api_service_domain_types::$DEFAULT_TYPE_ATTRS, | 'attributes' => kolab_api_service_domain_types::$DEFAULT_TYPE_ATTRS, | ||||
), | ), | ||||
'2' => array( | |||||
'key' => 'hosted', | |||||
'attributes' => kolab_api_service_domain_types::$HOSTED_TYPE_ATTRS, | |||||
), | |||||
); | ); | ||||
$object_types['1']['attributes']['form_fields']['aci'] = array( | $object_types['1']['attributes']['form_fields']['aci'] = array( | ||||
'type' => 'list', | 'type' => 'list', | ||||
'optional' => true, | 'optional' => true, | ||||
); | ); | ||||
} | } | ||||
else { | else { | ||||
$sql_result = $this->db->query("SELECT * FROM `{$object_name}_types` ORDER BY `name`"); | $sql_result = $this->db->query("SELECT * FROM `{$object_name}_types` ORDER BY `name`"); | ||||
▲ Show 20 Lines • Show All 453 Lines • Show Last 20 Lines |