* @var Sabre\DAV\ObjectTree
*/
protected $_webdavTree;
-
+
+ /**
+ * tear down tests
+ */
+ protected function tearDown()
+ {
+ parent::tearDown();
+ Tinebase_Config::getInstance()->set(Tinebase_Config::USE_LOGINNAME_AS_FOLDERNAME, false);
+ }
+
/**
* testgetNodeForPath
*/
$savedMTime = new Tinebase_DateTime($node->getLastModified());
$this->assertEquals($mtime, $savedMTime, 'X_OC_MTIME not saved');
}
+
+ public function testgetNodeForPath_webdav_filemanager_currentuser2()
+ {
+ Tinebase_Config::getInstance()->set(Tinebase_Config::USE_LOGINNAME_AS_FOLDERNAME, true);
+ $node = $this->_getWebDAVTree()->getNodeForPath('/webdav/Filemanager/' . Tinebase_Core::getUser()->accountLoginName);
+
+ $this->assertInstanceOf('Filemanager_Frontend_WebDAV', $node, 'wrong node class');
+ $this->assertEquals(Tinebase_Core::getUser()->accountLoginName, $node->getName());
+
+ $children = $node->getChildren();
+
+ $this->assertGreaterThanOrEqual(1, count($children));
+ $this->assertInstanceOf('Filemanager_Frontend_WebDAV_Container', $children[0], 'wrong node class');
+
+ $this->setExpectedException('Sabre\DAV\Exception\Forbidden');
+
+ $this->_getWebDAVTree()->delete('/webdav/Filemanager/' . Tinebase_Core::getUser()->accountLoginName);
+ }
/**
* test chunked upload from OwnCloud clients
{
/**
* unit under test (UIT)
+ *
* @var Tinebase_Config
*/
protected $_instance;
protected $objects = array();
protected $_filenamesToDelete = array();
-
+
/**
* Sets up the fixture.
* This method is called before a test is executed.
Tinebase_Config::getInstance()->clearCache();
}
-
+
/**
* test instance retrival
- *
+ *
*/
public function testConfigInstance()
{
$this->assertTrue($this->_instance === Tinebase_Core::getConfig(), 'Tinebase_Core::getConfig() is wrong instance');
}
-
+
/**
* test basic config getting/setting/deleting cycle
*/
{
$this->_instance->set(Tinebase_Config::PAGETITLEPOSTFIX, 'phpunit');
$this->assertEquals('phpunit', $this->_instance->{Tinebase_Config::PAGETITLEPOSTFIX}, 'could not set config');
-
+
$this->_instance->delete(Tinebase_Config::PAGETITLEPOSTFIX, 'phpunit');
-
+
$this->assertEquals('###PHPUNIT-NOTSET###', $this->_instance->get(Tinebase_Config::PAGETITLEPOSTFIX, '###PHPUNIT-NOTSET###'), 'config got not deleted');
-
+
$this->assertFalse(isset($this->_instance->{Tinebase_Config::PAGETITLEPOSTFIX}), '__isset not working');
}
-
+
/**
* test if config from config.inc.php overwrites config in db
*
public function testConfigFromFileOverwrites()
{
$configData = include('config.inc.php');
-
- if (! (isset($configData['Overwrite Test']) || array_key_exists('Overwrite Test', $configData))) {
+
+ if (!(isset($configData['Overwrite Test']) || array_key_exists('Overwrite Test', $configData))) {
$this->markTestSkipped('config.inc.php has no test key "Overwrite Test"');
return;
}
-
+
$overwrittenValue = Tinebase_Record_Abstract::generateUID();
$this->_instance->{'Overwrite Test'} = $overwrittenValue;
-
+
$this->assertEquals($configData['Overwrite Test'], $this->_instance->{'Overwrite Test'});
-
+
$this->_instance->delete('Overwrite Test');
}
-
+
/**
* test get config from config.inc.php
*
public function testGetConfigFromFile()
{
$dbConfig = $this->_instance->database;
-
+
$this->assertGreaterThan(0, count($dbConfig), 'could not get db config');
$this->assertTrue($dbConfig['dbname'] != '', 'could not get dbname');
}
-
+
/**
* test config value is a struct
*
public function testConfigTypeStruct()
{
$dbConfig = $this->_instance->database;
-
+
$this->assertTrue($dbConfig instanceof Tinebase_Config_Struct, 'db config is not a struct');
$this->assertTrue($dbConfig['dbname'] != '', 'could not get dbname via arrayAccess');
$this->assertTrue($dbConfig->dbname != '', 'could not get dbname via objectAccess');
}
-
+
/**
* test client config retrival
- *
+ *
*/
public function testGetClientRegistryConfig()
{
$this->assertTrue($clientConfig instanceof Tinebase_Config_Struct, 'clientconfig is not a struct');
$this->assertTrue($clientConfig->Calendar instanceof Tinebase_Config_Struct, 'calendar clientconfig is not a struct');
$this->assertEquals(Calendar_Config::getInstance()->fixedCalendars, $clientConfig->Calendar->fixedCalendars->value, 'fixed calendar config not correct');
-
+
$this->assertFalse((isset($clientConfig->Tinebase['SMTP']) || array_key_exists('SMTP', $clientConfig->Tinebase)), 'SMTP is not a client config');
}
-
+
/**
* test if config returns empty array if it's empty
*/
{
// Hold original value for further tests of sieve.
$keepOriginalValue = $this->_instance->get("sieve");
-
+
// Ensure sieve key is null
$this->_instance->set("sieve", null);
-
+
// If key is null it throws an exception, so return empty array if it's null.
$this->assertTrue($this->_instance->get("sieve") instanceof Tinebase_Config_Struct);
-
+
// Check common function of the getFunction
$this->assertTrue(is_numeric($this->_instance->get("acceptedTermsVersion")));
-
+
// restore value
$this->_instance->set("sieve", $keepOriginalValue);
}
-
+
/**
* testApplicationDefaultConfig
*/
public function testApplicationDefaultConfig()
{
$defaultConfigFile = $this->_getSalesCustomDefaultConfig();
-
+
if (file_exists($defaultConfigFile)) {
$this->markTestSkipped('ignore test because Sales default config exists');
}
-
+
$ignoreBillablesConfig = Sales_Config::getInstance()->get(Sales_Config::IGNORE_BILLABLES_BEFORE);
$this->assertEquals('2000-01-01 22:00:00', $ignoreBillablesConfig);
-
+
copy(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'files' . DIRECTORY_SEPARATOR . 'configtest.inc.php', $defaultConfigFile);
$this->_filenamesToDelete[] = $defaultConfigFile;
Sales_Config::getInstance()->clearCache();
-
+
$ignoreBillablesConfigAppDefault = Sales_Config::getInstance()->get(Sales_Config::IGNORE_BILLABLES_BEFORE);
$this->assertEquals('1999-10-01 22:00:00', $ignoreBillablesConfigAppDefault);
}
-
+
protected function _getSalesCustomDefaultConfig()
{
return dirname(dirname(dirname(dirname(__FILE__)))) . DIRECTORY_SEPARATOR . 'tine20'
- . DIRECTORY_SEPARATOR . 'Sales' . DIRECTORY_SEPARATOR . 'config.inc.php';
+ . DIRECTORY_SEPARATOR . 'Sales' . DIRECTORY_SEPARATOR . 'config.inc.php';
}
-
+
/**
* testFeatureEnabled
- *
+ *
* @see 0010756: add feature switches for easy enabling/disabling of features
*/
public function testFeatureEnabled()
if (file_exists($customConfigFilename)) {
$this->markTestSkipped('do not test with existing custom config');
}
-
+
$invoicesFeatureEnabled = Sales_Config::getInstance()->featureEnabled(Sales_Config::FEATURE_INVOICES_MODULE);
-
+
$this->assertTrue($invoicesFeatureEnabled);
}
public function testComposeConfigDir()
{
$confdfolder = Tinebase_Config::getInstance()->get(Tinebase_Config::CONFD_FOLDER);
- if (empty($confdfolder) || ! is_readable($confdfolder)) {
+ if (empty($confdfolder) || !is_readable($confdfolder)) {
$this->markTestSkipped('no confdfolder configured/readable');
}
$defaultPolicy = ActiveSync_Config::getInstance()->get(ActiveSync_Config::DEFAULT_POLICY, null);
$this->assertTrue(is_null($defaultPolicy), 'config should be null: ' . var_export($defaultPolicy, true));
}
+
+ /**
+ * set + get bool config
+ */
+ public function testBoolConfig()
+ {
+ Tinebase_Config::getInstance()->set(Tinebase_Config::USE_LOGINNAME_AS_FOLDERNAME, true);
+
+ $this->assertEquals(true, Tinebase_Config::getInstance()->get(Tinebase_Config::USE_LOGINNAME_AS_FOLDERNAME));
+ }
}
}
/**
+ * tear down tests
+ */
+ protected function tearDown()
+ {
+ parent::tearDown();
+ Tinebase_Config::getInstance()->set(Tinebase_Config::USE_LOGINNAME_AS_FOLDERNAME, false);
+ }
+
+ /**
* test getPluginName method
*/
public function testGetPluginName()
$this->assertEquals(1, $nodes->length, $responseDoc->saveXML());
$this->assertNotEmpty($nodes->item(0)->nodeValue, $responseDoc->saveXML());
}
+
+ /**
+ * test testGetProperties method with alternate loginname config
+ */
+ public function testGetProperties2()
+ {
+ Tinebase_Config::getInstance()->set(Tinebase_Config::USE_LOGINNAME_AS_FOLDERNAME, true);
+
+ $body = '<?xml version="1.0" encoding="utf-8"?>
+ <propfind xmlns="DAV:">
+ <prop>
+ <getlastmodified xmlns="DAV:"/>
+ <getcontentlength xmlns="DAV:"/>
+ <resourcetype xmlns="DAV:"/>
+ <getetag xmlns="DAV:"/>
+ <id xmlns="http://owncloud.org/ns"/>
+ </prop>
+ </propfind>';
+
+ $request = new Sabre\HTTP\Request(array(
+ 'REQUEST_METHOD' => 'PROPFIND',
+ 'REQUEST_URI' => '/remote.php/webdav/' . Tinebase_Core::getUser()->accountLoginName,
+ 'HTTP_DEPTH' => '0',
+ ));
+ $request->setBody($body);
+
+ $this->server->httpRequest = $request;
+ $this->server->exec();
+ //var_dump($this->response->body);
+ $this->assertEquals('HTTP/1.1 207 Multi-Status', $this->response->status);
+
+ $responseDoc = new DOMDocument();
+ $responseDoc->loadXML($this->response->body);
+ //$responseDoc->formatOutput = true; echo $responseDoc->saveXML();
+ $xpath = new DomXPath($responseDoc);
+ $xpath->registerNamespace('owncloud', 'http://owncloud.org/ns');
+
+ $nodes = $xpath->query('//d:multistatus/d:response/d:propstat/d:prop/owncloud:id');
+ $this->assertEquals(1, $nodes->length, $responseDoc->saveXML());
+ $this->assertNotEmpty($nodes->item(0)->nodeValue, $responseDoc->saveXML());
+ }
}
* @var array test objects
*/
protected $objects = array();
-
+
/**
- * Runs the test methods of this class.
- *
- * @access public
- * @static
+ * tear down tests
*/
- public static function main()
+ protected function tearDown()
{
- $suite = new PHPUnit_Framework_TestSuite('Tinebase_WebDav_RootTest');
- PHPUnit_TextUI_TestRunner::run($suite);
+ parent::tearDown();
+ Tinebase_Config::getInstance()->set(Tinebase_Config::USE_LOGINNAME_AS_FOLDERNAME, false);
}
/**
}
/**
+ * test getLastModified method
+ */
+ public function testGetLastModified2()
+ {
+ Tinebase_Config::getInstance()->set(Tinebase_Config::USE_LOGINNAME_AS_FOLDERNAME, true);
+
+ $remoteWebDav = $this->_getWebDAVTree()->getNodeForPath('/remote.php/webdav');
+
+ $this->assertNotEmpty($remoteWebDav->getLastModified());
+
+ $personal = $remoteWebDav->getChild(Tinebase_Core::getUser()->accountLoginName);
+
+ $this->assertNotEmpty($personal->getLastModified());
+
+ $shared = $remoteWebDav->getChild('shared');
+
+ $this->assertNotEmpty($shared->getLastModified());
+
+ $this->assertContains($remoteWebDav->getLastModified(), array($personal->getLastModified(), $shared->getLastModified()));
+
+ Tinebase_Config::getInstance()->set(Tinebase_Config::USE_LOGINNAME_AS_FOLDERNAME, false);
+
+ }
+
+ /**
+ * test getETag
+ */
+ public function testGetETag2()
+ {
+ Tinebase_Config::getInstance()->set(Tinebase_Config::USE_LOGINNAME_AS_FOLDERNAME, true);
+
+ $remoteWebDav = $this->_getWebDAVTree()->getNodeForPath('/remote.php/webdav');
+ $properties = $remoteWebDav->getProperties(array('{DAV:}getetag'));
+ $this->assertArrayHasKey('{DAV:}getetag', $properties);
+
+ $currentUser = $remoteWebDav->getChild(Tinebase_Core::getUser()->accountLoginName);
+ $properties = $currentUser->getProperties(array('{DAV:}getetag'));
+ $this->assertArrayHasKey('{DAV:}getetag', $properties);
+
+ foreach ($currentUser->getChildren() as $child) {
+ $properties = $child->getProperties(array('{DAV:}getetag'));
+ $this->assertArrayHasKey('{DAV:}getetag', $properties);
+ }
+
+ Tinebase_Config::getInstance()->set(Tinebase_Config::USE_LOGINNAME_AS_FOLDERNAME, false);
+ }
+
+ /**
*
* @return \Sabre\DAV\ObjectTree
*/
* @param array $_data
* @return array $_data
*/
- protected function _resolveAutoValues(array $_data) {
+ protected function _resolveAutoValues(array $_data)
+ {
if (! (isset($_data['org_name']) || array_key_exists('org_name', $_data))) {
$_data['org_name'] = '';
}
header('HTTP/1.0 404 Not found');
- $view = new Zend_View();
- $view->setScriptPath('Filemanager/views');
-
+ $view = $this->_getView();
header('Content-Type: text/html; charset=utf-8');
die($view->render('notfound.phtml'));
}
*/
protected function _listDirectory(Filemanager_Model_DownloadLink $download, Tinebase_Model_Tree_Node $node, $path)
{
- $view = new Zend_View();
- $view->setScriptPath('Filemanager/views');
-
- $view->path = '/' . implode('/', $path);
-
+ $this->_getView($path, $node);
$view->files = Filemanager_Controller_DownloadLink::getInstance()->getFileList($download, $path, $node);
header('Content-Type: text/html; charset=utf-8');
*/
protected function _displayFile(Filemanager_Model_DownloadLink $download, Tinebase_Model_Tree_Node $node, $path)
{
- $view = new Zend_View();
- $view->setScriptPath('Filemanager/views');
-
- $view->path = '/' . implode('/', $path);
-
+ $view = $this->_getView($path, $node);
+
$view->file = $node;
$view->file->path = $download->getDownloadUrl('get') . '/' . implode('/', $path);
header('Content-Type: text/html; charset=utf-8');
die($view->render('file.phtml'));
}
+
+ protected function _getView($path = null, $node = null)
+ {
+ $view = new Zend_View();
+ $view->setScriptPath('Filemanager/views');
+
+ $view->logoPath = Tinebase_Core::getUrl() . '/images/tine_logo.png';
+
+ if ($path !== null) {
+ $view->path = (empty($path)) ? '/' . $node->name : '/' . implode('/', $path);
+ }
+ }
/**
* sets download link owner (creator) as current user to ensure ACL handling
<meta http-equiv="X-UA-Compatible" content="IE=8; IE=7" />
</head>
<body>
- <img alt="Tine 2.0" src="/images/tine_logo.png"><h1><?php echo $this->path ?></h1>
+ <img alt="Tine 2.0" src="<?php echo $this->logoPath ?>"><h1><?php echo $this->path ?></h1>
<hr>
<table>
<tr><td>Name:</td><td><?php echo $this->file->name ?></td></tr>
<meta http-equiv="X-UA-Compatible" content="IE=8; IE=7" />
</head>
<body>
- <img alt="Tine 2.0" src="/images/tine_logo.png"><h1><?php echo $this->path ?></h1>
+ <img alt="Tine 2.0" src="<?php echo $this->logoPath ?>"><h1><?php echo $this->path ?></h1>
<hr>
<table>
<tr><th>Name</th><th>letzte Änderung</th><th>Größe</th><th>Beschreibung</th></tr>
<meta http-equiv="X-UA-Compatible" content="IE=8; IE=7" />
</head>
<body>
- <img alt="Tine 2.0" src="/images/tine_logo.png"><h1></h1>
+ <img alt="Tine 2.0" src="<?php echo $this->logoPath ?>"><h1></h1>
File not found!
</body>
</html>
/**
* maintenance mode
*
- * @var bool
+ * @var string
*/
const MAINTENANCE_MODE = 'maintenanceMode';
/**
- * @var array of strings
+ * @var string
*/
const FAT_CLIENT_CUSTOM_JS = 'fatClientCustomJS';
const BRANDING_DESCRIPTION = 'branding_description';
/**
+ * @var string
+ */
+ const USE_LOGINNAME_AS_FOLDERNAME = 'useLoginnameAsFoldername';
+
+ /**
+ * @var string
+ */
+ const VERSION_CHECK = 'versionCheck';
+
+ /**
* (non-PHPdoc)
* @see tine20/Tinebase/Config/Definition::$_properties
*/
'setByAdminModule' => TRUE,
'setBySetupModule' => TRUE,
),
+ self::VERSION_CHECK => array(
+ //_('Version check enabled')
+ 'label' => 'Version check enabled',
+ 'description' => 'Version check enabled',
+ 'type' => 'bool',
+ 'default' => true,
+ 'clientRegistryInclude' => true,
+ 'setByAdminModule' => false,
+ 'setBySetupModule' => false,
+ ),
self::FAT_CLIENT_CUSTOM_JS => array(
// NOTE: it's possible to deliver customjs vom vfs by using the tine20:// streamwrapper
// tine20://<applicationid>/folders/shared/<containerid>/custom.js
'setByAdminModule' => FALSE,
'setBySetupModule' => FALSE,
),
+ self::USE_LOGINNAME_AS_FOLDERNAME => array(
+ //_('Use login name instead of full name')
+ 'label' => 'Use login name instead of full name',
+ //_('Use login name instead of full name for webdav.')
+ 'description' => 'Use login name instead of full name for webdav.',
+ 'type' => 'bool',
+ 'clientRegistryInclude' => FALSE,
+ 'setByAdminModule' => FALSE,
+ 'setBySetupModule' => FALSE,
+ 'default' => FALSE,
+ ),
);
/**
*/
protected function _getCommonModlog($_model, $_backend, $_updateMetaData = array(), $_recordId = NULL)
{
- if (empty($_updateMetaData)) {
+ if (empty($_updateMetaData) || ! isset($_updateMetaData['last_modified_by']) || ! isset($_updateMetaData['last_modified_time'])) {
list($currentAccountId, $currentTime) = Tinebase_Timemachine_ModificationLog::getCurrentAccountIdAndTime();
} else {
$currentAccountId = $_updateMetaData['last_modified_by'];
. ' new contact: ' . print_r($contact->toArray(), true)
. ' orig contact:' . print_r($originalContact->toArray(), true));
- $syncPhoto = isset($options['syncContactPhoto']) && $options['syncContactPhoto'];
- $diff = $contact->diff($originalContact, $syncPhoto ? array() : array('jpegphoto'));
- if (! $diff->isEmpty() || ($originalContact->jpegphoto == 0 && ! empty($contact->jpegphoto))) {
+ if (isset($options['syncContactPhoto']) && $options['syncContactPhoto']) {
+ $syncPhoto = true;
+ if ($originalContact->jpegphoto == 1) {
+ // TODO use generic function with ignoreAcl ...
+ //$originalContact->jpegphoto = Tinebase_Controller::getInstance()->getImage('Addressbook', $originalContact->getId())->getBlob();
+ $adb = new Addressbook_Backend_Sql();
+ $originalContact->jpegphoto = $adb->getImage($originalContact->getId());
+ }
+ if ($contact->jpegphoto == 1) {
+ if (Tinebase_Core::isLogLevel(Zend_Log::INFO)) Tinebase_Core::getLogger()->info(__METHOD__ . '::' . __LINE__
+ . ' Removing/unset current jpegphoto');
+ $contact->jpegphoto = false;
+ }
+ }
+ $diff = $contact->diff($originalContact, $syncPhoto ? array('n_fn') : array('jpegphoto', 'n_fn'));
+ if (! $diff->isEmpty() || ($originalContact->jpegphoto === 0 && ! empty($contact->jpegphoto)) ) {
// add modlog info
Tinebase_Timemachine_ModificationLog::setRecordMetaData($contact, 'update');
if ($contact->container_id !== null) {
$contact->{$contactKey} = $user->{$userKey};
}
}
+
+ if ($contact->n_fn !== $user->accountFullName) {
+ // use accountFullName overwrites contact n_fn
+ $contact->n_fn = $user->accountFullName;
+ }
return $contact;
}
protected $_useIdAsName;
protected static $_classCache = array (
- '_getContact' => array()
+ '_getUser' => array()
);
/**
$this->_path = $path;
$this->_useIdAsName = $useIdAsName;
}
+
+ /**
+ * use login as folder name
+ *
+ * @return boolean
+ */
+ protected function _useLoginAsFolderName()
+ {
+ return Tinebase_Config::getInstance()->get(Tinebase_Config::USE_LOGINNAME_AS_FOLDERNAME);
+ }
/**
* (non-PHPdoc)
* (non-PHPdoc)
* @see \Sabre\DAV\IExtendedCollection::createExtendedCollection()
*/
- function createExtendedCollection($name, array $resourceType, array $properties)
+ public function createExtendedCollection($name, array $resourceType, array $properties)
{
return $this->_createContainer(array(
'name' => isset($properties['{DAV:}displayname']) ? $properties['{DAV:}displayname'] : $name,
} else {
try {
- $contact = $this->_getContact($name);
+ // check if it exists only
+ $this->_getUser($name);
} catch (Tinebase_Exception_NotFound $tenf) {
- throw new \Sabre\DAV\Exception\NotFound("Directory $this->_path/$name not found");
+ $message = "Directory $this->_path/$name not found";
+ if (Tinebase_Core::isLogLevel(Zend_Log::INFO)) Tinebase_Core::getLogger()->info(
+ __METHOD__ . '::' . __LINE__ . ' ' . $message);
+ throw new \Sabre\DAV\Exception\NotFound($message);
}
- $path = $this->_path . '/' . ($this->_useIdAsName ? $contact->getId() : $contact->n_fileas);
+ $path = $this->_path . '/' . $name;
}
} else {
} else {
try {
- $accountId = $this->_getContact(Tinebase_Helper::array_value(1, $this->_getPathParts()))->account_id;
+ $accountId = $this->_getUser(Tinebase_Helper::array_value(1, $this->_getPathParts()))->accountId;
} catch (Tinebase_Exception_NotFound $tenf) {
throw new \Sabre\DAV\Exception\NotFound("Directory $this->_path/$name not found");
if ($this->_hasPersonalFolders) {
$children[] = $this->getChild(
- $this->_useIdAsName ? Tinebase_Core::getUser()->contact_id :
- Addressbook_Controller_Contact::getInstance()->get(Tinebase_Core::getUser()->contact_id)->n_fileas
+ $this->_useIdAsName ? Tinebase_Core::getUser()->contact_id : $this->_useLoginAsFolderName() ? Tinebase_Core::getUser()->accountLoginName : Tinebase_Core::getUser()->accountDisplayName
);
$otherUsers = Tinebase_Container::getInstance()->getOtherUsers(Tinebase_Core::getUser(), $this->_getApplicationName(), array(
foreach ($otherUsers as $user) {
if ($user->contact_id && $user->visibility === Tinebase_Model_User::VISIBILITY_DISPLAYED) {
try {
- $folderId = $this->_useIdAsName ? $user->contact_id :
- Addressbook_Controller_Contact::getInstance()->get($user->contact_id)->n_fileas;
+ $folderId = $this->_useIdAsName ? $user->contact_id : $this->_useLoginAsFolderName() ? $user->accountLoginName : $user->accountDisplayName;
$children[] = $this->getChild($folderId);
} catch (\Sabre\DAV\Exception\NotFound $sdavenf) {
} else {
try {
- $accountId = $this->_getContact(Tinebase_Helper::array_value(1, $this->_getPathParts()))->account_id;
+ $accountId = $this->_getUser(Tinebase_Helper::array_value(1, $this->_getPathParts()))->accountId;
} catch (Tinebase_Exception_NotFound $tenf) {
throw new \Sabre\DAV\Exception\NotFound("Path $this->_path not found");
}
!$this->_useIdAsName
) {
try {
- $contact = $this->_getContact(Tinebase_Helper::array_value(1, $this->_getPathParts()));
+ $user = $this->_getUser(Tinebase_Helper::array_value(1, $this->_getPathParts()));
- $name = $contact->n_fileas;
+ $name = $this->_useLoginAsFolderName() ? $user->accountLoginName : $user->accountDisplayName;
} catch (Tinebase_Exception_NotFound $tenf) {
list(,$name) = Sabre\DAV\URLUtil::splitPath($this->_path);
{
if (count($this->_getPathParts()) === 2 && $this->getName() !== Tinebase_Model_Container::TYPE_SHARED) {
try {
- $contact = $this->_getContact(Tinebase_Helper::array_value(1, $this->_getPathParts()));
+ $user = $this->_getUser(Tinebase_Helper::array_value(1, $this->_getPathParts()));
} catch (Tinebase_Exception_NotFound $tenf) {
return null;
}
- return 'principals/users/' . $contact->getId();
+ return 'principals/users/' . $user->contact_id;
}
return null;
case '{DAV:}displayname':
if (count($this->_getPathParts()) === 2 && $this->getName() !== Tinebase_Model_Container::TYPE_SHARED) {
try {
- $contact = $this->_getContact(Tinebase_Helper::array_value(1, $this->_getPathParts()));
+ $user = $this->_getUser(Tinebase_Helper::array_value(1, $this->_getPathParts()));
+ $contact = Addressbook_Controller_Contact::getInstance()->get($user->contact_id);
} catch (Tinebase_Exception_NotFound $tenf) {
continue;
}
return $pathParts;
}
-
- /**
- * resolve contact_id to Addressbook_Model_Contact
- *
- * @return Addressbook_Model_Contact
- */
- protected function _getContact($contactId)
+
+ protected function _getUser($_id)
{
- $classCacheId = ($this->_useIdAsName ? 'id' : 'n_fileas') . $contactId;
-
+ $classCacheId = ($this->_useIdAsName ? 'contact_id' : $this->_useLoginAsFolderName() ? 'accountLoginName' : 'accountDisplayName') . $_id;
+
if (isset(self::$_classCache[__FUNCTION__][$classCacheId])) {
return self::$_classCache[__FUNCTION__][$classCacheId];
}
-
- $filter = new Addressbook_Model_ContactFilter(array(
- array(
- 'field' => 'type',
- 'operator' => 'equals',
- 'value' => Addressbook_Model_Contact::CONTACTTYPE_USER
- ),
- array(
- 'field' => $this->_useIdAsName ? 'id' : 'n_fileas',
- 'operator' => 'equals',
- 'value' => $contactId
- ),
- ));
-
- $contact = Addressbook_Controller_Contact::getInstance()->search($filter)->getFirstRecord();
-
- if (!$contact) {
- throw new Tinebase_Exception_NotFound('contact not found');
+
+ if ($this->_useIdAsName) {
+ $contact = Addressbook_Controller_Contact::getInstance()->get($_id);
+ $user = Tinebase_User::getInstance()->getUserByPropertyFromSqlBackend('accountId', $contact->account_id, 'Tinebase_Model_FullUser');
+ } else {
+ if ($this->_useLoginAsFolderName()) {
+ $user = Tinebase_User::getInstance()->getUserByPropertyFromSqlBackend('accountLoginName', $_id, 'Tinebase_Model_FullUser');
+ } else {
+ $user = Tinebase_User::getInstance()->getUserByPropertyFromSqlBackend('accountDisplayName', $_id, 'Tinebase_Model_FullUser');
+ }
}
-
- self::$_classCache[__FUNCTION__][$classCacheId] = $contact;
-
- return $contact;
+
+ self::$_classCache[__FUNCTION__][$classCacheId] = $user;
+
+ return $user;
}
}
this.activateDefaultApp();
- // check for new version
- if (Tine.Tinebase.common.hasRight('check_version', 'Tinebase')) {
+ // check for new version
+ // TODO add helper function for fetching config ... this condition sucks.
+ if (( ! Tine.Tinebase.registry.get("config")
+ || ! Tine.Tinebase.registry.get("config").versionCheck
+ || Tine.Tinebase.registry.get("config").versionCheck.value
+ ) && Tine.Tinebase.common.hasRight('check_version', 'Tinebase')
+ ) {
Tine.widgets.VersionCheck();
}
},
{
"name": "syncroton/syncroton",
- "version": "1.2.1",
+ "version": "1.2.2",
"source": {
"type": "git",
"url": "http://git.syncroton.org/Syncroton",
- "reference": "31d151de7cba6fa95ffd34efffd85444ccab0b2d"
+ "reference": "05ff4ef7b67d7ad92ca21a8b086c5e92e090a365"
},
"require": {
"php": ">=5.3.0",