summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/dav/appinfo/register_command.php3
-rw-r--r--apps/dav/command/syncsystemaddressbook.php107
-rw-r--r--apps/dav/lib/carddav/addressbook.php36
-rw-r--r--apps/dav/lib/carddav/addressbookroot.php12
-rw-r--r--apps/dav/lib/carddav/card.php39
-rw-r--r--apps/dav/lib/carddav/carddavbackend.php6
-rw-r--r--apps/dav/lib/carddav/converter.php158
-rw-r--r--apps/dav/lib/carddav/plugin.php47
-rw-r--r--apps/dav/lib/carddav/useraddressbooks.php36
-rw-r--r--apps/dav/lib/dav/systemprincipalbackend.php183
-rw-r--r--apps/dav/lib/rootcollection.php24
-rw-r--r--apps/dav/lib/server.php2
-rw-r--r--apps/dav/tests/travis/caldavtest/config/serverinfo.xml2
-rw-r--r--apps/dav/tests/travis/caldavtest/tests/CardDAV/sync-report.xml10
-rw-r--r--apps/dav/tests/unit/bootstrap.php4
-rw-r--r--apps/dav/tests/unit/carddav/convertertest.php136
-rw-r--r--apps/dav/tests/unit/connector/sabre/custompropertiesbackend.php8
-rw-r--r--apps/dav/tests/unit/connector/sabre/file.php7
-rw-r--r--apps/dav/tests/unit/connector/sabre/objecttree.php7
-rw-r--r--apps/dav/tests/unit/connector/sabre/requesttest/downloadtest.php7
-rw-r--r--apps/dav/tests/unit/connector/sabre/requesttest/encryptionuploadtest.php7
-rw-r--r--apps/dav/tests/unit/connector/sabre/requesttest/uploadtest.php7
-rw-r--r--apps/encryption/lib/crypto/encryptall.php14
-rw-r--r--apps/federation/tests/backgroundjob/getsharedsecrettest.php7
-rw-r--r--apps/files/appinfo/app.php1
-rw-r--r--apps/files/controller/apicontroller.php2
-rw-r--r--apps/files/controller/viewcontroller.php8
-rw-r--r--apps/files/l10n/ja.js3
-rw-r--r--apps/files/l10n/ja.json3
-rw-r--r--apps/files/l10n/nl.js11
-rw-r--r--apps/files/l10n/nl.json11
-rw-r--r--apps/files/l10n/ru.js10
-rw-r--r--apps/files/l10n/ru.json10
-rw-r--r--apps/files/l10n/th_TH.js1
-rw-r--r--apps/files/l10n/th_TH.json1
-rw-r--r--apps/files/lib/activity.php29
-rw-r--r--apps/files/service/tagservice.php2
-rw-r--r--apps/files/tests/activitytest.php42
-rw-r--r--apps/files/tests/command/deleteorphanedfilestest.php7
-rw-r--r--apps/files/tests/controller/ViewControllerTest.php3
-rw-r--r--apps/files/tests/service/tagservice.php7
-rw-r--r--apps/files_external/appinfo/app.php3
-rw-r--r--apps/files_external/appinfo/register_command.php4
-rw-r--r--apps/files_external/command/config.php112
-rw-r--r--apps/files_external/command/option.php85
-rw-r--r--apps/files_external/controller/storagescontroller.php8
-rw-r--r--apps/files_external/js/settings.js1
-rw-r--r--apps/files_external/l10n/ja.js1
-rw-r--r--apps/files_external/l10n/ja.json1
-rw-r--r--apps/files_external/l10n/nl.js1
-rw-r--r--apps/files_external/l10n/nl.json1
-rw-r--r--apps/files_external/l10n/ru.js2
-rw-r--r--apps/files_external/l10n/ru.json2
-rw-r--r--apps/files_external/lib/config.php56
-rw-r--r--apps/files_external/lib/config/configadapter.php1
-rw-r--r--apps/files_external/lib/etagpropagator.php141
-rw-r--r--apps/files_external/lib/sftp.php2
-rw-r--r--apps/files_external/lib/storageconfig.php19
-rw-r--r--apps/files_external/service/storagesservice.php3
-rw-r--r--apps/files_external/tests/amazons3migration.php7
-rw-r--r--apps/files_external/tests/backends/amazons3.php7
-rw-r--r--apps/files_external/tests/backends/dropbox.php7
-rw-r--r--apps/files_external/tests/backends/ftp.php7
-rw-r--r--apps/files_external/tests/backends/google.php7
-rw-r--r--apps/files_external/tests/backends/owncloud.php7
-rw-r--r--apps/files_external/tests/backends/sftp.php7
-rw-r--r--apps/files_external/tests/backends/sftp_key.php7
-rw-r--r--apps/files_external/tests/backends/smb.php7
-rw-r--r--apps/files_external/tests/backends/swift.php7
-rw-r--r--apps/files_external/tests/backends/webdav.php7
-rw-r--r--apps/files_external/tests/etagpropagator.php343
-rw-r--r--apps/files_external/tests/owncloudfunctions.php7
-rw-r--r--apps/files_sharing/api/sharees.php25
-rw-r--r--apps/files_sharing/appinfo/app.php4
-rw-r--r--apps/files_sharing/css/sharetabview.css2
-rw-r--r--apps/files_sharing/js/public.js9
-rw-r--r--apps/files_sharing/l10n/de.js2
-rw-r--r--apps/files_sharing/l10n/de.json2
-rw-r--r--apps/files_sharing/l10n/de_DE.js2
-rw-r--r--apps/files_sharing/l10n/de_DE.json2
-rw-r--r--apps/files_sharing/lib/helper.php16
-rw-r--r--apps/files_sharing/settings-personal.php4
-rw-r--r--apps/files_sharing/tests/activity.php11
-rw-r--r--apps/files_sharing/tests/api.php2
-rw-r--r--apps/files_sharing/tests/api/shareestest.php35
-rw-r--r--apps/files_sharing/tests/backend.php2
-rw-r--r--apps/files_sharing/tests/cache.php6
-rw-r--r--apps/files_sharing/tests/capabilities.php2
-rw-r--r--apps/files_sharing/tests/controller/sharecontroller.php2
-rw-r--r--apps/files_sharing/tests/deleteorphanedsharesjobtest.php7
-rw-r--r--apps/files_sharing/tests/etagpropagation.php7
-rw-r--r--apps/files_sharing/tests/expiresharesjobtest.php7
-rw-r--r--apps/files_sharing/tests/external/cache.php19
-rw-r--r--apps/files_sharing/tests/external/managertest.php7
-rw-r--r--apps/files_sharing/tests/externalstorage.php2
-rw-r--r--apps/files_sharing/tests/helper.php20
-rw-r--r--apps/files_sharing/tests/js/publicAppSpec.js8
-rw-r--r--apps/files_sharing/tests/locking.php7
-rw-r--r--apps/files_sharing/tests/migrationtest.php5
-rw-r--r--apps/files_sharing/tests/permissions.php6
-rw-r--r--apps/files_sharing/tests/server2server.php2
-rw-r--r--apps/files_sharing/tests/share.php2
-rw-r--r--apps/files_sharing/tests/sharedmount.php2
-rw-r--r--apps/files_sharing/tests/sharedstorage.php2
-rw-r--r--apps/files_sharing/tests/sizepropagation.php7
-rw-r--r--apps/files_sharing/tests/testcase.php2
-rw-r--r--apps/files_sharing/tests/unsharechildren.php7
-rw-r--r--apps/files_sharing/tests/updater.php2
-rw-r--r--apps/files_sharing/tests/watcher.php5
-rw-r--r--apps/files_trashbin/tests/command/cleanuptest.php7
-rw-r--r--apps/files_trashbin/tests/command/expiretest.php7
-rw-r--r--apps/files_trashbin/tests/storage.php7
-rw-r--r--apps/files_trashbin/tests/trashbin.php9
-rw-r--r--apps/files_versions/tests/command/cleanuptest.php7
-rw-r--r--apps/files_versions/tests/command/expiretest.php7
-rw-r--r--apps/files_versions/tests/versions.php2
-rw-r--r--apps/provisioning_api/lib/users.php2
-rw-r--r--apps/provisioning_api/tests/appstest.php26
-rw-r--r--apps/provisioning_api/tests/testcase.php5
-rw-r--r--apps/provisioning_api/tests/userstest.php55
-rw-r--r--apps/user_ldap/tests/access.php7
-rw-r--r--apps/user_ldap/tests/connection.php9
-rw-r--r--apps/user_ldap/tests/group_ldap.php7
-rw-r--r--apps/user_ldap/tests/mapping/groupmapping.php7
-rw-r--r--apps/user_ldap/tests/mapping/usermapping.php7
-rw-r--r--apps/user_ldap/tests/user/manager.php7
-rw-r--r--apps/user_ldap/tests/user/user.php7
-rw-r--r--apps/user_ldap/tests/user_ldap.php7
-rw-r--r--apps/user_ldap/tests/wizard.php7
129 files changed, 1631 insertions, 712 deletions
diff --git a/apps/dav/appinfo/register_command.php b/apps/dav/appinfo/register_command.php
index 1f0df054110..af41036cddc 100644
--- a/apps/dav/appinfo/register_command.php
+++ b/apps/dav/appinfo/register_command.php
@@ -2,7 +2,9 @@
use OCA\DAV\Command\CreateAddressBook;
use OCA\DAV\Command\CreateCalendar;
+use OCA\DAV\Command\SyncSystemAddressBook;
+$config = \OC::$server->getConfig();
$dbConnection = \OC::$server->getDatabaseConnection();
$userManager = OC::$server->getUserManager();
$config = \OC::$server->getConfig();
@@ -10,3 +12,4 @@ $config = \OC::$server->getConfig();
/** @var Symfony\Component\Console\Application $application */
$application->add(new CreateAddressBook($userManager, $dbConnection, $config));
$application->add(new CreateCalendar($userManager, $dbConnection));
+$application->add(new SyncSystemAddressBook($userManager, $dbConnection, $config));
diff --git a/apps/dav/command/syncsystemaddressbook.php b/apps/dav/command/syncsystemaddressbook.php
new file mode 100644
index 00000000000..bb2896abc60
--- /dev/null
+++ b/apps/dav/command/syncsystemaddressbook.php
@@ -0,0 +1,107 @@
+<?php
+
+namespace OCA\DAV\Command;
+
+use OCA\DAV\CardDAV\CardDavBackend;
+use OCA\DAV\CardDAV\Converter;
+use OCA\DAV\Connector\Sabre\Principal;
+use OCP\IConfig;
+use OCP\IDBConnection;
+use OCP\IUser;
+use OCP\IUserManager;
+use Sabre\CardDAV\Plugin;
+use Sabre\VObject\Component\VCard;
+use Sabre\VObject\Property\Text;
+use Sabre\VObject\Reader;
+use Symfony\Component\Console\Command\Command;
+use Symfony\Component\Console\Helper\ProgressBar;
+use Symfony\Component\Console\Input\InputArgument;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Output\OutputInterface;
+
+class SyncSystemAddressBook extends Command {
+
+ /** @var IUserManager */
+ protected $userManager;
+
+ /** @var \OCP\IDBConnection */
+ protected $dbConnection;
+
+ /** @var IConfig */
+ protected $config;
+
+ /** @var CardDavBackend */
+ private $backend;
+
+ /**
+ * @param IUserManager $userManager
+ * @param IDBConnection $dbConnection
+ * @param IConfig $config
+ */
+ function __construct(IUserManager $userManager, IDBConnection $dbConnection, IConfig $config) {
+ parent::__construct();
+ $this->userManager = $userManager;
+ $this->dbConnection = $dbConnection;
+ $this->config = $config;
+ }
+
+ protected function configure() {
+ $this
+ ->setName('dav:sync-system-addressbook')
+ ->setDescription('Synchronizes users to the system addressbook');
+ }
+
+ /**
+ * @param InputInterface $input
+ * @param OutputInterface $output
+ */
+ protected function execute(InputInterface $input, OutputInterface $output) {
+ $principalBackend = new Principal(
+ $this->config,
+ $this->userManager
+ );
+
+ $this->backend = new CardDavBackend($this->dbConnection, $principalBackend);
+
+ // ensure system addressbook exists
+ $systemAddressBook = $this->ensureSystemAddressBookExists();
+ $converter = new Converter();
+
+ $output->writeln('Syncing users ...');
+ $progress = new ProgressBar($output);
+ $progress->start();
+ $this->userManager->callForAllUsers(function($user) use ($systemAddressBook, $converter, $progress) {
+ /** @var IUser $user */
+ $name = $user->getBackendClassName();
+ $userId = $user->getUID();
+
+ $cardId = "$name:$userId.vcf";
+ $card = $this->backend->getCard($systemAddressBook['id'], $cardId);
+ if ($card === false) {
+ $vCard = $converter->createCardFromUser($user);
+ $this->backend->createCard($systemAddressBook['id'], $cardId, $vCard->serialize());
+ } else {
+ $vCard = Reader::read($card['carddata']);
+ if ($converter->updateCard($vCard, $user)) {
+ $this->backend->updateCard($systemAddressBook['id'], $cardId, $vCard->serialize());
+ }
+ }
+ $progress->advance();
+ });
+ $progress->finish();
+ $output->writeln('');
+ }
+
+ protected function ensureSystemAddressBookExists() {
+ $book = $this->backend->getAddressBooksByUri('system');
+ if (!is_null($book)) {
+ return $book;
+ }
+ $systemPrincipal = "principals/system/system";
+ $this->backend->createAddressBook($systemPrincipal, 'system', [
+ '{' . Plugin::NS_CARDDAV . '}addressbook-description' => 'System addressbook which holds all users of this instance'
+ ]);
+
+ return $this->backend->getAddressBooksByUri('system');
+ }
+}
diff --git a/apps/dav/lib/carddav/addressbook.php b/apps/dav/lib/carddav/addressbook.php
index eff1ad321e5..507657e9682 100644
--- a/apps/dav/lib/carddav/addressbook.php
+++ b/apps/dav/lib/carddav/addressbook.php
@@ -3,6 +3,7 @@
namespace OCA\DAV\CardDAV;
use OCA\DAV\CardDAV\Sharing\IShareableAddressBook;
+use Sabre\DAV\Exception\NotFound;
class AddressBook extends \Sabre\CardDAV\AddressBook implements IShareableAddressBook {
@@ -51,4 +52,39 @@ class AddressBook extends \Sabre\CardDAV\AddressBook implements IShareableAddres
$carddavBackend = $this->carddavBackend;
$carddavBackend->getShares($this->getName());
}
+
+ function getACL() {
+ $acl = parent::getACL();
+ if ($this->getOwner() === 'principals/system/system') {
+ $acl[] = [
+ 'privilege' => '{DAV:}read',
+ 'principal' => '{DAV:}authenticated',
+ 'protected' => true,
+ ];
+ }
+
+ return $acl;
+ }
+
+ function getChildACL() {
+ $acl = parent::getChildACL();
+ if ($this->getOwner() === 'principals/system/system') {
+ $acl[] = [
+ 'privilege' => '{DAV:}read',
+ 'principal' => '{DAV:}authenticated',
+ 'protected' => true,
+ ];
+ }
+
+ return $acl;
+ }
+
+ function getChild($name) {
+ $obj = $this->carddavBackend->getCard($this->addressBookInfo['id'], $name);
+ if (!$obj) {
+ throw new NotFound('Card not found');
+ }
+ return new Card($this->carddavBackend, $this->addressBookInfo, $obj);
+ }
+
}
diff --git a/apps/dav/lib/carddav/addressbookroot.php b/apps/dav/lib/carddav/addressbookroot.php
index ee99ac8d798..8c78d024556 100644
--- a/apps/dav/lib/carddav/addressbookroot.php
+++ b/apps/dav/lib/carddav/addressbookroot.php
@@ -20,4 +20,14 @@ class AddressBookRoot extends \Sabre\CardDAV\AddressBookRoot {
}
-} \ No newline at end of file
+ function getName() {
+
+ // Grabbing all the components of the principal path.
+ $parts = explode('/', $this->principalPrefix);
+
+ // We are only interested in the second part.
+ return $parts[1];
+
+ }
+
+}
diff --git a/apps/dav/lib/carddav/card.php b/apps/dav/lib/carddav/card.php
new file mode 100644
index 00000000000..cea0b1e41c7
--- /dev/null
+++ b/apps/dav/lib/carddav/card.php
@@ -0,0 +1,39 @@
+<?php
+/**
+ * @author Thomas Müller <thomas.mueller@tmit.eu>
+ *
+ * @copyright Copyright (c) 2015, ownCloud, Inc.
+ * @license AGPL-3.0
+ *
+ * This code is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License, version 3,
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+namespace OCA\DAV\CardDAV;
+
+class Card extends \Sabre\CardDAV\Card {
+
+ function getACL() {
+ $acl = parent::getACL();
+ if ($this->getOwner() === 'principals/system/system') {
+ $acl[] = [
+ 'privilege' => '{DAV:}read',
+ 'principal' => '{DAV:}authenticated',
+ 'protected' => true,
+ ];
+ }
+
+ return $acl;
+ }
+
+}
diff --git a/apps/dav/lib/carddav/carddavbackend.php b/apps/dav/lib/carddav/carddavbackend.php
index daa31725fa1..29b056672b4 100644
--- a/apps/dav/lib/carddav/carddavbackend.php
+++ b/apps/dav/lib/carddav/carddavbackend.php
@@ -108,7 +108,7 @@ class CardDavBackend implements BackendInterface, SyncSupport {
return $addressBooks;
}
- private function getAddressBooksByUri($addressBookUri) {
+ public function getAddressBooksByUri($addressBookUri) {
$query = $this->db->getQueryBuilder();
$result = $query->select(['id', 'uri', 'displayname', 'principaluri', 'description', 'synctoken'])
->from('addressbooks')
@@ -117,10 +117,10 @@ class CardDavBackend implements BackendInterface, SyncSupport {
->execute();
$row = $result->fetch();
- if (is_null($row)) {
+ $result->closeCursor();
+ if ($row === false) {
return null;
}
- $result->closeCursor();
return [
'id' => $row['id'],
diff --git a/apps/dav/lib/carddav/converter.php b/apps/dav/lib/carddav/converter.php
new file mode 100644
index 00000000000..56b73eba4c0
--- /dev/null
+++ b/apps/dav/lib/carddav/converter.php
@@ -0,0 +1,158 @@
+<?php
+/**
+ * @author Thomas Müller <thomas.mueller@tmit.eu>
+ *
+ * @copyright Copyright (c) 2015, ownCloud, Inc.
+ * @license AGPL-3.0
+ *
+ * This code is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License, version 3,
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+namespace OCA\DAV\CardDAV;
+
+use OCP\IImage;
+use OCP\IUser;
+use Sabre\VObject\Component\VCard;
+use Sabre\VObject\Property\Text;
+
+class Converter {
+
+ /**
+ * @param IUser $user
+ * @return VCard
+ */
+ public function createCardFromUser(IUser $user) {
+
+ $uid = $user->getUID();
+ $displayName = $user->getDisplayName();
+ $displayName = empty($displayName ) ? $uid : $displayName;
+ $emailAddress = $user->getEMailAddress();
+ $cloudId = $user->getCloudId();
+ $image = $user->getAvatarImage(-1);
+
+ $vCard = new VCard();
+ $vCard->add(new Text($vCard, 'UID', $uid));
+ if (!empty($displayName)) {
+ $vCard->add(new Text($vCard, 'FN', $displayName));
+ $vCard->add(new Text($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));
+ }
+ if ($image) {
+ $vCard->add('PHOTO', $image->data(), ['ENCODING' => 'b', 'TYPE' => $image->mimeType()]);
+ }
+ $vCard->validate();
+
+ return $vCard;
+ }
+
+ /**
+ * @param VCard $vCard
+ * @param IUser $user
+ * @return bool
+ */
+ public function updateCard(VCard $vCard, IUser $user) {
+ $uid = $user->getUID();
+ $displayName = $user->getDisplayName();
+ $displayName = empty($displayName ) ? $uid : $displayName;
+ $emailAddress = $user->getEMailAddress();
+ $cloudId = $user->getCloudId();
+ $image = $user->getAvatarImage(-1);
+
+ $updated = false;
+ if($this->propertyNeedsUpdate($vCard, 'FN', $displayName)) {
+ $vCard->FN = new Text($vCard, 'FN', $displayName);
+ unset($vCard->N);
+ $vCard->add(new Text($vCard, 'N', $this->splitFullName($displayName)));
+ $updated = true;
+ }
+ if($this->propertyNeedsUpdate($vCard, 'EMAIL', $emailAddress)) {
+ $vCard->EMAIL = new Text($vCard, 'EMAIL', $emailAddress);
+ $updated = true;
+ }
+ if($this->propertyNeedsUpdate($vCard, 'CLOUD', $cloudId)) {
+ $vCard->CLOUD = new Text($vCard, 'CLOUD', $cloudId);
+ $updated = true;
+ }
+
+ if($this->propertyNeedsUpdate($vCard, 'PHOTO', $image)) {
+ $vCard->add('PHOTO', $image->data(), ['ENCODING' => 'b', 'TYPE' => $image->mimeType()]);
+ $updated = true;
+ }
+
+ if (empty($emailAddress) && !is_null($vCard->EMAIL)) {
+ unset($vCard->EMAIL);
+ $updated = true;
+ }
+ if (empty($cloudId) && !is_null($vCard->CLOUD)) {
+ unset($vCard->CLOUD);
+ $updated = true;
+ }
+ if (empty($image) && !is_null($vCard->PHOTO)) {
+ unset($vCard->PHOTO);
+ $updated = true;
+ }
+
+ return $updated;
+ }
+
+ /**
+ * @param VCard $vCard
+ * @param string $name
+ * @param string|IImage $newValue
+ * @return bool
+ */
+ private function propertyNeedsUpdate(VCard $vCard, $name, $newValue) {
+ if (is_null($newValue)) {
+ return false;
+ }
+ $value = $vCard->__get($name);
+ if (!is_null($value)) {
+ $value = $value->getValue();
+ $newValue = $newValue instanceof IImage ? $newValue->data() : $newValue;
+
+ return $value !== $newValue;
+ }
+ return true;
+ }
+
+ /**
+ * @param string $fullName
+ * @return string[]
+ */
+ public function splitFullName($fullName) {
+ // Very basic western style parsing. I'm not gonna implement
+ // https://github.com/android/platform_packages_providers_contactsprovider/blob/master/src/com/android/providers/contacts/NameSplitter.java ;)
+
+ $elements = explode(' ', $fullName);
+ $result = ['', '', '', '', ''];
+ if (count($elements) > 2) {
+ $result[0] = implode(' ', array_slice($elements, count($elements)-1));
+ $result[1] = $elements[0];
+ $result[2] = implode(' ', array_slice($elements, 1, count($elements)-2));
+ } elseif (count($elements) === 2) {
+ $result[0] = $elements[1];
+ $result[1] = $elements[0];
+ } else {
+ $result[0] = $elements[0];
+ }
+
+ return $result;
+ }
+
+}
diff --git a/apps/dav/lib/carddav/plugin.php b/apps/dav/lib/carddav/plugin.php
new file mode 100644
index 00000000000..f2b3dcbfda9
--- /dev/null
+++ b/apps/dav/lib/carddav/plugin.php
@@ -0,0 +1,47 @@
+<?php
+/**
+ * @author Thomas Müller <thomas.mueller@tmit.eu>
+ *
+ * @copyright Copyright (c) 2015, ownCloud, Inc.
+ * @license AGPL-3.0
+ *
+ * This code is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License, version 3,
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+namespace OCA\DAV\CardDAV;
+
+use Sabre\HTTP\URLUtil;
+
+class Plugin extends \Sabre\CardDAV\Plugin {
+
+ /**
+ * Returns the addressbook home for a given principal
+ *
+ * @param string $principal
+ * @return string
+ */
+ protected function getAddressbookHomeForPrincipal($principal) {
+
+ if (strrpos($principal, 'principals/users', -strlen($principal)) !== FALSE) {
+ list(, $principalId) = URLUtil::splitPath($principal);
+ return self::ADDRESSBOOK_ROOT . '/users/' . $principalId;
+ }
+ if (strrpos($principal, 'principals/system', -strlen($principal)) !== FALSE) {
+ list(, $principalId) = URLUtil::splitPath($principal);
+ return self::ADDRESSBOOK_ROOT . '/system/' . $principalId;
+ }
+
+ throw new \LogicException('This is not supposed to happen');
+ }
+}
diff --git a/apps/dav/lib/carddav/useraddressbooks.php b/apps/dav/lib/carddav/useraddressbooks.php
index 5f618a0ece3..093cee0e1b2 100644
--- a/apps/dav/lib/carddav/useraddressbooks.php
+++ b/apps/dav/lib/carddav/useraddressbooks.php
@@ -11,13 +11,39 @@ class UserAddressBooks extends \Sabre\CardDAV\AddressBookHome {
*/
function getChildren() {
- $addressbooks = $this->carddavBackend->getAddressBooksForUser($this->principalUri);
- $objs = [];
- foreach($addressbooks as $addressbook) {
- $objs[] = new AddressBook($this->carddavBackend, $addressbook);
+ $addressBooks = $this->carddavBackend->getAddressBooksForUser($this->principalUri);
+ $objects = [];
+ foreach($addressBooks as $addressBook) {
+ $objects[] = new AddressBook($this->carddavBackend, $addressBook);
}
- return $objs;
+ return $objects;
}
+ /**
+ * Returns a list of ACE's for this node.
+ *
+ * Each ACE has the following properties:
+ * * 'privilege', a string such as {DAV:}read or {DAV:}write. These are
+ * currently the only supported privileges
+ * * 'principal', a url to the principal who owns the node
+ * * 'protected' (optional), indicating that this ACE is not allowed to
+ * be updated.
+ *
+ * @return array
+ */
+ function getACL() {
+
+ $acl = parent::getACL();
+ if ($this->principalUri === 'principals/system/system') {
+ $acl[] = [
+ 'privilege' => '{DAV:}read',
+ 'principal' => '{DAV:}authenticated',
+ 'protected' => true,
+ ];
+ }
+
+ return $acl;
+ }
+
}
diff --git a/apps/dav/lib/dav/systemprincipalbackend.php b/apps/dav/lib/dav/systemprincipalbackend.php
new file mode 100644
index 00000000000..2c2049ace60
--- /dev/null
+++ b/apps/dav/lib/dav/systemprincipalbackend.php
@@ -0,0 +1,183 @@
+<?php
+/**
+ * @author Thomas Müller <thomas.mueller@tmit.eu>
+ *
+ * @copyright Copyright (c) 2015, ownCloud, Inc.
+ * @license AGPL-3.0
+ *
+ * This code is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License, version 3,
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+namespace OCA\DAV\DAV;
+
+use Sabre\DAVACL\PrincipalBackend\AbstractBackend;
+use Sabre\HTTP\URLUtil;
+
+class SystemPrincipalBackend extends AbstractBackend {
+
+ /**
+ * Returns a list of principals based on a prefix.
+ *
+ * This prefix will often contain something like 'principals'. You are only
+ * expected to return principals that are in this base path.
+ *
+ * You are expected to return at least a 'uri' for every user, you can
+ * return any additional properties if you wish so. Common properties are:
+ * {DAV:}displayname
+ * {http://sabredav.org/ns}email-address - This is a custom SabreDAV
+ * field that's actually injected in a number of other properties. If
+ * you have an email address, use this property.
+ *
+ * @param string $prefixPath
+ * @return array
+ */
+ function getPrincipalsByPrefix($prefixPath) {
+ $principals = [];
+
+ if ($prefixPath === 'principals/system') {
+ $principals[] = [
+ 'uri' => 'principals/system/system',
+ '{DAV:}displayname' => 'system',
+ ];
+ }
+
+ return $principals;
+ }
+
+ /**
+ * Returns a specific principal, specified by it's path.
+ * The returned structure should be the exact same as from
+ * getPrincipalsByPrefix.
+ *
+ * @param string $path
+ * @return array
+ */
+ function getPrincipalByPath($path) {
+
+ $elements = explode('/', $path);
+ if ($elements[0] !== 'principals') {
+ return null;
+ }
+ if ($elements[1] === 'system') {
+ $principal = [
+ 'uri' => 'principals/system/system',
+ '{DAV:}displayname' => 'system',
+ ];
+ return $principal;
+ }
+
+ return null;
+ }
+
+ /**
+ * Updates one ore more webdav properties on a principal.
+ *
+ * The list of mutations is stored in a Sabre\DAV\PropPatch object.
+ * To do the actual updates, you must tell this object which properties
+ * you're going to process with the handle() method.
+ *
+ * Calling the handle method is like telling the PropPatch object "I
+ * promise I can handle updating this property".
+ *
+ * Read the PropPatch documentation for more info and examples.
+ *
+ * @param string $path
+ * @param \Sabre\DAV\PropPatch $propPatch
+ * @return void
+ */
+ function updatePrincipal($path, \Sabre\DAV\PropPatch $propPatch) {
+ }
+
+ /**
+ * This method is used to search for principals matching a set of
+ * properties.
+ *
+ * This search is specifically used by RFC3744's principal-property-search
+ * REPORT.
+ *
+ * The actual search should be a unicode-non-case-sensitive search. The
+ * keys in searchProperties are the WebDAV property names, while the values
+ * are the property values to search on.
+ *
+ * By default, if multiple properties are submitted to this method, the
+ * various properties should be combined with 'AND'. If $test is set to
+ * 'anyof', it should be combined using 'OR'.
+ *
+ * This method should simply return an array with full principal uri's.
+ *
+ * If somebody attempted to search on a property the backend does not
+ * support, you should simply return 0 results.
+ *
+ * You can also just return 0 results if you choose to not support
+ * searching at all, but keep in mind that this may stop certain features
+ * from working.
+ *
+ * @param string $prefixPath
+ * @param array $searchProperties
+ * @param string $test
+ * @return array
+ */
+ function searchPrincipals($prefixPath, array $searchProperties, $test = 'allof') {
+ return [];
+ }
+
+ /**
+ * Returns the list of members for a group-principal
+ *
+ * @param string $principal
+ * @return array
+ */
+ function getGroupMemberSet($principal) {
+ // TODO: for now the group principal has only one member, the user itself
+ $principal = $this->getPrincipalByPath($principal);
+ if (!$principal) {
+ throw new \Sabre\DAV\Exception('Principal not found');
+ }
+
+ return [$principal['uri']];
+ }
+
+ /**
+ * Returns the list of groups a principal is a member of
+ *
+ * @param string $principal
+ * @return array
+ */
+ function getGroupMembership($principal) {
+ list($prefix, $name) = URLUtil::splitPath($principal);
+
+ if ($prefix === 'principals/system') {
+ $principal = $this->getPrincipalByPath($principal);
+ if (!$principal) {
+ throw new \Sabre\DAV\Exception('Principal not found');
+ }
+
+ return [];
+ }
+ return [];
+ }
+
+ /**
+ * Updates the list of group members for a group principal.
+ *
+ * The principals should be passed as a list of uri's.
+ *
+ * @param string $principal
+ * @param array $members
+ * @return void
+ */
+ function setGroupMemberSet($principal, array $members) {
+ throw new \Sabre\DAV\Exception('Setting members of the group is not supported yet');
+ }
+}
diff --git a/apps/dav/lib/rootcollection.php b/apps/dav/lib/rootcollection.php
index 3e349fa31c9..c1635c9cde5 100644
--- a/apps/dav/lib/rootcollection.php
+++ b/apps/dav/lib/rootcollection.php
@@ -6,6 +6,7 @@ use OCA\DAV\CalDAV\CalDavBackend;
use OCA\DAV\CardDAV\AddressBookRoot;
use OCA\DAV\CardDAV\CardDavBackend;
use OCA\DAV\Connector\Sabre\Principal;
+use OCA\DAV\DAV\SystemPrincipalBackend;
use Sabre\CalDAV\CalendarRoot;
use Sabre\CalDAV\Principal\Collection;
use Sabre\DAV\SimpleCollection;
@@ -23,24 +24,33 @@ class RootCollection extends SimpleCollection {
$disableListing = !$config->getSystemValue('debug', false);
// setup the first level of the dav tree
- $principalCollection = new Collection($principalBackend, 'principals/users');
- $principalCollection->disableListing = $disableListing;
+ $userPrincipals = new Collection($principalBackend, 'principals/users');
+ $userPrincipals->disableListing = $disableListing;
+ $systemPrincipals = new Collection(new SystemPrincipalBackend(), 'principals/system');
+ $systemPrincipals->disableListing = $disableListing;
$filesCollection = new Files\RootCollection($principalBackend, 'principals/users');
$filesCollection->disableListing = $disableListing;
$caldavBackend = new CalDavBackend($db);
$calendarRoot = new CalendarRoot($principalBackend, $caldavBackend, 'principals/users');
$calendarRoot->disableListing = $disableListing;
- $cardDavBackend = new CardDavBackend(\OC::$server->getDatabaseConnection(), $principalBackend);
+ $usersCardDavBackend = new CardDavBackend($db, $principalBackend);
+ $usersAddressBookRoot = new AddressBookRoot($principalBackend, $usersCardDavBackend, 'principals/users');
+ $usersAddressBookRoot->disableListing = $disableListing;
- $addressBookRoot = new AddressBookRoot($principalBackend, $cardDavBackend, 'principals/users');
- $addressBookRoot->disableListing = $disableListing;
+ $systemCardDavBackend = new CardDavBackend($db, $principalBackend);
+ $systemAddressBookRoot = new AddressBookRoot(new SystemPrincipalBackend(), $systemCardDavBackend, 'principals/system');
+ $systemAddressBookRoot->disableListing = $disableListing;
$children = [
- new SimpleCollection('principals', [$principalCollection]),
+ new SimpleCollection('principals', [
+ $userPrincipals,
+ $systemPrincipals]),
$filesCollection,
$calendarRoot,
- $addressBookRoot,
+ new SimpleCollection('addressbooks', [
+ $usersAddressBookRoot,
+ $systemAddressBookRoot]),
];
parent::__construct('root', $children);
diff --git a/apps/dav/lib/server.php b/apps/dav/lib/server.php
index ffdb917085e..a031f2c442b 100644
--- a/apps/dav/lib/server.php
+++ b/apps/dav/lib/server.php
@@ -58,7 +58,7 @@ class Server {
$this->server->addPlugin(new CardDAV\Sharing\Plugin($authBackend, \OC::$server->getRequest()));
// addressbook plugins
- $this->server->addPlugin(new \Sabre\CardDAV\Plugin());
+ $this->server->addPlugin(new \OCA\DAV\CardDAV\Plugin());
// Finder on OS X requires Class 2 WebDAV support (locking), since we do
// not provide locking we emulate it using a fake locking plugin.
diff --git a/apps/dav/tests/travis/caldavtest/config/serverinfo.xml b/apps/dav/tests/travis/caldavtest/config/serverinfo.xml
index a474bb7135c..c80e47f9481 100644
--- a/apps/dav/tests/travis/caldavtest/config/serverinfo.xml
+++ b/apps/dav/tests/travis/caldavtest/config/serverinfo.xml
@@ -569,7 +569,7 @@
<!-- relative path to user addressbook home-->
<substitution>
<key>$addressbookhome%d:</key>
- <value>$addressbooks:$userid%d:</value>
+ <value>$addressbooks:users/$userid%d:</value>
</substitution>
<!-- relative path to user addressbook-->
<substitution>
diff --git a/apps/dav/tests/travis/caldavtest/tests/CardDAV/sync-report.xml b/apps/dav/tests/travis/caldavtest/tests/CardDAV/sync-report.xml
index 0321e61edbc..ffa6662981c 100644
--- a/apps/dav/tests/travis/caldavtest/tests/CardDAV/sync-report.xml
+++ b/apps/dav/tests/travis/caldavtest/tests/CardDAV/sync-report.xml
@@ -181,8 +181,7 @@
</verify>
</request>
</test>
- <!--
- <test name='6'>
+ <!-- test name='6'>
<require-feature>
<feature>sync-report-home</feature>
</require-feature>
@@ -236,7 +235,7 @@
</arg>
</verify>
</request>
- </test>
+ </test -->
<test name='8'>
<description>remove new resource</description>
<request>
@@ -264,14 +263,15 @@
<callback>multistatusItems</callback>
<arg>
<name>okhrefs</name>
- <value>$calendar_sync_extra_items:</value>
+ <!-- no sync on addressbook level -->
+ <!--<value>$calendar_sync_extra_items:</value>-->
<value>1.vcf</value>
<value>2.vcf</value>
</arg>
</verify>
</request>
</test>
- <test name='10'>
+ <!--test name='10'>
<require-feature>
<feature>sync-report-home</feature>
</require-feature>
diff --git a/apps/dav/tests/unit/bootstrap.php b/apps/dav/tests/unit/bootstrap.php
index 28f6b971dec..b6ea48ec903 100644
--- a/apps/dav/tests/unit/bootstrap.php
+++ b/apps/dav/tests/unit/bootstrap.php
@@ -1,6 +1,8 @@
<?php
-define('PHPUNIT_RUN', 1);
+if (!defined('PHPUNIT_RUN')) {
+ define('PHPUNIT_RUN', 1);
+}
require_once __DIR__.'/../../../../lib/base.php';
diff --git a/apps/dav/tests/unit/carddav/convertertest.php b/apps/dav/tests/unit/carddav/convertertest.php
new file mode 100644
index 00000000000..f4e2ea3f002
--- /dev/null
+++ b/apps/dav/tests/unit/carddav/convertertest.php
@@ -0,0 +1,136 @@
+<?php
+/**
+ * @author Thomas Müller <thomas.mueller@tmit.eu>
+ *
+ * @copyright Copyright (c) 2015, ownCloud, Inc.
+ * @license AGPL-3.0
+ *
+ * This code is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License, version 3,
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+namespace OCA\DAV\Tests\Unit;
+
+use OCA\DAV\CardDAV\Converter;
+use Test\TestCase;
+
+class ConverterTests extends TestCase {
+
+ /**
+ * @dataProvider providesNewUsers
+ */
+ public function testCreation($expectedVCard, $displayName = null, $eMailAddress = null, $cloudId = null) {
+ $user = $this->getUserMock($displayName, $eMailAddress, $cloudId);
+
+ $converter = new Converter();
+ $vCard = $converter->createCardFromUser($user);
+ $cardData = $vCard->serialize();
+
+ $this->assertEquals($expectedVCard, $cardData);
+ }
+
+ public function providesNewUsers() {
+ return [
+ ["BEGIN:VCARD\r\nVERSION:3.0\r\nPRODID:-//Sabre//Sabre VObject 3.4.7//EN\r\nUID:12345\r\nFN:12345\r\nN:12345;;;;\r\nPHOTO;ENCODING=b;TYPE=JPEG:MTIzNDU2Nzg5\r\nEND:VCARD\r\n"],
+ ["BEGIN:VCARD\r\nVERSION:3.0\r\nPRODID:-//Sabre//Sabre VObject 3.4.7//EN\r\nUID:12345\r\nFN:Dr. Foo Bar\r\nN:Bar;Dr.;Foo;;\r\nPHOTO;ENCODING=b;TYPE=JPEG:MTIzNDU2Nzg5\r\nEND:VCARD\r\n", "Dr. Foo Bar"],
+ ["BEGIN:VCARD\r\nVERSION:3.0\r\nPRODID:-//Sabre//Sabre VObject 3.4.7//EN\r\nUID:12345\r\nFN:Dr. Foo Bar\r\nN:Bar;Dr.;Foo;;\r\nEMAIL;TYPE=OTHER:foo@bar.net\r\nPHOTO;ENCODING=b;TYPE=JPEG:MTIzNDU2Nzg5\r\nEND:VCARD\r\n", "Dr. Foo Bar", "foo@bar.net"],
+ ["BEGIN:VCARD\r\nVERSION:3.0\r\nPRODID:-//Sabre//Sabre VObject 3.4.7//EN\r\nUID:12345\r\nFN:Dr. Foo Bar\r\nN:Bar;Dr.;Foo;;\r\nCLOUD:foo@bar.net\r\nPHOTO;ENCODING=b;TYPE=JPEG:MTIzNDU2Nzg5\r\nEND:VCARD\r\n", "Dr. Foo Bar", null, "foo@bar.net"],
+ ];
+ }
+
+ /**
+ * @dataProvider providesNewUsers
+ */
+ public function testUpdateOfUnchangedUser($expectedVCard, $displayName = null, $eMailAddress = null, $cloudId = null) {
+ $user = $this->getUserMock($displayName, $eMailAddress, $cloudId);
+
+ $converter = new Converter();
+ $vCard = $converter->createCardFromUser($user);
+ $updated = $converter->updateCard($vCard, $user);
+ $this->assertFalse($updated);
+ $cardData = $vCard->serialize();
+
+ $this->assertEquals($expectedVCard, $cardData);
+ }
+
+ /**
+ * @dataProvider providesUsersForUpdateOfRemovedElement
+ */
+ public function testUpdateOfRemovedElement($expectedVCard, $displayName = null, $eMailAddress = null, $cloudId = null) {
+ $user = $this->getUserMock($displayName, $eMailAddress, $cloudId);
+
+ $converter = new Converter();
+ $vCard = $converter->createCardFromUser($user);
+
+ $user1 = $this->getMockBuilder('OCP\IUser')->disableOriginalConstructor()->getMock();
+ $user1->method('getUID')->willReturn('12345');
+ $user1->method('getDisplayName')->willReturn(null);
+ $user1->method('getEMailAddress')->willReturn(null);
+ $user1->method('getCloudId')->willReturn(null);
+ $user1->method('getAvatarImage')->willReturn(null);
+
+ $updated = $converter->updateCard($vCard, $user1);
+ $this->assertTrue($updated);
+ $cardData = $vCard->serialize();
+
+ $this->assertEquals($expectedVCard, $cardData);
+ }
+
+ public function providesUsersForUpdateOfRemovedElement() {
+ return [
+ ["BEGIN:VCARD\r\nVERSION:3.0\r\nPRODID:-//Sabre//Sabre VObject 3.4.7//EN\r\nUID:12345\r\nFN:12345\r\nN:12345;;;;\r\nEND:VCARD\r\n", "Dr. Foo Bar"],
+ ["BEGIN:VCARD\r\nVERSION:3.0\r\nPRODID:-//Sabre//Sabre VObject 3.4.7//EN\r\nUID:12345\r\nFN:12345\r\nN:12345;;;;\r\nEND:VCARD\r\n", "Dr. Foo Bar", "foo@bar.net"],
+ ["BEGIN:VCARD\r\nVERSION:3.0\r\nPRODID:-//Sabre//Sabre VObject 3.4.7//EN\r\nUID:12345\r\nFN:12345\r\nN:12345;;;;\r\nEND:VCARD\r\n", "Dr. Foo Bar", null, "foo@bar.net"],
+ ];
+ }
+
+ /**
+ * @dataProvider providesNames
+ * @param $expected
+ * @param $fullName
+ */
+ public function testNameSplitter($expected, $fullName) {
+
+ $converter = new Converter();
+ $r = $converter->splitFullName($fullName);
+ $r = implode(';', $r);
+ $this->assertEquals($expected, $r);
+ }
+
+ public function providesNames() {
+ return [
+ ['Sauron;;;;', 'Sauron'],
+ ['Baggins;Bilbo;;;', 'Bilbo Baggins'],
+ ['Tolkien;John;Ronald Reuel;;', 'John Ronald Reuel Tolkien'],
+ ];
+ }
+
+ /**
+ * @param $displayName
+ * @param $eMailAddress
+ * @param $cloudId
+ * @return \PHPUnit_Framework_MockObject_MockObject
+ */
+ protected function getUserMock($displayName, $eMailAddress, $cloudId) {
+ $image0 = $this->getMockBuilder('OCP\IImage')->disableOriginalConstructor()->getMock();
+ $image0->method('mimeType')->willReturn('JPEG');
+ $image0->method('data')->willReturn('123456789');
+ $user = $this->getMockBuilder('OCP\IUser')->disableOriginalConstructor()->getMock();
+ $user->method('getUID')->willReturn('12345');
+ $user->method('getDisplayName')->willReturn($displayName);
+ $user->method('getEMailAddress')->willReturn($eMailAddress);
+ $user->method('getCloudId')->willReturn($cloudId);
+ $user->method('getAvatarImage')->willReturn($image0);
+ return $user;
+ }
+}
diff --git a/apps/dav/tests/unit/connector/sabre/custompropertiesbackend.php b/apps/dav/tests/unit/connector/sabre/custompropertiesbackend.php
index e1bcc996908..1a973a28ed4 100644
--- a/apps/dav/tests/unit/connector/sabre/custompropertiesbackend.php
+++ b/apps/dav/tests/unit/connector/sabre/custompropertiesbackend.php
@@ -8,6 +8,14 @@ namespace OCA\DAV\Tests\Unit\Connector\Sabre;
* later.
* See the COPYING-README file.
*/
+
+/**
+ * Class CustomPropertiesBackend
+ *
+ * @group DB
+ *
+ * @package Tests\Connector\Sabre
+ */
class CustomPropertiesBackend extends \Test\TestCase {
/**
diff --git a/apps/dav/tests/unit/connector/sabre/file.php b/apps/dav/tests/unit/connector/sabre/file.php
index 0a52299cec7..2a6cf46ef16 100644
--- a/apps/dav/tests/unit/connector/sabre/file.php
+++ b/apps/dav/tests/unit/connector/sabre/file.php
@@ -14,6 +14,13 @@ use Test\HookHelper;
use OC\Files\Filesystem;
use OCP\Lock\ILockingProvider;
+/**
+ * Class File
+ *
+ * @group DB
+ *
+ * @package Test\Connector\Sabre
+ */
class File extends \Test\TestCase {
/**
diff --git a/apps/dav/tests/unit/connector/sabre/objecttree.php b/apps/dav/tests/unit/connector/sabre/objecttree.php
index 3a56404e552..1cea4ff0b69 100644
--- a/apps/dav/tests/unit/connector/sabre/objecttree.php
+++ b/apps/dav/tests/unit/connector/sabre/objecttree.php
@@ -41,6 +41,13 @@ class TestDoubleFileView extends \OC\Files\View {
}
}
+/**
+ * Class ObjectTree
+ *
+ * @group DB
+ *
+ * @package OCA\DAV\Tests\Unit\Connector\Sabre
+ */
class ObjectTree extends \Test\TestCase {
/**
diff --git a/apps/dav/tests/unit/connector/sabre/requesttest/downloadtest.php b/apps/dav/tests/unit/connector/sabre/requesttest/downloadtest.php
index 245deff3b31..29454c38218 100644
--- a/apps/dav/tests/unit/connector/sabre/requesttest/downloadtest.php
+++ b/apps/dav/tests/unit/connector/sabre/requesttest/downloadtest.php
@@ -11,6 +11,13 @@ namespace OCA\DAV\Tests\Unit\Connector\Sabre\RequestTest;
use OCP\AppFramework\Http;
use OCP\Lock\ILockingProvider;
+/**
+ * Class DownloadTest
+ *
+ * @group DB
+ *
+ * @package OCA\DAV\Tests\Unit\Connector\Sabre\RequestTest
+ */
class DownloadTest extends RequestTest {
public function testDownload() {
$user = $this->getUniqueID();
diff --git a/apps/dav/tests/unit/connector/sabre/requesttest/encryptionuploadtest.php b/apps/dav/tests/unit/connector/sabre/requesttest/encryptionuploadtest.php
index ed1d6046d75..b79dfa0c265 100644
--- a/apps/dav/tests/unit/connector/sabre/requesttest/encryptionuploadtest.php
+++ b/apps/dav/tests/unit/connector/sabre/requesttest/encryptionuploadtest.php
@@ -11,6 +11,13 @@ namespace OCA\DAV\Tests\Unit\Connector\Sabre\RequestTest;
use OC\Files\View;
use Test\Traits\EncryptionTrait;
+/**
+ * Class EncryptionUploadTest
+ *
+ * @group DB
+ *
+ * @package OCA\DAV\Tests\Unit\Connector\Sabre\RequestTest
+ */
class EncryptionUploadTest extends UploadTest {
use EncryptionTrait;
diff --git a/apps/dav/tests/unit/connector/sabre/requesttest/uploadtest.php b/apps/dav/tests/unit/connector/sabre/requesttest/uploadtest.php
index a2a8326f4ff..c1876a7f29f 100644
--- a/apps/dav/tests/unit/connector/sabre/requesttest/uploadtest.php
+++ b/apps/dav/tests/unit/connector/sabre/requesttest/uploadtest.php
@@ -12,6 +12,13 @@ use OC\Connector\Sabre\Exception\FileLocked;
use OCP\AppFramework\Http;
use OCP\Lock\ILockingProvider;
+/**
+ * Class UploadTest
+ *
+ * @group DB
+ *
+ * @package OCA\DAV\Tests\Unit\Connector\Sabre\RequestTest
+ */
class UploadTest extends RequestTest {
public function testBasicUpload() {
$user = $this->getUniqueID();
diff --git a/apps/encryption/lib/crypto/encryptall.php b/apps/encryption/lib/crypto/encryptall.php
index 8e97fe341b4..ef67523d7e2 100644
--- a/apps/encryption/lib/crypto/encryptall.php
+++ b/apps/encryption/lib/crypto/encryptall.php
@@ -31,6 +31,7 @@ use OCP\IL10N;
use OCP\IUserManager;
use OCP\Mail\IMailer;
use OCP\Security\ISecureRandom;
+use OCP\Util;
use Symfony\Component\Console\Helper\ProgressBar;
use Symfony\Component\Console\Helper\QuestionHelper;
use Symfony\Component\Console\Helper\Table;
@@ -358,14 +359,15 @@ class EncryptAll {
$progress = new ProgressBar($this->output, count($this->userPasswords));
$progress->start();
- foreach ($this->userPasswords as $recipient => $password) {
+ foreach ($this->userPasswords as $uid => $password) {
$progress->advance();
if (!empty($password)) {
- $recipientDisplayName = $this->userManager->get($recipient)->getDisplayName();
- $to = $this->config->getUserValue($recipient, 'settings', 'email', '');
+ $recipient = $this->userManager->get($uid);
+ $recipientDisplayName = $recipient->getDisplayName();
+ $to = $recipient->getEMailAddress();
if ($to === '') {
- $noMail[] = $recipient;
+ $noMail[] = $uid;
continue;
}
@@ -380,12 +382,12 @@ class EncryptAll {
$message->setHtmlBody($htmlBody);
$message->setPlainBody($textBody);
$message->setFrom([
- \OCP\Util::getDefaultEmailAddress('admin-noreply')
+ Util::getDefaultEmailAddress('admin-noreply')
]);
$this->mailer->send($message);
} catch (\Exception $e) {
- $noMail[] = $recipient;
+ $noMail[] = $uid;
}
}
}
diff --git a/apps/federation/tests/backgroundjob/getsharedsecrettest.php b/apps/federation/tests/backgroundjob/getsharedsecrettest.php
index 953af5ff3e1..cb3a294713a 100644
--- a/apps/federation/tests/backgroundjob/getsharedsecrettest.php
+++ b/apps/federation/tests/backgroundjob/getsharedsecrettest.php
@@ -34,6 +34,13 @@ use OCP\Http\Client\IResponse;
use OCP\ILogger;
use OCP\IURLGenerator;
+/**
+ * Class GetSharedSecretTest
+ *
+ * @group DB
+ *
+ * @package OCA\Federation\Tests\BackgroundJob
+ */
class GetSharedSecretTest extends TestCase {
/** @var \PHPUnit_Framework_MockObject_MockObject | IClient */
diff --git a/apps/files/appinfo/app.php b/apps/files/appinfo/app.php
index c752b5e7d72..61ff6d748f9 100644
--- a/apps/files/appinfo/app.php
+++ b/apps/files/appinfo/app.php
@@ -65,6 +65,7 @@ $templateManager->registerTemplate('application/vnd.oasis.opendocument.spreadshe
new \OCA\Files\ActivityHelper(
\OC::$server->getTagManager()
),
+ \OC::$server->getDatabaseConnection(),
\OC::$server->getConfig()
);
});
diff --git a/apps/files/controller/apicontroller.php b/apps/files/controller/apicontroller.php
index 1ecd5294c66..ee54db63191 100644
--- a/apps/files/controller/apicontroller.php
+++ b/apps/files/controller/apicontroller.php
@@ -127,7 +127,7 @@ class ApiController extends Controller {
*
* @NoAdminRequired
*
- * @param array|string $tagName tag name to filter by
+ * @param string $tagName tag name to filter by
* @return DataResponse
*/
public function getFilesByTag($tagName) {
diff --git a/apps/files/controller/viewcontroller.php b/apps/files/controller/viewcontroller.php
index 1d1a9111d19..d9c59592863 100644
--- a/apps/files/controller/viewcontroller.php
+++ b/apps/files/controller/viewcontroller.php
@@ -23,6 +23,7 @@ namespace OCA\Files\Controller;
use OC\AppFramework\Http\Request;
use OCP\AppFramework\Controller;
+use OCP\AppFramework\Http\ContentSecurityPolicy;
use OCP\AppFramework\Http\RedirectResponse;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\IL10N;
@@ -215,10 +216,15 @@ class ViewController extends Controller {
$params['appContents'] = $contentItems;
$this->navigationManager->setActiveEntry('files_index');
- return new TemplateResponse(
+ $response = new TemplateResponse(
$this->appName,
'index',
$params
);
+ $policy = new ContentSecurityPolicy();
+ $policy->addAllowedFrameDomain('\'self\'');
+ $response->setContentSecurityPolicy($policy);
+
+ return $response;
}
}
diff --git a/apps/files/l10n/ja.js b/apps/files/l10n/ja.js
index 1a50238de60..cd6f45f27b9 100644
--- a/apps/files/l10n/ja.js
+++ b/apps/files/l10n/ja.js
@@ -40,9 +40,12 @@ OC.L10N.register(
"Unable to determine date" : "更新日不明",
"This operation is forbidden" : "この操作は禁止されています",
"This directory is unavailable, please check the logs or contact the administrator" : "このディレクトリは利用できません。ログを確認するか管理者に問い合わせてください。",
+ "Could not move \"{file}\", target exists" : "ターゲットが存在するため,ファイル \"{file}\"を移動できませんでした",
"Could not move \"{file}\"" : "\"{file}\" を移動できませんでした",
"{newName} already exists" : "{newName} はすでに存在します",
+ "Could not rename \"{fileName}\", it does not exist any more" : "ファイルが存在しないため,\"{fileName}\"の名前変更ができませんでした",
"The name \"{targetName}\" is already used in the folder \"{dir}\". Please choose a different name." : "\"{targetName}\" はフォルダー \"{dir}\" ですでに使われています。別の名前を選択してください。",
+ "Could not rename \"{fileName}\"" : "\"{fileName}\"の名前変更ができませんでした",
"Could not create file \"{file}\"" : "ファイル \"{file}\" を作成できませんでした",
"Could not create file \"{file}\" because it already exists" : "ファイル \"{file}\"は既に存在するため作成できませんでした",
"Could not create folder \"{dir}\"" : "フォルダー \"{dir}\" を作成できませんでした",
diff --git a/apps/files/l10n/ja.json b/apps/files/l10n/ja.json
index 1be742b469a..01d93403c20 100644
--- a/apps/files/l10n/ja.json
+++ b/apps/files/l10n/ja.json
@@ -38,9 +38,12 @@
"Unable to determine date" : "更新日不明",
"This operation is forbidden" : "この操作は禁止されています",
"This directory is unavailable, please check the logs or contact the administrator" : "このディレクトリは利用できません。ログを確認するか管理者に問い合わせてください。",
+ "Could not move \"{file}\", target exists" : "ターゲットが存在するため,ファイル \"{file}\"を移動できませんでした",
"Could not move \"{file}\"" : "\"{file}\" を移動できませんでした",
"{newName} already exists" : "{newName} はすでに存在します",
+ "Could not rename \"{fileName}\", it does not exist any more" : "ファイルが存在しないため,\"{fileName}\"の名前変更ができませんでした",
"The name \"{targetName}\" is already used in the folder \"{dir}\". Please choose a different name." : "\"{targetName}\" はフォルダー \"{dir}\" ですでに使われています。別の名前を選択してください。",
+ "Could not rename \"{fileName}\"" : "\"{fileName}\"の名前変更ができませんでした",
"Could not create file \"{file}\"" : "ファイル \"{file}\" を作成できませんでした",
"Could not create file \"{file}\" because it already exists" : "ファイル \"{file}\"は既に存在するため作成できませんでした",
"Could not create folder \"{dir}\"" : "フォルダー \"{dir}\" を作成できませんでした",
diff --git a/apps/files/l10n/nl.js b/apps/files/l10n/nl.js
index 95054067597..f99d3314230 100644
--- a/apps/files/l10n/nl.js
+++ b/apps/files/l10n/nl.js
@@ -40,6 +40,17 @@ OC.L10N.register(
"Unable to determine date" : "Kon datum niet vaststellen",
"This operation is forbidden" : "Deze taak is verboden",
"This directory is unavailable, please check the logs or contact the administrator" : "Deze map is niet beschikbaar. Verifieer de logs of neem contact op met de beheerder",
+ "Could not move \"{file}\", target exists" : "Kon \"{file}\" niet verplaatsen, doel bestaat al",
+ "Could not move \"{file}\"" : "Kon \"{file}\" niet verplaatsen",
+ "{newName} already exists" : "{newName} bestaat al",
+ "Could not rename \"{fileName}\", it does not exist any more" : "Kon \"{fileName}\" niet hernoemen, het bestaat niet meer",
+ "The name \"{targetName}\" is already used in the folder \"{dir}\". Please choose a different name." : "De naam \"{targetName}\" bestaat al in map \"{dir}\". Kies een andere naam.",
+ "Could not rename \"{fileName}\"" : "Kon \"{fileName}\" niet hernoemen",
+ "Could not create file \"{file}\"" : "Kon \"{file}\" niet aanmaken",
+ "Could not create file \"{file}\" because it already exists" : "Kon \"{file}\" niet aanmaken omdat het al bestaat",
+ "Could not create folder \"{dir}\"" : "Kon map \"{dir}\" niet aanmaken",
+ "Could not create folder \"{dir}\" because it already exists" : "Kon map \"{dir}\" niet aanmaken omdat die al bestaat",
+ "Error deleting file \"{fileName}\"." : "Fout bij verwijderen bestand \"{fileName}\".",
"No entries in this folder match '{filter}'" : "Niets in deze map komt overeen met '{filter}'",
"Name" : "Naam",
"Size" : "Grootte",
diff --git a/apps/files/l10n/nl.json b/apps/files/l10n/nl.json
index 81f906d40b3..aaf4edcfdd4 100644
--- a/apps/files/l10n/nl.json
+++ b/apps/files/l10n/nl.json
@@ -38,6 +38,17 @@
"Unable to determine date" : "Kon datum niet vaststellen",
"This operation is forbidden" : "Deze taak is verboden",
"This directory is unavailable, please check the logs or contact the administrator" : "Deze map is niet beschikbaar. Verifieer de logs of neem contact op met de beheerder",
+ "Could not move \"{file}\", target exists" : "Kon \"{file}\" niet verplaatsen, doel bestaat al",
+ "Could not move \"{file}\"" : "Kon \"{file}\" niet verplaatsen",
+ "{newName} already exists" : "{newName} bestaat al",
+ "Could not rename \"{fileName}\", it does not exist any more" : "Kon \"{fileName}\" niet hernoemen, het bestaat niet meer",
+ "The name \"{targetName}\" is already used in the folder \"{dir}\". Please choose a different name." : "De naam \"{targetName}\" bestaat al in map \"{dir}\". Kies een andere naam.",
+ "Could not rename \"{fileName}\"" : "Kon \"{fileName}\" niet hernoemen",
+ "Could not create file \"{file}\"" : "Kon \"{file}\" niet aanmaken",
+ "Could not create file \"{file}\" because it already exists" : "Kon \"{file}\" niet aanmaken omdat het al bestaat",
+ "Could not create folder \"{dir}\"" : "Kon map \"{dir}\" niet aanmaken",
+ "Could not create folder \"{dir}\" because it already exists" : "Kon map \"{dir}\" niet aanmaken omdat die al bestaat",
+ "Error deleting file \"{fileName}\"." : "Fout bij verwijderen bestand \"{fileName}\".",
"No entries in this folder match '{filter}'" : "Niets in deze map komt overeen met '{filter}'",
"Name" : "Naam",
"Size" : "Grootte",
diff --git a/apps/files/l10n/ru.js b/apps/files/l10n/ru.js
index 222184d87af..f4b71563e6e 100644
--- a/apps/files/l10n/ru.js
+++ b/apps/files/l10n/ru.js
@@ -40,6 +40,15 @@ OC.L10N.register(
"Unable to determine date" : "Невозможно определить дату",
"This operation is forbidden" : "Операция запрещена",
"This directory is unavailable, please check the logs or contact the administrator" : "Директория недоступна, пожалуйста проверьте журнал сообщений или свяжитесь с администратором",
+ "Could not move \"{file}\", target exists" : "Невозможно переместить \"{file}\", цель отсутствует",
+ "Could not move \"{file}\"" : "Невозможно переместить \"{file}\"",
+ "{newName} already exists" : "{newName} уже имеется",
+ "Could not rename \"{fileName}\"" : "Невозможно переименовать \"{fileName}\"",
+ "Could not create file \"{file}\"" : "Невозможно создать файл \"{file}\"",
+ "Could not create file \"{file}\" because it already exists" : "Невозможно создать файл \"{file}\" потому что уже имеется",
+ "Could not create folder \"{dir}\"" : "Невозможно создать папку \"{dir}\"",
+ "Could not create folder \"{dir}\" because it already exists" : "Невозможно создать папку \"{dir}\" потому что уже имеется",
+ "Error deleting file \"{fileName}\"." : "Ошибка удаления файла \"{fileName}\".",
"No entries in this folder match '{filter}'" : "В данном каталоге нет элементов соответствующих '{filter}'",
"Name" : "Имя",
"Size" : "Размер",
@@ -88,6 +97,7 @@ OC.L10N.register(
"Maximum upload size" : "Максимальный размер загружаемого файла",
"max. possible: " : "макс. возможно: ",
"Save" : "Сохранить",
+ "Missing permissions to edit from here." : "Отсутствуют права на удаление.",
"Settings" : "Настройки",
"WebDAV" : "WebDAV",
"Use this address to <a href=\"%s\" target=\"_blank\">access your Files via WebDAV</a>" : "Используйте этот адрес для <a href=\"%s\" target=\"_blank\">доступа файлам через WebDAV</a>",
diff --git a/apps/files/l10n/ru.json b/apps/files/l10n/ru.json
index f3b318dc100..81dbf53184e 100644
--- a/apps/files/l10n/ru.json
+++ b/apps/files/l10n/ru.json
@@ -38,6 +38,15 @@
"Unable to determine date" : "Невозможно определить дату",
"This operation is forbidden" : "Операция запрещена",
"This directory is unavailable, please check the logs or contact the administrator" : "Директория недоступна, пожалуйста проверьте журнал сообщений или свяжитесь с администратором",
+ "Could not move \"{file}\", target exists" : "Невозможно переместить \"{file}\", цель отсутствует",
+ "Could not move \"{file}\"" : "Невозможно переместить \"{file}\"",
+ "{newName} already exists" : "{newName} уже имеется",
+ "Could not rename \"{fileName}\"" : "Невозможно переименовать \"{fileName}\"",
+ "Could not create file \"{file}\"" : "Невозможно создать файл \"{file}\"",
+ "Could not create file \"{file}\" because it already exists" : "Невозможно создать файл \"{file}\" потому что уже имеется",
+ "Could not create folder \"{dir}\"" : "Невозможно создать папку \"{dir}\"",
+ "Could not create folder \"{dir}\" because it already exists" : "Невозможно создать папку \"{dir}\" потому что уже имеется",
+ "Error deleting file \"{fileName}\"." : "Ошибка удаления файла \"{fileName}\".",
"No entries in this folder match '{filter}'" : "В данном каталоге нет элементов соответствующих '{filter}'",
"Name" : "Имя",
"Size" : "Размер",
@@ -86,6 +95,7 @@
"Maximum upload size" : "Максимальный размер загружаемого файла",
"max. possible: " : "макс. возможно: ",
"Save" : "Сохранить",
+ "Missing permissions to edit from here." : "Отсутствуют права на удаление.",
"Settings" : "Настройки",
"WebDAV" : "WebDAV",
"Use this address to <a href=\"%s\" target=\"_blank\">access your Files via WebDAV</a>" : "Используйте этот адрес для <a href=\"%s\" target=\"_blank\">доступа файлам через WebDAV</a>",
diff --git a/apps/files/l10n/th_TH.js b/apps/files/l10n/th_TH.js
index 791b987a9b8..d371d5a39c4 100644
--- a/apps/files/l10n/th_TH.js
+++ b/apps/files/l10n/th_TH.js
@@ -44,6 +44,7 @@ OC.L10N.register(
"Could not move \"{file}\"" : "ไม่สามารถย้ายไฟล์ \"{file}\"",
"{newName} already exists" : "{newName} มีอยู่แล้ว",
"Could not rename \"{fileName}\", it does not exist any more" : "ไม่สามารถเปลี่ยนชื่อไฟล์ \"{fileName}\" ไฟล์นั้นไม่มีอยู่",
+ "The name \"{targetName}\" is already used in the folder \"{dir}\". Please choose a different name." : "ชื่อโฟลเดอร์ \"{targetName}\" มีอยู่แล้วใน \"{dir}\" กรุณาใช้ชื่อที่แตกต่างกัน",
"Could not rename \"{fileName}\"" : "ไม่สามารถเปลี่ยนชื่อไฟล์ \"{fileName}\"",
"Could not create file \"{file}\"" : "ไม่สามารถสร้างไฟล์ \"{file}\"",
"Could not create file \"{file}\" because it already exists" : "ไม่สามารถสร้างไฟล์ \"{file}\" เพราะมันมีอยู่แล้ว",
diff --git a/apps/files/l10n/th_TH.json b/apps/files/l10n/th_TH.json
index f0a5263892e..5e8086ad9d9 100644
--- a/apps/files/l10n/th_TH.json
+++ b/apps/files/l10n/th_TH.json
@@ -42,6 +42,7 @@
"Could not move \"{file}\"" : "ไม่สามารถย้ายไฟล์ \"{file}\"",
"{newName} already exists" : "{newName} มีอยู่แล้ว",
"Could not rename \"{fileName}\", it does not exist any more" : "ไม่สามารถเปลี่ยนชื่อไฟล์ \"{fileName}\" ไฟล์นั้นไม่มีอยู่",
+ "The name \"{targetName}\" is already used in the folder \"{dir}\". Please choose a different name." : "ชื่อโฟลเดอร์ \"{targetName}\" มีอยู่แล้วใน \"{dir}\" กรุณาใช้ชื่อที่แตกต่างกัน",
"Could not rename \"{fileName}\"" : "ไม่สามารถเปลี่ยนชื่อไฟล์ \"{fileName}\"",
"Could not create file \"{file}\"" : "ไม่สามารถสร้างไฟล์ \"{file}\"",
"Could not create file \"{file}\" because it already exists" : "ไม่สามารถสร้างไฟล์ \"{file}\" เพราะมันมีอยู่แล้ว",
diff --git a/apps/files/lib/activity.php b/apps/files/lib/activity.php
index f3bbff48640..a941572ed15 100644
--- a/apps/files/lib/activity.php
+++ b/apps/files/lib/activity.php
@@ -22,7 +22,8 @@
namespace OCA\Files;
-use OC\L10N\Factory;
+use OCP\IDBConnection;
+use OCP\L10N\IFactory;
use OCP\Activity\IExtension;
use OCP\Activity\IManager;
use OCP\IConfig;
@@ -43,7 +44,7 @@ class Activity implements IExtension {
/** @var IL10N */
protected $l;
- /** @var Factory */
+ /** @var IFactory */
protected $languageFactory;
/** @var IURLGenerator */
@@ -52,6 +53,9 @@ class Activity implements IExtension {
/** @var \OCP\Activity\IManager */
protected $activityManager;
+ /** @var \OCP\IDBConnection */
+ protected $connection;
+
/** @var \OCP\IConfig */
protected $config;
@@ -59,18 +63,20 @@ class Activity implements IExtension {
protected $helper;
/**
- * @param Factory $languageFactory
+ * @param IFactory $languageFactory
* @param IURLGenerator $URLGenerator
* @param IManager $activityManager
* @param ActivityHelper $helper
+ * @param IDBConnection $connection
* @param IConfig $config
*/
- public function __construct(Factory $languageFactory, IURLGenerator $URLGenerator, IManager $activityManager, ActivityHelper $helper, IConfig $config) {
+ public function __construct(IFactory $languageFactory, IURLGenerator $URLGenerator, IManager $activityManager, ActivityHelper $helper, IDBConnection $connection, IConfig $config) {
$this->languageFactory = $languageFactory;
$this->URLGenerator = $URLGenerator;
$this->l = $this->getL10N();
$this->activityManager = $activityManager;
$this->helper = $helper;
+ $this->connection = $connection;
$this->config = $config;
}
@@ -160,7 +166,7 @@ class Activity implements IExtension {
* @param string $text
* @param IL10N $l
* @param array $params
- * @return bool|string
+ * @return string|false
*/
protected function translateLong($text, IL10N $l, array $params) {
switch ($text) {
@@ -192,7 +198,7 @@ class Activity implements IExtension {
* @param string $text
* @param IL10N $l
* @param array $params
- * @return bool|string
+ * @return string|false
*/
protected function translateShort($text, IL10N $l, array $params) {
switch ($text) {
@@ -379,6 +385,7 @@ class Activity implements IExtension {
*/
$parameters = $fileQueryList = [];
$parameters[] = self::APP_FILES;
+ $parameters[] = self::APP_FILES;
$fileQueryList[] = '(`type` <> ? AND `type` <> ?)';
$parameters[] = self::TYPE_SHARE_CREATED;
@@ -390,13 +397,15 @@ class Activity implements IExtension {
}
foreach ($favorites['folders'] as $favorite) {
$fileQueryList[] = '`file` LIKE ?';
- $parameters[] = $favorite . '/%';
+ $parameters[] = $this->connection->escapeLikeParameter($favorite) . '/%';
}
- $parameters[] = self::APP_FILES;
-
return [
- ' CASE WHEN `app` = ? THEN (' . implode(' OR ', $fileQueryList) . ') ELSE `app` <> ? END ',
+ ' CASE '
+ . 'WHEN `app` <> ? THEN 1 '
+ . 'WHEN `app` = ? AND (' . implode(' OR ', $fileQueryList) . ') THEN 1 '
+ . 'ELSE 0 '
+ . 'END = 1 ',
$parameters,
];
}
diff --git a/apps/files/service/tagservice.php b/apps/files/service/tagservice.php
index 1999d97e1af..cf3f2bb7865 100644
--- a/apps/files/service/tagservice.php
+++ b/apps/files/service/tagservice.php
@@ -91,7 +91,7 @@ class TagService {
/**
* Get all files for the given tag
*
- * @param array $tagName tag name to filter by
+ * @param string $tagName tag name to filter by
* @return FileInfo[] list of matching files
* @throws \Exception if the tag does not exist
*/
diff --git a/apps/files/tests/activitytest.php b/apps/files/tests/activitytest.php
index cdb1d21bcd8..59c020c9042 100644
--- a/apps/files/tests/activitytest.php
+++ b/apps/files/tests/activitytest.php
@@ -25,24 +25,30 @@ namespace OCA\Files\Tests;
use OCA\Files\Activity;
use Test\TestCase;
+/**
+ * Class ActivityTest
+ *
+ * @group DB
+ * @package OCA\Files\Tests
+ */
class ActivityTest extends TestCase {
/** @var \OC\ActivityManager */
private $activityManager;
- /** @var \PHPUnit_Framework_MockObject_MockObject */
+ /** @var \OCP\IRequest|\PHPUnit_Framework_MockObject_MockObject */
protected $request;
- /** @var \PHPUnit_Framework_MockObject_MockObject */
+ /** @var \OCP\IUserSession|\PHPUnit_Framework_MockObject_MockObject */
protected $session;
- /** @var \PHPUnit_Framework_MockObject_MockObject */
+ /** @var \OCP\IConfig|\PHPUnit_Framework_MockObject_MockObject */
protected $config;
- /** @var \PHPUnit_Framework_MockObject_MockObject */
+ /** @var \OCA\Files\ActivityHelper|\PHPUnit_Framework_MockObject_MockObject */
protected $activityHelper;
- /** @var \PHPUnit_Framework_MockObject_MockObject */
+ /** @var \OCP\L10N\IFactory|\PHPUnit_Framework_MockObject_MockObject */
protected $l10nFactory;
/** @var \OCA\Files\Activity */
@@ -70,7 +76,7 @@ class ActivityTest extends TestCase {
$this->config
);
- $this->l10nFactory = $this->getMockBuilder('OC\L10N\Factory')
+ $this->l10nFactory = $this->getMockBuilder('OCP\L10N\IFactory')
->disableOriginalConstructor()
->getMock();
$deL10n = $this->getMockBuilder('OC_L10N')
@@ -95,6 +101,7 @@ class ActivityTest extends TestCase {
$this->getMockBuilder('OCP\IURLGenerator')->disableOriginalConstructor()->getMock(),
$this->activityManager,
$this->activityHelper,
+ \OC::$server->getDatabaseConnection(),
$this->config
);
@@ -290,16 +297,16 @@ class ActivityTest extends TestCase {
'items' => [],
'folders' => [],
],
- ' CASE WHEN `app` = ? THEN ((`type` <> ? AND `type` <> ?)) ELSE `app` <> ? END ',
- ['files', Activity::TYPE_SHARE_CREATED, Activity::TYPE_SHARE_CHANGED, 'files']
+ ' CASE WHEN `app` <> ? THEN 1 WHEN `app` = ? AND ((`type` <> ? AND `type` <> ?)) THEN 1 ELSE 0 END = 1 ',
+ ['files', 'files', Activity::TYPE_SHARE_CREATED, Activity::TYPE_SHARE_CHANGED]
],
[
[
'items' => ['file.txt', 'folder'],
'folders' => ['folder'],
],
- ' CASE WHEN `app` = ? THEN ((`type` <> ? AND `type` <> ?) OR `file` = ? OR `file` = ? OR `file` LIKE ?) ELSE `app` <> ? END ',
- ['files', Activity::TYPE_SHARE_CREATED, Activity::TYPE_SHARE_CHANGED, 'file.txt', 'folder', 'folder/%', 'files']
+ ' CASE WHEN `app` <> ? THEN 1 WHEN `app` = ? AND ((`type` <> ? AND `type` <> ?) OR `file` = ? OR `file` = ? OR `file` LIKE ?) THEN 1 ELSE 0 END = 1 ',
+ ['files', 'files', Activity::TYPE_SHARE_CREATED, Activity::TYPE_SHARE_CHANGED, 'file.txt', 'folder', 'folder/%']
],
];
}
@@ -333,6 +340,21 @@ class ActivityTest extends TestCase {
$result = $this->activityExtension->getQueryForFilter('all');
$this->assertEquals([$query, $parameters], $result);
+
+ $this->executeQueryForFilter($result);
+ }
+
+ public function executeQueryForFilter(array $result) {
+ list($resultQuery, $resultParameters) = $result;
+ $resultQuery = str_replace('`file`', '`user`', $resultQuery);
+ $resultQuery = str_replace('`type`', '`key`', $resultQuery);
+
+ $connection = \OC::$server->getDatabaseConnection();
+ // Test the query on the privatedata table, because the activity table
+ // does not exist in core
+ $result = $connection->executeQuery('SELECT * FROM `*PREFIX*privatedata` WHERE ' . $resultQuery, $resultParameters);
+ $rows = $result->fetchAll();
+ $result->closeCursor();
}
protected function mockUserSession($user) {
diff --git a/apps/files/tests/command/deleteorphanedfilestest.php b/apps/files/tests/command/deleteorphanedfilestest.php
index a667dba99fc..18f568036e4 100644
--- a/apps/files/tests/command/deleteorphanedfilestest.php
+++ b/apps/files/tests/command/deleteorphanedfilestest.php
@@ -25,6 +25,13 @@ namespace OCA\Files\Tests\Command;
use OCA\Files\Command\DeleteOrphanedFiles;
use OCP\Files\StorageNotAvailableException;
+/**
+ * Class DeleteOrphanedFilesTest
+ *
+ * @group DB
+ *
+ * @package OCA\Files\Tests\Command
+ */
class DeleteOrphanedFilesTest extends \Test\TestCase {
/**
diff --git a/apps/files/tests/controller/ViewControllerTest.php b/apps/files/tests/controller/ViewControllerTest.php
index 028dfce8c58..0e8ab5e752d 100644
--- a/apps/files/tests/controller/ViewControllerTest.php
+++ b/apps/files/tests/controller/ViewControllerTest.php
@@ -245,6 +245,9 @@ class ViewControllerTest extends TestCase {
],
]
);
+ $policy = new Http\ContentSecurityPolicy();
+ $policy->addAllowedFrameDomain('\'self\'');
+ $expected->setContentSecurityPolicy($policy);
$this->assertEquals($expected, $this->viewController->index('MyDir', 'MyView'));
}
}
diff --git a/apps/files/tests/service/tagservice.php b/apps/files/tests/service/tagservice.php
index 147e698aaaa..36da3edc61e 100644
--- a/apps/files/tests/service/tagservice.php
+++ b/apps/files/tests/service/tagservice.php
@@ -22,6 +22,13 @@ namespace OCA\Files;
use \OCA\Files\Service\TagService;
+/**
+ * Class TagServiceTest
+ *
+ * @group DB
+ *
+ * @package OCA\Files
+ */
class TagServiceTest extends \Test\TestCase {
/**
diff --git a/apps/files_external/appinfo/app.php b/apps/files_external/appinfo/app.php
index a7d8f4f668d..1fcd09cca51 100644
--- a/apps/files_external/appinfo/app.php
+++ b/apps/files_external/appinfo/app.php
@@ -60,8 +60,5 @@ if (OCP\Config::getAppValue('files_external', 'allow_user_mounting', 'yes') == '
"name" => $l->t('External storage')
]);
-// connecting hooks
-OCP\Util::connectHook('OC_Filesystem', 'post_initMountPoints', '\OC_Mount_Config', 'initMountPointsHook');
-
$mountProvider = $appContainer->query('OCA\Files_External\Config\ConfigAdapter');
\OC::$server->getMountProviderCollection()->registerProvider($mountProvider);
diff --git a/apps/files_external/appinfo/register_command.php b/apps/files_external/appinfo/register_command.php
index a436dc95005..183d965d1a1 100644
--- a/apps/files_external/appinfo/register_command.php
+++ b/apps/files_external/appinfo/register_command.php
@@ -21,6 +21,8 @@
use OCA\Files_External\Command\ListCommand;
+use OCA\Files_External\Command\Config;
+use OCA\Files_External\Command\Option;
$userManager = OC::$server->getUserManager();
$userSession = OC::$server->getUserSession();
@@ -32,3 +34,5 @@ $userStorageService = $app->getContainer()->query('\OCA\Files_external\Service\U
/** @var Symfony\Component\Console\Application $application */
$application->add(new ListCommand($globalStorageService, $userStorageService, $userSession, $userManager));
+$application->add(new Config($globalStorageService));
+$application->add(new Option($globalStorageService));
diff --git a/apps/files_external/command/config.php b/apps/files_external/command/config.php
new file mode 100644
index 00000000000..6a57b2dd961
--- /dev/null
+++ b/apps/files_external/command/config.php
@@ -0,0 +1,112 @@
+<?php
+/**
+ * @author Robin Appelman <icewind@owncloud.com>
+ *
+ * @copyright Copyright (c) 2015, ownCloud, Inc.
+ * @license AGPL-3.0
+ *
+ * This code is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License, version 3,
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+namespace OCA\Files_External\Command;
+
+use OC\Core\Command\Base;
+use OCA\Files_external\Lib\StorageConfig;
+use OCA\Files_external\NotFoundException;
+use OCA\Files_external\Service\GlobalStoragesService;
+use Symfony\Component\Console\Command\Command;
+use Symfony\Component\Console\Helper\Table;
+use Symfony\Component\Console\Helper\TableHelper;
+use Symfony\Component\Console\Input\InputArgument;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Input\InputOption;
+use Symfony\Component\Console\Output\OutputInterface;
+
+class Config extends Base {
+ /**
+ * @var GlobalStoragesService
+ */
+ protected $globalService;
+
+ function __construct(GlobalStoragesService $globalService) {
+ parent::__construct();
+ $this->globalService = $globalService;
+ }
+
+ protected function configure() {
+ $this
+ ->setName('files_external:config')
+ ->setDescription('Manage backend configuration for a mount')
+ ->addArgument(
+ 'mount_id',
+ InputArgument::REQUIRED,
+ 'The id of the mount to edit'
+ )->addArgument(
+ 'key',
+ InputArgument::REQUIRED,
+ 'key of the config option to set/get'
+ )->addArgument(
+ 'value',
+ InputArgument::OPTIONAL,
+ 'value to set the config option to, when no value is provided the existing value will be printed'
+ );
+ parent::configure();
+ }
+
+ protected function execute(InputInterface $input, OutputInterface $output) {
+ $mountId = $input->getArgument('mount_id');
+ $key = $input->getArgument('key');
+ try {
+ $mount = $this->globalService->getStorage($mountId);
+ } catch (NotFoundException $e) {
+ $output->writeln('<error>Mount with id "' . $mountId . ' not found, check "occ files_external:list" to get available mounts"</error>');
+ return 404;
+ }
+
+ $value = $input->getArgument('value');
+ if ($value) {
+ $this->setOption($mount, $key, $value, $output);
+ } else {
+ $this->getOption($mount, $key, $output);
+ }
+ }
+
+ /**
+ * @param StorageConfig $mount
+ * @param string $key
+ * @param OutputInterface $output
+ */
+ protected function getOption(StorageConfig $mount, $key, OutputInterface $output) {
+ $value = $mount->getBackendOption($key);
+ if (!is_string($value)) { // show bools and objects correctly
+ $value = json_encode($value);
+ }
+ $output->writeln($value);
+ }
+
+ /**
+ * @param StorageConfig $mount
+ * @param string $key
+ * @param string $value
+ * @param OutputInterface $output
+ */
+ protected function setOption(StorageConfig $mount, $key, $value, OutputInterface $output) {
+ $decoded = json_decode($value, true);
+ if (!is_null($decoded)) {
+ $value = $decoded;
+ }
+ $mount->setBackendOption($key, $value);
+ $this->globalService->updateStorage($mount);
+ }
+}
diff --git a/apps/files_external/command/option.php b/apps/files_external/command/option.php
new file mode 100644
index 00000000000..64dafb8f6dc
--- /dev/null
+++ b/apps/files_external/command/option.php
@@ -0,0 +1,85 @@
+<?php
+/**
+ * @author Robin Appelman <icewind@owncloud.com>
+ *
+ * @copyright Copyright (c) 2015, ownCloud, Inc.
+ * @license AGPL-3.0
+ *
+ * This code is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License, version 3,
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+namespace OCA\Files_External\Command;
+
+use OC\Core\Command\Base;
+use OCA\Files_external\Lib\StorageConfig;
+use OCA\Files_external\Service\GlobalStoragesService;
+use OCA\Files_external\Service\UserStoragesService;
+use OCP\IUserManager;
+use OCP\IUserSession;
+use Symfony\Component\Console\Command\Command;
+use Symfony\Component\Console\Helper\Table;
+use Symfony\Component\Console\Helper\TableHelper;
+use Symfony\Component\Console\Input\InputArgument;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Input\InputOption;
+use Symfony\Component\Console\Output\OutputInterface;
+
+class Option extends Config {
+ protected function configure() {
+ $this
+ ->setName('files_external:option')
+ ->setDescription('Manage mount options for a mount')
+ ->addArgument(
+ 'mount_id',
+ InputArgument::REQUIRED,
+ 'The id of the mount to edit'
+ )->addArgument(
+ 'key',
+ InputArgument::REQUIRED,
+ 'key of the mount option to set/get'
+ )->addArgument(
+ 'value',
+ InputArgument::OPTIONAL,
+ 'value to set the mount option to, when no value is provided the existing value will be printed'
+ );
+ }
+
+ /**
+ * @param StorageConfig $mount
+ * @param string $key
+ * @param OutputInterface $output
+ */
+ protected function getOption(StorageConfig $mount, $key, OutputInterface $output) {
+ $value = $mount->getMountOption($key);
+ if (!is_string($value)) { // show bools and objects correctly
+ $value = json_encode($value);
+ }
+ $output->writeln($value);
+ }
+
+ /**
+ * @param StorageConfig $mount
+ * @param string $key
+ * @param string $value
+ * @param OutputInterface $output
+ */
+ protected function setOption(StorageConfig $mount, $key, $value, OutputInterface $output) {
+ $decoded = json_decode($value, true);
+ if (!is_null($decoded)) {
+ $value = $decoded;
+ }
+ $mount->setMountOption($key, $value);
+ $this->globalService->updateStorage($mount);
+ }
+}
diff --git a/apps/files_external/controller/storagescontroller.php b/apps/files_external/controller/storagescontroller.php
index c66bd902d8d..7712f9769c9 100644
--- a/apps/files_external/controller/storagescontroller.php
+++ b/apps/files_external/controller/storagescontroller.php
@@ -238,18 +238,18 @@ abstract class StoragesController extends Controller {
);
} catch (InsufficientDataForMeaningfulAnswerException $e) {
$storage->setStatus(
- \OC_Mount_Config::STATUS_INDETERMINATE,
+ StorageNotAvailableException::STATUS_INDETERMINATE,
$this->l10n->t('Insufficient data: %s', [$e->getMessage()])
);
} catch (StorageNotAvailableException $e) {
$storage->setStatus(
- \OC_Mount_Config::STATUS_ERROR,
- $e->getMessage()
+ $e->getCode(),
+ $this->l10n->t('%s', [$e->getMessage()])
);
} catch (\Exception $e) {
// FIXME: convert storage exceptions to StorageNotAvailableException
$storage->setStatus(
- \OC_Mount_Config::STATUS_ERROR,
+ StorageNotAvailableException::STATUS_ERROR,
get_class($e).': '.$e->getMessage()
);
}
diff --git a/apps/files_external/js/settings.js b/apps/files_external/js/settings.js
index f712ecf4328..134db41fc32 100644
--- a/apps/files_external/js/settings.js
+++ b/apps/files_external/js/settings.js
@@ -460,7 +460,6 @@ MountOptionsDropdown.prototype = {
var $el = $(template());
this.$el = $el;
- $el.addClass('hidden');
this.setOptions(mountOptions, enabledOptions);
diff --git a/apps/files_external/l10n/ja.js b/apps/files_external/l10n/ja.js
index 38c98caf7aa..5518f6afa78 100644
--- a/apps/files_external/l10n/ja.js
+++ b/apps/files_external/l10n/ja.js
@@ -33,6 +33,7 @@ OC.L10N.register(
"Every time the filesystem is used" : "ファイルシステム利用時には毎回",
"All users. Type to select user or group." : "すべてのユーザー。ユーザー、グループを追加",
"(group)" : "(グループ)",
+ "Admin defined" : "管理者設定済",
"Saved" : "保存されました",
"Access key" : "アクセスキー",
"Secret key" : "シークレットキー",
diff --git a/apps/files_external/l10n/ja.json b/apps/files_external/l10n/ja.json
index be6f88f3155..8134ed16cd5 100644
--- a/apps/files_external/l10n/ja.json
+++ b/apps/files_external/l10n/ja.json
@@ -31,6 +31,7 @@
"Every time the filesystem is used" : "ファイルシステム利用時には毎回",
"All users. Type to select user or group." : "すべてのユーザー。ユーザー、グループを追加",
"(group)" : "(グループ)",
+ "Admin defined" : "管理者設定済",
"Saved" : "保存されました",
"Access key" : "アクセスキー",
"Secret key" : "シークレットキー",
diff --git a/apps/files_external/l10n/nl.js b/apps/files_external/l10n/nl.js
index cb015b104cb..05d1a3f6de5 100644
--- a/apps/files_external/l10n/nl.js
+++ b/apps/files_external/l10n/nl.js
@@ -33,6 +33,7 @@ OC.L10N.register(
"Every time the filesystem is used" : "Elke keer bij gebruik bestandssysteem",
"All users. Type to select user or group." : "Alle gebruikers. Tikken om een gebruiker of groep te selecteren.",
"(group)" : "(groep)",
+ "Admin defined" : "Beheerder gedefinieerd",
"Saved" : "Bewaard",
"Access key" : "Access Key",
"Secret key" : "Geheime sleutel",
diff --git a/apps/files_external/l10n/nl.json b/apps/files_external/l10n/nl.json
index 1a80aa31e30..e30870e4ae1 100644
--- a/apps/files_external/l10n/nl.json
+++ b/apps/files_external/l10n/nl.json
@@ -31,6 +31,7 @@
"Every time the filesystem is used" : "Elke keer bij gebruik bestandssysteem",
"All users. Type to select user or group." : "Alle gebruikers. Tikken om een gebruiker of groep te selecteren.",
"(group)" : "(groep)",
+ "Admin defined" : "Beheerder gedefinieerd",
"Saved" : "Bewaard",
"Access key" : "Access Key",
"Secret key" : "Geheime sleutel",
diff --git a/apps/files_external/l10n/ru.js b/apps/files_external/l10n/ru.js
index edcfc6af6c0..6fbfe273557 100644
--- a/apps/files_external/l10n/ru.js
+++ b/apps/files_external/l10n/ru.js
@@ -16,6 +16,7 @@ OC.L10N.register(
"Not permitted to use authentication mechanism \"%s\"" : "Не допускается использование механизма авторизации \"%s\"",
"Unsatisfied backend parameters" : "Недопустимые настройки бэкенда",
"Unsatisfied authentication mechanism parameters" : "Недопустимые настройки механизма авторизации",
+ "Insufficient data: %s" : "Недостаточно данных: %s",
"Personal" : "Личное",
"System" : "Система",
"Grant access" : "Предоставить доступ",
@@ -101,6 +102,7 @@ OC.L10N.register(
"Add storage" : "Добавить хранилище",
"Advanced settings" : "Расширенные настройки",
"Delete" : "Удалить",
+ "Allow users to mount external storage" : "Разрешить пользователями монтировать внешние накопители",
"Allow users to mount the following external storage" : "Разрешить пользователям монтировать следующие сервисы хранения данных"
},
"nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n%100>=11 && n%100<=14)? 2 : 3);");
diff --git a/apps/files_external/l10n/ru.json b/apps/files_external/l10n/ru.json
index b85e04d3667..12a62259f50 100644
--- a/apps/files_external/l10n/ru.json
+++ b/apps/files_external/l10n/ru.json
@@ -14,6 +14,7 @@
"Not permitted to use authentication mechanism \"%s\"" : "Не допускается использование механизма авторизации \"%s\"",
"Unsatisfied backend parameters" : "Недопустимые настройки бэкенда",
"Unsatisfied authentication mechanism parameters" : "Недопустимые настройки механизма авторизации",
+ "Insufficient data: %s" : "Недостаточно данных: %s",
"Personal" : "Личное",
"System" : "Система",
"Grant access" : "Предоставить доступ",
@@ -99,6 +100,7 @@
"Add storage" : "Добавить хранилище",
"Advanced settings" : "Расширенные настройки",
"Delete" : "Удалить",
+ "Allow users to mount external storage" : "Разрешить пользователями монтировать внешние накопители",
"Allow users to mount the following external storage" : "Разрешить пользователям монтировать следующие сервисы хранения данных"
},"pluralForm" :"nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n%100>=11 && n%100<=14)? 2 : 3);"
} \ No newline at end of file
diff --git a/apps/files_external/lib/config.php b/apps/files_external/lib/config.php
index 6c900f0f224..7a869847a63 100644
--- a/apps/files_external/lib/config.php
+++ b/apps/files_external/lib/config.php
@@ -33,10 +33,10 @@
use phpseclib\Crypt\AES;
use \OCA\Files_External\Appinfo\Application;
-use \OCA\Files_External\Lib\BackendConfig;
-use \OCA\Files_External\Service\BackendService;
use \OCA\Files_External\Lib\Backend\LegacyBackend;
use \OCA\Files_External\Lib\StorageConfig;
+use \OCA\Files_External\Lib\Backend\Backend;
+use \OCP\Files\StorageNotAvailableException;
/**
* Class to configure mount.json globally and for users
@@ -49,11 +49,6 @@ class OC_Mount_Config {
const MOUNT_TYPE_USER = 'user';
const MOUNT_TYPE_PERSONAL = 'personal';
- // getBackendStatus return types
- const STATUS_SUCCESS = 0;
- const STATUS_ERROR = 1;
- const STATUS_INDETERMINATE = 2;
-
// whether to skip backend test (for unit tests, as this static class is not mockable)
public static $skipTest = false;
@@ -75,36 +70,6 @@ class OC_Mount_Config {
return true;
}
- /*
- * Hook that mounts the given user's visible mount points
- *
- * @param array $data
- */
- public static function initMountPointsHook($data) {
- if ($data['user']) {
- $user = \OC::$server->getUserManager()->get($data['user']);
- if (!$user) {
- \OC::$server->getLogger()->warning(
- 'Cannot init external mount points for non-existant user "' . $data['user'] . '".',
- ['app' => 'files_external']
- );
- return;
- }
- $userView = new \OC\Files\View('/' . $user->getUID() . '/files');
- $changePropagator = new \OC\Files\Cache\ChangePropagator($userView);
- $etagPropagator = new \OCA\Files_External\EtagPropagator($user, $changePropagator, \OC::$server->getConfig());
- $etagPropagator->propagateDirtyMountPoints();
- \OCP\Util::connectHook(
- \OC\Files\Filesystem::CLASSNAME,
- \OC\Files\Filesystem::signal_create_mount,
- $etagPropagator, 'updateHook');
- \OCP\Util::connectHook(
- \OC\Files\Filesystem::CLASSNAME,
- \OC\Files\Filesystem::signal_delete_mount,
- $etagPropagator, 'updateHook');
- }
- }
-
/**
* Returns the mount points for the given user.
* The mount point is relative to the data directory.
@@ -244,24 +209,27 @@ class OC_Mount_Config {
*
* @param string $class backend class name
* @param array $options backend configuration options
+ * @param boolean $isPersonal
* @return int see self::STATUS_*
+ * @throws Exception
*/
public static function getBackendStatus($class, $options, $isPersonal) {
if (self::$skipTest) {
- return self::STATUS_SUCCESS;
+ return StorageNotAvailableException::STATUS_SUCCESS;
}
foreach ($options as &$option) {
$option = self::setUserVars(OCP\User::getUser(), $option);
}
if (class_exists($class)) {
try {
+ /** @var \OC\Files\Storage\Common $storage */
$storage = new $class($options);
try {
$result = $storage->test($isPersonal);
$storage->setAvailability($result);
if ($result) {
- return self::STATUS_SUCCESS;
+ return StorageNotAvailableException::STATUS_SUCCESS;
}
} catch (\Exception $e) {
$storage->setAvailability(false);
@@ -272,7 +240,7 @@ class OC_Mount_Config {
throw $exception;
}
}
- return self::STATUS_ERROR;
+ return StorageNotAvailableException::STATUS_ERROR;
}
/**
@@ -322,7 +290,7 @@ class OC_Mount_Config {
* Get backend dependency message
* TODO: move into AppFramework along with templates
*
- * @param BackendConfig[] $backends
+ * @param Backend[] $backends
* @return string
*/
public static function dependencyMessage($backends) {
@@ -361,11 +329,11 @@ class OC_Mount_Config {
private static function getSingleDependencyMessage(\OCP\IL10N $l, $module, $backend) {
switch (strtolower($module)) {
case 'curl':
- return $l->t('<b>Note:</b> The cURL support in PHP is not enabled or installed. Mounting of %s is not possible. Please ask your system administrator to install it.', $backend);
+ return (string)$l->t('<b>Note:</b> The cURL support in PHP is not enabled or installed. Mounting of %s is not possible. Please ask your system administrator to install it.', $backend);
case 'ftp':
- return $l->t('<b>Note:</b> The FTP support in PHP is not enabled or installed. Mounting of %s is not possible. Please ask your system administrator to install it.', $backend);
+ return (string)$l->t('<b>Note:</b> The FTP support in PHP is not enabled or installed. Mounting of %s is not possible. Please ask your system administrator to install it.', $backend);
default:
- return $l->t('<b>Note:</b> "%s" is not installed. Mounting of %s is not possible. Please ask your system administrator to install it.', array($module, $backend));
+ return (string)$l->t('<b>Note:</b> "%s" is not installed. Mounting of %s is not possible. Please ask your system administrator to install it.', array($module, $backend));
}
}
diff --git a/apps/files_external/lib/config/configadapter.php b/apps/files_external/lib/config/configadapter.php
index 3a04512e8a8..f9640d53377 100644
--- a/apps/files_external/lib/config/configadapter.php
+++ b/apps/files_external/lib/config/configadapter.php
@@ -32,7 +32,6 @@ use OCP\IUser;
use OCA\Files_external\Service\UserStoragesService;
use OCA\Files_External\Service\UserGlobalStoragesService;
use OCA\Files_External\Lib\StorageConfig;
-use OCP\Files\StorageNotAvailableException;
use OCA\Files_External\Lib\FailedStorage;
/**
diff --git a/apps/files_external/lib/etagpropagator.php b/apps/files_external/lib/etagpropagator.php
deleted file mode 100644
index 772a11ea36f..00000000000
--- a/apps/files_external/lib/etagpropagator.php
+++ /dev/null
@@ -1,141 +0,0 @@
-<?php
-/**
- * @author Morris Jobke <hey@morrisjobke.de>
- * @author Robin Appelman <icewind@owncloud.com>
- * @author Vincent Petry <pvince81@owncloud.com>
- *
- * @copyright Copyright (c) 2015, ownCloud, Inc.
- * @license AGPL-3.0
- *
- * This code is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License, version 3,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License, version 3,
- * along with this program. If not, see <http://www.gnu.org/licenses/>
- *
- */
-
-namespace OCA\Files_External;
-
-use OC\Files\Filesystem;
-
-/**
- * Updates the etag of parent folders whenever a new external storage mount
- * point has been created or deleted. Updates need to be triggered using
- * the updateHook() method.
- *
- * There are two modes of operation:
- * - for personal mount points, the etag is propagated directly
- * - for system mount points, a dirty flag is saved in the configuration and
- * the etag will be updated the next time propagateDirtyMountPoints() is called
- */
-class EtagPropagator {
- /**
- * @var \OCP\IUser
- */
- protected $user;
-
- /**
- * @var \OC\Files\Cache\ChangePropagator
- */
- protected $changePropagator;
-
- /**
- * @var \OCP\IConfig
- */
- protected $config;
-
- /**
- * @param \OCP\IUser $user current user, must match the propagator's
- * user
- * @param \OC\Files\Cache\ChangePropagator $changePropagator change propagator
- * initialized with a view for $user
- * @param \OCP\IConfig $config
- */
- public function __construct($user, $changePropagator, $config) {
- $this->user = $user;
- $this->changePropagator = $changePropagator;
- $this->config = $config;
- }
-
- /**
- * Propagate the etag changes for all mountpoints marked as dirty and mark the mountpoints as clean
- *
- * @param int $time
- */
- public function propagateDirtyMountPoints($time = null) {
- if ($time === null) {
- $time = time();
- }
- $mountPoints = $this->getDirtyMountPoints();
- foreach ($mountPoints as $mountPoint) {
- $this->changePropagator->addChange($mountPoint);
- $this->config->setUserValue($this->user->getUID(), 'files_external', $mountPoint, $time);
- }
- if (count($mountPoints)) {
- $this->changePropagator->propagateChanges($time);
- }
- }
-
- /**
- * Get all mountpoints we need to update the etag for
- *
- * @return string[]
- */
- protected function getDirtyMountPoints() {
- $dirty = array();
- $mountPoints = $this->config->getAppKeys('files_external');
- foreach ($mountPoints as $mountPoint) {
- if (substr($mountPoint, 0, 1) === '/') {
- $updateTime = $this->config->getAppValue('files_external', $mountPoint);
- $userTime = $this->config->getUserValue($this->user->getUID(), 'files_external', $mountPoint);
- if ($updateTime > $userTime) {
- $dirty[] = $mountPoint;
- }
- }
- }
- return $dirty;
- }
-
- /**
- * @param string $mountPoint
- * @param int $time
- */
- protected function markDirty($mountPoint, $time = null) {
- if ($time === null) {
- $time = time();
- }
- $this->config->setAppValue('files_external', $mountPoint, $time);
- }
-
- /**
- * Update etags for mount points for known user
- * For global or group mount points, updating the etag for every user is not feasible
- * instead we mark the mount point as dirty and update the etag when the filesystem is loaded for the user
- * For personal mount points, the change is propagated directly
- *
- * @param array $params hook parameters
- * @param int $time update time to use when marking a mount point as dirty
- */
- public function updateHook($params, $time = null) {
- if ($time === null) {
- $time = time();
- }
- $users = $params[Filesystem::signal_param_users];
- $type = $params[Filesystem::signal_param_mount_type];
- $mountPoint = $params[Filesystem::signal_param_path];
- $mountPoint = Filesystem::normalizePath($mountPoint);
- if ($type === \OC_Mount_Config::MOUNT_TYPE_GROUP or $users === 'all') {
- $this->markDirty($mountPoint, $time);
- } else {
- $this->changePropagator->addChange($mountPoint);
- $this->changePropagator->propagateChanges($time);
- }
- }
-}
diff --git a/apps/files_external/lib/sftp.php b/apps/files_external/lib/sftp.php
index f8651727fd2..bcf3143736e 100644
--- a/apps/files_external/lib/sftp.php
+++ b/apps/files_external/lib/sftp.php
@@ -195,7 +195,7 @@ class SFTP extends \OC\Files\Storage\Common {
}
/**
- * @return bool|string
+ * @return string|false
*/
private function hostKeysPath() {
try {
diff --git a/apps/files_external/lib/storageconfig.php b/apps/files_external/lib/storageconfig.php
index 86a7e6ffa12..97e0386be73 100644
--- a/apps/files_external/lib/storageconfig.php
+++ b/apps/files_external/lib/storageconfig.php
@@ -302,6 +302,25 @@ class StorageConfig implements \JsonSerializable {
}
/**
+ * @param string $key
+ * @return mixed
+ */
+ public function getMountOption($key) {
+ if (isset($this->mountOptions[$key])) {
+ return $this->mountOptions[$key];
+ }
+ return null;
+ }
+
+ /**
+ * @param string $key
+ * @param mixed $value
+ */
+ public function setMountOption($key, $value) {
+ $this->mountOptions[$key] = $value;
+ }
+
+ /**
* Gets the storage status, whether the config worked last time
*
* @return int $status status
diff --git a/apps/files_external/service/storagesservice.php b/apps/files_external/service/storagesservice.php
index 3446ed0dab3..c847930ba2d 100644
--- a/apps/files_external/service/storagesservice.php
+++ b/apps/files_external/service/storagesservice.php
@@ -31,6 +31,7 @@ use \OCA\Files_external\NotFoundException;
use \OCA\Files_External\Service\BackendService;
use \OCA\Files_External\Lib\Backend\Backend;
use \OCA\Files_External\Lib\Auth\AuthMechanism;
+use \OCP\Files\StorageNotAvailableException;
/**
* Service class to manage external storages
@@ -411,7 +412,7 @@ abstract class StoragesService {
$this->triggerHooks($newStorage, Filesystem::signal_create_mount);
- $newStorage->setStatus(\OC_Mount_Config::STATUS_SUCCESS);
+ $newStorage->setStatus(StorageNotAvailableException::STATUS_SUCCESS);
return $newStorage;
}
diff --git a/apps/files_external/tests/amazons3migration.php b/apps/files_external/tests/amazons3migration.php
index 3eba5bca644..33fb6119a92 100644
--- a/apps/files_external/tests/amazons3migration.php
+++ b/apps/files_external/tests/amazons3migration.php
@@ -25,6 +25,13 @@
namespace Test\Files\Storage;
+/**
+ * Class AmazonS3Migration
+ *
+ * @group DB
+ *
+ * @package Test\Files\Storage
+ */
class AmazonS3Migration extends \Test\TestCase {
/**
diff --git a/apps/files_external/tests/backends/amazons3.php b/apps/files_external/tests/backends/amazons3.php
index c16581a4495..e1465b51125 100644
--- a/apps/files_external/tests/backends/amazons3.php
+++ b/apps/files_external/tests/backends/amazons3.php
@@ -25,6 +25,13 @@
namespace Test\Files\Storage;
+/**
+ * Class AmazonS3
+ *
+ * @group DB
+ *
+ * @package Test\Files\Storage
+ */
class AmazonS3 extends Storage {
private $config;
diff --git a/apps/files_external/tests/backends/dropbox.php b/apps/files_external/tests/backends/dropbox.php
index 8765011532c..8dd0e58adc1 100644
--- a/apps/files_external/tests/backends/dropbox.php
+++ b/apps/files_external/tests/backends/dropbox.php
@@ -25,6 +25,13 @@
namespace Test\Files\Storage;
+/**
+ * Class Dropbox
+ *
+ * @group DB
+ *
+ * @package Test\Files\Storage
+ */
class Dropbox extends Storage {
private $config;
diff --git a/apps/files_external/tests/backends/ftp.php b/apps/files_external/tests/backends/ftp.php
index 20a5c275d29..b715f0f780d 100644
--- a/apps/files_external/tests/backends/ftp.php
+++ b/apps/files_external/tests/backends/ftp.php
@@ -26,6 +26,13 @@
namespace Test\Files\Storage;
+/**
+ * Class FTP
+ *
+ * @group DB
+ *
+ * @package Test\Files\Storage
+ */
class FTP extends Storage {
private $config;
diff --git a/apps/files_external/tests/backends/google.php b/apps/files_external/tests/backends/google.php
index 6ff235ac6af..c9a5d48382c 100644
--- a/apps/files_external/tests/backends/google.php
+++ b/apps/files_external/tests/backends/google.php
@@ -28,6 +28,13 @@ namespace Test\Files\Storage;
require_once 'files_external/lib/google.php';
+/**
+ * Class Google
+ *
+ * @group DB
+ *
+ * @package Test\Files\Storage
+ */
class Google extends Storage {
private $config;
diff --git a/apps/files_external/tests/backends/owncloud.php b/apps/files_external/tests/backends/owncloud.php
index 47e27870be2..d51fa638c50 100644
--- a/apps/files_external/tests/backends/owncloud.php
+++ b/apps/files_external/tests/backends/owncloud.php
@@ -23,6 +23,13 @@
namespace Test\Files\Storage;
+/**
+ * Class OwnCloud
+ *
+ * @group DB
+ *
+ * @package Test\Files\Storage
+ */
class OwnCloud extends Storage {
private $config;
diff --git a/apps/files_external/tests/backends/sftp.php b/apps/files_external/tests/backends/sftp.php
index aaed2b3460a..03f2dcc0d77 100644
--- a/apps/files_external/tests/backends/sftp.php
+++ b/apps/files_external/tests/backends/sftp.php
@@ -25,6 +25,13 @@
namespace Test\Files\Storage;
+/**
+ * Class SFTP
+ *
+ * @group DB
+ *
+ * @package Test\Files\Storage
+ */
class SFTP extends Storage {
/**
* @var \OC\Files\Storage\SFTP instance
diff --git a/apps/files_external/tests/backends/sftp_key.php b/apps/files_external/tests/backends/sftp_key.php
index 6e8ac9f7239..762cb0887c1 100644
--- a/apps/files_external/tests/backends/sftp_key.php
+++ b/apps/files_external/tests/backends/sftp_key.php
@@ -23,6 +23,13 @@
namespace Test\Files\Storage;
+/**
+ * Class SFTP_Key
+ *
+ * @group DB
+ *
+ * @package Test\Files\Storage
+ */
class SFTP_Key extends Storage {
private $config;
diff --git a/apps/files_external/tests/backends/smb.php b/apps/files_external/tests/backends/smb.php
index 0da86cb824f..0c43aba24dd 100644
--- a/apps/files_external/tests/backends/smb.php
+++ b/apps/files_external/tests/backends/smb.php
@@ -24,6 +24,13 @@
namespace Test\Files\Storage;
+/**
+ * Class SMB
+ *
+ * @group DB
+ *
+ * @package Test\Files\Storage
+ */
class SMB extends Storage {
protected function setUp() {
diff --git a/apps/files_external/tests/backends/swift.php b/apps/files_external/tests/backends/swift.php
index 07ee36043b1..b71b4f77add 100644
--- a/apps/files_external/tests/backends/swift.php
+++ b/apps/files_external/tests/backends/swift.php
@@ -25,6 +25,13 @@
namespace Test\Files\Storage;
+/**
+ * Class Swift
+ *
+ * @group DB
+ *
+ * @package Test\Files\Storage
+ */
class Swift extends Storage {
private $config;
diff --git a/apps/files_external/tests/backends/webdav.php b/apps/files_external/tests/backends/webdav.php
index e2020da7c72..130e0c99cb3 100644
--- a/apps/files_external/tests/backends/webdav.php
+++ b/apps/files_external/tests/backends/webdav.php
@@ -24,6 +24,13 @@
namespace Test\Files\Storage;
+/**
+ * Class DAV
+ *
+ * @group DB
+ *
+ * @package Test\Files\Storage
+ */
class DAV extends Storage {
protected function setUp() {
diff --git a/apps/files_external/tests/etagpropagator.php b/apps/files_external/tests/etagpropagator.php
deleted file mode 100644
index d45982cb40c..00000000000
--- a/apps/files_external/tests/etagpropagator.php
+++ /dev/null
@@ -1,343 +0,0 @@
-<?php
-/**
- * @author Joas Schilling <nickvergessen@owncloud.com>
- * @author Morris Jobke <hey@morrisjobke.de>
- * @author Robin Appelman <icewind@owncloud.com>
- *
- * @copyright Copyright (c) 2015, ownCloud, Inc.
- * @license AGPL-3.0
- *
- * This code is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License, version 3,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License, version 3,
- * along with this program. If not, see <http://www.gnu.org/licenses/>
- *
- */
-
-namespace Tests\Files_External;
-
-use OC\Files\Filesystem;
-use OC\User\User;
-
-class EtagPropagator extends \Test\TestCase {
- protected function getUser() {
- return new User($this->getUniqueID(), null);
- }
-
- /**
- * @return \PHPUnit_Framework_MockObject_MockObject | \OC\Files\Cache\ChangePropagator
- */
- protected function getChangePropagator() {
- return $this->getMockBuilder('\OC\Files\Cache\ChangePropagator')
- ->disableOriginalConstructor()
- ->getMock();
- }
-
- /**
- * @return \PHPUnit_Framework_MockObject_MockObject | \OCP\IConfig
- */
- protected function getConfig() {
- $appConfig = array();
- $userConfig = array();
- $mock = $this->getMockBuilder('\OCP\IConfig')
- ->disableOriginalConstructor()
- ->getMock();
-
- $mock->expects($this->any())
- ->method('getAppValue')
- ->will($this->returnCallback(function ($appId, $key, $default = null) use (&$appConfig) {
- if (isset($appConfig[$appId]) and isset($appConfig[$appId][$key])) {
- return $appConfig[$appId][$key];
- } else {
- return $default;
- }
- }));
- $mock->expects($this->any())
- ->method('setAppValue')
- ->will($this->returnCallback(function ($appId, $key, $value) use (&$appConfig) {
- if (!isset($appConfig[$appId])) {
- $appConfig[$appId] = array();
- }
- $appConfig[$appId][$key] = $value;
- }));
- $mock->expects($this->any())
- ->method('getAppKeys')
- ->will($this->returnCallback(function ($appId) use (&$appConfig) {
- if (!isset($appConfig[$appId])) {
- $appConfig[$appId] = array();
- }
- return array_keys($appConfig[$appId]);
- }));
-
- $mock->expects($this->any())
- ->method('getUserValue')
- ->will($this->returnCallback(function ($userId, $appId, $key, $default = null) use (&$userConfig) {
- if (isset($userConfig[$userId]) and isset($userConfig[$userId][$appId]) and isset($userConfig[$userId][$appId][$key])) {
- return $userConfig[$userId][$appId][$key];
- } else {
- return $default;
- }
- }));
- $mock->expects($this->any())
- ->method('setUserValue')
- ->will($this->returnCallback(function ($userId, $appId, $key, $value) use (&$userConfig) {
- if (!isset($userConfig[$userId])) {
- $userConfig[$userId] = array();
- }
- if (!isset($userConfig[$userId][$appId])) {
- $userConfig[$userId][$appId] = array();
- }
- $userConfig[$userId][$appId][$key] = $value;
- }));
-
- return $mock;
- }
-
- public function testSingleUserMount() {
- $time = time();
- $user = $this->getUser();
- $config = $this->getConfig();
- $changePropagator = $this->getChangePropagator();
- $propagator = new \OCA\Files_External\EtagPropagator($user, $changePropagator, $config);
-
- $changePropagator->expects($this->once())
- ->method('addChange')
- ->with('/test');
- $changePropagator->expects($this->once())
- ->method('propagateChanges')
- ->with($time);
-
- $propagator->updateHook(array(
- Filesystem::signal_param_path => '/test',
- Filesystem::signal_param_mount_type => \OC_Mount_Config::MOUNT_TYPE_USER,
- Filesystem::signal_param_users => $user->getUID(),
- ), $time);
- }
-
- public function testGlobalMountNoDirectUpdate() {
- $time = time();
- $user = $this->getUser();
- $config = $this->getConfig();
- $changePropagator = $this->getChangePropagator();
- $propagator = new \OCA\Files_External\EtagPropagator($user, $changePropagator, $config);
-
- // not updated directly
- $changePropagator->expects($this->never())
- ->method('addChange');
- $changePropagator->expects($this->never())
- ->method('propagateChanges');
-
- $propagator->updateHook(array(
- Filesystem::signal_param_path => '/test',
- Filesystem::signal_param_mount_type => \OC_Mount_Config::MOUNT_TYPE_USER,
- Filesystem::signal_param_users => 'all',
- ), $time);
-
- // mount point marked as dirty
- $this->assertEquals(array('/test'), $config->getAppKeys('files_external'));
- $this->assertEquals($time, $config->getAppValue('files_external', '/test'));
- }
-
- public function testGroupMountNoDirectUpdate() {
- $time = time();
- $user = $this->getUser();
- $config = $this->getConfig();
- $changePropagator = $this->getChangePropagator();
- $propagator = new \OCA\Files_External\EtagPropagator($user, $changePropagator, $config);
-
- // not updated directly
- $changePropagator->expects($this->never())
- ->method('addChange');
- $changePropagator->expects($this->never())
- ->method('propagateChanges');
-
- $propagator->updateHook(array(
- Filesystem::signal_param_path => '/test',
- Filesystem::signal_param_mount_type => \OC_Mount_Config::MOUNT_TYPE_GROUP,
- Filesystem::signal_param_users => 'test',
- ), $time);
-
- // mount point marked as dirty
- $this->assertEquals(array('/test'), $config->getAppKeys('files_external'));
- $this->assertEquals($time, $config->getAppValue('files_external', '/test'));
- }
-
- public function testGlobalMountNoDirtyMountPoint() {
- $time = time();
- $user = $this->getUser();
- $config = $this->getConfig();
- $changePropagator = $this->getChangePropagator();
- $propagator = new \OCA\Files_External\EtagPropagator($user, $changePropagator, $config);
-
- $changePropagator->expects($this->never())
- ->method('addChange');
- $changePropagator->expects($this->never())
- ->method('propagateChanges');
-
- $propagator->propagateDirtyMountPoints($time);
-
- $this->assertEquals(0, $config->getUserValue($user->getUID(), 'files_external', '/test', 0));
- }
-
- public function testGlobalMountDirtyMountPointFirstTime() {
- $time = time();
- $user = $this->getUser();
- $config = $this->getConfig();
- $changePropagator = $this->getChangePropagator();
- $propagator = new \OCA\Files_External\EtagPropagator($user, $changePropagator, $config);
-
- $config->setAppValue('files_external', '/test', $time - 10);
-
- $changePropagator->expects($this->once())
- ->method('addChange')
- ->with('/test');
- $changePropagator->expects($this->once())
- ->method('propagateChanges')
- ->with($time);
-
- $propagator->propagateDirtyMountPoints($time);
-
- $this->assertEquals($time, $config->getUserValue($user->getUID(), 'files_external', '/test'));
- }
-
- public function testGlobalMountNonDirtyMountPoint() {
- $time = time();
- $user = $this->getUser();
- $config = $this->getConfig();
- $changePropagator = $this->getChangePropagator();
- $propagator = new \OCA\Files_External\EtagPropagator($user, $changePropagator, $config);
-
- $config->setAppValue('files_external', '/test', $time - 10);
- $config->setUserValue($user->getUID(), 'files_external', '/test', $time - 10);
-
- $changePropagator->expects($this->never())
- ->method('addChange');
- $changePropagator->expects($this->never())
- ->method('propagateChanges');
-
- $propagator->propagateDirtyMountPoints($time);
-
- $this->assertEquals($time - 10, $config->getUserValue($user->getUID(), 'files_external', '/test'));
- }
-
- public function testGlobalMountNonDirtyMountPointOtherUser() {
- $time = time();
- $user = $this->getUser();
- $user2 = $this->getUser();
- $config = $this->getConfig();
- $changePropagator = $this->getChangePropagator();
- $propagator = new \OCA\Files_External\EtagPropagator($user, $changePropagator, $config);
-
- $config->setAppValue('files_external', '/test', $time - 10);
- $config->setUserValue($user2->getUID(), 'files_external', '/test', $time - 10);
-
- $changePropagator->expects($this->once())
- ->method('addChange')
- ->with('/test');
- $changePropagator->expects($this->once())
- ->method('propagateChanges')
- ->with($time);
-
- $propagator->propagateDirtyMountPoints($time);
-
- $this->assertEquals($time, $config->getUserValue($user->getUID(), 'files_external', '/test'));
- }
-
- public function testGlobalMountDirtyMountPointSecondTime() {
- $time = time();
- $user = $this->getUser();
- $config = $this->getConfig();
- $changePropagator = $this->getChangePropagator();
- $propagator = new \OCA\Files_External\EtagPropagator($user, $changePropagator, $config);
-
- $config->setAppValue('files_external', '/test', $time - 10);
- $config->setUserValue($user->getUID(), 'files_external', '/test', $time - 20);
-
- $changePropagator->expects($this->once())
- ->method('addChange')
- ->with('/test');
- $changePropagator->expects($this->once())
- ->method('propagateChanges')
- ->with($time);
-
- $propagator->propagateDirtyMountPoints($time);
-
- $this->assertEquals($time, $config->getUserValue($user->getUID(), 'files_external', '/test'));
- }
-
- public function testGlobalMountMultipleUsers() {
- $time = time();
- $config = $this->getConfig();
- $user1 = $this->getUser();
- $user2 = $this->getUser();
- $user3 = $this->getUser();
- $changePropagator1 = $this->getChangePropagator();
- $changePropagator2 = $this->getChangePropagator();
- $changePropagator3 = $this->getChangePropagator();
- $propagator1 = new \OCA\Files_External\EtagPropagator($user1, $changePropagator1, $config);
- $propagator2 = new \OCA\Files_External\EtagPropagator($user2, $changePropagator2, $config);
- $propagator3 = new \OCA\Files_External\EtagPropagator($user3, $changePropagator3, $config);
-
- $config->setAppValue('files_external', '/test', $time - 10);
-
- $changePropagator1->expects($this->once())
- ->method('addChange')
- ->with('/test');
- $changePropagator1->expects($this->once())
- ->method('propagateChanges')
- ->with($time);
-
- $propagator1->propagateDirtyMountPoints($time);
-
- $this->assertEquals($time, $config->getUserValue($user1->getUID(), 'files_external', '/test'));
- $this->assertEquals(0, $config->getUserValue($user2->getUID(), 'files_external', '/test', 0));
- $this->assertEquals(0, $config->getUserValue($user3->getUID(), 'files_external', '/test', 0));
-
- $changePropagator2->expects($this->once())
- ->method('addChange')
- ->with('/test');
- $changePropagator2->expects($this->once())
- ->method('propagateChanges')
- ->with($time);
-
- $propagator2->propagateDirtyMountPoints($time);
-
- $this->assertEquals($time, $config->getUserValue($user1->getUID(), 'files_external', '/test'));
- $this->assertEquals($time, $config->getUserValue($user2->getUID(), 'files_external', '/test', 0));
- $this->assertEquals(0, $config->getUserValue($user3->getUID(), 'files_external', '/test', 0));
- }
-
- public function testGlobalMountMultipleDirtyMountPoints() {
- $time = time();
- $user = $this->getUser();
- $config = $this->getConfig();
- $changePropagator = $this->getChangePropagator();
- $propagator = new \OCA\Files_External\EtagPropagator($user, $changePropagator, $config);
-
- $config->setAppValue('files_external', '/test', $time - 10);
- $config->setAppValue('files_external', '/foo', $time - 50);
- $config->setAppValue('files_external', '/bar', $time - 70);
-
- $config->setUserValue($user->getUID(), 'files_external', '/foo', $time - 70);
- $config->setUserValue($user->getUID(), 'files_external', '/bar', $time - 70);
-
- $changePropagator->expects($this->exactly(2))
- ->method('addChange');
- $changePropagator->expects($this->once())
- ->method('propagateChanges')
- ->with($time);
-
- $propagator->propagateDirtyMountPoints($time);
-
- $this->assertEquals($time, $config->getUserValue($user->getUID(), 'files_external', '/test'));
- $this->assertEquals($time, $config->getUserValue($user->getUID(), 'files_external', '/foo'));
- $this->assertEquals($time - 70, $config->getUserValue($user->getUID(), 'files_external', '/bar'));
- }
-}
diff --git a/apps/files_external/tests/owncloudfunctions.php b/apps/files_external/tests/owncloudfunctions.php
index 4cfe83db950..887dd91539b 100644
--- a/apps/files_external/tests/owncloudfunctions.php
+++ b/apps/files_external/tests/owncloudfunctions.php
@@ -24,6 +24,13 @@
namespace Test\Files\Storage;
+/**
+ * Class OwnCloudFunctions
+ *
+ * @group DB
+ *
+ * @package Test\Files\Storage
+ */
class OwnCloudFunctions extends \Test\TestCase {
function configUrlProvider() {
diff --git a/apps/files_sharing/api/sharees.php b/apps/files_sharing/api/sharees.php
index 21f68d9b253..24b51d7afe4 100644
--- a/apps/files_sharing/api/sharees.php
+++ b/apps/files_sharing/api/sharees.php
@@ -120,6 +120,7 @@ class Sharees {
protected function getUsers($search) {
$this->result['users'] = $this->result['exact']['users'] = $users = [];
+ $userGroups = [];
if ($this->shareWithGroupOnly) {
// Search in all the groups this user is part of
$userGroups = $this->groupManager->getUserGroupIds($this->userSession->getUser());
@@ -171,13 +172,23 @@ class Sharees {
// user id and if so, we add that to the exact match list
$user = $this->userManager->get($search);
if ($user instanceof IUser) {
- array_push($this->result['exact']['users'], [
- 'label' => $user->getDisplayName(),
- 'value' => [
- 'shareType' => Share::SHARE_TYPE_USER,
- 'shareWith' => $user->getUID(),
- ],
- ]);
+ $addUser = true;
+
+ if ($this->shareWithGroupOnly) {
+ // Only add, if we have a common group
+ $commonGroups = array_intersect($userGroups, $this->groupManager->getUserGroupIds($user));
+ $addUser = !empty($commonGroups);
+ }
+
+ if ($addUser) {
+ array_push($this->result['exact']['users'], [
+ 'label' => $user->getDisplayName(),
+ 'value' => [
+ 'shareType' => Share::SHARE_TYPE_USER,
+ 'shareWith' => $user->getUID(),
+ ],
+ ]);
+ }
}
}
diff --git a/apps/files_sharing/appinfo/app.php b/apps/files_sharing/appinfo/app.php
index 5f56340d254..d7f3ba6e98d 100644
--- a/apps/files_sharing/appinfo/app.php
+++ b/apps/files_sharing/appinfo/app.php
@@ -57,7 +57,9 @@ $eventDispatcher->addListener(
function() {
\OCP\Util::addScript('files_sharing', 'share');
\OCP\Util::addScript('files_sharing', 'sharetabview');
- \OCP\Util::addScript('files_sharing', 'external');
+ if (\OC::$server->getConfig()->getAppValue('files_sharing', 'incoming_server2server_share_enabled', 'yes') === 'yes') {
+ \OCP\Util::addScript('files_sharing', 'external');
+ }
\OCP\Util::addStyle('files_sharing', 'sharetabview');
}
);
diff --git a/apps/files_sharing/css/sharetabview.css b/apps/files_sharing/css/sharetabview.css
index 7597004e684..642c0909af3 100644
--- a/apps/files_sharing/css/sharetabview.css
+++ b/apps/files_sharing/css/sharetabview.css
@@ -28,7 +28,7 @@
width: 94%;
margin-left: 0;
}
-.shareTabView #shareWith {
+.shareTabView input[type="text"].shareWithField {
width: 80%;
}
diff --git a/apps/files_sharing/js/public.js b/apps/files_sharing/js/public.js
index 9b2e2c00f60..0b78d200b94 100644
--- a/apps/files_sharing/js/public.js
+++ b/apps/files_sharing/js/public.js
@@ -148,11 +148,14 @@ OCA.Sharing.PublicApp = {
if (this.fileList) {
// TODO: move this to a separate PublicFileList class that extends OCA.Files.FileList (+ unit tests)
- this.fileList.getDownloadUrl = function (filename, dir) {
- if ($.isArray(filename)) {
+ this.fileList.getDownloadUrl = function (filename, dir, isDir) {
+ var path = dir || this.getCurrentDirectory();
+ if (filename && !_.isArray(filename) && !isDir) {
+ return OC.getRootPath() + '/public.php/webdav' + OC.joinPaths(path, filename);
+ }
+ if (_.isArray(filename)) {
filename = JSON.stringify(filename);
}
- var path = dir || FileList.getCurrentDirectory();
var params = {
path: path,
files: filename
diff --git a/apps/files_sharing/l10n/de.js b/apps/files_sharing/l10n/de.js
index 295c7cdbb76..1c5121fdde2 100644
--- a/apps/files_sharing/l10n/de.js
+++ b/apps/files_sharing/l10n/de.js
@@ -62,7 +62,7 @@ OC.L10N.register(
"Password" : "Passwort",
"No entries found in this folder" : "Keine Einträge in diesem Ordner gefunden",
"Name" : "Name",
- "Share time" : "Zeitpunkt der Freigabe",
+ "Share time" : "Freigabezeitpunkt",
"Sorry, this link doesn’t seem to work anymore." : "Entschuldigung, dieser Link scheint nicht mehr zu funktionieren.",
"Reasons might be:" : "Gründe könnten sein:",
"the item was removed" : "Das Element wurde entfernt",
diff --git a/apps/files_sharing/l10n/de.json b/apps/files_sharing/l10n/de.json
index 690e7596ffc..48b2e81b681 100644
--- a/apps/files_sharing/l10n/de.json
+++ b/apps/files_sharing/l10n/de.json
@@ -60,7 +60,7 @@
"Password" : "Passwort",
"No entries found in this folder" : "Keine Einträge in diesem Ordner gefunden",
"Name" : "Name",
- "Share time" : "Zeitpunkt der Freigabe",
+ "Share time" : "Freigabezeitpunkt",
"Sorry, this link doesn’t seem to work anymore." : "Entschuldigung, dieser Link scheint nicht mehr zu funktionieren.",
"Reasons might be:" : "Gründe könnten sein:",
"the item was removed" : "Das Element wurde entfernt",
diff --git a/apps/files_sharing/l10n/de_DE.js b/apps/files_sharing/l10n/de_DE.js
index 38698110e7d..b1b4be9e5ad 100644
--- a/apps/files_sharing/l10n/de_DE.js
+++ b/apps/files_sharing/l10n/de_DE.js
@@ -58,7 +58,7 @@ OC.L10N.register(
"Password" : "Passwort",
"No entries found in this folder" : "Keine Einträge in diesem Ordner gefunden",
"Name" : "Name",
- "Share time" : "Zeitpunkt der Freigabe",
+ "Share time" : "Freigabezeitpunkt",
"Sorry, this link doesn’t seem to work anymore." : "Entschuldigung, dieser Link scheint nicht mehr zu funktionieren.",
"Reasons might be:" : "Gründe könnten sein:",
"the item was removed" : "Das Element wurde entfernt",
diff --git a/apps/files_sharing/l10n/de_DE.json b/apps/files_sharing/l10n/de_DE.json
index afd267f78b1..7ed2c480284 100644
--- a/apps/files_sharing/l10n/de_DE.json
+++ b/apps/files_sharing/l10n/de_DE.json
@@ -56,7 +56,7 @@
"Password" : "Passwort",
"No entries found in this folder" : "Keine Einträge in diesem Ordner gefunden",
"Name" : "Name",
- "Share time" : "Zeitpunkt der Freigabe",
+ "Share time" : "Freigabezeitpunkt",
"Sorry, this link doesn’t seem to work anymore." : "Entschuldigung, dieser Link scheint nicht mehr zu funktionieren.",
"Reasons might be:" : "Gründe könnten sein:",
"the item was removed" : "Das Element wurde entfernt",
diff --git a/apps/files_sharing/lib/helper.php b/apps/files_sharing/lib/helper.php
index a804737c490..391b491e1ff 100644
--- a/apps/files_sharing/lib/helper.php
+++ b/apps/files_sharing/lib/helper.php
@@ -310,20 +310,4 @@ class Helper {
\OC::$server->getConfig()->setSystemValue('share_folder', $shareFolder);
}
- /**
- * remove protocol from URL
- *
- * @param string $url
- * @return string
- */
- public static function removeProtocolFromUrl($url) {
- if (strpos($url, 'https://') === 0) {
- return substr($url, strlen('https://'));
- } else if (strpos($url, 'http://') === 0) {
- return substr($url, strlen('http://'));
- }
-
- return $url;
- }
-
}
diff --git a/apps/files_sharing/settings-personal.php b/apps/files_sharing/settings-personal.php
index deaa7b92ac7..85fad9c3eaf 100644
--- a/apps/files_sharing/settings-personal.php
+++ b/apps/files_sharing/settings-personal.php
@@ -32,9 +32,7 @@ if (count($matches) > 0 && $matches[1] <= 9) {
$isIE8 = true;
}
-$uid = \OC::$server->getUserSession()->getUser()->getUID();
-$server = \OC::$server->getURLGenerator()->getAbsoluteURL('/');
-$cloudID = $uid . '@' . rtrim(\OCA\Files_Sharing\Helper::removeProtocolFromUrl($server), '/');
+$cloudID = \OC::$server->getUserSession()->getUser()->getCloudId();
$url = 'https://owncloud.org/federation#' . $cloudID;
$ownCloudLogoPath = \OC::$server->getURLGenerator()->imagePath('core', 'logo-icon.svg');
diff --git a/apps/files_sharing/tests/activity.php b/apps/files_sharing/tests/activity.php
index f7f324cdfc3..fa626749957 100644
--- a/apps/files_sharing/tests/activity.php
+++ b/apps/files_sharing/tests/activity.php
@@ -22,10 +22,15 @@
*/
namespace OCA\Files_sharing\Tests;
-use OCA\Files_sharing\Tests\TestCase;
-
-class Activity extends \OCA\Files_Sharing\Tests\TestCase{
+/**
+ * Class Activity
+ *
+ * @group DB
+ *
+ * @package OCA\Files_sharing\Tests
+ */
+class Activity extends \OCA\Files_Sharing\Tests\TestCase {
/**
* @var \OCA\Files_Sharing\Activity
diff --git a/apps/files_sharing/tests/api.php b/apps/files_sharing/tests/api.php
index 760bc0591e5..36ae3398393 100644
--- a/apps/files_sharing/tests/api.php
+++ b/apps/files_sharing/tests/api.php
@@ -31,6 +31,8 @@ use OCA\Files_sharing\Tests\TestCase;
/**
* Class Test_Files_Sharing_Api
+ *
+ * @group DB
*/
class Test_Files_Sharing_Api extends TestCase {
diff --git a/apps/files_sharing/tests/api/shareestest.php b/apps/files_sharing/tests/api/shareestest.php
index 8a35350aeb5..a3e3a6dee6d 100644
--- a/apps/files_sharing/tests/api/shareestest.php
+++ b/apps/files_sharing/tests/api/shareestest.php
@@ -27,6 +27,13 @@ use OCA\Files_sharing\Tests\TestCase;
use OCP\AppFramework\Http;
use OCP\Share;
+/**
+ * Class ShareesTest
+ *
+ * @group DB
+ *
+ * @package OCA\Files_Sharing\Tests\API
+ */
class ShareesTest extends TestCase {
/** @var Sharees */
protected $sharees;
@@ -129,12 +136,20 @@ class ShareesTest extends TestCase {
],
[
'test', true, true, [], [],
+ [], [], true, $this->getUserMock('test', 'Test')
+ ],
+ [
+ 'test', true, false, [], [],
+ [], [], true, $this->getUserMock('test', 'Test')
+ ],
+ [
+ 'test', true, true, ['test-group'], [['test-group', 'test', 2, 0, []]],
[
['label' => 'Test', 'value' => ['shareType' => Share::SHARE_TYPE_USER, 'shareWith' => 'test']],
], [], true, $this->getUserMock('test', 'Test')
],
[
- 'test', true, false, [], [],
+ 'test', true, false, ['test-group'], [['test-group', 'test', 2, 0, []]],
[
['label' => 'Test', 'value' => ['shareType' => Share::SHARE_TYPE_USER, 'shareWith' => 'test']],
], [], true, $this->getUserMock('test', 'Test')
@@ -383,10 +398,20 @@ class ShareesTest extends TestCase {
->with($searchTerm, $this->invokePrivate($this->sharees, 'limit'), $this->invokePrivate($this->sharees, 'offset'))
->willReturn($userResponse);
} else {
- $this->groupManager->expects($this->once())
- ->method('getUserGroupIds')
- ->with($user)
- ->willReturn($groupResponse);
+ if ($singleUser !== false) {
+ $this->groupManager->expects($this->exactly(2))
+ ->method('getUserGroupIds')
+ ->withConsecutive(
+ $user,
+ $singleUser
+ )
+ ->willReturn($groupResponse);
+ } else {
+ $this->groupManager->expects($this->once())
+ ->method('getUserGroupIds')
+ ->with($user)
+ ->willReturn($groupResponse);
+ }
$this->groupManager->expects($this->exactly(sizeof($groupResponse)))
->method('displayNamesInGroup')
diff --git a/apps/files_sharing/tests/backend.php b/apps/files_sharing/tests/backend.php
index 1332342c44b..57cdfc45115 100644
--- a/apps/files_sharing/tests/backend.php
+++ b/apps/files_sharing/tests/backend.php
@@ -27,6 +27,8 @@ use OCA\Files_sharing\Tests\TestCase;
/**
* Class Test_Files_Sharing
+ *
+ * @group DB
*/
class Test_Files_Sharing_Backend extends TestCase {
diff --git a/apps/files_sharing/tests/cache.php b/apps/files_sharing/tests/cache.php
index 7e7e5ee26d5..df7f4fd19a3 100644
--- a/apps/files_sharing/tests/cache.php
+++ b/apps/files_sharing/tests/cache.php
@@ -47,6 +47,12 @@ use OCA\Files_sharing\Tests\TestCase;
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
+
+/**
+ * Class Test_Files_Sharing_Cache
+ *
+ * @group DB
+ */
class Test_Files_Sharing_Cache extends TestCase {
/**
diff --git a/apps/files_sharing/tests/capabilities.php b/apps/files_sharing/tests/capabilities.php
index 8bebde9f2d1..6fb76f10c24 100644
--- a/apps/files_sharing/tests/capabilities.php
+++ b/apps/files_sharing/tests/capabilities.php
@@ -26,6 +26,8 @@ use OCA\Files_Sharing\Tests\TestCase;
/**
* Class FilesSharingCapabilitiesTest
+ *
+ * @group DB
*/
class FilesSharingCapabilitiesTest extends \Test\TestCase {
diff --git a/apps/files_sharing/tests/controller/sharecontroller.php b/apps/files_sharing/tests/controller/sharecontroller.php
index db5eb75d761..ccef4263c2b 100644
--- a/apps/files_sharing/tests/controller/sharecontroller.php
+++ b/apps/files_sharing/tests/controller/sharecontroller.php
@@ -38,6 +38,8 @@ use OCP\Share;
use OC\URLGenerator;
/**
+ * @group DB
+ *
* @package OCA\Files_Sharing\Controllers
*/
class ShareControllerTest extends \Test\TestCase {
diff --git a/apps/files_sharing/tests/deleteorphanedsharesjobtest.php b/apps/files_sharing/tests/deleteorphanedsharesjobtest.php
index 124cb83e6f0..a2e3f36f6ac 100644
--- a/apps/files_sharing/tests/deleteorphanedsharesjobtest.php
+++ b/apps/files_sharing/tests/deleteorphanedsharesjobtest.php
@@ -23,6 +23,13 @@ namespace Test\BackgroundJob;
use OCA\Files_sharing\Lib\DeleteOrphanedSharesJob;
+/**
+ * Class DeleteOrphanedSharesJobTest
+ *
+ * @group DB
+ *
+ * @package Test\BackgroundJob
+ */
class DeleteOrphanedSharesJobTest extends \Test\TestCase {
/**
diff --git a/apps/files_sharing/tests/etagpropagation.php b/apps/files_sharing/tests/etagpropagation.php
index 2a33732d63f..de9ce565394 100644
--- a/apps/files_sharing/tests/etagpropagation.php
+++ b/apps/files_sharing/tests/etagpropagation.php
@@ -27,6 +27,13 @@ namespace OCA\Files_sharing\Tests;
use OC\Files\Filesystem;
use OC\Files\View;
+/**
+ * Class EtagPropagation
+ *
+ * @group DB
+ *
+ * @package OCA\Files_sharing\Tests
+ */
class EtagPropagation extends TestCase {
/**
* @var \OC\Files\View
diff --git a/apps/files_sharing/tests/expiresharesjobtest.php b/apps/files_sharing/tests/expiresharesjobtest.php
index 63a2c46f647..b21d095e6b1 100644
--- a/apps/files_sharing/tests/expiresharesjobtest.php
+++ b/apps/files_sharing/tests/expiresharesjobtest.php
@@ -23,6 +23,13 @@ namespace OCA\Files_Sharing\Tests;
use OCA\Files_Sharing\ExpireSharesJob;
+/**
+ * Class ExpireSharesJobTest
+ *
+ * @group DB
+ *
+ * @package OCA\Files_Sharing\Tests
+ */
class ExpireSharesJobTest extends \Test\TestCase {
/**
diff --git a/apps/files_sharing/tests/external/cache.php b/apps/files_sharing/tests/external/cache.php
index aa3839899ce..e44c935d3fd 100644
--- a/apps/files_sharing/tests/external/cache.php
+++ b/apps/files_sharing/tests/external/cache.php
@@ -23,24 +23,11 @@ namespace OCA\Files_sharing\Tests\External;
use OCA\Files_sharing\Tests\TestCase;
/**
- * ownCloud
+ * Class Cache
*
- * @author Vincent Petry
- * @copyright 2015 Vincent Petry <pvince81@owncloud.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
- *
- * You should have received a copy of the GNU Affero General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ * @group DB
*
+ * @package OCA\Files_sharing\Tests\External
*/
class Cache extends TestCase {
diff --git a/apps/files_sharing/tests/external/managertest.php b/apps/files_sharing/tests/external/managertest.php
index 5b93b7494e9..015be47270e 100644
--- a/apps/files_sharing/tests/external/managertest.php
+++ b/apps/files_sharing/tests/external/managertest.php
@@ -28,6 +28,13 @@ use OCA\Files_Sharing\External\MountProvider;
use OCA\Files_Sharing\Tests\TestCase;
use Test\Traits\UserTrait;
+/**
+ * Class ManagerTest
+ *
+ * @group DB
+ *
+ * @package OCA\Files_Sharing\Tests\External
+ */
class ManagerTest extends TestCase {
use UserTrait;
diff --git a/apps/files_sharing/tests/externalstorage.php b/apps/files_sharing/tests/externalstorage.php
index a549e093dc1..109545119ba 100644
--- a/apps/files_sharing/tests/externalstorage.php
+++ b/apps/files_sharing/tests/externalstorage.php
@@ -24,6 +24,8 @@
/**
* Tests for the external Storage class for remote shares.
+ *
+ * @group DB
*/
class Test_Files_Sharing_External_Storage extends \Test\TestCase {
diff --git a/apps/files_sharing/tests/helper.php b/apps/files_sharing/tests/helper.php
index 34a1389db77..1a4a9ee7834 100644
--- a/apps/files_sharing/tests/helper.php
+++ b/apps/files_sharing/tests/helper.php
@@ -24,26 +24,10 @@
use OCA\Files_sharing\Tests\TestCase;
/**
- * ownCloud
- *
- * @author Bjoern Schiessle
- * @copyright 2014 Bjoern Schiessle <schiessle@owncloud.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
- *
- * You should have received a copy of the GNU Affero General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ * Class Test_Files_Sharing_Helper
*
+ * @group DB
*/
-
class Test_Files_Sharing_Helper extends TestCase {
/**
diff --git a/apps/files_sharing/tests/js/publicAppSpec.js b/apps/files_sharing/tests/js/publicAppSpec.js
index 1ea5f7ed1bc..74f008025e1 100644
--- a/apps/files_sharing/tests/js/publicAppSpec.js
+++ b/apps/files_sharing/tests/js/publicAppSpec.js
@@ -101,12 +101,12 @@ describe('OCA.Sharing.PublicApp tests', function() {
it('returns correct download URL for single files', function() {
expect(fileList.getDownloadUrl('some file.txt'))
- .toEqual(OC.webroot + '/index.php/s/sh4tok/download?path=%2Fsubdir&files=some%20file.txt');
- expect(fileList.getDownloadUrl('some file.txt', '/anotherpath/abc'))
- .toEqual(OC.webroot + '/index.php/s/sh4tok/download?path=%2Fanotherpath%2Fabc&files=some%20file.txt');
+ .toEqual('/owncloud/public.php/webdav/subdir/some file.txt');
+ expect(fileList.getDownloadUrl('some file.txt', '/another path/abc'))
+ .toEqual('/owncloud/public.php/webdav/another path/abc/some file.txt');
fileList.changeDirectory('/');
expect(fileList.getDownloadUrl('some file.txt'))
- .toEqual(OC.webroot + '/index.php/s/sh4tok/download?path=%2F&files=some%20file.txt');
+ .toEqual('/owncloud/public.php/webdav/some file.txt');
});
it('returns correct download URL for multiple files', function() {
expect(fileList.getDownloadUrl(['a b c.txt', 'd e f.txt']))
diff --git a/apps/files_sharing/tests/locking.php b/apps/files_sharing/tests/locking.php
index ae1fcf30a53..3b8900f2061 100644
--- a/apps/files_sharing/tests/locking.php
+++ b/apps/files_sharing/tests/locking.php
@@ -27,6 +27,13 @@ use OC\Files\View;
use OC\Lock\MemcacheLockingProvider;
use OCP\Lock\ILockingProvider;
+/**
+ * Class Locking
+ *
+ * @group DB
+ *
+ * @package OCA\Files_sharing\Tests
+ */
class Locking extends TestCase {
/**
* @var \Test\Util\User\Dummy
diff --git a/apps/files_sharing/tests/migrationtest.php b/apps/files_sharing/tests/migrationtest.php
index 522181fbb23..49d76126eb2 100644
--- a/apps/files_sharing/tests/migrationtest.php
+++ b/apps/files_sharing/tests/migrationtest.php
@@ -24,6 +24,11 @@
use OCA\Files_Sharing\Tests\TestCase;
use OCA\Files_Sharing\Migration;
+/**
+ * Class MigrationTest
+ *
+ * @group DB
+ */
class MigrationTest extends TestCase {
/**
diff --git a/apps/files_sharing/tests/permissions.php b/apps/files_sharing/tests/permissions.php
index 80e727b7178..4261ede7a76 100644
--- a/apps/files_sharing/tests/permissions.php
+++ b/apps/files_sharing/tests/permissions.php
@@ -26,7 +26,11 @@ use OC\Files\Cache\Cache;
use OC\Files\Storage\Storage;
use OC\Files\View;
-
+/**
+ * Class Test_Files_Sharing_Permissions
+ *
+ * @group DB
+ */
class Test_Files_Sharing_Permissions extends OCA\Files_sharing\Tests\TestCase {
/**
diff --git a/apps/files_sharing/tests/server2server.php b/apps/files_sharing/tests/server2server.php
index 300c637c777..a0f0e18b769 100644
--- a/apps/files_sharing/tests/server2server.php
+++ b/apps/files_sharing/tests/server2server.php
@@ -26,6 +26,8 @@ use OCA\Files_Sharing\Tests\TestCase;
/**
* Class Test_Files_Sharing_Api
+ *
+ * @group DB
*/
class Test_Files_Sharing_S2S_OCS_API extends TestCase {
diff --git a/apps/files_sharing/tests/share.php b/apps/files_sharing/tests/share.php
index 896191dfe51..b5ba0e3ad51 100644
--- a/apps/files_sharing/tests/share.php
+++ b/apps/files_sharing/tests/share.php
@@ -27,6 +27,8 @@ use OCA\Files\Share;
/**
* Class Test_Files_Sharing
+ *
+ * @group DB
*/
class Test_Files_Sharing extends OCA\Files_sharing\Tests\TestCase {
diff --git a/apps/files_sharing/tests/sharedmount.php b/apps/files_sharing/tests/sharedmount.php
index 94c0ad448bc..7b256588f93 100644
--- a/apps/files_sharing/tests/sharedmount.php
+++ b/apps/files_sharing/tests/sharedmount.php
@@ -27,6 +27,8 @@
/**
* Class Test_Files_Sharing_Api
+ *
+ * @group DB
*/
class Test_Files_Sharing_Mount extends OCA\Files_sharing\Tests\TestCase {
diff --git a/apps/files_sharing/tests/sharedstorage.php b/apps/files_sharing/tests/sharedstorage.php
index 3361d2cbd12..0d4a6b56307 100644
--- a/apps/files_sharing/tests/sharedstorage.php
+++ b/apps/files_sharing/tests/sharedstorage.php
@@ -28,6 +28,8 @@ use OCA\Files\Share;
/**
* Class Test_Files_Sharing_Api
+ *
+ * @group DB
*/
class Test_Files_Sharing_Storage extends OCA\Files_sharing\Tests\TestCase {
diff --git a/apps/files_sharing/tests/sizepropagation.php b/apps/files_sharing/tests/sizepropagation.php
index 1d09f69449f..535a475276c 100644
--- a/apps/files_sharing/tests/sizepropagation.php
+++ b/apps/files_sharing/tests/sizepropagation.php
@@ -24,6 +24,13 @@ namespace OCA\Files_sharing\Tests;
use OC\Files\View;
+/**
+ * Class SizePropagation
+ *
+ * @group DB
+ *
+ * @package OCA\Files_sharing\Tests
+ */
class SizePropagation extends TestCase {
public function testSizePropagationWhenOwnerChangesFile() {
diff --git a/apps/files_sharing/tests/testcase.php b/apps/files_sharing/tests/testcase.php
index 6a72a34149a..dc5b8ed79d9 100644
--- a/apps/files_sharing/tests/testcase.php
+++ b/apps/files_sharing/tests/testcase.php
@@ -36,6 +36,8 @@ use OCA\Files_Sharing\Appinfo\Application;
/**
* Class Test_Files_Sharing_Base
*
+ * @group DB
+ *
* Base class for sharing tests.
*/
abstract class TestCase extends \Test\TestCase {
diff --git a/apps/files_sharing/tests/unsharechildren.php b/apps/files_sharing/tests/unsharechildren.php
index c57070ba641..8de735363d1 100644
--- a/apps/files_sharing/tests/unsharechildren.php
+++ b/apps/files_sharing/tests/unsharechildren.php
@@ -26,6 +26,13 @@ namespace OCA\Files_sharing\Tests;
use OCA\Files\Share;
+/**
+ * Class UnshareChildren
+ *
+ * @group DB
+ *
+ * @package OCA\Files_sharing\Tests
+ */
class UnshareChildren extends TestCase {
protected $subsubfolder;
diff --git a/apps/files_sharing/tests/updater.php b/apps/files_sharing/tests/updater.php
index 63ab452a5e1..312734523b5 100644
--- a/apps/files_sharing/tests/updater.php
+++ b/apps/files_sharing/tests/updater.php
@@ -25,6 +25,8 @@
/**
* Class Test_Files_Sharing_Updater
+ *
+ * @group DB
*/
class Test_Files_Sharing_Updater extends OCA\Files_Sharing\Tests\TestCase {
diff --git a/apps/files_sharing/tests/watcher.php b/apps/files_sharing/tests/watcher.php
index 5e96a3fe68e..6443be664a7 100644
--- a/apps/files_sharing/tests/watcher.php
+++ b/apps/files_sharing/tests/watcher.php
@@ -25,6 +25,11 @@
*
*/
+/**
+ * Class Test_Files_Sharing_Watcher
+ *
+ * @group DB
+ */
class Test_Files_Sharing_Watcher extends OCA\Files_sharing\Tests\TestCase {
/**
diff --git a/apps/files_trashbin/tests/command/cleanuptest.php b/apps/files_trashbin/tests/command/cleanuptest.php
index e928f55eb8b..82084a2d525 100644
--- a/apps/files_trashbin/tests/command/cleanuptest.php
+++ b/apps/files_trashbin/tests/command/cleanuptest.php
@@ -29,6 +29,13 @@ use Test\TestCase;
use OC\User\Manager;
use OCP\Files\IRootFolder;
+/**
+ * Class CleanUpTest
+ *
+ * @group DB
+ *
+ * @package OCA\Files_Trashbin\Tests\Command
+ */
class CleanUpTest extends TestCase {
/** @var CleanUp */
diff --git a/apps/files_trashbin/tests/command/expiretest.php b/apps/files_trashbin/tests/command/expiretest.php
index 0d457db2807..463fca6080e 100644
--- a/apps/files_trashbin/tests/command/expiretest.php
+++ b/apps/files_trashbin/tests/command/expiretest.php
@@ -24,6 +24,13 @@ namespace OCA\Files_Trashbin\Tests\Command;
use OCA\Files_Trashbin\Command\Expire;
use Test\TestCase;
+/**
+ * Class ExpireTest
+ *
+ * @group DB
+ *
+ * @package OCA\Files_Trashbin\Tests\Command
+ */
class ExpireTest extends TestCase {
public function testExpireNonExistingUser() {
$command = new Expire('test');
diff --git a/apps/files_trashbin/tests/storage.php b/apps/files_trashbin/tests/storage.php
index 44b680f265c..3ebbbc3ec9d 100644
--- a/apps/files_trashbin/tests/storage.php
+++ b/apps/files_trashbin/tests/storage.php
@@ -27,6 +27,13 @@ namespace OCA\Files_trashbin\Tests\Storage;
use OC\Files\Storage\Temporary;
use OC\Files\Filesystem;
+/**
+ * Class Storage
+ *
+ * @group DB
+ *
+ * @package OCA\Files_trashbin\Tests\Storage
+ */
class Storage extends \Test\TestCase {
/**
* @var string
diff --git a/apps/files_trashbin/tests/trashbin.php b/apps/files_trashbin/tests/trashbin.php
index 934f831ef74..c53ed8d8a9b 100644
--- a/apps/files_trashbin/tests/trashbin.php
+++ b/apps/files_trashbin/tests/trashbin.php
@@ -29,6 +29,8 @@ use OCA\Files_Trashbin;
/**
* Class Test_Encryption
+ *
+ * @group DB
*/
class Test_Trashbin extends \Test\TestCase {
@@ -69,9 +71,10 @@ class Test_Trashbin extends \Test\TestCase {
//disable encryption
\OC_App::disable('encryption');
+ $config = \OC::$server->getConfig();
//configure trashbin
- self::$rememberRetentionObligation = \OC_Config::getValue('trashbin_retention_obligation', Files_Trashbin\Expiration::DEFAULT_RETENTION_OBLIGATION);
- \OC_Config::setValue('trashbin_retention_obligation', 'auto, 2');
+ self::$rememberRetentionObligation = $config->getSystemValue('trashbin_retention_obligation', Files_Trashbin\Expiration::DEFAULT_RETENTION_OBLIGATION);
+ $config->setSystemValue('trashbin_retention_obligation', 'auto, 2');
// register hooks
Files_Trashbin\Trashbin::registerHooks();
@@ -87,7 +90,7 @@ class Test_Trashbin extends \Test\TestCase {
// cleanup test user
\OC_User::deleteUser(self::TEST_TRASHBIN_USER1);
- \OC_Config::setValue('trashbin_retention_obligation', self::$rememberRetentionObligation);
+ \OC::$server->getConfig()->setSystemValue('trashbin_retention_obligation', self::$rememberRetentionObligation);
\OC_Hook::clear();
diff --git a/apps/files_versions/tests/command/cleanuptest.php b/apps/files_versions/tests/command/cleanuptest.php
index bfde25d75ce..141213774c0 100644
--- a/apps/files_versions/tests/command/cleanuptest.php
+++ b/apps/files_versions/tests/command/cleanuptest.php
@@ -28,6 +28,13 @@ use Test\TestCase;
use OC\User\Manager;
use OCP\Files\IRootFolder;
+/**
+ * Class CleanupTest
+ *
+ * @group DB
+ *
+ * @package OCA\Files_Versions\Tests\Command
+ */
class CleanupTest extends TestCase {
/** @var CleanUp */
diff --git a/apps/files_versions/tests/command/expiretest.php b/apps/files_versions/tests/command/expiretest.php
index eccc1f4c2ad..5048ab1ef31 100644
--- a/apps/files_versions/tests/command/expiretest.php
+++ b/apps/files_versions/tests/command/expiretest.php
@@ -25,6 +25,13 @@ namespace OCA\Files_Versions\Tests\Command;
use OCA\Files_Versions\Command\Expire;
use Test\TestCase;
+/**
+ * Class ExpireTest
+ *
+ * @group DB
+ *
+ * @package OCA\Files_Versions\Tests\Command
+ */
class ExpireTest extends TestCase {
public function testExpireNonExistingUser() {
$command = new Expire($this->getUniqueID('test'), '');
diff --git a/apps/files_versions/tests/versions.php b/apps/files_versions/tests/versions.php
index 6ebbf830e70..ffc98c2e98c 100644
--- a/apps/files_versions/tests/versions.php
+++ b/apps/files_versions/tests/versions.php
@@ -34,6 +34,8 @@ use OC\Files\Storage\Temporary;
/**
* Class Test_Files_versions
* this class provide basic files versions test
+ *
+ * @group DB
*/
class Test_Files_Versioning extends \Test\TestCase {
diff --git a/apps/provisioning_api/lib/users.php b/apps/provisioning_api/lib/users.php
index a2568425d0f..ad067b03cfd 100644
--- a/apps/provisioning_api/lib/users.php
+++ b/apps/provisioning_api/lib/users.php
@@ -199,7 +199,7 @@ class Users {
// Find the data
$data['quota'] = $this->fillStorageInfo($userId);
- $data['email'] = $this->config->getUserValue($userId, 'settings', 'email');
+ $data['email'] = $targetUserObject->getEMailAddress();
$data['displayname'] = $targetUserObject->getDisplayName();
return new OC_OCS_Result($data);
diff --git a/apps/provisioning_api/tests/appstest.php b/apps/provisioning_api/tests/appstest.php
index 2e1a86025c2..4ccba704a3a 100644
--- a/apps/provisioning_api/tests/appstest.php
+++ b/apps/provisioning_api/tests/appstest.php
@@ -23,15 +23,35 @@
*/
namespace OCA\Provisioning_API\Tests;
+use OCA\Provisioning_API\Apps;
+use OCP\API;
+use OCP\App\IAppManager;
+use OCP\IUserSession;
+/**
+ * Class AppsTest
+ *
+ * @group DB
+ *
+ * @package OCA\Provisioning_API\Tests
+ */
class AppsTest extends TestCase {
-
+
+ /** @var IAppManager */
+ private $appManager;
+
+ /** @var Apps */
+ private $api;
+
+ /** @var IUserSession */
+ private $userSession;
+
public function setup() {
parent::setup();
$this->appManager = \OC::$server->getAppManager();
$this->groupManager = \OC::$server->getGroupManager();
$this->userSession = \OC::$server->getUserSession();
- $this->api = new \OCA\Provisioning_API\Apps($this->appManager);
+ $this->api = new Apps($this->appManager);
}
public function testGetAppInfo() {
@@ -46,7 +66,7 @@ class AppsTest extends TestCase {
$result = $this->api->getAppInfo(['appid' => 'not_provisioning_api']);
$this->assertInstanceOf('OC_OCS_Result', $result);
$this->assertFalse($result->succeeded());
- $this->assertEquals(\OCP\API::RESPOND_NOT_FOUND, $result->getStatusCode());
+ $this->assertEquals(API::RESPOND_NOT_FOUND, $result->getStatusCode());
}
diff --git a/apps/provisioning_api/tests/testcase.php b/apps/provisioning_api/tests/testcase.php
index 113bc512243..0cbe0d89f86 100644
--- a/apps/provisioning_api/tests/testcase.php
+++ b/apps/provisioning_api/tests/testcase.php
@@ -23,10 +23,13 @@
namespace OCA\Provisioning_API\Tests;
+use OCP\IUser;
use OCP\IUserManager;
use OCP\IGroupManager;
abstract class TestCase extends \Test\TestCase {
+
+ /** @var IUser[] */
protected $users = array();
/** @var IUserManager */
@@ -46,7 +49,7 @@ abstract class TestCase extends \Test\TestCase {
/**
* Generates a temp user
* @param int $num number of users to generate
- * @return IUser[]|Iuser
+ * @return IUser[]|IUser
*/
protected function generateUsers($num = 1) {
$users = array();
diff --git a/apps/provisioning_api/tests/userstest.php b/apps/provisioning_api/tests/userstest.php
index 63180eb3472..72c76326ac5 100644
--- a/apps/provisioning_api/tests/userstest.php
+++ b/apps/provisioning_api/tests/userstest.php
@@ -27,26 +27,27 @@
namespace OCA\Provisioning_API\Tests;
use OCA\Provisioning_API\Users;
+use OCP\API;
use OCP\IUserManager;
use OCP\IConfig;
-use OCP\IGroupManager;
use OCP\IUserSession;
+use PHPUnit_Framework_MockObject_MockObject;
use Test\TestCase as OriginalTest;
use OCP\ILogger;
class UsersTest extends OriginalTest {
- /** @var IUserManager */
+ /** @var IUserManager | PHPUnit_Framework_MockObject_MockObject */
protected $userManager;
- /** @var IConfig */
+ /** @var IConfig | PHPUnit_Framework_MockObject_MockObject */
protected $config;
- /** @var \OC\Group\Manager */
+ /** @var \OC\Group\Manager | PHPUnit_Framework_MockObject_MockObject */
protected $groupManager;
- /** @var IUserSession */
+ /** @var IUserSession | PHPUnit_Framework_MockObject_MockObject */
protected $userSession;
- /** @var ILogger */
+ /** @var ILogger | PHPUnit_Framework_MockObject_MockObject */
protected $logger;
- /** @var Users */
+ /** @var Users | PHPUnit_Framework_MockObject_MockObject */
protected $api;
protected function tearDown() {
@@ -83,7 +84,7 @@ class UsersTest extends OriginalTest {
->method('getUser')
->will($this->returnValue(null));
- $expected = new \OC_OCS_Result(null, \OCP\API::RESPOND_UNAUTHORISED);
+ $expected = new \OC_OCS_Result(null, API::RESPOND_UNAUTHORISED);
$this->assertEquals($expected, $this->api->getUsers());
}
@@ -203,7 +204,7 @@ class UsersTest extends OriginalTest {
->method('getSubAdmin')
->will($this->returnValue($subAdminManager));
- $expected = new \OC_OCS_Result(null, \OCP\API::RESPOND_UNAUTHORISED);
+ $expected = new \OC_OCS_Result(null, API::RESPOND_UNAUTHORISED);
$this->assertEquals($expected, $this->api->getUsers());
}
@@ -464,7 +465,7 @@ class UsersTest extends OriginalTest {
->with()
->willReturn($subAdminManager);
- $expected = new \OC_OCS_Result(null, \OCP\API::RESPOND_UNAUTHORISED);
+ $expected = new \OC_OCS_Result(null, API::RESPOND_UNAUTHORISED);
$this->assertEquals($expected, $this->api->addUser());
}
@@ -653,7 +654,7 @@ class UsersTest extends OriginalTest {
->method('getUser')
->will($this->returnValue(null));
- $expected = new \OC_OCS_Result(null, \OCP\API::RESPOND_UNAUTHORISED);
+ $expected = new \OC_OCS_Result(null, API::RESPOND_UNAUTHORISED);
$this->assertEquals($expected, $this->api->getUser(['userid' => 'UserToGet']));
}
@@ -669,7 +670,7 @@ class UsersTest extends OriginalTest {
->with('UserToGet')
->will($this->returnValue(null));
- $expected = new \OC_OCS_Result(null, \OCP\API::RESPOND_NOT_FOUND, 'The requested user could not be found');
+ $expected = new \OC_OCS_Result(null, API::RESPOND_NOT_FOUND, 'The requested user could not be found');
$this->assertEquals($expected, $this->api->getUser(['userid' => 'UserToGet']));
}
@@ -680,6 +681,9 @@ class UsersTest extends OriginalTest {
->method('getUID')
->will($this->returnValue('admin'));
$targetUser = $this->getMock('\OCP\IUser');
+ $targetUser->expects($this->once())
+ ->method('getEMailAddress')
+ ->willReturn('demo@owncloud.org');
$this->userSession
->expects($this->once())
->method('getUser')
@@ -704,11 +708,6 @@ class UsersTest extends OriginalTest {
->method('fillStorageInfo')
->with('UserToGet')
->will($this->returnValue(['DummyValue']));
- $this->config
- ->expects($this->at(1))
- ->method('getUserValue')
- ->with('UserToGet', 'settings', 'email')
- ->will($this->returnValue('demo@owncloud.org'));
$targetUser
->expects($this->once())
->method('getDisplayName')
@@ -732,6 +731,10 @@ class UsersTest extends OriginalTest {
->method('getUID')
->will($this->returnValue('subadmin'));
$targetUser = $this->getMock('\OCP\IUser');
+ $targetUser
+ ->expects($this->once())
+ ->method('getEMailAddress')
+ ->willReturn('demo@owncloud.org');
$this->userSession
->expects($this->once())
->method('getUser')
@@ -768,11 +771,6 @@ class UsersTest extends OriginalTest {
->method('fillStorageInfo')
->with('UserToGet')
->will($this->returnValue(['DummyValue']));
- $this->config
- ->expects($this->at(1))
- ->method('getUserValue')
- ->with('UserToGet', 'settings', 'email')
- ->will($this->returnValue('demo@owncloud.org'));
$targetUser
->expects($this->once())
->method('getDisplayName')
@@ -823,7 +821,7 @@ class UsersTest extends OriginalTest {
->method('getSubAdmin')
->will($this->returnValue($subAdminManager));
- $expected = new \OC_OCS_Result(null, \OCP\API::RESPOND_UNAUTHORISED);
+ $expected = new \OC_OCS_Result(null, API::RESPOND_UNAUTHORISED);
$this->assertEquals($expected, $this->api->getUser(['userid' => 'UserToGet']));
}
@@ -865,15 +863,14 @@ class UsersTest extends OriginalTest {
->method('fillStorageInfo')
->with('subadmin')
->will($this->returnValue(['DummyValue']));
- $this->config
- ->expects($this->once())
- ->method('getUserValue')
- ->with('subadmin', 'settings', 'email')
- ->will($this->returnValue('subadmin@owncloud.org'));
$targetUser
->expects($this->once())
->method('getDisplayName')
->will($this->returnValue('Subadmin User'));
+ $targetUser
+ ->expects($this->once())
+ ->method('getEMailAddress')
+ ->will($this->returnValue('subadmin@owncloud.org'));
$expected = new \OC_OCS_Result([
'quota' => ['DummyValue'],
@@ -889,7 +886,7 @@ class UsersTest extends OriginalTest {
->method('getUser')
->will($this->returnValue(null));
- $expected = new \OC_OCS_Result(null, \OCP\API::RESPOND_UNAUTHORISED);
+ $expected = new \OC_OCS_Result(null, API::RESPOND_UNAUTHORISED);
$this->assertEquals($expected, $this->api->editUser(['userid' => 'UserToEdit']));
}
diff --git a/apps/user_ldap/tests/access.php b/apps/user_ldap/tests/access.php
index 25e871d9b3d..ef31a1037dd 100644
--- a/apps/user_ldap/tests/access.php
+++ b/apps/user_ldap/tests/access.php
@@ -28,6 +28,13 @@ use \OCA\user_ldap\lib\Access;
use \OCA\user_ldap\lib\Connection;
use \OCA\user_ldap\lib\ILDAPWrapper;
+/**
+ * Class Test_Access
+ *
+ * @group DB
+ *
+ * @package OCA\user_ldap\tests
+ */
class Test_Access extends \Test\TestCase {
private function getConnectorAndLdapMock() {
static $conMethods;
diff --git a/apps/user_ldap/tests/connection.php b/apps/user_ldap/tests/connection.php
index b0b4b78ce4d..10a299a61b1 100644
--- a/apps/user_ldap/tests/connection.php
+++ b/apps/user_ldap/tests/connection.php
@@ -23,6 +23,13 @@
namespace OCA\user_ldap\tests;
+/**
+ * Class Test_Connection
+ *
+ * @group DB
+ *
+ * @package OCA\user_ldap\tests
+ */
class Test_Connection extends \Test\TestCase {
public function testOriginalAgentUnchangedOnClone() {
@@ -52,4 +59,4 @@ class Test_Connection extends \Test\TestCase {
$this->assertSame($agentPawd, $agent['ldapAgentPassword']);
}
-} \ No newline at end of file
+}
diff --git a/apps/user_ldap/tests/group_ldap.php b/apps/user_ldap/tests/group_ldap.php
index 6a6d5bc7ca1..5362b97f216 100644
--- a/apps/user_ldap/tests/group_ldap.php
+++ b/apps/user_ldap/tests/group_ldap.php
@@ -30,6 +30,13 @@ use \OCA\user_ldap\lib\Access;
use \OCA\user_ldap\lib\Connection;
use \OCA\user_ldap\lib\ILDAPWrapper;
+/**
+ * Class Test_Group_Ldap
+ *
+ * @group DB
+ *
+ * @package OCA\user_ldap\tests
+ */
class Test_Group_Ldap extends \Test\TestCase {
private function getAccessMock() {
static $conMethods;
diff --git a/apps/user_ldap/tests/mapping/groupmapping.php b/apps/user_ldap/tests/mapping/groupmapping.php
index e8fe655630d..f9136cf5290 100644
--- a/apps/user_ldap/tests/mapping/groupmapping.php
+++ b/apps/user_ldap/tests/mapping/groupmapping.php
@@ -24,6 +24,13 @@ namespace OCA\user_ldap\tests\mapping;
use OCA\User_LDAP\Mapping\GroupMapping;
+/**
+ * Class Test_GroupMapping
+ *
+ * @group DB
+ *
+ * @package OCA\user_ldap\tests\mapping
+ */
class Test_GroupMapping extends AbstractMappingTest {
public function getMapper(\OCP\IDBConnection $dbMock) {
return new GroupMapping($dbMock);
diff --git a/apps/user_ldap/tests/mapping/usermapping.php b/apps/user_ldap/tests/mapping/usermapping.php
index fa9311b405a..e84f5020231 100644
--- a/apps/user_ldap/tests/mapping/usermapping.php
+++ b/apps/user_ldap/tests/mapping/usermapping.php
@@ -24,6 +24,13 @@ namespace OCA\user_ldap\tests\mapping;
use OCA\User_LDAP\Mapping\UserMapping;
+/**
+ * Class Test_UserMapping
+ *
+ * @group DB
+ *
+ * @package OCA\user_ldap\tests\mapping
+ */
class Test_UserMapping extends AbstractMappingTest {
public function getMapper(\OCP\IDBConnection $dbMock) {
return new UserMapping($dbMock);
diff --git a/apps/user_ldap/tests/user/manager.php b/apps/user_ldap/tests/user/manager.php
index 98e48638d8b..d8602978a9d 100644
--- a/apps/user_ldap/tests/user/manager.php
+++ b/apps/user_ldap/tests/user/manager.php
@@ -26,6 +26,13 @@ namespace OCA\user_ldap\tests;
use OCA\user_ldap\lib\user\Manager;
+/**
+ * Class Test_User_Manager
+ *
+ * @group DB
+ *
+ * @package OCA\user_ldap\tests
+ */
class Test_User_Manager extends \Test\TestCase {
private function getTestInstances() {
diff --git a/apps/user_ldap/tests/user/user.php b/apps/user_ldap/tests/user/user.php
index 19581d835d1..a5bb459d6fd 100644
--- a/apps/user_ldap/tests/user/user.php
+++ b/apps/user_ldap/tests/user/user.php
@@ -25,6 +25,13 @@ namespace OCA\user_ldap\tests;
use OCA\user_ldap\lib\user\User;
+/**
+ * Class Test_User_User
+ *
+ * @group DB
+ *
+ * @package OCA\user_ldap\tests
+ */
class Test_User_User extends \Test\TestCase {
private function getTestInstances() {
diff --git a/apps/user_ldap/tests/user_ldap.php b/apps/user_ldap/tests/user_ldap.php
index 0f70c43fc11..7593371d85d 100644
--- a/apps/user_ldap/tests/user_ldap.php
+++ b/apps/user_ldap/tests/user_ldap.php
@@ -31,6 +31,13 @@ use \OCA\user_ldap\lib\Access;
use \OCA\user_ldap\lib\Connection;
use \OCA\user_ldap\lib\ILDAPWrapper;
+/**
+ * Class Test_User_Ldap_Direct
+ *
+ * @group DB
+ *
+ * @package OCA\user_ldap\tests
+ */
class Test_User_Ldap_Direct extends \Test\TestCase {
protected $backend;
protected $access;
diff --git a/apps/user_ldap/tests/wizard.php b/apps/user_ldap/tests/wizard.php
index 7b046187831..c29361096a1 100644
--- a/apps/user_ldap/tests/wizard.php
+++ b/apps/user_ldap/tests/wizard.php
@@ -31,6 +31,13 @@ use \OCA\user_ldap\lib\Wizard;
// use \OCA\user_ldap\lib\Configuration;
// use \OCA\user_ldap\lib\ILDAPWrapper;
+/**
+ * Class Test_Wizard
+ *
+ * @group DB
+ *
+ * @package OCA\user_ldap\tests
+ */
class Test_Wizard extends \Test\TestCase {
protected function setUp() {
parent::setUp();