Ejemplo n.º 1
0
 /**
  * fetch one contact of a user identified by his user_id
  *
  * @param   int $_userId
  * @return  Addressbook_Model_Contact 
  * @throws  Addressbook_Exception_NotFound if contact not found
  */
 public function getByUserId($_userId)
 {
     $userId = Tinebase_Model_User::convertUserIdToInt($_userId);
     $contactData = $this->_ldap->fetch($this->_baseDn, "uidnumber={$userId}", $this->_getSupportedLdapAttributes());
     if (!$contactData) {
         throw new Addressbook_Exception_NotFound("Contact with user id {$_userId} not found.");
     }
     $contact = $this->_ldap2Contacts(array($contactData))->offsetGet(0);
     $contact->jpegphoto = $this->_ldap->fetchBinaryAttribute($this->_baseDn, "uidnumber={$userId}", 'jpegphoto');
     return $contact;
 }
Ejemplo n.º 2
0
 /**
  * returns ldap metadata of given group
  *
  * @param  int         $_groupId
  */
 protected function _getMetaData($_groupId)
 {
     $metaData = array();
     try {
         $groupId = Tinebase_Model_Group::convertGroupIdToInt($_groupId);
         $group = $this->_ldap->fetch($this->_options['groupsDn'], 'objectGUID=' . $groupId, array('objectclass'));
         $metaData['dn'] = $group['dn'];
         $metaData['objectClass'] = $group['objectclass'];
         unset($metaData['objectClass']['count']);
     } catch (Tinebase_Exception_NotFound $e) {
         throw new Exception("group with id {$groupId} not found");
     }
     //if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . '  $data: ' . print_r($metaData, true));
     return $metaData;
 }