diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2014-03-06 00:15:08 +0100 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2014-03-06 00:15:08 +0100 |
commit | 32b29c9d735ae235641a7ea3869c14d7eb69cb4f (patch) | |
tree | 63e4e269bd33b0688965c9b3b1059466a8f502b8 /apps | |
parent | 6de370b64cb8f7fcd9d3bd090b8d801d91d2fcca (diff) | |
parent | 1785c0c9b9fcdc6e9a8e58f13f45e5b53364882a (diff) | |
download | nextcloud-server-32b29c9d735ae235641a7ea3869c14d7eb69cb4f.tar.gz nextcloud-server-32b29c9d735ae235641a7ea3869c14d7eb69cb4f.zip |
Merge branch 'master' into fix-7307
Conflicts:
core/js/router.js
settings/js/admin.js
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files/ajax/move.php | 2 | ||||
-rw-r--r-- | apps/files/js/file-upload.js | 34 | ||||
-rw-r--r-- | apps/files/js/filelist.js | 13 | ||||
-rw-r--r-- | apps/files/js/files.js | 7 | ||||
-rw-r--r-- | apps/files/templates/part.list.php | 16 | ||||
-rw-r--r-- | apps/files/tests/js/filesSpec.js | 35 | ||||
-rw-r--r-- | apps/files_encryption/lib/util.php | 1 | ||||
-rw-r--r-- | apps/files_external/js/settings.js | 12 | ||||
-rwxr-xr-x | apps/files_external/lib/config.php | 40 | ||||
-rwxr-xr-x | apps/files_external/personal.php | 5 | ||||
-rw-r--r-- | apps/files_external/settings.php | 18 | ||||
-rw-r--r-- | apps/files_external/templates/settings.php | 18 | ||||
-rw-r--r-- | apps/files_sharing/js/share.js | 21 | ||||
-rw-r--r-- | apps/files_sharing/lib/cache.php | 3 | ||||
-rw-r--r-- | apps/files_sharing/lib/share/file.php | 3 | ||||
-rw-r--r-- | apps/user_ldap/lib/helper.php | 2 | ||||
-rw-r--r-- | apps/user_ldap/user_proxy.php | 17 |
17 files changed, 184 insertions, 63 deletions
diff --git a/apps/files/ajax/move.php b/apps/files/ajax/move.php index 93063e52eb0..04a260265c2 100644 --- a/apps/files/ajax/move.php +++ b/apps/files/ajax/move.php @@ -18,7 +18,7 @@ if(\OC\Files\Filesystem::file_exists($target . '/' . $file)) { exit; } -if ($dir != '' || $file != 'Shared') { +if ($target != '' || strtolower($file) != 'shared') { $targetFile = \OC\Files\Filesystem::normalizePath($target . '/' . $file); $sourceFile = \OC\Files\Filesystem::normalizePath($dir . '/' . $file); if(\OC\Files\Filesystem::rename($sourceFile, $targetFile)) { diff --git a/apps/files/js/file-upload.js b/apps/files/js/file-upload.js index f962a7044a8..aa85644cefb 100644 --- a/apps/files/js/file-upload.js +++ b/apps/files/js/file-upload.js @@ -82,7 +82,7 @@ OC.Upload = { */ isProcessing:function() { var count = 0; - + jQuery.each(this._uploads,function(i, data) { if (data.state() === 'pending') { count++; @@ -208,13 +208,13 @@ $(document).ready(function() { add: function(e, data) { OC.Upload.log('add', e, data); var that = $(this); - + // we need to collect all data upload objects before starting the upload so we can check their existence // and set individual conflict actions. unfortunately there is only one variable that we can use to identify // the selection a data upload is part of, so we have to collect them in data.originalFiles // turning singleFileUploads off is not an option because we want to gracefully handle server errors like // already exists - + // create a container where we can store the data objects if ( ! data.originalFiles.selection ) { // initialize selection and remember number of files to upload @@ -225,34 +225,34 @@ $(document).ready(function() { }; } var selection = data.originalFiles.selection; - + // add uploads if ( selection.uploads.length < selection.filesToUpload ) { // remember upload selection.uploads.push(data); } - + //examine file var file = data.files[0]; try { // FIXME: not so elegant... need to refactor that method to return a value - Files.isFileNameValid(file.name); + Files.isFileNameValid(file.name, FileList.getCurrentDirectory()); } catch (errorMessage) { data.textStatus = 'invalidcharacters'; data.errorThrown = errorMessage; } - + if (file.type === '' && file.size === 4096) { data.textStatus = 'dirorzero'; data.errorThrown = t('files', 'Unable to upload {filename} as it is a directory or has 0 bytes', {filename: file.name} ); } - + // add size selection.totalBytes += file.size; - + // check PHP upload limit if (selection.totalBytes > $('#upload_limit').val()) { data.textStatus = 'sizeexceedlimit'; @@ -270,7 +270,7 @@ $(document).ready(function() { 'size2': humanFileSize($('#free_space').val()) }); } - + // end upload for whole selection on error if (data.errorThrown) { // trigger fileupload fail @@ -281,12 +281,12 @@ $(document).ready(function() { // check existing files when all is collected if ( selection.uploads.length >= selection.filesToUpload ) { - + //remove our selection hack: delete data.originalFiles.selection; var callbacks = { - + onNoConflicts: function (selection) { $.each(selection.uploads, function(i, upload) { upload.submit(); @@ -309,7 +309,7 @@ $(document).ready(function() { }; OC.Upload.checkExistingFiles(selection, callbacks); - + } return true; // continue adding files @@ -439,7 +439,7 @@ $(document).ready(function() { }); fileupload.on('fileuploadstop', function(e, data) { OC.Upload.log('progress handle fileuploadstop', e, data); - + $('#uploadprogresswrapper input.stop').fadeOut(); $('#uploadprogressbar').fadeOut(); Files.updateStorageStatistics(); @@ -531,7 +531,7 @@ $(document).ready(function() { if ($(this).children('p').length === 0) { return; } - + $('#new .error').tipsy('hide'); $('#new li').each(function(i,element) { @@ -545,7 +545,7 @@ $(document).ready(function() { var text=$(this).children('p').text(); $(this).data('text',text); $(this).children('p').remove(); - + // add input field var form = $('<form></form>'); var input = $('<input type="text">'); @@ -562,7 +562,7 @@ $(document).ready(function() { throw t('files', 'URL cannot be empty'); } else if (type !== 'web' && !Files.isFileNameValid(filename)) { // Files.isFileNameValid(filename) throws an exception itself - } else if ($('#dir').val() === '/' && filename === 'Shared') { + } else if (FileList.getCurrentDirectory() === '/' && filename.toLowerCase() === 'shared') { throw t('files', 'In the home folder \'Shared\' is a reserved filename'); } else if (FileList.inList(filename)) { throw t('files', '{new_name} already exists', {new_name: filename}); diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index d6a4ae99764..503bf681139 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -421,15 +421,12 @@ window.FileList={ len = input.val().length; } input.selectRange(0, len); - var checkInput = function () { var filename = input.val(); if (filename !== oldname) { - if (!Files.isFileNameValid(filename)) { - // Files.isFileNameValid(filename) throws an exception itself - } else if($('#dir').val() === '/' && filename === 'Shared') { - throw t('files','In the home folder \'Shared\' is a reserved filename'); - } else if (FileList.inList(filename)) { + // Files.isFileNameValid(filename) throws an exception itself + Files.isFileNameValid(filename, FileList.getCurrentDirectory()); + if (FileList.inList(filename)) { throw t('files', '{new_name} already exists', {new_name: filename}); } } @@ -1158,9 +1155,9 @@ $(document).ready(function() { // need to initially switch the dir to the one from the hash (IE8) FileList.changeDirectory(parseCurrentDirFromUrl(), false, true); } - } - FileList.setCurrentDir(parseCurrentDirFromUrl(), false); + FileList.setCurrentDir(parseCurrentDirFromUrl(), false); + } FileList.createFileSummary(); }); diff --git a/apps/files/js/files.js b/apps/files/js/files.js index c93862e85d8..1186a72a44f 100644 --- a/apps/files/js/files.js +++ b/apps/files/js/files.js @@ -87,9 +87,12 @@ var Files = { * Throws a string exception with an error message if * the file name is not valid */ - isFileNameValid: function (name) { + isFileNameValid: function (name, root) { var trimmedName = name.trim(); - if (trimmedName === '.' || trimmedName === '..') { + if (trimmedName === '.' + || trimmedName === '..' + || (root === '/' && trimmedName.toLowerCase() === 'shared')) + { throw t('files', '"{name}" is an invalid file name.', {name: name}); } else if (trimmedName.length === 0) { throw t('files', 'File name cannot be empty.'); diff --git a/apps/files/templates/part.list.php b/apps/files/templates/part.list.php index f4fb96a7a7c..8a7a1e370eb 100644 --- a/apps/files/templates/part.list.php +++ b/apps/files/templates/part.list.php @@ -17,7 +17,13 @@ $totalsize = 0; ?> data-mime="<?php p($file['mimetype'])?>" data-size="<?php p($file['size']);?>" data-etag="<?php p($file['etag']);?>" - data-permissions="<?php p($file['permissions']); ?>"> + data-permissions="<?php p($file['permissions']); ?>" + + <?php if(isset($file['displayname_owner'])): ?> + data-share-owner="<?php p($file['displayname_owner']) ?>" + <?php endif; ?> + > + <?php if(isset($file['isPreviewAvailable']) and $file['isPreviewAvailable']): ?> <td class="filename svg preview-icon" <?php else: ?> @@ -34,17 +40,15 @@ $totalsize = 0; ?> <span class="nametext"> <?php print_unescaped(htmlspecialchars($file['name']));?> </span> + <span class="uploadtext" currentUploads="0"> + </span> + </a> <?php else: ?> <a class="name" href="<?php p(rtrim($_['downloadURL'],'/').'/'.trim($directory,'/').'/'.$name); ?>"> <label class="filetext" title="" for="select-<?php p($file['fileid']); ?>"></label> <span class="nametext"><?php print_unescaped(htmlspecialchars($file['basename']));?><span class='extension'><?php p($file['extension']);?></span></span> </a> <?php endif; ?> - <?php if($file['type'] == 'dir'):?> - <span class="uploadtext" currentUploads="0"> - </span> - <?php endif;?> - </a> </td> <td class="filesize" style="color:rgb(<?php p($simple_size_color.','.$simple_size_color.','.$simple_size_color) ?>)"> diff --git a/apps/files/tests/js/filesSpec.js b/apps/files/tests/js/filesSpec.js index 018c8ef0f3c..95bf87e03ec 100644 --- a/apps/files/tests/js/filesSpec.js +++ b/apps/files/tests/js/filesSpec.js @@ -48,6 +48,41 @@ describe('Files tests', function() { expect(error).toEqual(false); } }); + it('Validates correct file names do not create Shared folder in root', function() { + // create shared file in subfolder + var error = false; + try { + expect(Files.isFileNameValid('shared', '/foo')).toEqual(true); + expect(Files.isFileNameValid('Shared', '/foo')).toEqual(true); + } + catch (e) { + error = e; + } + expect(error).toEqual(false); + + // create shared file in root + var threwException = false; + try { + Files.isFileNameValid('Shared', '/'); + console.error('Invalid file name not detected'); + } + catch (e) { + threwException = true; + } + expect(threwException).toEqual(true); + + // create shared file in root + var threwException = false; + try { + Files.isFileNameValid('shared', '/'); + console.error('Invalid file name not detected'); + } + catch (e) { + threwException = true; + } + expect(threwException).toEqual(true); + + }); it('Detects invalid file names', function() { var fileNames = [ '', diff --git a/apps/files_encryption/lib/util.php b/apps/files_encryption/lib/util.php index 6bf69cd8ee1..3db5a423478 100644 --- a/apps/files_encryption/lib/util.php +++ b/apps/files_encryption/lib/util.php @@ -135,7 +135,6 @@ class Util { // Set directories to check / create $setUpDirs = array( $this->userDir, - $this->userFilesDir, $this->publicKeyDir, $this->encryptionDir, $this->keyfilesPath, diff --git a/apps/files_external/js/settings.js b/apps/files_external/js/settings.js index 895f97bd2c3..cd2a3103eb7 100644 --- a/apps/files_external/js/settings.js +++ b/apps/files_external/js/settings.js @@ -264,7 +264,7 @@ $(document).ready(function() { OC.MountConfig.saveStorage($(this).parent().parent()); }); - $('#sslCertificate').on('click', 'td.remove>img', function() { + $('#sslCertificate').on('click', 'td.remove>img', function() { var $tr = $(this).parent().parent(); var row = this.parentNode.parentNode; $.post(OC.filePath('files_external', 'ajax', 'removeRootCertificate.php'), {cert: row.id}); @@ -302,13 +302,23 @@ $(document).ready(function() { }); $('#allowUserMounting').bind('change', function() { + OC.msg.startSaving('#userMountingMsg'); if (this.checked) { OC.AppConfig.setValue('files_external', 'allow_user_mounting', 'yes'); + $('#userMountingBackups').removeClass('hidden'); } else { OC.AppConfig.setValue('files_external', 'allow_user_mounting', 'no'); + $('#userMountingBackups').addClass('hidden'); } + OC.msg.finishedSaving('#userMountingMsg', {status: 'success', data: {message: t('settings', 'Saved')}}); }); + $('input[name="allowUserMountingBackends\\[\\]"]').bind('change', function() { + OC.msg.startSaving('#userMountingMsg'); + var user_mounting_backends = $('input[name="allowUserMountingBackends\\[\\]"]:checked').map(function(){return $(this).val();}).get(); + OC.AppConfig.setValue('files_external', 'user_mounting_backends', user_mounting_backends.join()); + OC.msg.finishedSaving('#userMountingMsg', {status: 'success', data: {message: t('settings', 'Saved')}}); + }); }); })(); diff --git a/apps/files_external/lib/config.php b/apps/files_external/lib/config.php index 43275d36c06..2767076eefa 100755 --- a/apps/files_external/lib/config.php +++ b/apps/files_external/lib/config.php @@ -45,7 +45,7 @@ class OC_Mount_Config { 'datadir' => 'Location')); $backends['\OC\Files\Storage\AmazonS3']=array( - 'backend' => 'Amazon S3', + 'backend' => 'Amazon S3 and compliant', 'configuration' => array( 'key' => 'Access Key', 'secret' => '*Secret Key', @@ -156,6 +156,35 @@ class OC_Mount_Config { } /** + * Get details on each of the external storage backends, used for the mount config UI + * Some backends are not available as a personal backend, f.e. Local and such that have + * been disabled by the admin. + * + * If a custom UI is needed, add the key 'custom' and a javascript file with that name will be loaded + * If the configuration parameter should be secret, add a '*' to the beginning of the value + * If the configuration parameter is a boolean, add a '!' to the beginning of the value + * If the configuration parameter is optional, add a '&' to the beginning of the value + * If the configuration parameter is hidden, add a '#' to the beginning of the value + * @return array + */ + public static function getPersonalBackends() { + + $backends = self::getBackends(); + + // Remove local storage and other disabled storages + unset($backends['\OC\Files\Storage\Local']); + + $allowed_backends = explode(',', OCP\Config::getAppValue('files_external', 'user_mounting_backends', '')); + foreach ($backends as $backend => $null) { + if (!in_array($backend, $allowed_backends)) { + unset($backends[$backend]); + } + } + + return $backends; + } + + /** * Get the system mount points * The returned array is not in the same format as getUserMountPoints() * @return array @@ -287,11 +316,12 @@ class OC_Mount_Config { if (!isset($backends[$class])) { // invalid backend return false; - } + } if ($isPersonal) { // Verify that the mount point applies for the current user - // Prevent non-admin users from mounting local storage - if ($applicable !== OCP\User::getUser() || strtolower($class) === '\oc\files\storage\local') { + // Prevent non-admin users from mounting local storage and other disabled backends + $allowed_backends = self::getPersonalBackends(); + if ($applicable != OCP\User::getUser() || !in_array($class, $allowed_backends)) { return false; } $mountPoint = '/'.$applicable.'/files/'.ltrim($mountPoint, '/'); @@ -446,7 +476,7 @@ class OC_Mount_Config { */ public static function checksmbclient() { if(function_exists('shell_exec')) { - $output=shell_exec('which smbclient 2> /dev/null'); + $output=shell_exec('command -v smbclient 2> /dev/null'); return !empty($output); }else{ return false; diff --git a/apps/files_external/personal.php b/apps/files_external/personal.php index 90f5e159535..90d7afed28b 100755 --- a/apps/files_external/personal.php +++ b/apps/files_external/personal.php @@ -22,9 +22,8 @@ OCP\Util::addScript('files_external', 'settings'); OCP\Util::addStyle('files_external', 'settings'); -$backends = OC_Mount_Config::getBackends(); -// Remove local storage -unset($backends['\OC\Files\Storage\Local']); +$backends = OC_Mount_Config::getPersonalBackends(); + $tmpl = new OCP\Template('files_external', 'settings'); $tmpl->assign('isAdminPage', false); $tmpl->assign('mounts', OC_Mount_Config::getPersonalMountPoints()); diff --git a/apps/files_external/settings.php b/apps/files_external/settings.php index 31183409e39..5b62b542200 100644 --- a/apps/files_external/settings.php +++ b/apps/files_external/settings.php @@ -26,10 +26,26 @@ OCP\Util::addScript('files_external', 'settings'); OCP\Util::addscript('3rdparty', 'chosen/chosen.jquery.min'); OCP\Util::addStyle('files_external', 'settings'); OCP\Util::addStyle('3rdparty', 'chosen/chosen'); + +$backends = OC_Mount_Config::getBackends(); +$personal_backends = array(); +$enabled_backends = explode(',', OCP\Config::getAppValue('files_external', 'user_mounting_backends', '')); +foreach ($backends as $class => $backend) +{ + if ($class != '\OC\Files\Storage\Local') + { + $personal_backends[$class] = array( + 'backend' => $backend['backend'], + 'enabled' => in_array($class, $enabled_backends), + ); + } +} + $tmpl = new OCP\Template('files_external', 'settings'); $tmpl->assign('isAdminPage', true); $tmpl->assign('mounts', OC_Mount_Config::getSystemMountPoints()); -$tmpl->assign('backends', OC_Mount_Config::getBackends()); +$tmpl->assign('backends', $backends); +$tmpl->assign('personal_backends', $personal_backends); $tmpl->assign('groups', OC_Group::getGroups()); $tmpl->assign('users', OCP\User::getUsers()); $tmpl->assign('userDisplayNames', OC_User::getDisplayNames()); diff --git a/apps/files_external/templates/settings.php b/apps/files_external/templates/settings.php index 3ca16c3c7a8..de44d3c8644 100644 --- a/apps/files_external/templates/settings.php +++ b/apps/files_external/templates/settings.php @@ -122,12 +122,18 @@ <?php if ($_['isAdminPage']): ?> <br /> - <input type="checkbox" - name="allowUserMounting" - id="allowUserMounting" - value="1" <?php if ($_['allowUserMounting'] == 'yes') print_unescaped(' checked="checked"'); ?> /> - <label for="allowUserMounting"><?php p($l->t('Enable User External Storage')); ?></label><br/> - <em><?php p($l->t('Allow users to mount their own external storage')); ?></em> + <input type="checkbox" name="allowUserMounting" id="allowUserMounting" + value="1" <?php if ($_['allowUserMounting'] == 'yes') print_unescaped(' checked="checked"'); ?> /> + <label for="allowUserMounting"><?php p($l->t('Enable User External Storage')); ?></label> <span id="userMountingMsg" class="msg"></span> + + <p id="userMountingBackups"<?php if ($_['allowUserMounting'] != 'yes'): ?> class="hidden"<?php endif; ?>> + <?php p($l->t('Allow users to mount the following external storage')); ?><br /> + <?php $i = 0; foreach ($_['personal_backends'] as $class => $backend): ?> + <input type="checkbox" id="allowUserMountingBackends<?php p($i); ?>" name="allowUserMountingBackends[]" value="<?php p($class); ?>" <?php if ($backend['enabled']) print_unescaped(' checked="checked"'); ?> /> + <label for="allowUserMountingBackends<?php p($i); ?>"><?php p($backend['backend']); ?></label> <br /> + <?php $i++; ?> + <?php endforeach; ?> + </p> <?php endif; ?> </fieldset> </form> diff --git a/apps/files_sharing/js/share.js b/apps/files_sharing/js/share.js index 36de452a55e..9f0ed12f935 100644 --- a/apps/files_sharing/js/share.js +++ b/apps/files_sharing/js/share.js @@ -5,6 +5,14 @@ $(document).ready(function() { if (typeof OC.Share !== 'undefined' && typeof FileActions !== 'undefined' && !disableSharing) { $('#fileList').on('fileActionsReady',function(){ + + var allShared = $('#fileList').find('[data-share-owner]').find('[data-Action="Share"]'); + allShared.addClass('permanent'); + allShared.find('span').text(function(){ + $owner = $(this).closest('tr').attr('data-share-owner'); + return ' ' + t('files_sharing', 'Shared by {owner}', {owner: $owner}); + }); + if (!sharesLoaded){ OC.Share.loadIcons('file'); // assume that we got all shares, so switching directories @@ -17,16 +25,15 @@ $(document).ready(function() { }); FileActions.register('all', 'Share', OC.PERMISSION_READ, OC.imagePath('core', 'actions/share'), function(filename) { - if ($('#dir').val() == '/') { - var item = $('#dir').val() + filename; - } else { - var item = $('#dir').val() + '/' + filename; + var dir = $('#dir').val(); + var item = dir + '/' + filename; + if (dir == '/') { + item = dir + filename; } var tr = FileList.findFileEl(filename); + var itemType = 'file'; if ($(tr).data('type') == 'dir') { - var itemType = 'folder'; - } else { - var itemType = 'file'; + itemType = 'folder'; } var possiblePermissions = $(tr).data('permissions'); var appendTo = $(tr).find('td.filename'); diff --git a/apps/files_sharing/lib/cache.php b/apps/files_sharing/lib/cache.php index 4b0da0b002d..10f2182655f 100644 --- a/apps/files_sharing/lib/cache.php +++ b/apps/files_sharing/lib/cache.php @@ -137,9 +137,12 @@ class Shared_Cache extends Cache { } else { $cache = $this->getSourceCache($folder); if ($cache) { + $parent = $this->storage->getFile($folder); $sourceFolderContent = $cache->getFolderContents($this->files[$folder]); foreach ($sourceFolderContent as $key => $c) { $sourceFolderContent[$key]['usersPath'] = 'files/Shared/' . $folder . '/' . $c['name']; + $sourceFolderContent[$key]['uid_owner'] = $parent['uid_owner']; + $sourceFolderContent[$key]['displayname_owner'] = $parent['uid_owner']; } return $sourceFolderContent; diff --git a/apps/files_sharing/lib/share/file.php b/apps/files_sharing/lib/share/file.php index ec0f368386f..5e00050fe1e 100644 --- a/apps/files_sharing/lib/share/file.php +++ b/apps/files_sharing/lib/share/file.php @@ -94,6 +94,9 @@ class OC_Share_Backend_File implements OCP\Share_Backend_File_Dependent { $file['mtime'] = $item['mtime']; $file['encrypted'] = $item['encrypted']; $file['etag'] = $item['etag']; + $file['uid_owner'] = $item['uid_owner']; + $file['displayname_owner'] = $item['displayname_owner']; + $storage = \OC\Files\Filesystem::getStorage('/'); $cache = $storage->getCache(); if ($item['encrypted'] or ($item['unencrypted_size'] > 0 and $cache->getMimetype($item['mimetype']) === 'httpd/unix-directory')) { diff --git a/apps/user_ldap/lib/helper.php b/apps/user_ldap/lib/helper.php index 7de7fe8667f..b5955cb2abb 100644 --- a/apps/user_ldap/lib/helper.php +++ b/apps/user_ldap/lib/helper.php @@ -120,7 +120,7 @@ class Helper { $saveOtherConfigurations = ''; if(empty($prefix)) { - $saveOtherConfigurations = 'AND `Configkey` NOT LIKE \'s%\''; + $saveOtherConfigurations = 'AND `configkey` NOT LIKE \'s%\''; } $query = \OCP\DB::prepare(' diff --git a/apps/user_ldap/user_proxy.php b/apps/user_ldap/user_proxy.php index 5ad127197f3..2cb3dfb2c60 100644 --- a/apps/user_ldap/user_proxy.php +++ b/apps/user_ldap/user_proxy.php @@ -54,11 +54,15 @@ class User_Proxy extends lib\Proxy implements \OCP\UserInterface { protected function walkBackends($uid, $method, $parameters) { $cacheKey = $this->getUserCacheKey($uid); foreach($this->backends as $configPrefix => $backend) { -// print("walkBackend '$configPrefix'<br/>"); - if($result = call_user_func_array(array($backend, $method), $parameters)) { + $instance = $backend; + if(!method_exists($instance, $method) + && method_exists($this->getAccess($configPrefix), $method)) { + $instance = $this->getAccess($configPrefix); + } + if($result = call_user_func_array(array($instance, $method), $parameters)) { $this->writeToCache($cacheKey, $configPrefix); return $result; - } + } } return false; } @@ -77,7 +81,12 @@ class User_Proxy extends lib\Proxy implements \OCP\UserInterface { //in case the uid has been found in the past, try this stored connection first if(!is_null($prefix)) { if(isset($this->backends[$prefix])) { - $result = call_user_func_array(array($this->backends[$prefix], $method), $parameters); + $instance = $this->backends[$prefix]; + if(!method_exists($instance, $method) + && method_exists($this->getAccess($prefix), $method)) { + $instance = $this->getAccess($prefix); + } + $result = call_user_func_array(array($instance, $method), $parameters); if($result === $passOnWhen) { //not found here, reset cache to null if user vanished //because sometimes methods return false with a reason |