Commit 65eddefe authored by Timo Benk's avatar Timo Benk
Browse files

Merge remote-tracking branch 'origin/master' into endorse-password-for-share-link

parents 8bd37aa6 094ac2e5
......@@ -14,13 +14,23 @@ timestampedNode('SLAVE') {
sh '''make test-js'''
}
stage 'PHPUnit on 7.1'
executeAndReport('tests/autotest-results-sqlite.xml') {
sh '''
export NOCOVERAGE=1
unset USEDOCKER
phpenv local 7.1
make test-php TEST_DATABASE=sqlite
'''
}
stage 'PHPUnit'
executeAndReport('tests/autotest-results-sqlite.xml') {
sh '''
export NOCOVERAGE=1
unset USEDOCKER
phpenv local 7.0
make test-php TEST_DATABASE=sqlite
make test-php TEST_DATABASE=sqlite
'''
}
executeAndReport('tests/autotest-results-mysql.xml') {
......
OC.L10N.register(
"comments",
{
"Type in a new comment..." : "Αυτό είναι ένα νέο σχόλιο...",
"Type in a new comment..." : "Πληκτρολογήστε νέο σχόλιο...",
"Delete comment" : "Διαγραφή σχολίου",
"Post" : "Δημοσίευση",
"Cancel" : "Άκυρο",
......
{ "translations": {
"Type in a new comment..." : "Αυτό είναι ένα νέο σχόλιο...",
"Type in a new comment..." : "Πληκτρολογήστε νέο σχόλιο...",
"Delete comment" : "Διαγραφή σχολίου",
"Post" : "Δημοσίευση",
"Cancel" : "Άκυρο",
......
OC.L10N.register(
"comments",
{
"Type in a new comment..." : "අලුත් අදහසක් දක්වන්න",
"Delete comment" : "අදහස මකන්න",
"Post" : "ලිපිය",
"Cancel" : "එපා",
"Save" : "සුරකින්න"
"Comments" : "අදහස්",
"More comments..." : "වැඩිදුර අදහස්",
"Save" : "සුරකින්න",
"Comment" : "අදහස"
},
"nplurals=2; plural=(n != 1);");
{ "translations": {
"Type in a new comment..." : "අලුත් අදහසක් දක්වන්න",
"Delete comment" : "අදහස මකන්න",
"Post" : "ලිපිය",
"Cancel" : "එපා",
"Save" : "සුරකින්න"
"Comments" : "අදහස්",
"More comments..." : "වැඩිදුර අදහස්",
"Save" : "සුරකින්න",
"Comment" : "අදහස"
},"pluralForm" :"nplurals=2; plural=(n != 1);"
}
\ No newline at end of file
OC.L10N.register(
"dav",
{
"Contact birthdays" : "Γενέθλια Επαφής",
"Contact birthdays" : "Γενέθλια επαφής",
"Personal" : "Προσωπικά",
"Contacts" : "Επαφές",
"Technical details" : "Τεχνικές λεπτομέρειες",
......
{ "translations": {
"Contact birthdays" : "Γενέθλια Επαφής",
"Contact birthdays" : "Γενέθλια επαφής",
"Personal" : "Προσωπικά",
"Contacts" : "Επαφές",
"Technical details" : "Τεχνικές λεπτομέρειες",
......
......@@ -7,6 +7,7 @@ OC.L10N.register(
"Technical details" : "Detalios technic",
"Remote Address: %s" : "Adresse remote: %s",
"Request ID: %s" : "ID de requesta: %s",
"Type: %s" : "Typo: %s",
"Code: %s" : "Codice: %s",
"Message: %s" : "Message: %s",
"File: %s" : "File: %s",
......
......@@ -5,6 +5,7 @@
"Technical details" : "Detalios technic",
"Remote Address: %s" : "Adresse remote: %s",
"Request ID: %s" : "ID de requesta: %s",
"Type: %s" : "Typo: %s",
"Code: %s" : "Codice: %s",
"Message: %s" : "Message: %s",
"File: %s" : "File: %s",
......
OC.L10N.register(
"dav",
{
"Contact birthdays" : "උපන්දින",
"Personal" : "පෞද්ගලික",
"Contacts" : "සබඳතා"
"Contacts" : "සබඳතා",
"Technical details" : "තාක්ෂණික තොරතුරු",
"Remote Address: %s" : "දූරස්ථ ලිපිනය: %s",
"Request ID: %s" : "ඉල්ලීම්: %s",
"Type: %s" : "වර්ගය: %s",
"Code: %s" : "කේතය: %s",
"Message: %s" : "පණිවිඩය: %s",
"File: %s" : "ගොනුව: %s",
"Line: %s" : "රේඛාව: %s",
"Trace" : "අනුරේඛනය"
},
"nplurals=2; plural=(n != 1);");
{ "translations": {
"Contact birthdays" : "උපන්දින",
"Personal" : "පෞද්ගලික",
"Contacts" : "සබඳතා"
"Contacts" : "සබඳතා",
"Technical details" : "තාක්ෂණික තොරතුරු",
"Remote Address: %s" : "දූරස්ථ ලිපිනය: %s",
"Request ID: %s" : "ඉල්ලීම්: %s",
"Type: %s" : "වර්ගය: %s",
"Code: %s" : "කේතය: %s",
"Message: %s" : "පණිවිඩය: %s",
"File: %s" : "ගොනුව: %s",
"Line: %s" : "රේඛාව: %s",
"Trace" : "අනුරේඛනය"
},"pluralForm" :"nplurals=2; plural=(n != 1);"
}
\ No newline at end of file
......@@ -29,6 +29,7 @@ use OCA\DAV\CardDAV\SyncService;
use OCA\DAV\HookManager;
use \OCP\AppFramework\App;
use OCP\Contacts\IManager;
use OCP\IUser;
use Symfony\Component\EventDispatcher\GenericEvent;
class Application extends App {
......@@ -58,6 +59,16 @@ class Application extends App {
$hm = $this->getContainer()->query(HookManager::class);
$hm->setup();
$dispatcher = $this->getContainer()->getServer()->getEventDispatcher();
// first time login event setup
$dispatcher->addListener(IUser::class . '::firstLogin', function ($event) use ($hm) {
if ($event instanceof GenericEvent) {
$hm->firstLogin($event->getSubject());
}
});
// carddav/caldav sync event setup
$listener = function($event) {
if ($event instanceof GenericEvent) {
/** @var BirthdayService $b */
......@@ -70,7 +81,6 @@ class Application extends App {
}
};
$dispatcher = $this->getContainer()->getServer()->getEventDispatcher();
$dispatcher->addListener('\OCA\DAV\CardDAV\CardDavBackend::createCard', $listener);
$dispatcher->addListener('\OCA\DAV\CardDAV\CardDavBackend::updateCard', $listener);
$dispatcher->addListener('\OCA\DAV\CardDAV\CardDavBackend::deleteCard', function($event) {
......
......@@ -64,7 +64,7 @@ class CalendarObject extends \Sabre\CalDAV\CalendarObject {
$vElement = $vObject->VTODO;
}
if(!is_null($vElement)) {
foreach ($vElement->children as &$property) {
foreach ($vElement->children() as &$property) {
/** @var Property $property */
switch($property->name) {
case 'CREATED':
......
<?php
/**
* @author Björn Schießle <bjoern@schiessle.org>
* @author Thomas Müller <thomas.mueller@tmit.eu>
*
* @copyright Copyright (c) 2016, ownCloud GmbH.
* @license AGPL-3.0
......@@ -19,19 +19,23 @@
*
*/
use OCA\Encryption\Command\MigrateKeys;
use Symfony\Component\Console\Helper\QuestionHelper;
namespace OCA\DAV\CalDAV;
$userManager = OC::$server->getUserManager();
$view = new \OC\Files\View();
$config = \OC::$server->getConfig();
$l = \OC::$server->getL10N('encryption');
$userSession = \OC::$server->getUserSession();
$connection = \OC::$server->getDatabaseConnection();
$logger = \OC::$server->getLogger();
$questionHelper = new QuestionHelper();
$crypt = new \OCA\Encryption\Crypto\Crypt($logger, $userSession, $config, $l);
$util = new \OCA\Encryption\Util($view, $crypt, $logger, $userSession, $config, $userManager);
use Sabre\HTTP\URLUtil;
$application->add(new MigrateKeys($userManager, $view, $connection, $config, $logger));
$application->add(new \OCA\Encryption\Command\EnableMasterKey($util, $config, $questionHelper));
class Plugin extends \Sabre\CalDAV\Plugin {
/**
* @inheritdoc
*/
function getCalendarHomeForPrincipal($principalUrl) {
if (strrpos($principalUrl, 'principals/users', -strlen($principalUrl)) !== false) {
list(, $principalId) = URLUtil::splitPath($principalUrl);
return self::CALENDAR_ROOT .'/' . $principalId;
}
return;
}
}
......@@ -27,7 +27,6 @@ use OCP\Constants;
use OCP\IAddressBook;
use OCP\IURLGenerator;
use Sabre\VObject\Component\VCard;
use Sabre\VObject\Property\Text;
use Sabre\VObject\Reader;
use Sabre\VObject\UUIDUtil;
......@@ -207,7 +206,7 @@ class AddressBookImpl implements IAddressBook {
*/
protected function createEmptyVCard($uid) {
$vCard = new VCard();
$vCard->add(new Text($vCard, 'UID', $uid));
$vCard->UID = $uid;
return $vCard;
}
......@@ -223,7 +222,7 @@ class AddressBookImpl implements IAddressBook {
'URI' => $uri,
];
foreach ($vCard->children as $property) {
foreach ($vCard->children() as $property) {
$result[$property->name] = $property->getValue();
if ($property->name === 'PHOTO' && $property->getValueType() === 'BINARY') {
$url = $this->urlGenerator->getAbsoluteURL(
......
......@@ -902,7 +902,7 @@ class CardDavBackend implements BackendInterface, SyncSupport {
]
);
foreach ($vCard->children as $property) {
foreach ($vCard->children() as $property) {
if(!in_array($property->name, self::$indexProperties)) {
continue;
}
......
......@@ -42,16 +42,17 @@ class Converter {
$image = $this->getAvatarImage($user);
$vCard = new VCard();
$vCard->add(new Text($vCard, 'UID', $uid));
$vCard->VERSION = '3.0';
$vCard->UID = $uid;
if (!empty($displayName)) {
$vCard->add(new Text($vCard, 'FN', $displayName));
$vCard->add(new Text($vCard, 'N', $this->splitFullName($displayName)));
$vCard->FN = $displayName;
$vCard->N = $this->splitFullName($displayName);
}
if (!empty($emailAddress)) {
$vCard->add(new Text($vCard, 'EMAIL', $emailAddress, ['TYPE' => 'OTHER']));
}
if (!empty($cloudId)) {
$vCard->add(new Text($vCard, 'CLOUD', $cloudId));
$vCard->CLOUD = $cloudId;
}
if ($image) {
$vCard->add('PHOTO', $image->data(), ['ENCODING' => 'b', 'TYPE' => $image->mimeType()]);
......
......@@ -36,6 +36,7 @@ use Sabre\DAV\INode;
class DavAclPlugin extends \Sabre\DAVACL\Plugin {
public function __construct() {
$this->hideNodesFromListings = true;
$this->allowUnauthenticatedAccess = false;
}
function checkPrivileges($uri, $privileges, $recursion = self::R_PARENT, $throwExceptions = true) {
......
......@@ -45,6 +45,10 @@ class ExceptionLoggerPlugin extends \Sabre\DAV\ServerPlugin {
'Sabre\DAV\Exception\Forbidden' => true,
// Custom exception similar to NotAuthenticated
'OCA\DAV\Connector\Sabre\Exception\PasswordLoginForbidden' => true,
// Happens when an external storage or federated share is temporarily
// not available
'Sabre\DAV\Exception\StorageNotAvailableException' => true,
'OCP\Files\StorageNotAvailableException' => true,
];
/** @var string */
......@@ -89,6 +93,14 @@ class ExceptionLoggerPlugin extends \Sabre\DAV\ServerPlugin {
$level = \OCP\Util::DEBUG;
}
$previous = $ex->getPrevious();
if ($previous !== null) {
$previousExceptionClass = get_class($previous);
if (isset($this->nonFatalExceptions[$previousExceptionClass])) {
$level = \OCP\Util::DEBUG;
}
}
$message = $ex->getMessage();
if ($ex instanceof Exception) {
if (empty($message)) {
......
......@@ -169,7 +169,7 @@ class FilesReportPlugin extends ServerPlugin {
public function onReport($reportName, $report, $uri) {
$reportTargetNode = $this->server->tree->getNodeForPath($uri);
if (!$reportTargetNode instanceof Directory || $reportName !== self::REPORT_NAME) {
throw new ReportNotSupported();
return;
}
$ns = '{' . $this::NS_OWNCLOUD . '}';
......@@ -204,7 +204,8 @@ class FilesReportPlugin extends ServerPlugin {
// find sabre nodes by file id, restricted to the root node path
$results = $this->findNodesByFileIds($reportTargetNode, $resultFileIds);
$responses = $this->prepareResponses($requestedProps, $results);
$filesUri = $this->getFilesBaseUri($uri, $reportTargetNode->getPath());
$responses = $this->prepareResponses($filesUri, $requestedProps, $results);
$xml = $this->server->xml->write(
'{DAV:}multistatus',
......@@ -218,6 +219,31 @@ class FilesReportPlugin extends ServerPlugin {
return false;
}
/**
* Returns the base uri of the files root by removing
* the subpath from the URI
*
* @param string $uri URI from this request
* @param string $subPath subpath to remove from the URI
*
* @return string files base uri
*/
private function getFilesBaseUri($uri, $subPath) {
$uri = trim($uri, '/');
$subPath = trim($subPath, '/');
$filesUri = '';
if (empty($subPath)) {
$filesUri = $uri;
} else {
$filesUri = substr($uri, 0, strlen($uri) - strlen($subPath));
}
$filesUri = trim($filesUri, '/');
if (empty($filesUri)) {
return '';
}
return '/' . $filesUri;
}
/**
* Find file ids matching the given filter rules
*
......@@ -305,14 +331,16 @@ class FilesReportPlugin extends ServerPlugin {
/**
* Prepare propfind response for the given nodes
*
* @param string $filesUri $filesUri URI leading to root of the files URI,
* with a leading slash but no trailing slash
* @param string[] $requestedProps requested properties
* @param Node[] nodes nodes for which to fetch and prepare responses
* @return Response[]
*/
public function prepareResponses($requestedProps, $nodes) {
public function prepareResponses($filesUri, $requestedProps, $nodes) {
$responses = [];
foreach ($nodes as $node) {
$propFind = new PropFind($node->getPath(), $requestedProps);
$propFind = new PropFind($filesUri . $node->getPath(), $requestedProps);
$this->server->getPropertiesByNode($propFind, $node);
// copied from Sabre Server's getPropertiesForPath
......@@ -325,7 +353,7 @@ class FilesReportPlugin extends ServerPlugin {
}
$responses[] = new Response(
rtrim($this->server->getBaseUri(), '/') . $node->getPath(),
rtrim($this->server->getBaseUri(), '/') . $filesUri . $node->getPath(),
$result,
200
);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment