/** The folder list sorted by type */
const BY_TYPE = 'BY_TYPE';
+ /** The folder owner list */
+ const OWNERS = 'OWNERS';
+
/**
* The queriable list.
*
}
/**
+ * Get the folder owners.
+ *
+ * @return array The folder owners with the folder names as key and the
+ * owner as values.
+ */
+ public function listOwners()
+ {
+ return $this->_list_cache->getQuery(self::OWNERS);
+ }
+
+ /**
* Synchronize the query data with the information from the backend.
*
* @return NULL
}
$this->_list_cache->setQuery(self::TYPES, $types);
$this->_list_cache->setQuery(self::BY_TYPE, $by_type);
+
+ $owners = array();
+ $namespace = $this->_list->getNamespace();
+ foreach ($this->_list->listFolders() as $folder) {
+ $owners[$folder] = $namespace->getOwner($folder);
+ }
+ $this->_list_cache->setQuery(self::OWNERS, $owners);
}
}
\ No newline at end of file
$this->assertEquals(array('INBOX/Tasks'), $query->listByType('task'));
}
+ public function testListOwnersReturn()
+ {
+ $factory = new Horde_Kolab_Storage_Factory();
+ $query = $this->getCachedQueryForList($this->getAnnotatedList($factory), $factory);
+ $this->assertType(
+ 'array',
+ $query->listOwners()
+ );
+ }
+
+ public function testListOwnerList()
+ {
+ $factory = new Horde_Kolab_Storage_Factory();
+ $query = $this->getCachedQueryForList($this->getAnnotatedList($factory), $factory);
+ $this->assertEquals(
+ array(
+ 'INBOX' => 'test@example.com',
+ 'INBOX/Calendar' => 'test@example.com',
+ 'INBOX/Contacts' => 'test@example.com',
+ 'INBOX/Notes' => 'test@example.com',
+ 'INBOX/Tasks' => 'test@example.com',
+ 'INBOX/a' => 'test@example.com',
+ ),
+ $query->listOwners()
+ );
+ }
+
+ public function testListOwnerNamespace()
+ {
+ $factory = new Horde_Kolab_Storage_Factory();
+ $query = $this->getCachedQueryForList($this->getNamespaceList($factory), $factory);
+ $this->assertEquals(
+ array(
+ 'INBOX' => 'test@example.com',
+ 'INBOX/Calendar' => 'test@example.com',
+ 'INBOX/Contacts' => 'test@example.com',
+ 'INBOX/Notes' => 'test@example.com',
+ 'INBOX/Tasks' => 'test@example.com',
+ 'INBOX/a' => 'test@example.com',
+ 'shared.Calendars/All' => 'anonymous',
+ 'shared.Calendars/Others' => 'anonymous',
+ 'user/example/Calendar' => 'example@example.com',
+ 'user/example/Notes' => 'example@example.com',
+ 'user/someone/Calendars/Events' => 'someone@example.com',
+ 'user/someone/Calendars/Party' => 'someone@example.com',
+ ),
+ $query->listOwners()
+ );
+ }
}