summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/files/js/filesummary.js38
-rw-r--r--apps/files/tests/js/filesummarySpec.js33
-rw-r--r--apps/files_sharing/tests/api.php20
-rw-r--r--lib/private/allconfig.php89
-rw-r--r--lib/private/encryption/update.php2
-rw-r--r--lib/private/encryption/util.php19
-rw-r--r--lib/private/files/filesystem.php6
-rw-r--r--lib/private/files/storage/common.php5
-rw-r--r--lib/private/files/storage/storagefactory.php19
-rw-r--r--lib/private/files/storage/wrapper/encryption.php2
-rw-r--r--lib/private/legacy/appconfig.php2
-rw-r--r--lib/private/share/helper.php8
-rw-r--r--lib/private/share/share.php9
-rw-r--r--lib/public/encryption/iencryptionmodule.php3
-rw-r--r--lib/public/encryption/keys/istorage.php8
-rw-r--r--lib/public/iappconfig.php7
-rw-r--r--lib/public/iconfig.php37
-rw-r--r--settings/application.php3
-rw-r--r--settings/controller/logsettingscontroller.php42
-rw-r--r--settings/css/settings.css14
-rw-r--r--settings/templates/personal.php2
-rw-r--r--tests/lib/encryption/utiltest.php35
-rw-r--r--tests/lib/files/storage/storagefactory.php27
-rw-r--r--tests/lib/share/share.php10
-rw-r--r--tests/settings/controller/logsettingscontrollertest.php12
25 files changed, 355 insertions, 97 deletions
diff --git a/apps/files/js/filesummary.js b/apps/files/js/filesummary.js
index 11cb4f8ee45..a4cefe692a8 100644
--- a/apps/files/js/filesummary.js
+++ b/apps/files/js/filesummary.js
@@ -40,7 +40,8 @@
totalFiles: 0,
totalDirs: 0,
totalSize: 0,
- filter:''
+ filter:'',
+ sumIsPending:false
},
/**
@@ -58,7 +59,12 @@
else {
this.summary.totalFiles++;
}
- this.summary.totalSize += parseInt(file.size, 10) || 0;
+ var size = parseInt(file.size, 10) || 0;
+ if (size >=0) {
+ this.summary.totalSize += size;
+ } else {
+ this.summary.sumIsPending = true;
+ }
if (!!update) {
this.update();
}
@@ -78,7 +84,10 @@
else {
this.summary.totalFiles--;
}
- this.summary.totalSize -= parseInt(file.size, 10) || 0;
+ var size = parseInt(file.size, 10) || 0;
+ if (size >=0) {
+ this.summary.totalSize -= size;
+ }
if (!!update) {
this.update();
}
@@ -103,7 +112,8 @@
totalDirs: 0,
totalFiles: 0,
totalSize: 0,
- filter: this.summary.filter
+ filter: this.summary.filter,
+ sumIsPending: false
};
for (var i = 0; i < files.length; i++) {
@@ -117,7 +127,12 @@
else {
summary.totalFiles++;
}
- summary.totalSize += parseInt(file.size, 10) || 0;
+ var size = parseInt(file.size, 10) || 0;
+ if (size >=0) {
+ summary.totalSize += size;
+ } else {
+ summary.sumIsPending = true;
+ }
}
this.setSummary(summary);
},
@@ -160,7 +175,8 @@
// Substitute old content with new translations
$dirInfo.html(n('files', '%n folder', '%n folders', this.summary.totalDirs));
$fileInfo.html(n('files', '%n file', '%n files', this.summary.totalFiles));
- this.$el.find('.filesize').html(OC.Util.humanFileSize(this.summary.totalSize));
+ var fileSize = this.summary.sumIsPending ? t('files', 'Pending') : OC.Util.humanFileSize(this.summary.totalSize);
+ this.$el.find('.filesize').html(fileSize);
// Show only what's necessary (may be hidden)
if (this.summary.totalDirs === 0) {
@@ -194,10 +210,9 @@
var summary = this.summary;
var directoryInfo = n('files', '%n folder', '%n folders', summary.totalDirs);
var fileInfo = n('files', '%n file', '%n files', summary.totalFiles);
- if (this.summary.filter === '') {
- var filterInfo = '';
- } else {
- var filterInfo = ' ' + n('files', 'matches \'{filter}\'', 'match \'{filter}\'', summary.totalFiles + summary.totalDirs, {filter: summary.filter});
+ var filterInfo = '';
+ if (this.summary.filter !== '') {
+ filterInfo = ' ' + n('files', 'matches \'{filter}\'', 'match \'{filter}\'', summary.totalFiles + summary.totalDirs, {filter: summary.filter});
}
var infoVars = {
@@ -208,7 +223,8 @@
// don't show the filesize column, if filesize is NaN (e.g. in trashbin)
var fileSize = '';
if (!isNaN(summary.totalSize)) {
- fileSize = '<td class="filesize">' + OC.Util.humanFileSize(summary.totalSize) + '</td>';
+ fileSize = summary.sumIsPending ? t('files', 'Pending') : OC.Util.humanFileSize(summary.totalSize);
+ fileSize = '<td class="filesize">' + fileSize + '</td>';
}
var info = t('files', '{dirs} and {files}', infoVars, null, {'escape': false});
diff --git a/apps/files/tests/js/filesummarySpec.js b/apps/files/tests/js/filesummarySpec.js
index 4c53b7d8b3a..ae5ff95fc0c 100644
--- a/apps/files/tests/js/filesummarySpec.js
+++ b/apps/files/tests/js/filesummarySpec.js
@@ -148,4 +148,37 @@ describe('OCA.Files.FileSummary tests', function() {
expect(s.summary.totalFiles).toEqual(1);
expect(s.summary.totalSize).toEqual(127903);
});
+ it('properly sum up pending folder sizes after adding', function() {
+ var s = new FileSummary($container);
+ s.setSummary({
+ totalDirs: 0,
+ totalFiles: 0,
+ totalSize: 0
+ });
+ s.add({type: 'dir', size: -1});
+ s.update();
+ expect($container.hasClass('hidden')).toEqual(false);
+ expect($container.find('.info').text()).toEqual('1 folder and 0 files');
+ expect($container.find('.filesize').text()).toEqual('Pending');
+ expect(s.summary.totalDirs).toEqual(1);
+ expect(s.summary.totalFiles).toEqual(0);
+ expect(s.summary.totalSize).toEqual(0);
+ });
+ it('properly sum up pending folder sizes after remove', function() {
+ var s = new FileSummary($container);
+ s.setSummary({
+ totalDirs: 0,
+ totalFiles: 0,
+ totalSize: 0
+ });
+ s.add({type: 'dir', size: -1});
+ s.remove({type: 'dir', size: -1});
+ s.update();
+ expect($container.hasClass('hidden')).toEqual(true);
+ expect($container.find('.info').text()).toEqual('0 folders and 0 files');
+ expect($container.find('.filesize').text()).toEqual('0 B');
+ expect(s.summary.totalDirs).toEqual(0);
+ expect(s.summary.totalFiles).toEqual(0);
+ expect(s.summary.totalSize).toEqual(0);
+ });
});
diff --git a/apps/files_sharing/tests/api.php b/apps/files_sharing/tests/api.php
index d3f0171075e..44c6b1dc4b9 100644
--- a/apps/files_sharing/tests/api.php
+++ b/apps/files_sharing/tests/api.php
@@ -1312,9 +1312,19 @@ class Test_Files_Sharing_Api extends TestCase {
public function testDefaultExpireDate() {
\Test_Files_Sharing_Api::loginHelper(\Test_Files_Sharing_Api::TEST_FILES_SHARING_API_USER1);
- \OC::$server->getAppConfig()->setValue('core', 'shareapi_default_expire_date', 'yes');
- \OC::$server->getAppConfig()->setValue('core', 'shareapi_enforce_expire_date', 'yes');
- \OC::$server->getAppConfig()->setValue('core', 'shareapi_expire_after_n_days', '2');
+
+ // TODO drop this once all code paths use the DI version - otherwise
+ // the cache inside this config object is out of date because
+ // OC_Appconfig is used and bypasses this cache which lead to integrity
+ // constraint violations
+ $config = \OC::$server->getConfig();
+ $config->deleteAppValue('core', 'shareapi_default_expire_date');
+ $config->deleteAppValue('core', 'shareapi_enforce_expire_date');
+ $config->deleteAppValue('core', 'shareapi_expire_after_n_days');
+
+ $config->setAppValue('core', 'shareapi_default_expire_date', 'yes');
+ $config->setAppValue('core', 'shareapi_enforce_expire_date', 'yes');
+ $config->setAppValue('core', 'shareapi_expire_after_n_days', '2');
// default expire date is set to 2 days
// the time when the share was created is set to 3 days in the past
@@ -1358,8 +1368,8 @@ class Test_Files_Sharing_Api extends TestCase {
//cleanup
$result = \OCP\Share::unshare('file', $info->getId(), \OCP\Share::SHARE_TYPE_USER, \Test_Files_Sharing_Api::TEST_FILES_SHARING_API_USER2);
$this->assertTrue($result);
- \OC::$server->getAppConfig()->setValue('core', 'shareapi_default_expire_date', 'no');
- \OC::$server->getAppConfig()->setValue('core', 'shareapi_enforce_expire_date', 'no');
+ $config->setAppValue('core', 'shareapi_default_expire_date', 'no');
+ $config->setAppValue('core', 'shareapi_enforce_expire_date', 'no');
}
}
diff --git a/lib/private/allconfig.php b/lib/private/allconfig.php
index df75a332a13..5706abc92be 100644
--- a/lib/private/allconfig.php
+++ b/lib/private/allconfig.php
@@ -26,6 +26,8 @@
*/
namespace OC;
+
+use OCP\IAppConfig;
use OCP\IDBConnection;
use OCP\PreConditionNotMetException;
@@ -39,6 +41,9 @@ class AllConfig implements \OCP\IConfig {
/** @var IDBConnection */
private $connection;
+ /** @var IAppConfig */
+ private $appConfig;
+
/**
* 3 dimensional array with the following structure:
* [ $userId =>
@@ -80,11 +85,17 @@ class AllConfig implements \OCP\IConfig {
*
* otherwise a SQLite database is created in the wrong directory
* because the database connection was created with an uninitialized config
+ *
+ * The same applies for the app config, because it uses the database
+ * connection itself
*/
private function fixDIInit() {
if($this->connection === null) {
$this->connection = \OC::$server->getDatabaseConnection();
}
+ if ($this->appConfig === null) {
+ $this->appConfig = \OC::$server->getAppConfig();
+ }
}
/**
@@ -134,7 +145,10 @@ class AllConfig implements \OCP\IConfig {
* @return string[] the keys stored for the app
*/
public function getAppKeys($appName) {
- return \OC::$server->getAppConfig()->getKeys($appName);
+ // TODO - FIXME
+ $this->fixDIInit();
+
+ return $this->appConfig->getKeys($appName);
}
/**
@@ -145,7 +159,24 @@ class AllConfig implements \OCP\IConfig {
* @param string $value the value that should be stored
*/
public function setAppValue($appName, $key, $value) {
- \OC::$server->getAppConfig()->setValue($appName, $key, $value);
+ // TODO - FIXME
+ $this->fixDIInit();
+
+ $this->appConfig->setValue($appName, $key, $value);
+ }
+
+ /**
+ * Checks if a key is set in the apps config
+ *
+ * @param string $appName the appName tto look a key up
+ * @param string $key the key to look up
+ * @return bool
+ */
+ public function hasAppKey($appName, $key) {
+ // TODO - FIXME
+ $this->fixDIInit();
+
+ $this->appConfig->hasKey($appName, $key);
}
/**
@@ -157,7 +188,49 @@ class AllConfig implements \OCP\IConfig {
* @return string the saved value
*/
public function getAppValue($appName, $key, $default = '') {
- return \OC::$server->getAppConfig()->getValue($appName, $key, $default);
+ // TODO - FIXME
+ $this->fixDIInit();
+
+ return $this->appConfig->getValue($appName, $key, $default);
+ }
+
+ /**
+ * Get all app values that are stored
+ *
+ * @param string $appName the appName
+ * @return array with key - value pair as they are saved previously
+ */
+ public function getAppValuesByApp($appName) {
+ // TODO - FIXME
+ $this->fixDIInit();
+
+ return $this->appConfig->getValues($appName, false);
+ }
+
+ /**
+ * Get all app values that use the same key
+ *
+ * @param string $key the appName
+ * @return array with key - value pair as they are saved previously with the
+ * app name as key
+ */
+ public function getAppValuesByKey($key) {
+ // TODO - FIXME
+ $this->fixDIInit();
+
+ return $this->appConfig->getValues(false, $key);
+ }
+
+ /**
+ * Get all apps that have at least one value saved
+ *
+ * @return array containing app names
+ */
+ public function getApps() {
+ // TODO - FIXME
+ $this->fixDIInit();
+
+ return $this->appConfig->getApps();
}
/**
@@ -167,7 +240,10 @@ class AllConfig implements \OCP\IConfig {
* @param string $key the key of the value, under which it was saved
*/
public function deleteAppValue($appName, $key) {
- \OC::$server->getAppConfig()->deleteKey($appName, $key);
+ // TODO - FIXME
+ $this->fixDIInit();
+
+ $this->appConfig->deleteKey($appName, $key);
}
/**
@@ -176,7 +252,10 @@ class AllConfig implements \OCP\IConfig {
* @param string $appName the appName the configs are stored under
*/
public function deleteAppValues($appName) {
- \OC::$server->getAppConfig()->deleteApp($appName);
+ // TODO - FIXME
+ $this->fixDIInit();
+
+ $this->appConfig->deleteApp($appName);
}
diff --git a/lib/private/encryption/update.php b/lib/private/encryption/update.php
index 649cf0285a6..06dc330151e 100644
--- a/lib/private/encryption/update.php
+++ b/lib/private/encryption/update.php
@@ -104,7 +104,7 @@ class Update {
foreach ($allFiles as $path) {
$usersSharing = $this->util->getSharingUsersArray($path);
- $encryptionModule->update($absPath, $usersSharing);
+ $encryptionModule->update($absPath, $this->uid, $usersSharing);
}
}
diff --git a/lib/private/encryption/util.php b/lib/private/encryption/util.php
index 2c6ff266841..85e852ec2c9 100644
--- a/lib/private/encryption/util.php
+++ b/lib/private/encryption/util.php
@@ -389,9 +389,22 @@ class Util {
* @return boolean
*/
public function isExcluded($path) {
- $root = explode('/', $path, 2);
- if (isset($root[0])) {
- if (in_array($root[0], $this->excludedPaths)) {
+ $normalizedPath = \OC\Files\Filesystem::normalizePath($path);
+ $root = explode('/', $normalizedPath, 4);
+ if (count($root) > 2) {
+
+ //detect system wide folders
+ if (in_array($root[1], $this->excludedPaths)) {
+ return true;
+ }
+
+ $v1 = $this->userManager->userExists($root[1]);
+ $v2 = in_array($root[2], $this->excludedPaths);
+
+ // detect user specific folders
+ if ($this->userManager->userExists($root[1])
+ && in_array($root[2], $this->excludedPaths)) {
+
return true;
}
}
diff --git a/lib/private/files/filesystem.php b/lib/private/files/filesystem.php
index 351483d59c1..eef76125311 100644
--- a/lib/private/files/filesystem.php
+++ b/lib/private/files/filesystem.php
@@ -201,11 +201,13 @@ class Filesystem {
private static $loader;
/**
+ * @param string $wrapperName
* @param callable $wrapper
+ * @param int $priority
*/
- public static function addStorageWrapper($wrapperName, $wrapper) {
+ public static function addStorageWrapper($wrapperName, $wrapper, $priority = 50) {
$mounts = self::getMountManager()->getAll();
- if (!self::getLoader()->addStorageWrapper($wrapperName, $wrapper, $mounts)) {
+ if (!self::getLoader()->addStorageWrapper($wrapperName, $wrapper, $priority, $mounts)) {
// do not re-wrap if storage with this name already existed
return;
}
diff --git a/lib/private/files/storage/common.php b/lib/private/files/storage/common.php
index 700164bdc3d..9fef53fa95a 100644
--- a/lib/private/files/storage/common.php
+++ b/lib/private/files/storage/common.php
@@ -37,7 +37,6 @@ namespace OC\Files\Storage;
use OC\Files\Cache\Cache;
use OC\Files\Cache\Scanner;
-use OC\Files\Cache\Storage;
use OC\Files\Filesystem;
use OC\Files\Cache\Watcher;
use OCP\Files\FileNameTooLongException;
@@ -56,7 +55,7 @@ use OCP\Files\ReservedWordException;
* Some \OC\Files\Storage\Common methods call functions which are first defined
* in classes which extend it, e.g. $this->stat() .
*/
-abstract class Common implements \OC\Files\Storage\Storage {
+abstract class Common implements Storage {
protected $cache;
protected $scanner;
protected $watcher;
@@ -370,7 +369,7 @@ abstract class Common implements \OC\Files\Storage\Storage {
$storage = $this;
}
if (!isset($this->storageCache)) {
- $this->storageCache = new Storage($storage);
+ $this->storageCache = new \OC\Files\Cache\Storage($storage);
}
return $this->storageCache;
}
diff --git a/lib/private/files/storage/storagefactory.php b/lib/private/files/storage/storagefactory.php
index 5da192e4c72..31b4090eda2 100644
--- a/lib/private/files/storage/storagefactory.php
+++ b/lib/private/files/storage/storagefactory.php
@@ -31,9 +31,9 @@ use OCP\Files\Storage\IStorageFactory;
class StorageFactory implements IStorageFactory {
/**
- * @var callable[] $storageWrappers
+ * @var array[] [$name=>['priority'=>$priority, 'wrapper'=>$callable] $storageWrappers
*/
- private $storageWrappers = array();
+ private $storageWrappers = [];
/**
* allow modifier storage behaviour by adding wrappers around storages
@@ -42,11 +42,12 @@ class StorageFactory implements IStorageFactory {
*
* @param string $wrapperName name of the wrapper
* @param callable $callback callback
+ * @param int $priority wrappers with the lower priority are applied last (meaning they get called first)
* @param \OCP\Files\Mount\IMountPoint[] $existingMounts existing mount points to apply the wrapper to
* @return bool true if the wrapper was added, false if there was already a wrapper with this
* name registered
*/
- public function addStorageWrapper($wrapperName, $callback, $existingMounts = []) {
+ public function addStorageWrapper($wrapperName, $callback, $priority = 50, $existingMounts = []) {
if (isset($this->storageWrappers[$wrapperName])) {
return false;
}
@@ -56,7 +57,7 @@ class StorageFactory implements IStorageFactory {
$mount->wrapStorage($callback);
}
- $this->storageWrappers[$wrapperName] = $callback;
+ $this->storageWrappers[$wrapperName] = ['wrapper' => $callback, 'priority' => $priority];
return true;
}
@@ -89,7 +90,15 @@ class StorageFactory implements IStorageFactory {
* @return \OCP\Files\Storage
*/
public function wrap(IMountPoint $mountPoint, $storage) {
- foreach ($this->storageWrappers as $wrapper) {
+ $wrappers = array_values($this->storageWrappers);
+ usort($wrappers, function ($a, $b) {
+ return $b['priority'] - $a['priority'];
+ });
+ /** @var callable[] $wrappers */
+ $wrappers = array_map(function ($wrapper) {
+ return $wrapper['wrapper'];
+ }, $wrappers);
+ foreach ($wrappers as $wrapper) {
$storage = $wrapper($mountPoint->getMountPoint(), $storage, $mountPoint);
}
return $storage;
diff --git a/lib/private/files/storage/wrapper/encryption.php b/lib/private/files/storage/wrapper/encryption.php
index 44fc2124f7a..0e70c99c8d7 100644
--- a/lib/private/files/storage/wrapper/encryption.php
+++ b/lib/private/files/storage/wrapper/encryption.php
@@ -254,7 +254,7 @@ class Encryption extends Wrapper {
'" not found, file will be stored unencrypted');
}
- if($shouldEncrypt === true && !$this->util->isExcluded($path) && $encryptionModule !== null) {
+ if($shouldEncrypt === true && !$this->util->isExcluded($fullPath) && $encryptionModule !== null) {
$source = $this->storage->fopen($path, $mode);
$handle = \OC\Files\Stream\Encryption::wrap($source, $path, $fullPath, $header,
$this->uid, $encryptionModule, $this->storage, $this, $this->util, $mode,
diff --git a/lib/private/legacy/appconfig.php b/lib/private/legacy/appconfig.php
index 3bf1fbd739e..00302d5577f 100644
--- a/lib/private/legacy/appconfig.php
+++ b/lib/private/legacy/appconfig.php
@@ -27,7 +27,7 @@
* This class provides an easy way for apps to store config values in the
* database.
*
- * @deprecated use \OC::$server->getAppConfig() to get an \OCP\IAppConfig instance
+ * @deprecated use \OC::$server->getConfig() to get an \OCP\IConfig instance
*/
class OC_Appconfig {
/**
diff --git a/lib/private/share/helper.php b/lib/private/share/helper.php
index 39dc8d8c7ef..5345c8a018f 100644
--- a/lib/private/share/helper.php
+++ b/lib/private/share/helper.php
@@ -170,14 +170,16 @@ class Helper extends \OC\Share\Constants {
*/
public static function getDefaultExpireSetting() {
+ $config = \OC::$server->getConfig();
+
$defaultExpireSettings = array('defaultExpireDateSet' => false);
// get default expire settings
- $defaultExpireDate = \OC_Appconfig::getValue('core', 'shareapi_default_expire_date', 'no');
+ $defaultExpireDate = $config->getAppValue('core', 'shareapi_default_expire_date', 'no');
if ($defaultExpireDate === 'yes') {
- $enforceExpireDate = \OC_Appconfig::getValue('core', 'shareapi_enforce_expire_date', 'no');
+ $enforceExpireDate = $config->getAppValue('core', 'shareapi_enforce_expire_date', 'no');
$defaultExpireSettings['defaultExpireDateSet'] = true;
- $defaultExpireSettings['expireAfterDays'] = (int)\OC_Appconfig::getValue('core', 'shareapi_expire_after_n_days', '7');
+ $defaultExpireSettings['expireAfterDays'] = (int)($config->getAppValue('core', 'shareapi_expire_after_n_days', '7'));
$defaultExpireSettings['enforceExpireDate'] = $enforceExpireDate === 'yes' ? true : false;
}
diff --git a/lib/private/share/share.php b/lib/private/share/share.php
index 9500ec69428..90f3f28f2ee 100644
--- a/lib/private/share/share.php
+++ b/lib/private/share/share.php
@@ -1834,9 +1834,10 @@ class Share extends \OC\Share\Constants {
if (in_array(\OCP\User::getUser(), $users)) {
unset($users[array_search(\OCP\User::getUser(), $users)]);
}
- $groupItemTarget = Helper::generateTarget($itemType, $itemSource, $shareType, $shareWith['group'],
- $uidOwner, $suggestedItemTarget);
- $groupFileTarget = $filePath;
+ $groupItemTarget = Helper::generateTarget($itemType, $itemSource,
+ $shareType, $shareWith['group'], $uidOwner, $suggestedItemTarget);
+ $groupFileTarget = Helper::generateTarget($itemType, $itemSource,
+ $shareType, $shareWith['group'], $uidOwner, $filePath);
// add group share to table and remember the id as parent
$queriesToExecute['groupShare'] = array(
@@ -1849,7 +1850,7 @@ class Share extends \OC\Share\Constants {
'permissions' => $permissions,
'shareTime' => time(),
'fileSource' => $fileSource,
- 'fileTarget' => $filePath,
+ 'fileTarget' => $groupFileTarget,
'token' => $token,
'parent' => $parent,
'expiration' => $expirationDate,
diff --git a/lib/public/encryption/iencryptionmodule.php b/lib/public/encryption/iencryptionmodule.php
index 2527e35e639..7265fee1259 100644
--- a/lib/public/encryption/iencryptionmodule.php
+++ b/lib/public/encryption/iencryptionmodule.php
@@ -84,10 +84,11 @@ interface IEncryptionModule {
* update encrypted file, e.g. give additional users access to the file
*
* @param string $path path to the file which should be updated
+ * @param string $uid of the user who performs the operation
* @param array $accessList who has access to the file contains the key 'users' and 'public'
* @return boolean
*/
- public function update($path, $accessList);
+ public function update($path, $uid, $accessList);
/**
* should the file be encrypted or not
diff --git a/lib/public/encryption/keys/istorage.php b/lib/public/encryption/keys/istorage.php
index 24f6efd6e51..4c2b01f4ad0 100644
--- a/lib/public/encryption/keys/istorage.php
+++ b/lib/public/encryption/keys/istorage.php
@@ -105,6 +105,14 @@ interface IStorage {
public function deleteFileKey($path, $keyId);
/**
+ * delete all file keys for a given file
+ *
+ * @param string $path to the file
+ * @return boolean
+ */
+ public function deleteAllFileKeys($path);
+
+ /**
* delete system-wide encryption keys not related to a specific user,
* e.g something like a key for public link shares
*
diff --git a/lib/public/iappconfig.php b/lib/public/iappconfig.php
index 33fc3e4e362..8846445f94c 100644
--- a/lib/public/iappconfig.php
+++ b/lib/public/iappconfig.php
@@ -27,6 +27,10 @@ namespace OCP;
/**
* This class provides an easy way for apps to store config values in the
* database.
+ *
+ * @deprecated This interface will be dropped with ownCloud 10.1 which will be
+ * released in the first quarter of 2017. Use the methods of
+ * \OCP\IConfig instead
*/
interface IAppConfig {
/**
@@ -34,6 +38,7 @@ interface IAppConfig {
* @param string $app
* @param string $key
* @return bool
+ * @deprecated use method hasAppKey of \OCP\IConfig
*/
public function hasKey($app, $key);
@@ -76,6 +81,7 @@ interface IAppConfig {
* @param string|false $key
* @param string|false $app
* @return array|false
+ * @deprecated use method getAppValuesByApp or getAppValuesByKey of \OCP\IConfig
*/
public function getValues($app, $key);
@@ -94,6 +100,7 @@ interface IAppConfig {
/**
* Get all apps using the config
* @return array an array of app ids
+ * @deprecated use method getApps of \OCP\IConfig
*
* This function returns a list of all apps that have at least one
* entry in the appconfig table.
diff --git a/lib/public/iconfig.php b/lib/public/iconfig.php
index c63ba1a90a6..8321c4043cd 100644
--- a/lib/public/iconfig.php
+++ b/lib/public/iconfig.php
@@ -90,6 +90,16 @@ interface IConfig {
public function setAppValue($appName, $key, $value);
/**
+ * Checks if a key is set in the apps config
+ *
+ * @param string $appName the appName tto look a key up
+ * @param string $key the key to look up
+ * @return bool
+ * @since 8.1.0
+ */
+ public function hasAppKey($appName, $key);
+
+ /**
* Looks up an app wide defined value
*
* @param string $appName the appName that we stored the value under
@@ -100,6 +110,33 @@ interface IConfig {
public function getAppValue($appName, $key, $default = '');
/**
+ * Get all app values that are stored
+ *
+ * @param string $appName the appName
+ * @return array with key - value pair as they are saved previously
+ * @since 8.1.0
+ */
+ public function getAppValuesByApp($appName);
+
+ /**
+ * Get all app values that use the same key
+ *
+ * @param string $key the appName
+ * @return array with key - value pair as they are saved previously with the
+ * app name as key
+ * @since 8.1.0
+ */
+ public function getAppValuesByKey($key);
+
+ /**
+ * Get all apps that have at least one value saved
+ *
+ * @return array containing app names
+ * @since 8.1.0
+ */
+ public function getApps();
+
+ /**
* Delete an app wide defined value
*
* @param string $appName the appName that we stored the value under
diff --git a/settings/application.php b/settings/application.php
index 6992742b8d8..397e3b3de91 100644
--- a/settings/application.php
+++ b/settings/application.php
@@ -114,8 +114,7 @@ class Application extends App {
$c->query('AppName'),
$c->query('Request'),
$c->query('Config'),
- $c->query('L10N'),
- $c->query('TimeFactory')
+ $c->query('L10N')
);
});
diff --git a/settings/controller/logsettingscontroller.php b/settings/controller/logsettingscontroller.php
index b2493c46bab..f3de1fbb7c6 100644
--- a/settings/controller/logsettingscontroller.php
+++ b/settings/controller/logsettingscontroller.php
@@ -25,9 +25,8 @@ namespace OC\Settings\Controller;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\JSONResponse;
-use OCP\AppFramework\Http\DataDownloadResponse;
+use OCP\AppFramework\Http\StreamResponse;
use OCP\IL10N;
-use OCP\AppFramework\Utility\ITimeFactory;
use OCP\IRequest;
use OCP\IConfig;
@@ -48,11 +47,6 @@ class LogSettingsController extends Controller {
private $l10n;
/**
- * @var \OCP\ITimeFactory
- */
- private $timefactory;
-
- /**
* @param string $appName
* @param IRequest $request
* @param IConfig $config
@@ -60,13 +54,10 @@ class LogSettingsController extends Controller {
public function __construct($appName,
IRequest $request,
IConfig $config,
- IL10N $l10n,
- ITimeFactory $timeFactory) {
-
+ IL10N $l10n) {
parent::__construct($appName, $request);
$this->config = $config;
$this->l10n = $l10n;
- $this->timefactory = $timeFactory;
}
/**
@@ -107,32 +98,11 @@ class LogSettingsController extends Controller {
*
* @NoCSRFRequired
*
- * @return DataDownloadResponse
+ * @return StreamResponse
*/
public function download() {
- return new DataDownloadResponse(
- json_encode(\OC_Log_Owncloud::getEntries(null, null)),
- $this->getFilenameForDownload(),
- 'application/json'
- );
- }
-
- /**
- * get filename for the logfile that's being downloaded
- *
- * @param int $timestamp (defaults to time())
- * @return string
- */
- private function getFilenameForDownload($timestamp=null) {
- $instanceId = $this->config->getSystemValue('instanceid');
-
- $filename = implode([
- 'ownCloud',
- $instanceId,
- (!is_null($timestamp)) ? $timestamp : $this->timefactory->getTime()
- ], '-');
- $filename .= '.log';
-
- return $filename;
+ $resp = new StreamResponse(\OC_Log_Owncloud::getLogFilePath());
+ $resp->addHeader('Content-Disposition', 'attachment; filename="owncloud.log"');
+ return $resp;
}
}
diff --git a/settings/css/settings.css b/settings/css/settings.css
index 869a113762b..c619bd7b9b3 100644
--- a/settings/css/settings.css
+++ b/settings/css/settings.css
@@ -370,6 +370,18 @@ span.error {
margin-top: -7px;
}
+.ie8 .strengthify-wrapper {
+ left: 389px;
+}
+
+.onlyInIE8 {
+ display: none;
+}
+
+.ie8 .onlyInIE8 {
+ display: inline;
+}
+
/* OPERA hack for strengthify*/
doesnotexist:-o-prefocus, .strengthify-wrapper {
left: 185px;
@@ -415,4 +427,4 @@ doesnotexist:-o-prefocus, .strengthify-wrapper {
#encryptionModules {
padding: 10px;
-} \ No newline at end of file
+}
diff --git a/settings/templates/personal.php b/settings/templates/personal.php
index 1d5bf1fc54f..2a0b4bb0dc4 100644
--- a/settings/templates/personal.php
+++ b/settings/templates/personal.php
@@ -73,9 +73,11 @@ if($_['passwordChangeSupported']) {
<div class="hidden icon-checkmark" id="password-changed"></div>
<div class="hidden" id="password-error"><?php p($l->t('Unable to change your password'));?></div>
<br>
+ <label for="pass1" class="onlyInIE8"><?php echo $l->t('Current password');?>: </label>
<input type="password" id="pass1" name="oldpassword"
placeholder="<?php echo $l->t('Current password');?>"
autocomplete="off" autocapitalize="off" autocorrect="off" />
+ <label for="pass2" class="onlyInIE8"><?php echo $l->t('New password');?>: </label>
<input type="password" id="pass2" name="personal-password"
placeholder="<?php echo $l->t('New password');?>"
data-typetoggle="#personal-show"
diff --git a/tests/lib/encryption/utiltest.php b/tests/lib/encryption/utiltest.php
index 00a9ab9c578..672f9ff5e97 100644
--- a/tests/lib/encryption/utiltest.php
+++ b/tests/lib/encryption/utiltest.php
@@ -98,4 +98,39 @@ class UtilTest extends TestCase {
$u->createHeader($header, $em);
}
+ /**
+ * @dataProvider providePathsForTestIsExcluded
+ */
+ public function testIsEcluded($path, $expected) {
+ $this->userManager
+ ->expects($this->any())
+ ->method('userExists')
+ ->will($this->returnCallback(array($this, 'isExcludedCallback')));
+
+ $u = new Util($this->view, $this->userManager);
+
+ $this->assertSame($expected,
+ $u->isExcluded($path)
+ );
+ }
+
+ public function providePathsForTestIsExcluded() {
+ return array(
+ array('files_encryption/foo.txt', true),
+ array('test/foo.txt', false),
+ array('/user1/files_encryption/foo.txt', true),
+ array('/user1/files/foo.txt', false),
+
+ );
+ }
+
+ public function isExcludedCallback() {
+ $args = func_get_args();
+ if ($args[0] === 'user1') {
+ return true;
+ }
+
+ return false;
+ }
+
}
diff --git a/tests/lib/files/storage/storagefactory.php b/tests/lib/files/storage/storagefactory.php
index 15519ef83fb..fcdff577dd5 100644
--- a/tests/lib/files/storage/storagefactory.php
+++ b/tests/lib/files/storage/storagefactory.php
@@ -15,7 +15,14 @@ use Test\TestCase;
use OC\Files\Storage\Wrapper\Wrapper;
class DummyWrapper extends Wrapper {
+ public $data;
+ public function __construct($arguments) {
+ parent::__construct($arguments);
+ if (isset($arguments['data'])) {
+ $this->data = $arguments['data'];
+ }
+ }
}
class StorageFactory extends TestCase {
@@ -42,4 +49,24 @@ class StorageFactory extends TestCase {
$wrapped = $mount->getStorage();
$this->assertInstanceOf('\OC\Files\Storage\Temporary', $wrapped);
}
+
+ public function testWrapperPriority() {
+ $instance = new \OC\Files\Storage\StorageFactory();
+ $mount = new MountPoint('\OC\Files\Storage\Temporary', '/foo', [[]], $instance);
+ $instance->addStorageWrapper('dummy1', function ($mountPoint, IStorage $storage) {
+ return new DummyWrapper(['storage' => $storage, 'data' => 1]);
+ }, 1);
+ $instance->addStorageWrapper('dummy2', function ($mountPoint, IStorage $storage) {
+ return new DummyWrapper(['storage' => $storage, 'data' => 100]);
+ }, 100);
+ $instance->addStorageWrapper('dummy3', function ($mountPoint, IStorage $storage) {
+ return new DummyWrapper(['storage' => $storage, 'data' => 50]);
+ }, 50);
+ /** @var \Test\Files\Storage\DummyWrapper $wrapped */
+ $wrapped = $mount->getStorage();
+ $this->assertInstanceOf('\Test\Files\Storage\DummyWrapper', $wrapped);
+ $this->assertEquals(1, $wrapped->data);// lowest priority is applied last, called first
+ $this->assertEquals(50, $wrapped->getWrapperStorage()->data);
+ $this->assertEquals(100, $wrapped->getWrapperStorage()->getWrapperStorage()->data);
+ }
}
diff --git a/tests/lib/share/share.php b/tests/lib/share/share.php
index 43539866508..f35a0fa8e43 100644
--- a/tests/lib/share/share.php
+++ b/tests/lib/share/share.php
@@ -897,8 +897,10 @@ class Test_Share extends \Test\TestCase {
public function testShareItemWithLinkAndDefaultExpireDate() {
OC_User::setUserId($this->user1);
- \OC_Appconfig::setValue('core', 'shareapi_default_expire_date', 'yes');
- \OC_Appconfig::setValue('core', 'shareapi_expire_after_n_days', '2');
+ $config = \OC::$server->getConfig();
+
+ $config->setAppValue('core', 'shareapi_default_expire_date', 'yes');
+ $config->setAppValue('core', 'shareapi_expire_after_n_days', '2');
$token = OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_LINK, null, \OCP\Constants::PERMISSION_READ);
$this->assertInternalType(
@@ -915,8 +917,8 @@ class Test_Share extends \Test\TestCase {
'Failed asserting that the returned row has an default expiration date.'
);
- \OC_Appconfig::deleteKey('core', 'shareapi_default_expire_date');
- \OC_Appconfig::deleteKey('core', 'shareapi_expire_after_n_days');
+ $config->deleteAppValue('core', 'shareapi_default_expire_date');
+ $config->deleteAppValue('core', 'shareapi_expire_after_n_days');
}
diff --git a/tests/settings/controller/logsettingscontrollertest.php b/tests/settings/controller/logsettingscontrollertest.php
index 84581bf5782..60680ba4647 100644
--- a/tests/settings/controller/logsettingscontrollertest.php
+++ b/tests/settings/controller/logsettingscontrollertest.php
@@ -66,15 +66,9 @@ class LogSettingsControllerTest extends \Test\TestCase {
];
}
- public function testGetFilenameForDownload() {
- $timestamp = 42;
- $this->container['Config']
- ->expects($this->once())
- ->method('getSystemValue')
- ->with('instanceid')
- ->will($this->returnValue('0xF'));
- $filename = \Test_Helper::invokePrivate($this->logSettingsController, 'getFilenameForDownload', [$timestamp]);
+ public function testDownload() {
+ $response = $this->logSettingsController->download();
- $this->assertSame('ownCloud-0xF-42.log', $filename);
+ $this->assertInstanceOf('\OCP\AppFramework\Http\StreamResponse', $response);
}
}