}
/**
- * Return the root of the UID values on this server.
- *
- * @return string The base UID on this server (base DN on ldap).
- */
- public function getBaseUid()
- {
- return '';
- }
-
- /**
* Fetch a Kolab object.
*
* This method will not necessarily retrieve any data from the server and
$uid = $this->uid;
}
if (empty($type)) {
- $type = $this->_determineType($uid);
+ $type = $this->determineType($uid);
if (is_a($type, 'PEAR_Error')) {
return $type;
}
}
/**
- * Determine the type of a Kolab object.
- *
- * @param string $uid The UID of the object to examine.
+ * Return the root of the UID values on this server.
*
- * @return string The corresponding Kolab object type.
+ * @return string The base UID on this server (base DN on ldap).
*/
- function _determineType($uid)
+ public function getBaseUid()
{
- return KOLAB_OBJECT_USER;
+ return '';
}
/**
* @return mixed|PEAR_Error The UID or false if there was no result.
*/
public function uidForAttr($attr, $value,
- $restrict = KOLAB_SERVER_RESULT_SINGLE)
+ $restrict = KOLAB_SERVER_RESULT_SINGLE)
{
/* In the default class we just return false */
return false;
* @return mixed|PEAR_Error The GID or false if there was no result.
*/
public function gidForAttr($attr, $value,
- $restrict = KOLAB_SERVER_RESULT_SINGLE)
+ $restrict = KOLAB_SERVER_RESULT_SINGLE)
{
/* In the default class we just return false */
return false;
* @return mixed|PEAR_Error The UID or false if there was no result.
*/
public function uidForId($id,
- $restrict = KOLAB_SERVER_RESULT_SINGLE)
+ $restrict = KOLAB_SERVER_RESULT_SINGLE)
{
return $this->uidForAttr('uid', $id);
}
* @return mixed|PEAR_Error The UID or false if there was no result.
*/
public function uidForMail($mail,
- $restrict = KOLAB_SERVER_RESULT_SINGLE)
+ $restrict = KOLAB_SERVER_RESULT_SINGLE)
{
return $this->uidForAttr('mail', $mail);
}
* @return mixed|PEAR_Error The GID or false if there was no result.
*/
public function gidForMail($mail,
- $restrict = KOLAB_SERVER_RESULT_SINGLE)
+ $restrict = KOLAB_SERVER_RESULT_SINGLE)
{
return $this->gidForAttr('mail', $mail);
}
* @return mixed|PEAR_Error The UID or false if there was no result.
*/
public function uidForAlias($mail,
- $restrict = KOLAB_SERVER_RESULT_SINGLE)
+ $restrict = KOLAB_SERVER_RESULT_SINGLE)
{
return $this->uidForAttr('alias', $mail);
}
*/
public function listHash($type, $params = null)
{
- $list = $this->_listObjects($type, $params);
+ $list = $this->listObjects($type, $params);
if (is_a($list, 'PEAR_Error')) {
return $list;
}
}
/**
- * List all objects of a specific type
- *
- * @param string $type The type of the objects to be listed
- * @param array $params Additional parameters.
- *
- * @return array|PEAR_Error An array of Kolab objects.
- */
- public function listObjects($type, $params = null)
- {
- return $this->_listObjects($type, $params);
- }
-
- /**
- * List all objects of a specific type
- *
- * @param string $type The type of the objects to be listed
- * @param array $params Additional parameters.
- *
- * @return array|PEAR_Error An array of Kolab objects.
- */
- public function _listObjects($type, $params = null)
- {
- return array();
- }
-
- /**
* Generates a unique ID for the given information.
*
* @param string $type The type of the object to create.
if (is_a($id, 'PEAR_Error')) {
return $id;
}
- return $this->_generateUid($type, $id, $info);
+ return $this->generateServerUid($type, $id, $info);
}
/**
abstract public function read($uid, $attrs = null);
/**
+ * Determine the type of a Kolab object.
+ *
+ * @param string $uid The UID of the object to examine.
+ *
+ * @return string The corresponding Kolab object type.
+ */
+ abstract protected function determineType($uid);
+
+ /**
+ * List all objects of a specific type
+ *
+ * @param string $type The type of the objects to be listed
+ * @param array $params Additional parameters.
+ *
+ * @return array|PEAR_Error An array of Kolab objects.
+ */
+ abstract public function listObjects($type, $params = null);
+
+ /**
* Generates a UID for the given information.
*
* @param string $type The type of the object to create.
*
* @return string|PEAR_Error The UID.
*/
- abstract protected function _generateUid($type, $id, $info);
+ abstract protected function generateServerUid($type, $id, $info);
}
*/
public function testDetermineType()
{
- $type = $this->ldap->_determineType('cn=empty.group@example.org,dc=example,dc=org');
+ $type = $this->ldap->determineType('cn=empty.group@example.org,dc=example,dc=org');
$this->assertNoError($type);
$this->assertEquals(KOLAB_OBJECT_GROUP, $type);
- $type = $this->ldap->_determineType('cn=shared@example.org,dc=example,dc=org');
+ $type = $this->ldap->determineType('cn=shared@example.org,dc=example,dc=org');
$this->assertNoError($type);
$this->assertEquals(KOLAB_OBJECT_SHAREDFOLDER, $type);
- $type = $this->ldap->_determineType('cn=The Administrator,dc=example,dc=org');
+ $type = $this->ldap->determineType('cn=The Administrator,dc=example,dc=org');
$this->assertNoError($type);
$this->assertEquals(KOLAB_OBJECT_ADMINISTRATOR, $type);
- $type = $this->ldap->_determineType('cn=Main Tainer,dc=example,dc=org');
+ $type = $this->ldap->determineType('cn=Main Tainer,dc=example,dc=org');
$this->assertNoError($type);
$this->assertEquals(KOLAB_OBJECT_MAINTAINER, $type);
- $type = $this->ldap->_determineType('cn=Domain Maintainer,dc=example,dc=org');
+ $type = $this->ldap->determineType('cn=Domain Maintainer,dc=example,dc=org');
$this->assertNoError($type);
$this->assertEquals(KOLAB_OBJECT_DOMAINMAINTAINER, $type);
- $type = $this->ldap->_determineType('cn=Test Address,cn=external,dc=example,dc=org');
+ $type = $this->ldap->determineType('cn=Test Address,cn=external,dc=example,dc=org');
$this->assertNoError($type);
$this->assertEquals(KOLAB_OBJECT_ADDRESS, $type);
- $type = $this->ldap->_determineType('cn=Gunnar Wrobel,dc=example,dc=org');
+ $type = $this->ldap->determineType('cn=Gunnar Wrobel,dc=example,dc=org');
$this->assertNoError($type);
$this->assertEquals(KOLAB_OBJECT_USER, $type);
}