Adapt to the way we handle Horde_Kolab_Server_Object instances now.
public static $filter = '(&(objectclass=inetOrgPerson)(!(uid=*))(sn=*))';
/**
- * The attributes supported by this class
- *
- * @var array
- */
- public $supported_attributes = array(
- KOLAB_ATTR_SN,
- KOLAB_ATTR_CN,
- KOLAB_ATTR_GIVENNAME,
- KOLAB_ATTR_FN,
- KOLAB_ATTR_LNFN,
- KOLAB_ATTR_MAIL,
- KOLAB_ATTR_DELETED,
- );
-
- /**
* Attributes derived from the LDAP values.
*
* @var array
*/
public $derived_attributes = array(
- KOLAB_ATTR_LNFN,
- KOLAB_ATTR_FNLN,
- );
-
- /**
- * The attributes required when creating an object of this class.
- *
- * @var array
- */
- public $required_attributes = array(
- KOLAB_ATTR_SN,
- KOLAB_ATTR_GIVENNAME,
+ Horde_Kolab_Server_Object::ATTRIBUTE_LNFN,
+ Horde_Kolab_Server_Object::ATTRIBUTE_FNLN,
);
/**
* @var array
*/
protected $object_classes = array(
- KOLAB_OC_TOP,
- KOLAB_OC_INETORGPERSON,
- KOLAB_OC_KOLABINETORGPERSON,
+ Horde_Kolab_Server_Object::OBJECTCLASS_TOP,
+ Horde_Kolab_Server_Object::OBJECTCLASS_INETORGPERSON,
+ Horde_Kolab_Server_Object::OBJECTCLASS_KOLABINETORGPERSON,
);
/**
{
if (!isset($attrs)) {
$attrs = array(
- KOLAB_ATTR_LNFN,
+ Horde_Kolab_Server_Object::ATTRIBUTE_LNFN,
);
}
return parent::toHash($attrs);
public static $filter = '(&(cn=*)(objectClass=inetOrgPerson)(!(uid=manager))(sn=*))';
/**
- * The attributes supported by this class
- *
- * @var array
- */
- public $supported_attributes = array(
- KOLAB_ATTR_SN,
- KOLAB_ATTR_CN,
- KOLAB_ATTR_GIVENNAME,
- KOLAB_ATTR_FN,
- KOLAB_ATTR_SID,
- KOLAB_ATTR_USERPASSWORD,
- KOLAB_ATTR_DELETED,
- );
-
- /**
- * The attributes required when creating an object of this class.
- *
- * @var array
- */
- public $required_attributes = array(
- KOLAB_ATTR_SN,
- KOLAB_ATTR_GIVENNAME,
- KOLAB_ATTR_USERPASSWORD,
- KOLAB_ATTR_SID,
- );
-
- /**
* Attributes derived from the LDAP values.
*
* @var array
*/
public $derived_attributes = array(
- KOLAB_ATTR_ID,
- KOLAB_ATTR_LNFN,
+ Horde_Kolab_Server_Object::ATTRIBUTE_ID,
+ Horde_Kolab_Server_Object::ATTRIBUTE_LNFN,
);
/**
* @var array
*/
protected $object_classes = array(
- KOLAB_OC_TOP,
- KOLAB_OC_INETORGPERSON,
- KOLAB_OC_KOLABINETORGPERSON,
+ Horde_Kolab_Server_Object::OBJECTCLASS_TOP,
+ Horde_Kolab_Server_Object::OBJECTCLASS_INETORGPERSON,
+ Horde_Kolab_Server_Object::OBJECTCLASS_KOLABINETORGPERSON,
);
/**
{
if (!isset($attrs)) {
$attrs = array(
- KOLAB_ATTR_SID,
- KOLAB_ATTR_LNFN,
+ Horde_Kolab_Server_Object::ATTRIBUTE_SID,
+ Horde_Kolab_Server_Object::ATTRIBUTE_LNFN,
);
}
return parent::toHash($attrs);
$parts = split(',', $this->required_group);
list($groupname) = sscanf($parts[0], 'cn=%s');
- $result = $this->db->add(array(KOLAB_ATTR_CN => $groupname,
- 'type' => 'Horde_Kolab_Server_Object_group',
- KOLAB_ATTR_MEMBER => $members,
- KOLAB_ATTR_VISIBILITY => false));
+ $result = $this->db->add(array(Horde_Kolab_Server_Object::ATTRIBUTE_CN => $groupname,
+ 'type' => 'Horde_Kolab_Server_Object_group',
+ Horde_Kolab_Server_Object::ATTRIBUTE_MEMBER => $members,
+ Horde_Kolab_Server_Object::ATTRIBUTE_VISIBILITY => false));
if (is_a($result, 'PEAR_Error')) {
return $result;
}
if ($result === false) {
$members = $admin_group->getMembers();
$members[] = $this->uid;
- $admin_group->save(array(KOLAB_ATTR_MEMBER => $members));
+ $admin_group->save(array(Horde_Kolab_Server_Object::ATTRIBUTE_MEMBER => $members));
}
}
return parent::save($info);
* @var string
*/
public static $filter = '(&(objectClass=kolabGroupOfNames)(mail=*))';
-
-
- /**
- * The attributes required when creating an object of this class.
- *
- * @var array
- */
- public $required_attributes = array(
- KOLAB_ATTR_MAIL,
- );
};
{
/**
- * The attributes required when creating an object of this class.
- *
- * @var array
- */
- public $required_attributes = array(
- KOLAB_ATTR_SN,
- KOLAB_ATTR_GIVENNAME,
- KOLAB_ATTR_USERPASSWORD,
- KOLAB_ATTR_SID,
- KOLAB_ATTR_DOMAIN,
- );
-
- /**
* Attributes derived from the LDAP values.
*
* @var array
*/
public $derived_attributes = array(
- KOLAB_ATTR_ID,
- KOLAB_ATTR_LNFN,
- KOLAB_ATTR_DOMAIN,
+ Horde_Kolab_Server_Object::ATTRIBUTE_ID,
+ Horde_Kolab_Server_Object::ATTRIBUTE_LNFN,
+ Horde_Kolab_Server_Object::ATTRIBUTE_DOMAIN,
);
/**
{
if (!isset($attrs)) {
$attrs = array(
- KOLAB_ATTR_SID,
- KOLAB_ATTR_LNFN,
- KOLAB_ATTR_DOMAIN,
+ Horde_Kolab_Server_Object::ATTRIBUTE_SID,
+ Horde_Kolab_Server_Object::ATTRIBUTE_LNFN,
+ Horde_Kolab_Server_Object::ATTRIBUTE_DOMAIN,
);
}
return parent::toHash($attrs);
*/
public function save($info)
{
- foreach ($info[KOLAB_ATTR_DOMAIN] as $domain) {
+ foreach ($info[Horde_Kolab_Server_Object::ATTRIBUTE_DOMAIN] as $domain) {
$domain_uid = sprintf('cn=%s,cn=domain,cn=internal,%s',
$domain, $this->db->getBaseUid());
}
if (!$domain_group->exists()) {
$members = array($this->uid);
- $domain_group->save(array(KOLAB_ATTR_CN => $domain,
- KOLAB_ATTR_MEMBER => $members));
+ $domain_group->save(array(Horde_Kolab_Server_Object::ATTRIBUTE_CN => $domain,
+ Horde_Kolab_Server_Object::ATTRIBUTE_MEMBER => $members));
} else {
$result = $domain_group->isMember($this->uid);
if (is_a($result, 'PEAR_Error')) {
if ($result === false) {
$members = $domain_group->getMembers();
$members[] = $this->uid;
- $domain_group->save(array(KOLAB_ATTR_MEMBER => $members));
+ $domain_group->save(array(Horde_Kolab_Server_Object::ATTRIBUTE_MEMBER => $members));
}
}
}
public static $filter = '(objectClass=kolabGroupOfNames)';
/**
- * The attributes supported by this class
- *
- * @var array
- */
- public $supported_attributes = array(
- KOLAB_ATTR_CN,
- KOLAB_ATTR_MAIL,
- KOLAB_ATTR_MEMBER,
- KOLAB_ATTR_DELETED,
- );
-
- /**
* Attributes derived from the LDAP values.
*
* @var array
*/
public $derived_attributes = array(
- KOLAB_ATTR_ID,
- KOLAB_ATTR_VISIBILITY,
- );
-
- /**
- * The attributes required when creating an object of this class.
- *
- * @var array
- */
- public $required_attributes = array(
- KOLAB_ATTR_CN,
+ Horde_Kolab_Server_Object::ATTRIBUTE_ID,
+ Horde_Kolab_Server_Object::ATTRIBUTE_VISIBILITY,
);
/**
* @var array
*/
protected $object_classes = array(
- KOLAB_OC_TOP,
- KOLAB_OC_KOLABGROUPOFNAMES,
+ Horde_Kolab_Server_Object::OBJECTCLASS_TOP,
+ Horde_Kolab_Server_Object::OBJECTCLASS_INETORGPERSON,
+ Horde_Kolab_Server_Object::OBJECTCLASS_KOLABGROUPOFNAMES,
);
/**
*
* @var string
*/
- public $sort_by = KOLAB_ATTR_MAIL;
+ public $sort_by = Horde_Kolab_Server_Object::ATTRIBUTE_MAIL;
/**
* Derive an attribute value.
protected function derive($attr)
{
switch ($attr) {
- case KOLAB_ATTR_VISIBILITY:
+ case self::ATTRIBUTE_VISIBILITY:
return strpos($this->_uid, 'cn=internal') === false;
default:
return parent::derive($attr);
{
if (!isset($attrs)) {
$attrs = array(
- KOLAB_ATTR_ID,
- KOLAB_ATTR_MAIL,
- KOLAB_ATTR_VISIBILITY,
+ Horde_Kolab_Server_Object::ATTRIBUTE_ID,
+ Horde_Kolab_Server_Object::ATTRIBUTE_MAIL,
+ Horde_Kolab_Server_Object::ATTRIBUTE_VISIBILITY,
);
}
return parent::toHash($attrs);
*/
public function getMembers()
{
- return $this->_get(KOLAB_ATTR_MEMBER, false);
+ return $this->_get(Horde_Kolab_Server_Object::ATTRIBUTE_MEMBER, false);
}
/**
return $members;
}
if (!in_array($member, $members)) {
- $this->_cache[KOLAB_ATTR_MEMBER][] = $member;
+ $this->_cache[Horde_Kolab_Server_Object::ATTRIBUTE_MEMBER][] = $member;
} else {
return PEAR::raiseError(_("The UID %s is already a member of the group %s!"),
$member, $this->_uid);
return $members;
}
if (in_array($member, $members)) {
- $this->_cache[KOLAB_ATTR_MEMBER] = array_diff($this->_cache[KOLAB_ATTR_MEMBER],
- array($member));
+ $this->_cache[Horde_Kolab_Server_Object::ATTRIBUTE_MEMBER] =
+ array_diff($this->_cache[Horde_Kolab_Server_Object::ATTRIBUTE_MEMBER],
+ array($member));
} else {
return PEAR::raiseError(_("The UID %s is no member of the group %s!"),
$member, $this->_uid);
* @var array
*/
public $supported_attributes = array(
- KOLAB_ATTR_FBPAST,
+ Horde_Kolab_Server_Object::ATTRIBUTE_FBPAST,
);
}
\ No newline at end of file
public static $filter = '(objectClass=kolabSharedFolder)';
/**
- * The attributes supported by this class
- *
- * @var array
- */
- public $supported_attributes = array(
- KOLAB_ATTR_CN,
- KOLAB_ATTR_DELETED,
- KOLAB_ATTR_FOLDERTYPE,
- KOLAB_ATTR_HOMESERVER,
- KOLAB_ATTR_IMAPHOST,
- KOLAB_ATTR_QUOTA,
- KOLAB_ATTR_ACL,
- );
-
- /**
- * The attributes required when creating an object of this class.
- *
- * @var array
- */
- public $required_attributes = array(
- KOLAB_ATTR_CN,
- KOLAB_ATTR_HOMESERVER,
- );
-
- /**
* The ldap classes for this type of object.
*
* @var array
*/
protected $object_classes = array(
- KOLAB_OC_TOP,
- KOLAB_OC_KOLABSHAREDFOLDER,
+ Horde_Kolab_Server_Object::OBJECTCLASS_TOP,
+ Horde_Kolab_Server_Object::OBJECTCLASS_KOLABSHAREDFOLDER,
);
/**
{
if (!isset($attrs)) {
$attrs = array(
- KOLAB_ATTR_CN,
- KOLAB_ATTR_HOMESERVER,
- KOLAB_ATTR_FOLDERTYPE,
+ Horde_Kolab_Server_Object::ATTRIBUTE_CN,
+ Horde_Kolab_Server_Object::ATTRIBUTE_HOMESERVER,
+ Horde_Kolab_Server_Object::ATTRIBUTE_FOLDERTYPE,
);
}
return parent::toHash($attrs);
class Horde_Kolab_Server_Object_user extends Horde_Kolab_Server_Object
{
+ /** Define attributes specific to this object type */
+ const ATTRIBUTE_USERTYPE = 'usertype';
+
+ /** Define the possible Kolab user types */
+ const USERTYPE_STANDARD = 0;
+ const USERTYPE_INTERNAL = 1;
+ const USERTYPE_GROUP = 2;
+ const USERTYPE_RESOURCE = 3;
+
/**
* The LDAP filter to retrieve this object type
*
*
* @var array
*/
- public $supported_attributes = array(
- KOLAB_ATTR_SN,
- KOLAB_ATTR_CN,
- KOLAB_ATTR_GIVENNAME,
- KOLAB_ATTR_FN,
- KOLAB_ATTR_SID,
- KOLAB_ATTR_USERPASSWORD,
- KOLAB_ATTR_MAIL,
- KOLAB_ATTR_DELETED,
- KOLAB_ATTR_IMAPHOST,
- KOLAB_ATTR_FREEBUSYHOST,
- KOLAB_ATTR_HOMESERVER,
- KOLAB_ATTR_KOLABDELEGATE,
- KOLAB_ATTR_IPOLICY,
- KOLAB_ATTR_FBFUTURE,
- );
+ public $supported_attributes = false;
/**
* Attributes derived from the LDAP values.
* @var array
*/
public $derived_attributes = array(
- KOLAB_ATTR_ID,
- KOLAB_ATTR_USERTYPE,
- KOLAB_ATTR_LNFN,
- KOLAB_ATTR_FNLN,
+ 'id',
+ 'usertype',
+ //FIXME: Do we really want to have this type of functionality within this library?
+ 'lnfn',
+ 'fnln',
);
/**
*
* @var array
*/
- public $required_attributes = array(
- KOLAB_ATTR_SN,
- KOLAB_ATTR_GIVENNAME,
- KOLAB_ATTR_USERPASSWORD,
- KOLAB_ATTR_MAIL,
- KOLAB_ATTR_HOMESERVER,
- );
+ public $required_attributes = false;
/**
* The ldap classes for this type of object.
* @var array
*/
protected $object_classes = array(
- KOLAB_OC_TOP,
- KOLAB_OC_INETORGPERSON,
- KOLAB_OC_KOLABINETORGPERSON,
- KOLAB_OC_HORDEPERSON,
+ self::OBJECTCLASS_TOP,
+ self::OBJECTCLASS_INETORGPERSON,
+ self::OBJECTCLASS_KOLABINETORGPERSON,
+ self::OBJECTCLASS_HORDEPERSON,
);
/**
protected function derive($attr)
{
switch ($attr) {
- case KOLAB_ATTR_USERTYPE:
+ case self::ATTRIBUTE_USERTYPE:
if (strpos($this->_uid, 'cn=internal')) {
- return KOLAB_UT_INTERNAL;
+ return self::USERTYPE_INTERNAL;
} else if (strpos($this->_uid, 'cn=group')) {
- return KOLAB_UT_GROUP;
+ return self::USERTYPE_GROUP;
} else if (strpos($this->_uid, 'cn=resource')) {
- return KOLAB_UT_RESOURCE;
+ return self::USERTYPE_RESOURCE;
} else {
- return KOLAB_UT_STANDARD;
+ return self::USERTYPE_STANDARD;
}
default:
return parent::derive($attr);
{
if (!isset($attrs)) {
$attrs = array(
- KOLAB_ATTR_SID,
- KOLAB_ATTR_FN,
- KOLAB_ATTR_MAIL,
- KOLAB_ATTR_USERTYPE,
+ self::ATTRIBUTE_SID,
+ self::ATTRIBUTE_FN,
+ self::ATTRIBUTE_MAIL,
+ self::ATTRIBUTE_USERTYPE,
);
}
return parent::toHash($attrs);
*/
public function getGroups()
{
- return $this->_db->getGroups($this->_uid);
+ return $this->db->getGroups($this->uid);
}
/**
switch ($server_type) {
case 'freebusy':
- $server = $this->get(KOLAB_ATTR_FREEBUSYHOST);
+ $server = $this->get(self::ATTRIBUTE_FREEBUSYHOST);
if (!empty($server)) {
return $server;
}
return 'https://' . $server . '/freebusy';
}
case 'imap':
- $server = $this->get(KOLAB_ATTR_IMAPHOST);
+ $server = $this->get(self::ATTRIBUTE_IMAPHOST);
if (!empty($server)) {
return $server;
}
case 'homeserver':
default:
- $server = $this->get(KOLAB_ATTR_HOMESERVER);
+ $server = $this->get(self::ATTRIBUTE_HOMESERVER);
if (empty($server)) {
$server = $_SERVER['SERVER_NAME'];
}