Compare commits

...

648 Commits

Author SHA1 Message Date
Daniel Molkentin 8f80be3b0d ownCloud Server 8.0.15 RC1 2016-08-18 13:01:56 +02:00
Thomas Müller 0e69a70c94 [stable8] Test jenkins pipeline (#25401) (#25505)
* [stable8] Test jenkins pipeline (#25401)

* stable8 does not support php 7.0 and there are no primary object store tests on swift
2016-08-12 13:27:04 +02:00
Daniel Molkentin eeded3195f ownCloud Server 8.0.14 2016-07-18 17:39:05 +02:00
Daniel Molkentin 18ec8c67a4 ownCloud Server 8.0.14 RC2 2016-07-13 17:03:01 +02:00
Vincent Petry ee4a797224 Merge pull request #25330 from owncloud/stable8-fix-versionrevertperms
[stable8] Hide revert button when no permission to revert
2016-07-13 14:32:07 +02:00
Vincent Petry d31720b6f1 Hide revert button when no permission to revert 2016-07-13 10:41:05 +02:00
Vincent Petry 86a71c6ca1 Additional perm check in Webdav (#25453) 2016-07-12 12:39:38 +02:00
Thomas Müller 8f42a1f1c2 [stable8] Use oracle docker for ci with stable8 (#24529)
* Use oracle docker for ci with stable8

* Fix failing unit test
2016-07-04 09:57:12 +02:00
Daniel Molkentin dba072ef3e ownCloud 8.0.14 RC1 2016-06-29 16:41:24 +02:00
Vincent Petry c45eda6d6d Merge pull request #25141 from owncloud/stable8-backport-25126
[8.0] load authentication apps first
2016-06-16 13:09:23 +02:00
Christoph Wurst da8523b5d7 load authentication apps first 2016-06-16 11:32:58 +02:00
Vincent Petry 42720eaa78 Merge pull request #24918 from owncloud/backport-24889-read-commited-warning-in-admin-section-8.0
[8.0] Add a warning when the transaction isolation level is not READ_COMMITED
2016-06-07 09:08:49 +02:00
Joas Schilling 617c651237 Add a warning when the transaction isolation level is not READ_COMMITED 2016-06-06 11:46:58 +02:00
Vincent Petry a420749255 Merge pull request #24901 from owncloud/stable8-backport-scan-fix
[stable8] fix getting mount points when passing a path to the files:scan command
2016-06-01 11:32:12 +02:00
Robin Appelman c131ced0a8 fix getting mount points when passing a path to the files:scan command 2016-05-30 16:45:54 +02:00
Vincent Petry 420dab7638 Merge pull request #24694 from owncloud/stable8-fixchunkttl
[stable8] Allow chunk GC mtime tolerance for unfinished part chunks
2016-05-18 18:21:09 +02:00
Vincent Petry 5bb892b206 Allow chunk GC mtime tolerance for unfinished part chunks
Whenever part chunks are written, every fwrite in the write loop will
reset the mtime to the current mtime. Only at the end will the touch()
operation set the mtime to now + ttl, in the future.

However the GC code is expecting that every chunk with mtime < now are
old and must be deleted. This causes the GC to sometimes delete part
chunks in which the write loop is slow.

To fix this, a tolerance value is added in the GC code to allow for
more time before a part chunk gets deleted.
2016-05-18 14:04:30 +02:00
Vincent Petry 8cee246880 Merge pull request #24515 from owncloud/stable8-updater-server-configurable
[stable8] Make update server URL configurable
2016-05-17 10:09:49 +02:00
Lukas Reschke 642099ba32 Make update server URL configurable
Currently testing the updates is a big problem and not really super easy possible. Since we now have a new updater server we should also make this configurable so that people can properly test updates.
2016-05-13 16:15:58 +02:00
C Montero-Luque 42c782f35c 8.0.13 2016-05-12 15:59:50 -04:00
Thomas Müller 5f9705d692 Merge pull request #24557 from owncloud/kill-en@pirate-stable8
[stable8] Yo-ho-oh - Murder all band 'o pirates
2016-05-11 14:29:44 +02:00
Thomas Müller de5beca999 Yo-ho-oh - Murder all band 'o pirates 2016-05-11 11:38:26 +02:00
C Montero-Luque bdec8b91e2 8.0.13 RC2 2016-05-10 15:51:20 -04:00
C Montero-Luque 04b62420b8 8.0.13 RC1 2016-05-09 18:45:04 -04:00
C Montero-Luque 5d5dda42b3 8.0.12 2016-05-03 04:41:03 -04:00
C Montero-Luque f0fddd1eaa 8.0.12 RC2 2016-05-02 04:19:41 -04:00
C Montero-Luque 3378256fb1 8.0.12 RC1 2016-04-26 21:27:44 -04:00
Thomas Müller 75e770c8cf Merge pull request #24168 from owncloud/stable8-certificate
[stable8] Ignore certificate file if it starts with file://
2016-04-22 09:35:06 +02:00
Lukas Reschke 9cdb881725 [stable8] Ignore certificate file if it starts with file:// 2016-04-21 18:53:00 +02:00
Thomas Müller e5691ab5cc Merge pull request #24148 from owncloud/stable8-quota-recognizeremoteunlimitedquota
[stable8] Workaround to be able to recognize unlimited quota in fed shares
2016-04-21 12:51:53 +02:00
Vincent Petry 8adbc41aa0 Workaround to be able to recognize unlimited quota in fed shares
Fixes issues where a user cannot upload to a fed share on OC >= 9.0
where the sharer has unlimited quota (-3)
2016-04-21 11:21:38 +02:00
Morris Jobke e04f994fb3 Merge pull request #24043 from owncloud/stable8-autoload
[stable8] Exclude autoload_static.php
2016-04-18 08:49:05 +02:00
Lukas Reschke 48a31327a5 Exclude autoload_static.php 2016-04-17 11:14:58 +02:00
Thomas Müller b9eb25abba Merge pull request #23352 from owncloud/stable8_backport_23346
[Stable 8] Set proper public webdav permissions when public upload disabled
2016-03-17 20:51:18 +01:00
Roeland Jago Douma a63ce82b90 Set proper public webdav permissions when public upload disabled
Fixes #23325

 It can happen that a user shares a folder with public upload. And some
 time later the admin disables public upload on the server.

 To make sure this is handled correctly we need to check the config
 value
 and reduce the permissions.

 Fix is kept small to be easy backportable.
2016-03-17 14:00:01 +01:00
Morris Jobke aee45210f7 Merge pull request #23310 from owncloud/check-syntax-travis-stable8
[stable8] Execute parallel-lint
2016-03-17 09:35:30 +01:00
Lukas Reschke 40c5902d7b [stable8] Execute parallel-lint
Backport of https://github.com/owncloud/core/pull/22994 and https://github.com/owncloud/core/pull/23303
2016-03-16 15:01:41 +01:00
Morris Jobke 463da6b81d Merge pull request #22844 from owncloud/stable8_22830
[Stable 8] Rename and move permissions are set when a file is updatable
2016-03-09 08:43:38 +01:00
C Montero-Luque 1f8dd6eeaf 8.0.11 2016-03-08 09:04:44 -05:00
C Montero-Luque cdf67f5b4c 8.0.11 RC2 2016-03-04 18:17:06 -05:00
C. Montero Luque 7dd55731d2 Merge pull request #22864 from owncloud/stable8-trashbin-checkpath
[stable8] Properly check path validity before deleting to trash
2016-03-04 13:36:25 -05:00
Vincent Petry da242962c3 Properly check path validity before deleting to trash
This prevents deleting the whole "files" folder of the user whenever
$ownerPath is empty. This can happen in concurrency situations.
2016-03-04 15:42:04 +01:00
Roeland Jago Douma 99bad9d24c Rename and move permissions are set when a file is updatable
* Fix unit tests
2016-03-04 09:48:12 +01:00
C Montero-Luque 519191bb05 8.0.11 RC1 2016-03-01 21:07:10 -05:00
C. Montero Luque 1153560d43 Merge pull request #22764 from owncloud/stable8-backport-phpmailer
[stable8] Backport PHPMailer validation
2016-03-01 15:34:10 -05:00
Lukas Reschke 3825113ad8 [stable8] Backport PHPMailer validation
For https://github.com/owncloud/3rdparty/pull/253

cc @cmonteroluque
2016-03-01 21:30:09 +01:00
Vincent Petry b558fc4d02 Merge pull request #21634 from owncloud/backport-17924-stable8
[backport] [stable8] always use an LDAP URL when connecting to LDAP
2016-03-01 14:35:41 +01:00
Morris Jobke 848fa08080 Merge pull request #22174 from owncloud/stable8-backport-22143
[Stable 8.0] When a user is removed we should remove the right shares
2016-02-06 09:27:49 +01:00
Roeland Jago Douma babd4e1450 When a user is removed we should remove the right shares
* This means all the shares directly shared with them
* Or all group shares having a special share with them

This patch fixes the operator precedece (AND before OR).
So before this patch:

(share_with = <deleted user> AND share_type = 0) OR share_type=2

So it deleted all user specific shares

Now:
share_with = <deleted user> AND (share_type = 0 OR (share_type=2)
2016-02-05 20:12:27 +01:00
Arthur Schiwon cb54370ea5 always use an LDAP URL when connecting to LDAP
- without original integration test as infrastructure was introduced in 8.1 only
2016-01-29 20:16:29 +01:00
Thomas Müller 4688cd11aa Merge pull request #21695 from owncloud/stable8-users-scrolltop
[stable8] Keep scroll position in users page when sorting
2016-01-15 13:19:28 +01:00
Vincent Petry 5b65d78ae3 Keep scroll position in users page when sorting
When sorting, some browsers like Chrome will lose the scroll position,
possibly because the sorting code is touching the DOM elements.

This fix saves the scroll position before sorting and sets it back
afterwards.
2016-01-13 15:35:10 +01:00
Thomas Müller 9b62439b06 Merge pull request #21464 from owncloud/stable8-fix-scanner-regression
[stable8] Fix regression in ajax/scan.php
2016-01-08 14:44:38 +01:00
Morris Jobke dffc6cdcd7 Fix regression in ajax/scan.php
* introduced in #20763
2016-01-05 14:41:17 +01:00
Morris Jobke 74c90c7fec Merge pull request #21297 from owncloud/stable8-prevent0bytedownloads
[stable8] prevent 0 byte downloads when storage returns false
2016-01-05 13:59:24 +01:00
C Montero-Luque 7562dc2c6e 8.0.10 2015-12-21 07:24:30 -05:00
C Montero-Luque 1ae1a63f79 8.0.10 RC2 2015-12-18 17:34:08 -05:00
Jörn Friedrich Dreyer a8f3da1f98 prevent 0 byte downloads when storage returns false
add unit test

More fixes for backport
2015-12-18 18:40:31 +01:00
C Montero-Luque 990f86d3d4 8.0.10 RC1 2015-12-15 16:09:43 -05:00
Vincent Petry 87eb48275b Merge pull request #21214 from owncloud/backport-21133-stable8
[backport] [stable8] Fix shared files of deleted users, detect DN change when checking for existence on LDAP
2015-12-15 20:52:58 +01:00
Arthur Schiwon 1ec2f3233e adjust tests for 8.0 2015-12-15 20:19:15 +01:00
Arthur Schiwon 5cab4a939e Backport of #21133 to stable8
throw NoUserException in getHome when the requested user does not exist anymore

look for DN changes before marking a user as deleted

adjust unit test

unit test on getHome in combination with OfflineUser

fix find DN by UUID for AD

adjust dealing with search results due to different format in 8.0
2015-12-15 20:19:15 +01:00
Arthur Schiwon 2eedf39b15 backport necessary OfflinerUser::unmark() 2015-12-15 20:15:56 +01:00
Vincent Petry 4d1bee9308 Merge pull request #21208 from owncloud/stable8-backport-16961
[stable8] Hardening home folder retrieval in user_ldap
2015-12-15 17:27:15 +01:00
Björn Schießle cc79334acc Merge pull request #21202 from owncloud/fix_20296_8.0
[stable8.0] don't allow to create a federated share if source and target are the same
2015-12-15 14:56:13 +01:00
Björn Schießle 91d17790d6 manually backport some helper methods 2015-12-15 11:43:18 +01:00
Vincent Petry f6be4f8ec1 Fixed JS unit tests for fed owner display name 2015-12-15 11:43:17 +01:00
Björn Schießle 2f6caa3075 show display name but internally use the user name 2015-12-15 11:43:17 +01:00
Björn Schießle c8366f3de5 don't allow to create a federated share if source and target server are the same 2015-12-15 11:43:17 +01:00
Morris Jobke 89fdca7748 Only throw exception if on new LDAP setups
* this is done by setting enforce_home_folder_naming_rule for the user_ldap
  app in the app settings
2015-12-15 10:01:25 +01:00
Morris Jobke 582ca0a50d Hardening home folder retrieval in user_ldap
* if the home folder naming rule is specified it should not fallback
  to the "use owncloud username as home folder" scenario
* this does not allow the mixed setup of users with the attribute
  and some users without the attribute (which then would fallback to
  "use owncloud username as home folder" rule) anymore
2015-12-15 08:45:32 +01:00
Morris Jobke 79857c975c Merge pull request #21150 from owncloud/backport-20978-stable8
reset mailadress/displayname on blur (backport for stable8)
2015-12-14 17:33:09 +01:00
Lukas Reschke 667a562ed9 Merge pull request #21192 from owncloud/preview-non-existing-8
[8.0] Handle non existing files in version previews
2015-12-14 16:34:24 +01:00
Robin Appelman 07fb3e329b Handle non existing files in version previews 2015-12-14 16:02:38 +01:00
Lukas Reschke 1d65016980 Use XMLWriter to generate response
Gets rid of manual XML generation.
2015-12-14 09:38:14 +01:00
michag86 2282ed373a reset mailadress/displayname on blur 2015-12-11 14:56:56 +01:00
Vincent Petry 254fc41f2d Merge pull request #20363 from owncloud/backport-20271-stable8
[backport] [stable8] LDAP: attempt to connect to backup server again, if main server is no…
2015-12-04 10:33:52 +01:00
Thomas Müller 3808618ae9 Merge pull request #20844 from owncloud/files-scan-user-path-80
[8.0] Lock scanner to the given user
2015-11-30 22:46:27 +01:00
Robin Appelman 5d7bd6f6ad Lock scanner to the given user 2015-11-30 17:01:52 +01:00
Vincent Petry 64ae79a9d9 Merge pull request #20808 from owncloud/backport-use-new-updater-url-stable8
[stable8] Use new updater URL
2015-11-30 12:03:34 +01:00
Lukas Reschke 8bd90a12f1 [stable8] Use new updater URL 2015-11-28 11:55:57 +01:00
Vincent Petry 76be8bb71b Merge pull request #20763 from owncloud/scan-eventsource-no-paths-8
[8.0] Dont output paths in scan.php
2015-11-26 16:40:19 +01:00
Robin Appelman fab59179f1 Dont output paths in scan.php 2015-11-26 16:35:52 +01:00
Vincent Petry ff214a3fb2 Merge pull request #19659 from owncloud/stable8-backport-19546
Stable8 backport 19546
2015-11-25 14:55:44 +01:00
Morris Jobke dc2a6e2210 Merge pull request #20638 from owncloud/cache-escape-like-8
[8.0] Escape like parameter in cache operations
2015-11-20 16:44:25 +01:00
Robin Appelman 08866d54fd escape like parameter in cache move 2015-11-20 14:44:13 +01:00
Robin Appelman 221de0060d Add test for special character during move 2015-11-20 14:42:12 +01:00
Robin Appelman 9f6dfd3e38 define escape character for like statements on oracle 2015-11-20 14:42:09 +01:00
Robin Appelman 2993a741cf define escape character for like statements on sqlite 2015-11-20 14:42:06 +01:00
Robin Appelman 8db22f5d50 fix internal path when searching in storage root
(cherry picked from commit c2d76d2)
2015-11-12 21:05:58 +01:00
Robin Appelman 345660b407 Add unit test for searching in storage root
(cherry picked from commit e28a2ff)
2015-11-12 21:05:58 +01:00
Olivier Paroz 5ed0d6079d The minimum size for internalRootLength is 1
(cherry picked from commit 3173ed2)
2015-11-12 21:05:58 +01:00
Morris Jobke ded50e8dbe Merge pull request #20396 from owncloud/stable8-extstorage-gdrive-forceapproval
[stable8] Force approval in GDrive oauth to get refresh_token
2015-11-09 14:02:45 +01:00
Vincent Petry 3a3ccd47b9 Force approval in GDrive oauth to get refresh_token
Forcing the approval of app permissions makes sure that the GDrive API
will always return a refresh_token.

In the case of apps that were already authorized for the current user/domain,
the API doesn't return the refresh_token which causes expiration issues.
2015-11-09 13:08:09 +01:00
Arthur Schiwon e92a0ff0e4 LDAP: attempt to connect to backup server again, if main server is not available. Fixes #18701 2015-11-06 13:04:46 +01:00
Vincent Petry 159e6b6444 Merge pull request #20302 from owncloud/backport-20155-8.0
[backport] [stable8] add port to host only, if an URL is used instead of a plain hostname
2015-11-05 10:51:15 +01:00
Arthur Schiwon fe21a8dddb add port to host only, if an URL is used instead of a plain hostname 2015-11-04 15:49:55 +01:00
C Montero-Luque 258496c951 8.0.9 2015-10-30 12:46:39 -04:00
C Montero-Luque ec7e355afc 8.0.9 RC2 2015-10-28 10:38:52 -04:00
Thomas Müller 8838e072c7 Merge pull request #20063 from owncloud/stable8-add-warning-for-php-7
[stable8] Stop processing if PHP 7 is used
2015-10-26 22:04:01 +01:00
Lukas Reschke 7e8f3ee28d Stop processing if PHP 7 is used
PHP 7 is only compatible with ownCloud 8.2.0
2015-10-26 17:40:00 +01:00
Lukas Reschke 6897cbebc0 Do not print exception message 2015-10-25 19:05:28 +01:00
C Montero-Luque 2e0952b081 8.0.9 RC1 2015-10-21 17:36:54 -04:00
Thomas Müller 9444e07e80 Merge pull request #19732 from owncloud/make-sure-sharing-extends-the-testcase
Make sure all sharing tests extend the testcase
2015-10-13 15:40:16 +02:00
Joas Schilling d78b4d0e72 Make sure all sharing tests extend the testcase 2015-10-13 11:16:40 +02:00
Thomas Müller f69161ae87 Merge pull request #19681 from owncloud/stable8-backport-19574
Clear the shares after the test like storages and files
2015-10-12 09:19:22 +02:00
Morris Jobke b64b8c1b48 Clear the shares after the test like storages and files
* adjusted to stable8.1 backport of #19574
2015-10-09 17:43:10 +02:00
Morris Jobke 4214df7bf6 Merge pull request #18958 from owncloud/stable8-backport-17791
[stable8] Add custom CSP for Win 10 compatibility
2015-10-09 15:25:11 +02:00
Morris Jobke 28de9c7357 Merge pull request #18857 from owncloud/memcached-fix-stable8
[stable8] Fallback to complete Memcached flush if getAllKeys fails
2015-10-09 13:19:26 +02:00
Thomas Müller 109a206ae3 Merge pull request #19476 from owncloud/thumbnail-temp-clean-8
[8] Clean temp files used for thumbnail generation
2015-09-30 16:10:09 +02:00
Robin Appelman 96b812bee6 Clean temp files used for thumbnail generation 2015-09-30 15:18:02 +02:00
Morris Jobke 4c912e66db Merge pull request #19447 from owncloud/stable8-backport-19441
[stable8][upgrade] switch to debug logging on upgrade
2015-09-29 18:25:24 +02:00
Morris Jobke 3f79484c45 [upgrade] switch to debug logging on upgrade
* resets afterwards
* adds output about the previous log level
2015-09-29 16:23:37 +02:00
Morris Jobke 5f81a5e641 Merge pull request #17953 from owncloud/backport-17464-stable8
[stable8] backport of #17464: fix uncaught exception on not permitted file types when setting avata…
2015-09-28 11:53:44 +02:00
Morris Jobke 7ff02a6daf Merge pull request #18704 from owncloud/stable8-dav-copy-fix
[stable8] Check for file existence before doing a DAV copy
2015-09-28 11:51:43 +02:00
C Montero-Luque 07546d0e8c 8.0.8 2015-09-10 10:26:01 -04:00
Lukas Reschke bb5b7290ac Add custom CSP for Win 10 compatibility
The default content-security-policy of ownCloud forbids inline
JavaScript for security reasons. IE starting on Windows 10 will
however also obey the CSP which will break the event source fallback.
As a workaround thus we set a custom policy which allows the execution
of inline JavaScript.

This fixes https://github.com/owncloud/core/issues/14286
2015-09-10 15:02:45 +02:00
Morris Jobke a283bf209b Merge pull request #18843 from owncloud/app-upgrade-routenotfound-stable8
[stable8] Always add to $loadedApps
2015-09-07 00:26:25 +02:00
Robin McCorkell 519e980f93 Fallback to complete Memcached flush if getAllKeys fails
Newer Memcached's do not support the underlying protocol commands that
getAllKeys() is implemented with. We should fallback to clearing
everything in that case, as causing (temporary) performance problems for
other applications on the server is better than having stale cached data.
2015-09-06 20:42:01 +01:00
Robin McCorkell 8d79c9576a Always add to $loadedApps 2015-09-05 11:43:58 +01:00
C Montero-Luque 019480a044 8.0.7 2015-09-02 10:53:39 +02:00
Vincent Petry f6a4d33ef7 Check for file existence before doing a DAV copy
Partial backport of f39fcbc250 from 8.1
2015-08-31 15:14:10 +02:00
Morris Jobke bc409d41c1 Merge pull request #18613 from owncloud/stable8-newer-certs
[stable8] Use certificates that expire in 10 years
2015-08-28 18:44:36 +02:00
Lukas Reschke 712ceb4443 Use certificates that expire in 10 years
🙊 🙊 🙊
2015-08-27 22:33:39 +02:00
C Montero-Luque 6e816e4e61 8.0.7 2015-08-27 11:39:43 +02:00
C Montero-Luque 751732f7ba 8.0.7 RC1 2015-08-27 11:33:37 +02:00
Morris Jobke 4942646ada Merge pull request #18560 from owncloud/ext-objectstore-stable8
[stable8] Prevent objectstore being set from client side
2015-08-25 18:31:25 +02:00
Robin McCorkell 595381b9bd Prevent objectstore being set from client side 2015-08-25 16:27:50 +01:00
Morris Jobke 67c68253a2 Merge pull request #18546 from owncloud/stable8-backport-18439
[stable8] [app management] fix dependency check on install
2015-08-25 15:13:30 +02:00
Morris Jobke ef4abb39a5 [app management] fix dependency check on install 2015-08-25 14:24:45 +02:00
Morris Jobke 12d70eb959 Merge pull request #18488 from owncloud/stable8-add-cors-header
[stable8] Add CORS header to status.php to allow client-based check i…
2015-08-24 09:30:19 +02:00
Lukas Reschke 602ec0efa1 [stable8] Add CORS header to status.php to allow client-based check in the future 2015-08-22 14:50:51 +02:00
Morris Jobke 17082469de Merge pull request #18286 from owncloud/stable8-backport-17785
[stable8] fix mobile scrolling, lower sidebar sensitivity, fix #11193
2015-08-19 19:52:28 +02:00
Morris Jobke 77b5ba9213 Merge pull request #17958 from owncloud/stable8-backport-17489
[stable8] Fix parsing of sharetime as string
2015-08-19 14:24:27 +02:00
Robin McCorkell 10a5b1b19d Merge pull request #18366 from owncloud/config-sample-typos-8
fix typos
2015-08-17 23:42:34 +01:00
Carla Schroder f7eb4b17e8 fix typos 2015-08-17 11:30:46 -07:00
Morris Jobke 0a8743a261 Merge pull request #18181 from owncloud/backport-18159-stable8
Backport 18159 stable8
2015-08-16 14:38:35 +02:00
Jan-Christoph Borchardt fe2710f60b fix mobile scrolling, lower sidebar sensitivity, fix #11193 2015-08-13 15:45:56 +02:00
Morris Jobke 5296ef64cc Merge pull request #18258 from owncloud/stable8-backport-17680
[stable8] handle rmdir on files for ftp storages
2015-08-13 15:32:53 +02:00
Robin McCorkell e4e4b6f902 Merge pull request #18278 from owncloud/stable8-17852
[stable8] add test for factories
2015-08-13 14:27:53 +01:00
Bernhard Posselt 6248dd19c5 add test for factories
use ref for factory test

Ensure we construct SimpleContainer

Use single instance of DIContainer in routing tests
2015-08-13 13:31:54 +01:00
Robin Appelman cb9aa372c8 handle rmdir on files for ftp storages 2015-08-13 10:56:09 +02:00
Morris Jobke 30409c7419 Merge pull request #17917 from owncloud/stable8-add-ssl-hint
[stable8] add note about SSL in admin settings
2015-08-12 10:58:40 +02:00
michag86 a34a683ef1 Update installer.php 2015-08-10 18:41:29 +02:00
michag86 15806febcb Check if archive contains a directory named like appid 2015-08-10 18:41:24 +02:00
Frank Karlitschek 811b7dff9f 8.0.6 2015-08-07 20:18:07 -04:00
C Montero-Luque 1d45298974 8.0.6 RC1 2015-08-03 08:06:06 -04:00
Morris Jobke fc3ce8441e tests for _parseTime with hex and empty strings 2015-07-29 14:58:56 +02:00
Morris Jobke 47d25989dc Fix parsing of sharetime as string
In some cases the ajax/share.php will return the share time as string.
If this is the case it would get parsed completely wrong and cause the
share dropdown to not work anymore. This change will properly cast the
string to an interger and also fallback if this is not possible.
2015-07-29 14:58:54 +02:00
Arthur Schiwon 232e3821cd fix uncaught exception on not permitted file types when setting avatar, fixes #17232 2015-07-29 13:01:29 +02:00
Morris Jobke cc00aba7cf [stable8] add note about SSL in admin settings
* reborn #16867
* fixes #16778
2015-07-28 08:37:07 +02:00
Morris Jobke b186a7822c Merge pull request #17897 from owncloud/backport-scan-check-path-stable8
[stable8] Backport scan check path stable8
2015-07-27 13:03:13 +02:00
Lukas Reschke 11dc65e76c Add unit tests 2015-07-27 11:23:32 +02:00
Robin Appelman 9f8c0a3a8d check if the user is trying to scan a valid path 2015-07-27 11:20:26 +02:00
blizzz 385aefdc8f Merge pull request #16456 from owncloud/stable8-backport-13740-and-15606
[stable8] backport 13740 and 15606
2015-07-23 17:25:08 +02:00
Arthur Schiwon 4253838b24 add primary group users to resultset before caching 2015-07-23 14:33:30 +02:00
Arthur Schiwon 9dcc7465aa Fixes returns of group memberships and counting if all members have the specific groups as primary set. 2015-07-23 14:33:30 +02:00
Arthur Schiwon 6309dbfa6a and escape the search term 2015-07-23 14:33:30 +02:00
Arthur Schiwon 36f17964e5 💄 2015-07-23 14:33:30 +02:00
Arthur Schiwon 5d10c37b08 fix counting of users in primary group 2015-07-23 14:33:30 +02:00
Arthur Schiwon 0d5b4b95ef inlcude AD primary group in user filter, if a group is selected. fixes #12190 2015-07-23 14:33:30 +02:00
C Montero-Luque 7cd4425b71 8.0.6 beta1 2015-07-22 17:24:54 -04:00
Morris Jobke 9036a46145 Merge pull request #17764 from owncloud/backport-17723-stable8
Backport of #17723 to stable8
2015-07-21 00:04:08 +02:00
Arthur Schiwon d64a6115f0 Backport of #17723 to stable8
fix runtime caching in ldap's user manager, fixes #17631

fix indentation. no code changes, whitespace only.
2015-07-20 23:01:32 +02:00
Thomas Müller 2b0de142ab Merge pull request #17688 from owncloud/stable8-publiclinksystemwidemountwithapplicable
[stable8] Pass owner to isSystemWideMountPoint to make it work for public links
2015-07-20 15:08:21 +02:00
Vincent Petry 535e4296b5 Pass owner to isSystemWideMountPoint to make it work for public links
Public links did not have the correct owner so could not properly detect
system wide mount points.

This is a manual backport of b25c06f576 from 8.1
2015-07-16 18:11:40 +02:00
Morris Jobke 558f1ec1ec Merge pull request #17158 from owncloud/backport-15772-no-permission-restriction-for-owner
[stable8] Backport 15772 no permission restriction for owner
2015-07-16 14:06:31 +02:00
Joas Schilling f13ff381ae Merge pull request #16019 from owncloud/backport-15486
[stable8] Keep fileid when restoring version, using stream copy
2015-07-16 11:53:18 +02:00
Robin McCorkell 96b252195b Merge pull request #17340 from owncloud/stable8-backport-16911
[stable8] Determine the size we need before asking for a thumbnail
2015-07-15 13:58:03 +01:00
Vincent Petry ad6a321266 Merge pull request #17566 from owncloud/stable8-dav-fixcalls
Fix DAV propfind call
2015-07-13 17:47:42 +02:00
Thomas Müller 28ce93aa02 Merge pull request #17608 from owncloud/stable8-backport-17426
[stable8] [config sample] Update info about appstore
2015-07-13 17:41:10 +02:00
Vincent Petry 7e7e2f2099 Fix DAV propfind call 2015-07-13 16:57:37 +02:00
Robin McCorkell f01ade72cd Merge pull request #17415 from owncloud/fix-ldap-port-field-size
[stable8] LDAP: make sure port input box is not getting too small on low width
2015-07-13 14:09:34 +01:00
Morris Jobke 65e33be707 [config sample] Update info about appstore 2015-07-13 14:54:19 +02:00
Morris Jobke c81823bb2d Merge pull request #16369 from owncloud/stable8-share-moveversionsproperly
[stable8] Fix version rename with files and folders
2015-07-09 22:26:25 +02:00
Morris Jobke 3fe4f53a1f Merge pull request #17326 from owncloud/stable8-catch-notpermitted
[stable8] Properly handle NotPermittedException in SabreDAV
2015-07-09 15:29:20 +02:00
Morris Jobke affe4d7a38 Merge pull request #17519 from owncloud/stable8-backport-config-sample
[stable8] backport config sample
2015-07-09 14:30:13 +02:00
Morris Jobke 3561a1572b Merge pull request #17405 from owncloud/stable8-backport-17095
[stable8] Proper error handling
2015-07-09 10:23:09 +02:00
Morris Jobke e47bf07b5e [config sample] improve RST markup and wording 2015-07-09 10:20:59 +02:00
Morris Jobke 97b3a82581 refine sample config text 2015-07-09 10:18:32 +02:00
Morris Jobke 751092d6dc [config sample] merge Miscellaneous & All other options 2015-07-09 10:16:54 +02:00
Morris Jobke f97b21da11 Merge pull request #17172 from owncloud/view-emit-path-stable8
[stable8] emit hooks from a view as long as the path is inside the default root
2015-07-08 10:36:20 +02:00
Morris Jobke 8b0b6924f5 Merge pull request #17271 from owncloud/stable8-share-etag-update-target
Stable8 share etag update target
2015-07-08 10:35:20 +02:00
Morris Jobke 97ac85164e Merge pull request #17367 from owncloud/fix_16740_8.0
[stable8] owner is stored as 'uid_owner', not as 'owner' in the oc_share table
2015-07-08 10:31:54 +02:00
Morris Jobke e9262dbe2f Merge pull request #17419 from owncloud/stable8-backport-17159
[stable8] remove duplicate ID in HTML template for public shares
2015-07-08 10:30:04 +02:00
Morris Jobke 4ec2e6c357 remove duplicate ID in HTML template for public shares 2015-07-06 13:40:20 +02:00
Arthur Schiwon a24b6a352a LDAP: make sure port input box is not getting too small on low width 2015-07-06 13:09:26 +02:00
Morris Jobke c9e77c7de4 Remove unneeded part file 2015-07-06 13:05:13 +02:00
Morris Jobke ecaad05c63 [updater] mark failure in red 2015-07-06 10:43:49 +02:00
Morris Jobke b94657a554 [updater] propagate error case properly
* add $success to the updateEnd hook
* add new return code for a update failure
* add exception class to failure hook message
2015-07-06 10:41:16 +02:00
Morris Jobke e0bf1e4f6e Added error message on initMountpoints exception 2015-07-06 10:32:37 +02:00
C Montero-Luque 3bd5f5eb4c 8.0.5 2015-07-03 06:14:56 -04:00
Bjoern Schiessle 918ba60aae call post_addToGroup als for class OC_User because sharing and LDAP are using this class. Minimal approach to fix #16740 2015-07-03 10:39:22 +02:00
Bjoern Schiessle 0a1b90929a owner is stored as 'uid_owner', not as 'owner' in the oc_share table 2015-07-03 10:39:03 +02:00
Morris Jobke 229635d65a Merge pull request #17318 from owncloud/stable8-clean-ocsid
[stable8] Delete OCS ID from DB if none is specified
2015-07-02 14:39:29 +02:00
Morris Jobke 6029b41760 Merge pull request #17312 from owncloud/stable8-remove-ocs-ids
[stable8] Remove OCS IDs
2015-07-02 14:39:09 +02:00
Olivier Paroz 62fa899fd2 floats are not welcome when setting the size of a preview 2015-07-02 13:27:14 +02:00
Olivier Paroz a20487907b Determine the size we need before asking for a thumbnail
We need to set the size of the preview using the devicePixelRatio and use that as arguments when using the preview endpoint or that endpoint will use the default 36x36 and thumbnails will be blurry on high DPI devices
2015-07-02 13:25:12 +02:00
Morris Jobke 0d9ad14165 Properly handle NotPermittedException in SabreDAV 2015-07-02 10:47:54 +02:00
Lukas Reschke bbd6f42c70 Bump versions 2015-07-02 09:25:39 +02:00
Lukas Reschke 3906951e91 Delete OCS ID from DB if none is specified
If no OCS ID is specified in appinfo.xml and an app update is triggered and a OCS ID is stored in the DB we should clean the value.

Ref https://github.com/owncloud/activity/issues/320#issuecomment-117937748
2015-07-02 09:22:20 +02:00
Lukas Reschke 43be73b9b4 [stable8] Remove OCS IDs
While making the AppStore ready for 8.1 I also deleted some dummy entries which means that these IDs do not resolve anymore. We should remove them to prevent errors such as https://github.com/owncloud/core/issues/17307

Ref https://github.com/owncloud/activity/issues/320#issuecomment-117691867
2015-07-02 08:49:59 +02:00
Lukas Reschke 78dc8ca702 Merge pull request #17297 from owncloud/stable8-use-mb-functions
[stable8] Use UTF-8 mode for preg_split and preg_replace
2015-07-01 21:41:37 +02:00
Lukas Reschke 7ec91b9177 Use UTF-8 mode for preg_split and preg_replace
Otherwise a single application with a description containing a non compliant character can break the whole ownCloud appstore. This is for example https://apps.owncloud.com/content/show.php?content=149553

Fixes https://github.com/owncloud/core/issues/17101#issuecomment-117365224
2015-07-01 16:51:45 +02:00
Vincent Petry 9eaa716667 Unit test for etag update on custom share folder 2015-07-01 09:59:15 +02:00
Robin Appelman 40ab639013 take share target into account when updating recipient etags 2015-07-01 09:59:15 +02:00
C Montero-Luque f8e6800cd4 8.0.5RC1 2015-06-30 18:24:20 -04:00
Morris Jobke 5785378951 Merge pull request #17233 from owncloud/oc-version-to-app-store-stable8
Add oc version to app store requests in stable8
2015-06-29 16:35:53 +02:00
Joas Schilling 57789e15a9 Add oc version to app store requests in stable8 2015-06-29 15:45:50 +02:00
Robin Appelman a9a5ac2fd1 fix check if hooks should be emited in runHooks 2015-06-29 14:13:19 +02:00
Robin Appelman 4e85a426a4 emit hooks from a view as long as the path is inside the default root 2015-06-29 14:13:19 +02:00
Lukas Reschke 8a1cfa4229 Merge pull request #17171 from owncloud/view-null-root-stable8
[stable8] dont allow using null as view root
2015-06-27 11:28:50 +02:00
Lukas Reschke 747cc45e9c Merge pull request #17177 from owncloud/stable8-backport-17026
[stable8] [config.sample.php] set correct default value for skeletondirectory
2015-06-26 10:54:37 +02:00
Morris Jobke adf1b2b5f3 [config.sample.php] set correct default value for skeletondirectory 2015-06-25 16:45:38 +02:00
Robin Appelman eb76504df6 add unit tests for null handling in view 2015-06-25 14:47:53 +02:00
Robin Appelman 698274491a dont allow using null as view root 2015-06-25 14:47:49 +02:00
Thomas Müller 8538aabfb5 Merge pull request #17157 from rullzer/stable8-backport-17136
[stable8] Allow removing of link password in OCS again
2015-06-25 13:25:43 +02:00
Joas Schilling 4cbf10f392 Ignore "parent" shares when the sharee is the owner of the reshare-source 2015-06-25 09:56:41 +02:00
Joas Schilling 5b1b844867 Correctly select file cache values also when checking group shares 2015-06-25 09:56:27 +02:00
Joas Schilling f3cddc9ec2 Add a test to share a subfolder of a folder shared with the owner by group 2015-06-25 09:56:09 +02:00
Vincent Petry 59bf55ca7b Added unit test for reshare by share owner
Conflicts:
	core/js/tests/specs/shareSpec.js
2015-06-25 09:55:52 +02:00
Joas Schilling 4e467c0b3c Do not restrict permissions for the original owner
Conflicts:
	core/js/share.js
2015-06-25 09:54:21 +02:00
Thomas Müller b828d2885d Merge pull request #17155 from owncloud/fix-15590-stable8
Backport of #15592 to stable8
2015-06-25 09:15:04 +02:00
Roeland Jago Douma cc0b1e4bf6 Added unit test to verify link password removeal 2015-06-25 08:39:01 +02:00
Roeland Jago Douma 1c36875429 set NULL correctly in password update
Old code used 'NULL' but docterine wants null. Now it is possible again
to remove the password from a link share.
2015-06-25 08:38:51 +02:00
Thomas Müller 5e555f18b1 Backport of #15592 to stable8
Avoid php message "Invalid argument supplied for foreach()" - refs #15590

Remove unneeded comments
2015-06-25 00:25:30 +02:00
Morris Jobke f4e0b344c4 Merge pull request #17115 from owncloud/stable8-share-error-handling
[stable8] [sharing] handle shares of users that aren't available anymore
2015-06-24 17:38:52 +02:00
Morris Jobke d6733e9ca7 [sharing] handle shares of users that aren't available anymore
* properly handle the case where an abandoned share is left and
  simply skip it
2015-06-23 18:07:36 +02:00
C Montero-Luque c000eb479b Changed version to 8.0.5 2015-06-23 11:48:23 -04:00
C Montero-Luque 6bd4bff834 8.0.5 beta 2015-06-23 11:30:52 -04:00
Morris Jobke dc0713941e Merge pull request #17033 from owncloud/backport-16890-stable8
Backport of #16890 to stable8
2015-06-23 16:31:55 +02:00
Thomas Müller 6aeee4fbc8 Merge pull request #16731 from owncloud/stable8-trash-deleteasrecipientkeepversions
[stable8] Keep versions when deleting as recipient
2015-06-23 10:22:27 +02:00
Thomas Müller abf9f79185 Merge pull request #16579 from owncloud/stable8-cors-no-cookie-auth
Disallow cookie auth for cors requests stable8
2015-06-22 21:39:27 +02:00
Thomas Müller 1744333f5f Merge pull request #17001 from owncloud/fix_15664
only try to determine unencrypted size if a encrypted file is read
2015-06-22 20:12:09 +02:00
Thomas Müller 1bdd3f7dc3 Merge pull request #16734 from owncloud/stable8-dav-getremoteetag
[stable8] Get etag from remote OC server
2015-06-22 20:11:17 +02:00
Morris Jobke 6464f6b25b Merge pull request #17074 from owncloud/appframework-type-cast-stable8
[stable8] Allow multiple whitespace in type hints in AppFramework
2015-06-22 15:47:39 +02:00
Robin McCorkell 4191844af5 AppFramework annotation whitespace unit test 2015-06-22 12:17:17 +01:00
Robin McCorkell b3d2232028 Allow multiple whitespace in type hints in AppFramework
Type hints such as `@param bool     $doSomething` will now correctly get
parsed, allowing for alignment of docblock parameters if the app developer so
wishes.
2015-06-22 12:17:17 +01:00
Thomas Müller 74ce46a8c8 Merge pull request #16747 from owncloud/stable8-backport-16403
[stable8] Only load commands of enabled apps
2015-06-19 13:08:38 +02:00
Thomas Müller a6b8902fd9 Merge pull request #17022 from owncloud/stable8-verify-path
[stable8] Verify if path exists
2015-06-19 13:08:19 +02:00
Lukas Reschke 850e0750b9 Merge pull request #16996 from owncloud/stable8-backport-16985-and-16995
[stable8] backport PHPDoc fixes
2015-06-19 09:14:10 +02:00
Arthur Schiwon 7bd7056a4c Backport of #16890 to stable8
the user is gone, userExists will not bring him back. But the user's folder needs to be deleted anyway

delete user test to take getHome into account to ensure it is also deleted subsequently
2015-06-18 22:01:42 +02:00
Lukas Reschke 9dd746489a Verify if path exists
We need to check if the path exists and throw an error instead of handling this situation ungraciously.
2015-06-18 17:27:33 +02:00
Bjoern Schiessle 48c17d2745 only try to determine unencrypted size if a encrypted file is read 2015-06-17 19:44:57 +02:00
blizzz ac8b748b88 Merge pull request #16627 from owncloud/stable8-multiselectsaveracecondition
[stable8] Fix LDAP wizard saveMultiSelect race condition
2015-06-17 19:30:06 +02:00
Morris Jobke c9fcc429e4 Merge pull request #16992 from owncloud/stable8-verify-if-path-exists
[stable8] Verify if path exists
2015-06-17 16:59:51 +02:00
Morris Jobke 855ae3f5d2 Fix return value for OCP PHPDoc 2015-06-17 16:56:08 +02:00
Morris Jobke 7759a9118c Fix OCP PHPDoc
* was always a string instead of \OCP\IUser
2015-06-17 16:55:21 +02:00
Vincent Petry 2972585ba1 Fix version rollback to keep fileid 2015-06-17 16:07:01 +02:00
Lukas Reschke 0f7f5bdb34 Throw nicer error message instead 500 2015-06-17 15:39:57 +02:00
Lukas Reschke dead1acba8 Verify if path exists
We need to verify if the specified path exists to gracefully prevent errors.
2015-06-17 15:08:09 +02:00
Vincent Petry 6ea7e89649 Merge pull request #16978 from owncloud/nomssql
remove mssql from supported dbs
2015-06-17 11:11:11 +02:00
Carla Schroder af4e04602a remove mssql from supported dbs 2015-06-16 15:16:45 -07:00
Vincent Petry 36e8162111 Fix version rename with files and folders
- fix moving folder into another folder
- fix moving file or folder into shared folder as recipient
2015-06-16 17:32:40 +02:00
Vincent Petry ad3f9dbb74 Merge pull request #16744 from owncloud/backport-15260
[stable8] Backport scrollbar fixes
2015-06-16 16:20:18 +02:00
Thomas Müller 64d502d602 Merge pull request #16862 from owncloud/use-single-action
[stable8] Don't use command concatenation
2015-06-11 09:42:27 +02:00
Morris Jobke 75c7554f62 Merge pull request #16861 from owncloud/stable8-backport-16840
[stable8] Disable video preview if previews are disabled
2015-06-10 15:53:45 +02:00
Morris Jobke 083356fe9d Disable video preview if previews are disabled 2015-06-10 15:06:04 +02:00
Lukas Reschke 14c760124f Don't use command concatenation
Possibly fixes https://github.com/owncloud/core/issues/16853
2015-06-10 14:46:42 +02:00
Morris Jobke c391f74c2e Merge pull request #16758 from owncloud/backport-16748-stable8
Backport stable8: port detection needs to take care of now thrown exceptions when LDAP …
2015-06-10 09:10:55 +02:00
Morris Jobke 952e774a0e Merge pull request #16630 from owncloud/stable8-quota-onlyforfiles
[stable8] Only use quota stream wrapper on "files"
2015-06-09 17:11:02 +02:00
Morris Jobke 000f3a5f26 Merge pull request #16738 from rullzer/ocs_set_password_backport
[stable8] Set password properly in OCS Share API
2015-06-09 17:09:16 +02:00
Joas Schilling 7dabbf9340 Merge pull request #16596 from owncloud/backport-16565
Add check for availability of /dev/urandom
2015-06-09 16:55:41 +02:00
Joas Schilling 1a8aae7282 Merge pull request #16660 from owncloud/stable8-returnfileidbug
[stable8] Properly return fileid when scanFile() did not find differences
2015-06-09 16:54:19 +02:00
Joas Schilling cb18bdd771 Merge pull request #16680 from owncloud/check-for-array
Check if array
2015-06-09 16:53:54 +02:00
Joas Schilling 1754c9a989 Merge pull request #16822 from owncloud/stable8-backport-16818
[stable8] Upgrade jquery-migrate to 1.2.1
2015-06-09 16:50:54 +02:00
Joas Schilling 2c118c3938 Merge pull request #16815 from owncloud/stable8-fix-16779
[Stable8] Do not use digits in random index names
2015-06-09 16:50:27 +02:00
Morris Jobke 8cd359a182 Upgrade jquery-migrate to 1.2.1 2015-06-09 10:44:29 +02:00
Victor Dubiniuk 28c6c2f4d4 Do not use digits in random index names 2015-06-09 01:43:52 +03:00
Vincent Petry 70bcb1a1c1 Register sharing hooks in trashbin tests
Register sharing hooks to make sure that the share mount points are
mounted properly, as required by the share-related trashbin tests.
2015-06-08 11:31:44 +02:00
Arthur Schiwon 4c4c12d905 save multiselect box on close, not on click. Makes it less frequent and less prone to race conditions 2015-06-05 20:27:08 +02:00
Arthur Schiwon b2548b01df port detection needs to take care of now thrown exceptions when LDAP server is not available 2015-06-05 13:12:11 +02:00
Morris Jobke 0c2ce1b495 Only load commands of enabled apps 2015-06-04 15:31:33 +02:00
Jan-Christoph Borchardt a040a5b08e fix scrutinizer issues 2015-06-04 14:31:35 +02:00
Jan-Christoph Borchardt eeace88beb adjust controls bar width to not overlay scrollbar 2015-06-04 14:31:31 +02:00
Frank Karlitschek 5fcab24e59 8.0.4 2015-06-03 20:39:46 -04:00
Roeland Jago Douma 5865a3af8c Added unit test 2015-06-03 21:32:20 +02:00
Roeland Jago Douma 783188d683 Password set via OCS API should not be double escaped 2015-06-03 21:32:10 +02:00
Roeland Jago Douma 7213be29c9 Fix unit test 2015-06-03 21:30:22 +02:00
Roeland Jago Douma 0b38c13891 No injections 2015-06-03 21:30:01 +02:00
Roeland Jago Douma fe1de11b23 OCS Fixes to allow setting of password without removing additional settings
- Added setPassword to share.php
- Fixed OCS API call
- Added unit tests
2015-06-03 21:21:54 +02:00
Vincent Petry f81ba63a52 Disable update check test when testing wrappers
The checkUpdate test is intended for testing real storages, not
wrappers.
2015-06-03 17:24:40 +02:00
Vincent Petry ae89153701 Added storage backend test for checkUpdate
This helps testing whether checkUpdate properly returns false when no
change exists
2015-06-03 17:24:36 +02:00
Vincent Petry 533bb85a85 Get etag from remote OC server 2015-06-03 17:24:26 +02:00
Vincent Petry bffcbe4895 Keep versions when deleting as recipient
The original owner could not be resolved because the original file was
already deleted, so no versions were retained.

This fix passes the owner and path to retainVersions() since it was
already resolved before the file deletion. This reactivates the versions
logic and creates a copy of the versions in each trashbin.
2015-06-03 17:10:12 +02:00
Morris Jobke d1f99f1003 Merge pull request #16705 from owncloud/stable8-fix-ie8-ie9
[stable8] fix IE8 & IE9
2015-06-03 16:25:27 +02:00
Morris Jobke e56fb7e368 Add min-height to login page for IE8 and IE9 2015-06-03 10:39:43 +02:00
Morris Jobke 1854c7f590 Revert "fix theme in IE8 and IE9"
This reverts commit bb79a6b4f0.
2015-06-03 10:39:00 +02:00
Lukas Reschke 8c6e5907d1 Check if array
The great library that we use apparently uses mixed types for everything because 🙈

Fixes https://github.com/owncloud/core/issues/16679
2015-06-02 11:20:24 +02:00
Frank Karlitschek 30bc7a7418 8.0.4RC2 2015-06-01 18:55:21 -04:00
Vincent Petry 1fb44bc7a7 Properly return fileid when scanFile() did not find differences 2015-06-01 17:35:30 +02:00
Lukas Reschke 72e576e529 Disallow semicolons in passed commands 2015-06-01 17:05:15 +02:00
Lukas Reschke 7b5493ea21 Ensure that passed argument is always a string
Some code paths called the `normalizePath` functionality with types other than a string which resulted in unexpected behaviour.

Thus the function is now manually casting the type to a string and I corrected the usage in list.php as well.
2015-06-01 17:05:08 +02:00
Lukas Reschke 6867d45ffc Clean application identifier before processing 2015-06-01 17:05:02 +02:00
Lukas Reschke a035198f4b Revert custom patch that can cause problems 2015-06-01 17:04:55 +02:00
Vincent Petry 960ca7b1a8 Backported unit tests from 31e94708f8
Partial backport, only took the unit tests from
31e94708f8 to simulate failure using mocks
instead of the quota storage wrapper.
2015-06-01 12:27:38 +02:00
Robin Appelman c08c4684be Make getSourcePath accessible for storage wrappers 2015-06-01 12:23:49 +02:00
Vincent Petry 43b7ac6ad2 Fix LDAP wizard saveMultiSelect race condition
Whenever a checkbox is ticked in a multiselect box, it will trigger the
saving and retrieving ajax calls at the same time.

This fix makes sure that it will first save, and only once saving is
done, do the call that retrieves the filter.
2015-06-01 11:12:09 +02:00
Morris Jobke 52d09386d4 Merge pull request #16634 from owncloud/fix-themes-readme
[stable8] Fix themes README
2015-05-30 13:05:35 +02:00
Morris Jobke 2c56909604 Fix themes README
Fixes #16617
2015-05-30 12:10:21 +02:00
Frank Karlitschek 2396ddf9e9 8.0.4 2015-05-29 15:00:36 -04:00
Frank Karlitschek bf69107c25 8.0.4RC1 2015-05-29 14:13:53 -04:00
Frank Karlitschek 080b837bc8 8.0.4 RC1 2015-05-29 13:52:10 -04:00
Vincent Petry b2e9f800a3 Only use quota stream wrapper on "files"
Prevent using the quota stream wrapper on trashbin folders and other
metadata folders
2015-05-29 19:48:17 +02:00
Thomas Müller 8b635cd7b7 Merge pull request #16117 from owncloud/fix-api-when-firewall-app-is-installed
Use existing IRequest to not read php://input multiple times
2015-05-29 12:27:06 +02:00
Thomas Müller 2d24ad53c6 Merge pull request #15306 from netzkolchose/stable8
Fixing: Undefined index: REMOTE_ADDR in lib/private/request.php
2015-05-28 20:14:50 +02:00
Morris Jobke cd311c1ac1 Merge pull request #16423 from rullzer/backport_15738
[stable8] Fix to make sure expiration date is properly set
2015-05-28 10:28:33 +02:00
Lukas Reschke f9e258437f Add check for availability of /dev/urandom
Backport of https://github.com/owncloud/core/pull/16565 to stable8
2015-05-27 18:43:17 +02:00
Morris Jobke d5d3cbd50d Merge pull request #16416 from owncloud/stable8-16415
[stable8] fix theme in IE8 and IE9
2015-05-27 16:40:27 +02:00
Bernhard Posselt 777a6c454e disallow cookie auth for cors requests
testing ...

fixes

fix test

add php doc

fix small mistake

add another phpdoc

remove not working cors annotations from files app
2015-05-27 13:59:36 +02:00
Thomas Müller e1492d9e0b Merge pull request #16462 from owncloud/stable8-backport-16444
[stable8] Closes "New" dropdown when switching category
2015-05-26 16:51:57 +02:00
Björn Schießle a3b53a7738 Merge pull request #16496 from owncloud/stable8-share-readonlyfile-permissions
[stable8] Do not automatically add "update" permission to shared mounts
2015-05-26 16:51:30 +02:00
Thomas Müller 94f7b3e25c Merge pull request #16497 from owncloud/stable8-backport-16473
Skip disable3rdParty Apps
2015-05-26 13:32:06 +02:00
Vincent Petry 609da64c3b Do not automatically add "update" permission to shared mounts
In the past it seems the update permission was needed to be able to
rename shared mounts, but it doesn't seem to be the case any more.

Removing the "update" permission that used to be added automatically
fixes the read-only permission check when trying to overwrite a
read-only file over WebDAV.
2015-05-21 12:18:12 +02:00
Steffen Lindner 6eb8bdb5c9 Skip disable3rdParty Apps 2015-05-21 11:32:17 +02:00
Morris Jobke d24d30f96b Closes "New" dropdown when switching category
* fixes #16394
* return false - stops all following event callbacks
2015-05-20 11:49:51 +02:00
Morris Jobke 3bc312ef9a Merge pull request #15401 from owncloud/response-setContentLengthHeader-stable8
[stable8] Add OC_Response::setContentLengthHeader() for Apache PHP SAPI workaround.
2015-05-20 11:17:24 +02:00
Morris Jobke 68b2a85ed0 Merge pull request #16459 from owncloud/sync-3rdparty
Sync third-party
2015-05-20 11:14:46 +02:00
Lukas Reschke 71a88d5f1f Sync third-party
Resolves https://github.com/owncloud/3rdparty/pull/173
2015-05-20 10:06:11 +02:00
Morris Jobke 0c231f5ac6 Merge pull request #15959 from owncloud/backport-15596-remote-share-feedback-urls
Backport 15596 remote share feedback urls
2015-05-20 09:14:05 +02:00
Morris Jobke 7015dd74ce Merge pull request #16421 from owncloud/stable8-replace-static-dbtableprefix-with-config-dbtableprefix
[stable8] Replace static dbtableprefix with config dbtableprefix
2015-05-19 12:18:10 +02:00
Vincent Petry 80afbd3e4f Add unit test for migrator with different prefix 2015-05-19 10:44:23 +02:00
Roeland Jago Douma 488c4a92da Fix to make sure expiration date is properly set
This did not happen correctly when the password was enforced since a
different code path was taken.

* moved generation of the default date string to separate function
* added unit test
2015-05-18 21:34:36 +02:00
martin-rueegg 524045cdbd replace 'oc_' with dbtableprefix form config for temporary table names and indexes 2015-05-18 17:01:06 +02:00
Morris Jobke bb79a6b4f0 fix theme in IE8 and IE9 2015-05-18 16:01:04 +02:00
Vincent Petry 4e44d2ecd6 Merge pull request #16375 from owncloud/tests-properlogout
[stable8] Properly log out test users in unit tests
2015-05-18 12:26:58 +02:00
Morris Jobke 23b8277c27 Merge pull request #15078 from owncloud/fix-smb-oc-admin-stable8
[stable8] Support constructing an SMB_OC without saved session credentials
2015-05-17 13:14:57 +02:00
Vincent Petry 1d35c01b19 Merge pull request #15974 from owncloud/backport-15549
[stable8] don't update identical values
2015-05-15 18:22:49 +02:00
Vincent Petry a5466fc909 Properly log out test users in unit tests 2015-05-15 17:36:38 +02:00
Joas Schilling 15c8501483 Merge pull request #16248 from owncloud/stable8-fixrmdirtodeletefolderstotrash
[stable8] Added rmdir to trashbin storage wrapper
2015-05-15 14:59:09 +02:00
Morris Jobke 8c4322ef5a Merge pull request #15270 from owncloud/stable8-fix-ext-owncloud
[stable8] Fix bugs in ownCloud external storage
2015-05-13 09:39:23 +02:00
Jörn Friedrich Dreyer 6fa4ee8e86 Merge pull request #15797 from owncloud/stable8-backport-15489
Stable8 backport 15489
2015-05-13 08:41:51 +02:00
Morris Jobke 485d415ed1 Merge pull request #16270 from owncloud/stable8-fix-16179
Check if cURL supports the desired features
2015-05-12 18:27:23 +02:00
Lukas Reschke 62e7696aed Check if cURL supports the desired features
Older versions of cURL that are unfortunately still bundled by distributors don't support these features which will result in errors and other possibly unpredictable behaviour.

Fixes https://github.com/owncloud/core/issues/16179 for stable8
2015-05-12 12:05:41 +02:00
Vincent Petry a97dae9065 Added rmdir to trashbin storage wrapper
This makes sure that folders are moved to trash when deleted with
rmdir() instead of unlink().

This happens for example when deleting a folder over WebDAV.
The web UI uses unlink() so it wasn't affected.
2015-05-12 11:11:06 +02:00
Lukas Reschke f50fc14935 Merge pull request #16201 from owncloud/stable8-backport-16124
Fix the share mail notification when the item is in a folder
2015-05-08 15:31:52 +02:00
Joas Schilling dbaaae071b Fix the share mail notification when the item is in a folder 2015-05-08 14:54:19 +02:00
Lukas Reschke 21c4331983 Merge pull request #16110 from owncloud/stable8-backport-15510-and-15465
[stable8] block cron.php and OCS API when in single user mode or maintenance mode
2015-05-08 12:27:36 +02:00
Lukas Reschke b2903485c0 Use existing IRequest to not read php://input multiple times
Fixes https://github.com/owncloud/client/issues/3204#issuecomment-99427563 - the firewall app has instantiiated an IRequest before and thus broke a lot of stuff on < PHP 5.6.
2015-05-06 14:23:24 +02:00
Lukas Reschke df9de41767 Merge pull request #16102 from owncloud/backport-add-workaround-for-populate-raw-post-data
Backport add workaround for populate raw post data
2015-05-06 13:12:10 +02:00
Thomas Müller 3be30babf8 Fix singe user mode on public.php - take two 2015-05-06 11:40:28 +02:00
Thomas Müller 30ed561110 Fix single user check in case no user is logged in 2015-05-06 11:38:46 +02:00
Robin Appelman 714ca7a3a2 block ocs in single user mode 2015-05-06 11:38:41 +02:00
Robin Appelman 7c0c34f682 block webdav in single user mode 2015-05-06 11:38:32 +02:00
Robin Appelman eded1f05fc block cron when in single user mode 2015-05-06 11:38:05 +02:00
Joas Schilling 3f4eba1acb Disable OCS api when in maintenance mode 2015-05-06 11:38:01 +02:00
Lukas Reschke 8e59d4c64b Don't depend on always_populate_raw_post_data 2015-05-06 10:38:32 +02:00
Lukas Reschke ecf8343905 Don't display errors and log them
Fixes https://github.com/owncloud/core/issues/16014
2015-05-06 10:38:28 +02:00
Joas Schilling 5733878d66 Add tests for the correct share id on the call aswell 2015-05-04 10:47:43 +02:00
Joas Schilling 45a36feec6 Correctly send Federate-Cloud Share Feedback against the remote share ID 2015-05-04 10:47:13 +02:00
Joas Schilling 92ae7c284b Fix scrutinizer complains and return type doc 2015-05-04 10:47:02 +02:00
Joas Schilling f3a6adff41 make scrutinizer happy 2015-05-04 10:46:55 +02:00
Joas Schilling 927eb763c3 Correctly remove the protocol before prepeding it 2015-05-04 10:46:37 +02:00
Joas Schilling 2e0c3665b0 Add tests for the remote sharing url 2015-05-04 10:46:20 +02:00
Joas Schilling b1a9e26c45 check the called URL 2015-05-04 10:46:10 +02:00
Joas Schilling 3dbe7e195c Correctly generate the feedback URL for remote share
The trailing slash was added in c78e3c4a7f
to correctly generate the encryption keys
2015-05-04 10:45:57 +02:00
Joas Schilling 5b5bf27653 Merge the two tests into one 2015-05-04 10:43:36 +02:00
Joas Schilling c501ca9ba4 *cough* 2015-05-04 10:43:18 +02:00
Joas Schilling 739e5f9fd6 Add a unit test for the naming conflict on the mountpoint name 2015-05-04 10:42:41 +02:00
Joas Schilling 67ee02574f Use insertIfNotExists() instead of manual logic 2015-05-04 10:42:32 +02:00
Joas Schilling 6a6acd2a46 Correctly get the unique mountpoint name when mounting the share
Previously the mount name was checked for uniqueness prior to inserting the
share. This caused problems, when two shares with the same name where done
or folder, mount point, local share with the same name was done, between
sending and accepting of the remote share
2015-05-04 10:42:21 +02:00
Joas Schilling a2af0aae5e Do not make setupMounts() public just because of testing 2015-05-04 10:41:33 +02:00
Robin Appelman 1aeb4c0e8c Add unit tests for external share mananger 2015-05-04 10:41:23 +02:00
Robin Appelman 66f1495538 Fix external shares without password on oracle 2015-05-04 10:41:08 +02:00
Morris Jobke 053ac11273 Merge pull request #16012 from owncloud/add-use-statement
Add use statement
2015-05-02 21:42:15 +02:00
Lukas Reschke 5230854dc8 Add use statement
Just fixes the PHPDoc and also fixes #16011
2015-05-02 19:51:01 +02:00
Jens-Christian Fischer c668a7c665 clarify the duplication of the $params array 2015-04-30 16:07:06 +02:00
Jens-Christian Fischer 8d51e8eb72 don't update identical values
The UPDATE oc_filecache statement blindly overwrites identical data.
Databases like Postgres that create a new row on an update
and mark the old one as dead will suffer from the previous
behaviour, as millions of "new" rows are created in the database.

This patch changes the WHERE clause to test for identical
values and not updating if the values in the DB are identical
to the ones being passed.
2015-04-30 16:07:01 +02:00
Morris Jobke b453cccf51 Merge pull request #15369 from owncloud/stable8-backport-15353
Cron has to be executed with the correct user - fixes 13912 and others
2015-04-28 15:57:47 +02:00
Morris Jobke 5be2aa4426 Merge pull request #15502 from owncloud/backport-14293-public-download-activities
Correctly create activities for public downloads
2015-04-28 15:57:41 +02:00
Morris Jobke 84287feb08 Merge pull request #15533 from owncloud/stable8-davclient-catchmoreexceptions
[stable8] Catch more exceptions when connecting to remote DAV server
2015-04-28 15:57:32 +02:00
Morris Jobke a4961afa7e Merge pull request #15605 from owncloud/backport-15566
[stable8] fix filepicker
2015-04-28 15:57:27 +02:00
Morris Jobke aacfe93fa2 Merge pull request #15609 from owncloud/stable8-share-donotreturntrashedfiles
[stable8]   Do not return shares for files outside "files"
2015-04-28 15:57:16 +02:00
Morris Jobke f87d492118 Merge pull request #15610 from rullzer/backport-15564
[stable8] Backport of #15564
2015-04-28 15:57:09 +02:00
Morris Jobke 337c541c0c Merge pull request #15672 from owncloud/revert-15666-revert-15572-stable8-shares-properlyformatmountpoint
[stable8] Properly add trailing slash to mount point
2015-04-28 15:57:03 +02:00
Morris Jobke d32a5d5e8c Merge pull request #15862 from owncloud/public-reshare-webdav-stable8
[stable8] Fix webdav access for public reshare
2015-04-28 15:56:57 +02:00
Morris Jobke ad2738f4f8 Merge pull request #15287 from dratini0/stable8
Backporting #14125 to stable8, as called for by @LukasReschke
2015-04-28 15:56:51 +02:00
Robin Appelman ba46469202 fix subfolder reshares over webdav 2015-04-24 14:04:20 +02:00
Robin Appelman e296709815 remove unneeded readonlycache 2015-04-24 14:04:14 +02:00
Robin Appelman f6df1546f4 resolve reshares in public webdav 2015-04-24 14:02:05 +02:00
Robin Appelman 2e694edba2 use the permissions mask cache wrapper instead of the read only cache 2015-04-24 14:01:59 +02:00
Frank Karlitschek 3f2069bd66 8.0.3 2015-04-23 20:14:08 +02:00
Frank Karlitschek 0fb207a926 8.0.3 RC4 2015-04-23 20:03:15 +02:00
Arthur Schiwon 3b7d285c0a throw exception when LDAP Connection was lost 2015-04-22 23:40:36 +02:00
Morris Jobke 15f54c263e fix unit tests 2015-04-22 23:40:36 +02:00
Morris Jobke 1f1e6f2e49 Throw ServerNotAvailableException always 2015-04-22 23:40:36 +02:00
Jörn Friedrich Dreyer 92febbf574 fix cherrypicking 2015-04-22 23:40:36 +02:00
Morris Jobke 69ae83eca7 fix typo and comment 2015-04-22 23:40:36 +02:00
Jörn Friedrich Dreyer ac062bd0aa fix filesystem and encryption tests
Conflicts:
	apps/files_encryption/lib/util.php
	apps/files_encryption/tests/hooks.php
2015-04-22 23:40:36 +02:00
Jörn Friedrich Dreyer 8939d1307f throw exception when backends don't provide a user instead of creating legacy local storages 2015-04-22 23:40:36 +02:00
Morris Jobke 2eced9ea99 throw exception if setup is incomplete 2015-04-22 23:40:35 +02:00
Morris Jobke 3fe909305d more robust share dialog 2015-04-22 23:40:35 +02:00
Jörn Friedrich Dreyer f98a624532 fix_tests
Conflicts:
	apps/user_ldap/tests/user_ldap.php
2015-04-22 23:40:35 +02:00
Jörn Friedrich Dreyer fed8ff8504 do not disclose information, show generic error on login page
Conflicts:
	core/templates/login.php
	lib/base.php
2015-04-22 23:40:35 +02:00
Jörn Friedrich Dreyer 01328b4622 do not hide exception when ldap server has a hiccup 2015-04-22 23:40:35 +02:00
Morris Jobke 0f314ce455 Revert "Revert "[stable8] Properly add trailing slash to mount point"" 2015-04-16 11:03:01 +02:00
Morris Jobke 273719f620 Merge pull request #15666 from owncloud/revert-15572-stable8-shares-properlyformatmountpoint
Revert "[stable8] Properly add trailing slash to mount point"
2015-04-16 11:02:50 +02:00
Thomas Müller 6e041088b8 Revert "[stable8] Properly add trailing slash to mount point" 2015-04-16 10:03:15 +02:00
Jörn Friedrich Dreyer da23ab0dd6 Merge pull request #15572 from owncloud/stable8-shares-properlyformatmountpoint
[stable8] Properly add trailing slash to mount point
2015-04-16 09:35:12 +02:00
Frank Karlitschek b7ab280d8e 8.0.3RC3 2015-04-15 22:59:15 +02:00
Thomas Müller 76eadfa8dc Merge pull request #15577 from owncloud/isolation-level-stable8
Using TRANSACTION_READ_COMMITTED
2015-04-16 11:30:04 +02:00
Frank Karlitschek d3761e02f5 8.0.3 RC2 2015-04-15 22:11:22 +02:00
Roeland Jago Douma 68d37afa3b Do not try to make user subadmin of group twice
If the provisioning api is used to make a user subadmin of a group that user
is already a subadmin just return success.

Added unit test to ensure things keep working.
2015-04-14 15:16:27 +02:00
Vincent Petry 823f2d205d Add logout in share test to avoid nasty side effects 2015-04-14 15:07:20 +02:00
Vincent Petry 80461daa28 Do not return shares for files outside "files" 2015-04-14 15:07:14 +02:00
Morris Jobke 1e60931119 fix filepicker
* add ability to filter for mimetype
* fixes #15526
* fixes #11563
2015-04-14 14:10:46 +02:00
Lukas Reschke 9dac69b21b Merge pull request #15558 from owncloud/backport-15541
[stable8] Add "Reply-To" support for sharing notifications
2015-04-13 23:31:43 +02:00
Thomas Müller e4f0892831 Using TRANSACTION_READ_COMMITTED 2015-04-13 14:50:55 +02:00
Vincent Petry 105b285874 Properly add trailing slash to mount point
Fixes resolving mount points when shared mount point's target name has
the same prefix as the source name
2015-04-13 12:48:09 +02:00
Lukas Reschke adfc8c79c4 Add "Reply-To" support for sharing notifications
Very hacky backport of https://github.com/owncloud/core/pull/15541 - I changed the code path to use OC_Mail instead the OCP pendant since I didn't want to modify the public API. (OCP\Util::sendMail() is anyways deprecated with 8.1)
2015-04-12 22:54:29 +02:00
Morris Jobke 06ab387509 Merge pull request #15539 from owncloud/stable8-fixRenameFailDeleteTargetKeepSource
[stable8] Fix renameFailDeleteTargetKeepSource
2015-04-10 23:39:46 +02:00
Jörn Friedrich Dreyer 7a3b4b464e fixes #15326 2015-04-10 15:47:02 +02:00
Vincent Petry 486e7e5ed1 Catch more exceptions when connecting to remote DAV server
Added InvalidArgumentException to catch HTML parsing errors when XML was
expected.
Made convertSabreException more generic to be able to handle more
exception cases.
2015-04-10 13:04:24 +02:00
Joas Schilling f914be3e07 Correctly create activities for public downloads 2015-04-09 12:00:56 +02:00
Thomas Müller 3f6db4c1ab Merge pull request #15425 from owncloud/failing-stable8-tests
Fix failing tests related to timezones on stable8
2015-04-07 10:56:39 +02:00
Joas Schilling 628bb3fb3e Select the timezone on the right timestamp and assert it 2015-04-07 10:16:47 +02:00
Joas Schilling dfd302178a When guessing the timezone, the offset might only be valid on a given timestamp 2015-04-07 10:16:36 +02:00
Joas Schilling 351a1ccaad Remove server timezone dependency from files list test 2015-04-07 10:16:24 +02:00
Thomas Müller 3d45d0bd1d Merge pull request #15422 from owncloud/backport-15383-insertifnotexists-exception-message
Fix the exception messages
2015-04-07 09:52:23 +02:00
Joas Schilling 142694d095 Fix the exception messages 2015-04-07 09:14:51 +02:00
Andreas Fischer 94ada409bb Add OC_Response::setContentLengthHeader() for Apache PHP SAPI workaround.
Do not send Content-Length headers with a value larger than PHP_INT_MAX
(2147483647) on Apache PHP SAPI 32-bit. PHP will eat them and send 2147483647
instead.

When X-Sendfile is enabled, Apache will send a correct Content-Length header,
even for files larger than 2147483647 bytes. When X-Sendfile is not enabled,
ownCloud will not send a Content-Length header. This prevents progress bars
from working, but allows the actual transfer to work properly.
2015-04-04 11:53:19 +02:00
Morris Jobke 8357a253b3 Merge pull request #15378 from owncloud/issue/15377-fix-enable-for-group-stable8
Correctly split and join group list with | instead of ,
2015-04-03 14:38:13 +02:00
Joas Schilling ea647ede73 Correctly split and join group list with | instead of , 2015-04-02 15:31:47 +02:00
Thomas Müller 4905a4cd4a Cron has to be executed with the correct user - fixes 13912 and others 2015-04-01 18:25:44 +02:00
heppstux 48082931d1 Fixing: Undefined index: REMOTE_ADDR in lib/private/request.php 2015-03-30 13:29:04 +02:00
Morris Jobke e94152b226 Merge pull request #15302 from owncloud/update-3rdparty-stable8
update 3rdparty to match stable8 HEAD of repo
2015-03-30 11:37:29 +02:00
Morris Jobke b1688311c8 update 3rdparty to match stable8 HEAD of repo 2015-03-30 11:04:57 +02:00
dratini0 86d3f85379 Backporting #14125 to stable8, as called for by @LukasReschke 2015-03-27 21:57:59 +01:00
Thomas Müller c1f52508a5 Merge pull request #15275 from owncloud/fix-stable-8
Increment version
2015-03-27 15:19:31 +01:00
Lukas Reschke 03473c51c2 Increment version
Fixes https://github.com/owncloud/core/issues/15273
2015-03-27 15:11:08 +01:00
Robin McCorkell c8c8d61431 Fix bugs in ownCloud external storage 2015-03-27 12:28:27 +00:00
Frank Karlitschek ddcb4e1b94 This is RC1 and not RC 2015-03-26 23:05:32 +01:00
Frank Karlitschek 5e3203348e 8.0.3 RC 2015-03-26 20:59:03 +01:00
Morris Jobke a538f14b4a Merge pull request #15246 from owncloud/stable8-share-partfilepermissions
[stable8] Fix share permission checks
2015-03-27 09:59:12 +01:00
Morris Jobke baa2e4f995 Merge pull request #15249 from owncloud/fix_group_share_oc8_backport
also call generateTarget for group shares
2015-03-27 09:57:38 +01:00
Morris Jobke ae59df8492 Merge pull request #15250 from owncloud/use_default_share_folder_oc8
always fall back to default share folder
2015-03-27 01:18:45 +01:00
Lukas Reschke a64c3fb3a2 Merge pull request #14497 from owncloud/kill-substr-mssql-stable8
[stable8] Remove hacky Substring support for MSSQL
2015-03-26 23:00:36 +01:00
Bjoern Schiessle 5964cd3751 always fall back to default share folder 2015-03-26 22:42:29 +01:00
Bjoern Schiessle 893cbc917d also call generateTarget for group share to add the correct prefix if share_folder is defined in config.php 2015-03-26 22:38:21 +01:00
Vincent Petry 48ceaa9502 Fix share permission related unit tests 2015-03-26 22:34:18 +01:00
Vincent Petry 944b301837 Rename must be possible with update-only permission
and this as long as the rename is done within the same folder.
2015-03-26 22:32:47 +01:00
Vincent Petry 29c56fbfb2 Fix permission checks in Sabre connector
This fixes moving files in and out of shared folders with some exotic
permission combinations.
2015-03-26 22:32:42 +01:00
Vincent Petry 3b69354d19 Reenable trashbin after failed rename
After a failed rename, the post_rename hook is not called.
This quickfix makes sure the trashbin storage logic is reenabled
also after a failed rename.
2015-03-26 22:32:36 +01:00
Vincent Petry 5ee843cd59 Fix shared storage permission checks 2015-03-26 22:32:32 +01:00
Morris Jobke 93ae742ad8 Merge pull request #15238 from owncloud/stable8-fileid-increment
[stable8] SQLite autoincrement fix backport
2015-03-26 20:39:31 +01:00
Morris Jobke cd47e72e88 Merge pull request #14860 from owncloud/stable8-fix-sizepropagationwithshares
[stable8] Fix size propagation over shared storage boundary
2015-03-26 20:10:46 +01:00
Vincent Petry b896be821f SQLite autoincrement fix backport
Add custom sqlite platform to set auto increment

Add repair step to fix SQLite autoincrement

Force Doctrine to generate alter table SQL statements for SQLite to make
sure the code from OCSqlitePlatform is triggered.
2015-03-26 19:43:02 +01:00
Lukas Reschke e90ead2a8d Merge pull request #15231 from owncloud/synchronize-php-setting
Synchronize PHP settings with master
2015-03-26 18:17:59 +01:00
Vincent Petry bc7676089c Merge pull request #15193 from owncloud/stable8-15145
Stable8: 15145
2015-03-26 17:25:07 +01:00
Lukas Reschke 3232dc76d4 Synchronize PHP settings with master
Fixes https://github.com/owncloud/core/issues/15044
2015-03-26 16:54:54 +01:00
Vincent Petry c0bcaa4980 Merge pull request #14914 from owncloud/backport-14766-compare-array-insertifnotexists
[Stable8] Backport 14766 compare array insertifnotexists
2015-03-26 16:30:25 +01:00
Lukas Reschke e12c76ed66 Merge pull request #15192 from owncloud/stable8-15153
Stable8: Add `getNonExistingName()` to the node api
2015-03-26 13:28:00 +01:00
Thomas Müller 722faee4c6 Merge pull request #15208 from owncloud/fix-15146-stable8
Do not use APCu when apc.enabled is Off.
2015-03-26 11:50:32 +01:00
Vincent Petry d04ad4be26 Merge pull request #15052 from rullzer/backport-15025
[stable8] Backport of #15025: OCS Respect enforced date
2015-03-26 11:27:49 +01:00
Andreas Fischer ba9446a1b8 Do not use APCu when apc.enabled is Off. 2015-03-26 11:06:47 +01:00
Jan-Christoph Borchardt 9bc1f0a67a do not show update notification on mobile, fix overlapping of header menus, fix #10544 2015-03-25 16:55:33 +01:00
Robin Appelman f7f14708a2 when the path doesnt exist show a proper error page 2015-03-25 14:02:48 +01:00
Lukas Reschke 78c348381d Properly catch whether a share is null
Despite it's PHPDoc the function might return `null` which was not properly catched and thus in some situations the share was resolved to the sharing users root directory.

To test this perform the following steps:

* Share file in owncloud 7 (7.0.4.2)
* Delete the parent folder of the shared file
* The share stays is in the DB and the share via the sharelink is inaccessible. (which is good)
* Upgrade to owncloud 8 (8.0.2) (This step is crucial. The bug is not reproduceable without upgrading from 7 to 8. It seems like the old tokens are handled different than the newer ones)
* Optional Step: Logout, Reset Browser Session, etc.
* Access the share via the old share url: almost empty page, but there is a dowload button which adds a "/download" to the URL.
* Upon clicking, a download.zip is downloaded which contains EVERYTHING from the owncloud directory (of the user who shared the file)
* No exception is thrown and no error is logged.

This will add a check whether the share is a valid one and also adds unit tests to prevent further regressions in the future. Needs to be backported to ownCloud 8.

Adding a proper clean-up of the orphaned shares is out-of-scope and would probably require some kind of FK or so.

Fixes https://github.com/owncloud/core/issues/15097
2015-03-25 14:02:38 +01:00
Robin Appelman 4c92aafc19 Add getNonExistingName() to the node api 2015-03-25 14:01:16 +01:00
Morris Jobke e4d8dc7825 Merge pull request #15140 from owncloud/backport-15123-stable8
[backport] [stable8] offset needs to be considered in computed limit
2015-03-24 11:03:58 +01:00
Arthur Schiwon 6e26b117b9 offset needs to be considered in computed limit 2015-03-24 10:18:12 +01:00
Thomas Müller 4149fc40c2 Merge pull request #15119 from owncloud/remove-curl
Remove hard dependency on cURL for 8.0
2015-03-23 15:23:23 +01:00
Lukas Reschke e2ea175ea2 Remove hard dependency on cURL for 8.0
This removes the recently introduced hard dependency on cURL for 8.0, for 8.1 it will still stay there.

Instead a warning will now be shown to the user asking to install the PHP cURL extension within the administrative interface of ownCloud.
2015-03-23 15:19:46 +01:00
Morris Jobke b960fa83ef Merge pull request #15110 from owncloud/backport-15108
The iran timezone removed the DST handling which breaks the timezone lib
2015-03-23 15:10:00 +01:00
Vincent Petry 31de51eacc Merge pull request #15079 from owncloud/fix-fileglobalgc-stable8
[stable8] Fix fileglobalgc unlink parameter warnings
2015-03-23 14:28:32 +01:00
Joas Schilling bda7b5c446 The iran timezone removed the DST handling which breaks the timezone lib 2015-03-23 14:25:03 +01:00
Robin McCorkell 58ad3fac06 Add unit tests for gc() for \OC\Cache\FileGlobalGC 2015-03-20 16:19:08 +00:00
Robin McCorkell 88a180fadb Fix fileglobalgc unlink parameter warnings 2015-03-20 16:18:50 +00:00
Robin McCorkell 09631f691b Support constructing an SMB_OC without saved session credentials
Conflicts:
	apps/files_external/lib/smb_oc.php
2015-03-20 16:00:52 +00:00
Thomas Müller 95d81c36ff Merge pull request #15064 from owncloud/backport-15050
[stable8] show a better error message when trying to create a user that already ex...
2015-03-20 13:42:31 +01:00
Robin Appelman 625cbc63a4 show a better error message when trying to create a user that already exists 2015-03-20 12:57:09 +01:00
Thomas Müller 5720211f70 Merge pull request #15043 from owncloud/stable8-dropbox-root-fix
[stable8] Fix root request path for Dropbox
2015-03-20 11:32:44 +01:00
Roeland Jago Douma 9d0ea7fa11 Backport of #15025
When the expiration date is enforced respect this

- Make sure that we do not allow removing of the expiration date when this
is enforced in the settings.
- Added unit test
2015-03-20 09:30:39 +01:00
Vincent Petry 02f00c9980 Fix root request path for Dropbox 2015-03-19 21:36:07 +01:00
Morris Jobke 4774d648bd Merge pull request #15008 from owncloud/backport-14071
add timeout to curl request
2015-03-18 20:47:11 +01:00
Lukas Reschke 3d7ed01135 Merge pull request #15006 from owncloud/backport-14586
proper description of appcodechecker in config sample
2015-03-18 17:40:23 +01:00
Bjoern Schiessle c28356fffc add timeout to curl request 2015-03-18 17:22:38 +01:00
Morris Jobke 3dad31d6df proper description of appcodechecker in config sample 2015-03-18 17:06:58 +01:00
Morris Jobke c9bafe5c7a Merge pull request #14928 from owncloud/stable8-repair-legacystoragenofatalfail
[stable8] Do not abort when meeting unfixable legacy storages
2015-03-18 16:58:01 +01:00
Thomas Müller 637503a1ac Merge pull request #14926 from owncloud/stable8-rescanversionsonlyonce
[stable8] Only rescan versions once in trashbin
2015-03-17 10:40:23 +01:00
Joas Schilling 9ad48e0fe9 Also add a note that clob does not work in the compare array
Conflicts:
	lib/private/appframework/db/db.php
2015-03-16 17:02:00 +01:00
Joas Schilling 97a65e153d The key is over configkey, user and app, not the value
stupid me :(
2015-03-16 17:01:02 +01:00
Vincent Petry 5ad226cedb Fixed expected warning count on repair fail 2015-03-16 16:25:44 +01:00
Vincent Petry 6843f1690f Detect that the done flag was not set after repair fail 2015-03-16 16:25:37 +01:00
Vincent Petry 04809b6037 Properly forward repair errors and warnings
This makes repair errors and warnings visible for the user when
upgrading on the command line or in the web UI.
2015-03-16 16:25:29 +01:00
Vincent Petry 5538c27322 Do not abort when meeting unfixable legacy storages 2015-03-16 16:25:21 +01:00
Morris Jobke 35abb4d71e Merge pull request #14917 from owncloud/imagepng_expects_resource_issue_stable8
backport: validate resource's integrity before using it
2015-03-16 13:37:42 +01:00
Georg Ehrke bc5ca78816 validate resource's integrity before using it 2015-03-16 12:41:53 +01:00
Joas Schilling f15d41e185 Also use all keys for an empty array, just in case 2015-03-16 11:47:10 +01:00
Joas Schilling 27df0a1735 Throw a RuntimeException in the cache aswell 2015-03-16 11:47:00 +01:00
Joas Schilling 171974e43c Fix doc blocks of insertIfNotExists() method
Conflicts:
	lib/private/appframework/db/db.php
2015-03-16 11:46:30 +01:00
Joas Schilling 03ef085a4c Add test for UniqueConstraintViolationException on wrong key 2015-03-16 11:45:29 +01:00
Thomas Müller d9f6971d0b let insertIfNotExist() throw the native DBALException - no need to hide the real exception 2015-03-16 11:45:14 +01:00
Thomas Müller b081bb24e5 Adding unit test which shows insertIfNotExists to fall apart in certain situations 2015-03-16 11:44:50 +01:00
Joas Schilling aa63a16f25 Get the id before using it 2015-03-16 11:44:39 +01:00
Joas Schilling 27990b5360 Better save then sorry 2015-03-16 11:44:25 +01:00
Joas Schilling 9383856ca5 insertIfNotExists() for storage insertion 2015-03-16 11:44:14 +01:00
Joas Schilling 78b2c8b0be Only check unique keys for the comparison on filecache insert & update otherwise 2015-03-16 11:44:02 +01:00
Joas Schilling 4cfa4ecc28 Allow specifying the compare-array for insertIfNotExists()
Conflicts:
	lib/private/appframework/db/db.php
2015-03-16 11:43:42 +01:00
blizzz 92a024b2fd Merge pull request #14875 from owncloud/backport-14849-stable8
[stable8] support paged results against 389ds.
2015-03-13 15:32:42 +01:00
Arthur Schiwon a1c414c197 support paged results against 389ds. 2015-03-13 13:18:57 +01:00
Vincent Petry e8ee079aa7 Add unit test for size propagation across share boundaries 2015-03-13 11:06:18 +01:00
Vincent Petry 769f666663 Fix size propagation over shared storage boundary 2015-03-13 11:06:14 +01:00
Thomas Müller c6136de551 Merge pull request #14845 from owncloud/fix-14843-stable8
cron shall not operate in case we are in maintenance mode - fixes #14843
2015-03-13 09:25:10 +01:00
Thomas Müller 4bf3d2907d cron shall not operate in case we are in maintenance mode - fixes #14843 2015-03-12 21:07:14 +01:00
Thomas Müller 1f1078120c Merge pull request #14839 from owncloud/backport/14838
[stable8] Add cURL as hard-dependency
2015-03-12 20:38:04 +01:00
Lukas Reschke 096ccb7a7b Add cURL as hard-dependency
It is required by other functionalities such as S2S anyways and ownCloud will fail hard at a lot of places without it.
2015-03-12 18:45:12 +01:00
blizzz e416b469de Merge pull request #14751 from owncloud/backport-14706
set up paged search when limit is 0
2015-03-12 15:15:44 +01:00
Morris Jobke 228d4087ac Merge pull request #14763 from owncloud/backport-14429
Etc timezones don't exist for .5 and .75 offsets
2015-03-11 16:34:29 +01:00
Morris Jobke b95405e09a Merge pull request #14514 from owncloud/stable8-tagmanager-nouser
[stable8] Return null when requesting tags for null user
2015-03-11 16:30:22 +01:00
Morris Jobke 8a5ef62b60 Merge pull request #14801 from owncloud/backport-13839
[stable8] Extract the remote host from user input in share dropdown
2015-03-11 16:22:53 +01:00
Morris Jobke f59b286a59 Merge pull request #14632 from owncloud/backport/14593
Backport/14593
2015-03-11 16:18:26 +01:00
Morris Jobke 7e87cdab4a Merge pull request #14669 from owncloud/enc-migrate-disable-updater-stable8
[stable8] Disable the cache updater when doing the encryption migration
2015-03-11 16:18:04 +01:00
Morris Jobke 5effc4a53a Merge pull request #14792 from owncloud/backport-14789-stable8
display app update error messages - fixes #14611
2015-03-11 16:16:36 +01:00
Morris Jobke 1540d8fad1 Merge pull request #14686 from owncloud/backport-14682
Backport 14682
2015-03-11 16:15:27 +01:00
Morris Jobke 81ae4b3687 Merge pull request #14698 from owncloud/backport-14550
[stable8] fix warning in gc
2015-03-11 16:15:20 +01:00
Morris Jobke 79f827cf40 Merge pull request #14755 from owncloud/backport/14753
[stable8] Verify CSRF token already in update.php and not the EventSource code
2015-03-11 16:15:14 +01:00
Morris Jobke 8781608ca7 Merge pull request #14765 from owncloud/backport-german-translation
[tx-robot] updated from transifex
2015-03-11 16:14:51 +01:00
Morris Jobke 5c10c05c1f Merge pull request #14762 from owncloud/backport-14633
Maintenance mode message might be misleading
2015-03-11 16:14:44 +01:00
Morris Jobke 9b573ee8c9 Merge pull request #14760 from owncloud/backport-14713
Check whether the file id is valid, before using it to delete the previe...
2015-03-11 16:14:36 +01:00
Morris Jobke 5d53314e8f Merge pull request #14756 from owncloud/backport-14750
[stable8] proper filename for "require version.php"
2015-03-11 16:14:17 +01:00
Joas Schilling 625bb3c4d5 Extract the remote host from user input in share dropdown
Fix #13678
2015-03-11 15:23:59 +01:00
Thomas Müller 1374f25a0b display app update error messages - fixes #14611 2015-03-11 12:19:32 +01:00
Jenkins for ownCloud ed954bd941 [tx-robot] updated from transifex 2015-03-09 16:31:10 +01:00
Joas Schilling a03d39b1ad Etc timezones don't exist for .5 and .75 offsets 2015-03-09 16:22:43 +01:00
Joas Schilling 2bfd03e483 Maintenance mode message might be misleading 2015-03-09 16:14:03 +01:00
Joas Schilling c100d90793 Check whether the file id is valid, before using it to delete the previews 2015-03-09 15:02:41 +01:00
Frank Karlitschek 8db687a1cd 8.0.2 2015-03-09 14:23:26 +01:00
Frank Karlitschek 5def2c0998 Merge pull request #14738 from owncloud/backport-14734-stable8
[Backport-14734-stable8]
2015-03-09 09:05:22 -04:00
Frank Karlitschek 10d0f0d9b3 8.0.2 2015-03-09 14:05:05 +01:00
Morris Jobke c477e24034 proper filename for "require version.php" 2015-03-09 10:17:11 +01:00
Lukas Reschke 36bed7c2f6 Verify CSRF token already in update.php and not the EventSource code
Issue report:
> Hum, well I upgraded the package then visited the web interface to
trigger the update and it failed; the UI would say there was a
possible CSRF attack and after that it'd be stuck in maintenance mode.
Tried a few times (by editing maintenance to false in owncloud.conf)
and same result each time.

That smells partially like an issue caused by our EventSource implementation, due to legacy concerns the CSRF verification happens within the EventSource handling and not when the actual endpoint is called, what happens here then is:

1. User has somehow an invalid CSRF token in session (or none at all)
2. User clicks the update button
3. Invalid CSRF token is sent to update.php - no CSRF check there => Instance gets set in maintenance mode
4. Invalid CSRF token is processed by the EventSource code => Code Execution is stopped and ownCloud is stuck in maintenance mode

I have a work-around for this problem, basically it verifies the CSRF token already in step 3 and cancels execution then. The same error will be shown to the user however he can work around it by refreshing the page – as stated by the error. I think that’s an acceptable behaviour for now: INSERT LINK

To verify this test:

1. Delete your ownCloud cookies
2. Increment the version in version.php
3. Try to upgrade
=> Before the patch: Instance shows an error, is set to upgrade mode and a refresh does not help
=> After the patch: Instance shows an error, a refresh helps though.

This is not really the best fix as a better solution would be to catch such situations when bootstrapping ownCloud, however, I don’t dare to touch base.php for this sake only, you never know what breaks then…

That said: There might be other bugs as well, especially the stacktrace is somewhat confusing but then again it installing ownCloud under /usr/share/owncloud/ and I bet that is part of the whole issue ;-)
2015-03-09 10:13:16 +01:00
Arthur Schiwon 860c59a347 set up paged search when limit is 0 2015-03-09 08:13:07 +01:00
Thomas Müller f6ceb0b0d5 use insertIfNotExist() in cache put 2015-03-06 17:41:51 +01:00
Thomas Müller e5aefc8bda Use an atomic implementation on sqlite for insertIfNotExist() 2015-03-06 17:41:33 +01:00
Lukas Reschke ba1748bd80 Merge pull request #14721 from owncloud/14711/without-public-api
[stable8] 14719 without public API
2015-03-05 23:35:06 +01:00
Lukas Reschke 6d5e60bd9b 14719 without public API 2015-03-05 22:36:17 +01:00
Frank Karlitschek a7fc0fc07b Merge pull request #14719 from owncloud/fix-totally-broken-appstore
[stable8] Fix totally broken AppStore code…
2015-03-05 16:06:50 -05:00
Lukas Reschke c032b94b77 Sort results 2015-03-05 21:22:25 +01:00
Lukas Reschke 8961967fec Fix totally broken AppStore
As it turned out the AppStore code was completely broken when it came from apps delivered from the appstore, this meant:

1. You could not disable and then re-enable an application that was installed from the AppStore. It simply failed hard.
2. You could not disable apps from the categories but only from the "Activated" page
3. It did not show the activation state from any category page

This code is completely static and thus testing it is impossible. We really have to stop with "let's add yet another feature in already existing static code". Such stuff has to get refactored first.

That said, this code works from what I can say when clicking around in the AppStore page GUI. However, it may easily be that it does not work with updates or whatsever as I have no chance to test that since the AppStore code is not open-source and it is impossible to write unit-tests for that.

Fixes https://github.com/owncloud/core/issues/14711
2015-03-05 20:48:43 +01:00
Robin Appelman c0cfd2ddbb fix warning in gc 2015-03-05 09:05:10 +01:00
Joas Schilling 00d0120e22 Fix method signature for stable8 2015-03-04 16:11:52 +01:00
Joas Schilling 3672ec39dd Add a test for ObjectStore\NoopScanner 2015-03-04 12:13:48 +01:00
Joas Schilling 2f6eaa3832 Update scanFile() and scanChildren() to the new signature of the parent class 2015-03-04 12:13:43 +01:00
Vincent Petry 8f23742ca6 Move keys instead of copy during encryption key migration 2015-03-03 13:11:43 +01:00
Robin Appelman c0a4affe00 add some tests for disabled updater 2015-03-03 13:11:35 +01:00
Robin Appelman efe635f0d5 Disable the cache updater when doing the encryption migration 2015-03-03 13:11:25 +01:00
Robin Appelman fa64ba356a Allow disabling the cache updater 2015-03-03 13:11:18 +01:00
Frank Karlitschek eb2ac86c5d bump version 2015-03-02 23:28:25 +01:00
Lukas Reschke 598c4fdcae Merge pull request #14636 from owncloud/stable8-fix-link-config.sample.php
fix link for Preview documentation
2015-03-02 14:36:25 +01:00
Vincent Petry fe9e2e9945 Only rescan versions once in trashbin
Whenever versions need to be rescanned, only do it once per PHP request.
Happens whenever multiple files need to be expired.
2015-03-02 12:59:20 +01:00
Morris Jobke 716e0e6645 fix link for Preview documentation 2015-03-02 10:47:08 +01:00
Lukas Reschke 266a655107 Simplify code 2015-03-02 09:33:44 +01:00
Lukas Reschke 2e85c1fb9b Add detection for invalid CLI configuration for settings page
This change will log all failures that prevent the CLI cronjob from happening to the database and display a warning to administrators when an error happened.

To test:

1. Configure some invalid CLI php.ini settings
2. Enable the CLI cronjob and run php cron.php
3. See the errors printed and also in the admin page
4. Configure the CLI settings correctly
5. Errors should be gone.

Fixes https://github.com/owncloud/core/issues/13994
2015-03-02 09:33:40 +01:00
Lukas Reschke 8c529adf85 Merge pull request #14583 from owncloud/backport-13969
Append search results to custom container
2015-03-01 11:47:22 +01:00
Frank Karlitschek fb8569499c 8.0.1 2015-02-28 01:03:18 +01:00
Frank Karlitschek 1d9d0f653d this is actually 8.0.1 RC1 2015-02-28 00:54:51 +01:00
Frank Karlitschek 846fdecbcc 8.0.1 RC1
2015-02-28 00:34:48 +01:00
Bernhard Posselt 95cfc4185a Merge pull request #14587 from owncloud/fix/14283
Only read php://input when parameters are requested
2015-02-27 19:52:42 +01:00
Vincent Petry c78b5453ff Merge pull request #14584 from owncloud/cache-rename-overwrite-stable8
[stable8] Fix cache update when doing a rename that overwrites the target
2015-02-27 18:18:14 +01:00
Lukas Reschke 75cae3b252 Only read php://input when parameters are requested
Less invasive version of https://github.com/owncloud/core/pull/14574 for stable8 as requested at https://github.com/owncloud/core/issues/14283#issuecomment-76402295

Alarm: Major hack detected 🙈
2015-02-27 17:58:18 +01:00
Robin Appelman a796021143 Fix cache update when doing a rename that overwrites the target 2015-02-27 17:35:28 +01:00
Raimund Schlüßler 83dd98426c Append search results to custom container
* fixes #13968
* fix variable already defined
2015-02-27 17:14:03 +01:00
Thomas Müller 0ec73a58e9 Merge pull request #14579 from owncloud/intuitive-version-check-8
Intuitive version check 8
2015-02-27 07:30:38 -08:00
Bernhard Posselt d29234382f add phpdoc 2015-02-27 15:23:26 +01:00
Bernhard Posselt 411cd5b2d5 make version check work on the lowest common version denominator 2015-02-27 15:23:22 +01:00
Morris Jobke 6d8d4ea546 Merge pull request #14568 from owncloud/node-check-fileinfo-stable8
[Stable8] Check if we have a proper fileinfo
2015-02-27 15:02:52 +01:00
Joas Schilling 9f6a640e73 Add "throws" lines to calling methods and interface aswell 2015-02-27 12:23:08 +01:00
Robin Appelman 810ac0fca7 Add unit test 2015-02-27 12:22:52 +01:00
Robin Appelman c77fd2eef6 Check if we have a proper fileinfo 2015-02-27 12:22:37 +01:00
Thomas Müller 3356abe5c7 Merge pull request #14504 from owncloud/stable8-quota-preventdatalossforfailedmove
[stable8] Fix file move/copy when storage space is not enough
2015-02-27 01:08:37 -08:00
Morris Jobke 5faf9f8192 Merge pull request #14533 from owncloud/stable8-defaultvalueforremoteid
[stable8] Add default value for remote_id
2015-02-26 18:37:31 +01:00
Thomas Müller c8d61ddad8 Merge pull request #14518 from owncloud/backport-14282-stable8
[Backport-14282-stable8]
2015-02-26 08:24:37 -08:00
Vincent Petry 80e3337bad Delete target file for unsuccessful copy/rename 2015-02-26 15:13:52 +01:00
Vincent Petry 17635053ab Bump up files_sharing version for schema update 2015-02-26 15:05:03 +01:00
Robin Appelman e82f30caae Cleanup garbage collection for global file cache 2015-02-26 14:02:25 +01:00
Thomas Müller ca7acd8461 Merge pull request #14424 from owncloud/backport-13767
[stable8] Use insertIfNotExists() and reload mimetypes after inserting one
2015-02-26 03:45:13 -08:00
Lukas Reschke c0550ed953 Merge pull request #14484 from owncloud/backport/auth/14471
[Backport] Always load authentication apps
2015-02-26 12:40:10 +01:00
Vincent Petry b0a6a54651 Add default value for remote_id
Fixes SQLite migration with non-null column.
2015-02-26 12:06:28 +01:00
Lukas Reschke b057ae2da1 Merge pull request #14515 from owncloud/stable8-dbal-251
[Stable8] Update doctrine/dbal to 251
2015-02-26 10:28:39 +01:00
Thomas Müller e277a9b3dd print app upgrade information to console as well 2015-02-25 23:07:48 +01:00
Thomas Müller 5c7157e0af 3rd-party apps are only disabled in case core is upgraded 2015-02-25 23:07:48 +01:00
Thomas Müller 1188c74fe5 shipped and 3rd-party apps of type authentication and session will remain enabled during update 2015-02-25 23:07:48 +01:00
Thomas Müller 06742fe24b 3rd-party apps are disabled on upgrade - refs #14026
Conflicts:
	lib/private/app.php
2015-02-25 23:07:40 +01:00
Victor Dubiniuk 9e38e2c1a9 Skip primary index if the table has one 2015-02-25 23:23:39 +03:00
Victor Dubiniuk 2e361618a3 Update doctrine/dbal to 2.5.1 2015-02-25 23:16:52 +03:00
Vincent Petry b63a6a4fc4 Return null when requesting tags for null user
The TagManager->load() now returns null if the user is not authenticated
instead of failing with an error.

Backport of 9ee37169a6 from master
2015-02-25 20:54:40 +01:00
Thomas Müller bc14181563 Merge pull request #14491 from owncloud/backport_apostrophe_fix_to_stable8
back port of #14419
2015-02-25 07:05:30 -08:00
Vincent Petry c6c888c8a1 Properly detect streamCopy errors
Now checking whether the written bytes match the number of read bytes.
2015-02-25 16:04:43 +01:00
Lukas Reschke ced104c206 Remove hacky Substring support for MSSQL
Substring() is not required for the core functionality and this allows us to get rid of a huge hack...
2015-02-25 14:05:10 +01:00
Georg Ehrke 5fef637f87 fix issue with previews not being displayed if filename contains apostrophe 2015-02-25 12:21:41 +01:00
Lukas Reschke 2ed3c7af27 Always load authentication apps
The current code path may trigger situations where the LDAP application is not yet loaded and thus problems with the authentication appeared.

In previous versions of ownCloud the authentication mechanism manually loaded these apps which is why this affects ownCloud 8 and master only for my knowledge. (certainly not 6, maybe 7)

Backport to 8 might be something to consider.

Fixes https://github.com/owncloud/core/issues/14469
2015-02-25 10:32:59 +01:00
Thomas Müller 673c8a7531 Merge pull request #14423 from owncloud/backport/14275
Backport/14275
2015-02-23 14:46:35 +01:00
Lukas Reschke 089ad7c242 Merge pull request #14257 from owncloud/backport/14194
[backport-14194-stabe8] URLEncode logout attribute
2015-02-23 14:39:23 +01:00
Joas Schilling ee83fa673e Use insertIfNotExists() and reload mimetypes after inserting one 2015-02-23 10:44:30 +01:00
Joas Schilling 033635c9fb Merge pull request #14191 from owncloud/bump-random-lib
Bump RandomLib to 1.1.0 for stable8
2015-02-23 10:33:54 +01:00
Christian Seiler 3c51f5ff38 DAV authentication: also use Owncloud's internal user for short-circuit
It still works otherwise, but without this, the performance optimization
of #13416 is defeated in these situations.
2015-02-23 10:25:45 +01:00
Christian Seiler 62029c3541 DAV authentication: use Owncloud's internal user instead of HTTP-supplied one
Fixes: #14048, #14104, calendar#712
2015-02-23 10:25:42 +01:00
Thomas Müller 9735fbb0f4 Merge pull request #14382 from owncloud/backport-14311
[stable8] Fix #14310
2015-02-20 16:16:11 +01:00
Thomas Müller c8f55ae5dd Merge pull request #14388 from RealRancor/backport_14097_stable8
Backport #14097 (in some case charset can be in lower case)
2015-02-20 16:15:47 +01:00
RealRancor 9e4be2909c in some case charset can be in lower case 2015-02-19 19:53:43 +01:00
Vincent Petry d8b676f485 Merge pull request #14304 from owncloud/backport/14278
[Stable8 - Backport] Check if the offset exists before accessing
2015-02-19 18:12:14 +01:00
Raimund Schlüßler 08e1ae11d5 Fix #14310 2015-02-19 16:44:48 +01:00
Morris Jobke 88f62bf4ea Merge pull request #14373 from owncloud/fix-nav-s8
Backport #14338 to stable8
2015-02-19 15:15:12 +01:00
Bernhard Posselt e1985647d5 if no link text has been set for the navigation show the link nonetheless 2015-02-19 13:24:20 +01:00
Thomas Müller 8e55425c93 Merge pull request #14367 from owncloud/remove-old-l10n-files-stable8
[Stable8] Remove old l10n files stable8
2015-02-19 13:04:58 +01:00
Joas Schilling 42c6963acc Remove old l10n files 2015-02-19 12:00:53 +01:00
Thomas Müller cb3060c940 Merge pull request #14345 from owncloud/stable8-fix-14247
[stable8] Add mapping for a broken varchar type. Fixes #14247
2015-02-18 20:42:45 +01:00
Victor Dubiniuk cd75ac2e2c Add mapping for a broken varchar type. Fixes #14247 2015-02-18 19:24:13 +03:00
Lukas Reschke 968dc81a74 Merge pull request #14274 from owncloud/backport/14273
[stable8] Use APCu only if available in version 4.0.6 and higher
2015-02-18 01:08:15 +01:00
Lukas Reschke fc4bb1ae88 Check if the offset exists before accessing
Minified backport of https://github.com/owncloud/core/pull/14278
2015-02-17 17:40:02 +01:00
Lukas Reschke f4f5097b00 URLEncode logout attribute
Otherwise logout can fail if the requesttoken contains a +
2015-02-17 14:05:50 +01:00
Lukas Reschke f558ee5802 Use APCu only if available in version 4.0.6 and higher
APCu before 4.0.6 is unbelievable buggy and tend to segfault the PHP process (i.e. the whole webserver)

This potentially fixes https://github.com/owncloud/core/issues/14175

Requires a backport to stable8
2015-02-17 13:28:51 +01:00
Morris Jobke 2740bdc1d9 Merge pull request #14262 from owncloud/fix-last-login-stable8
Return milliseconds instead of seconds for lastLogin - refs #14005
2015-02-16 21:12:33 +01:00
Lukas Reschke 1378c17b55 Merge pull request #14259 from owncloud/fix-autoloader-message-stable8
Properly show the warning about the missing composer autoloader
2015-02-16 20:22:59 +01:00
Thomas Müller 033873c6cc fixing unit tests in UsersControllerTest 2015-02-16 19:45:09 +01:00
Thomas Müller 159d1e4ce7 Return milliseconds instead of seconds for lastLogin - refs #14005 2015-02-16 17:43:13 +01:00
Morris Jobke 5642f1b97a Merge pull request #14258 from owncloud/fix-image-glip-php53-stable8
Check if imageflip is available
2015-02-16 17:35:49 +01:00
Morris Jobke b25bfb2796 Properly show the warning about the missing composer autoloader 2015-02-16 17:04:21 +01:00
Thomas Müller 4b8d1e8dbd Merge pull request #14019 from owncloud/13925-stable8
no fruitless count attempts, and notification should disappear
2015-02-16 17:01:41 +01:00
Morris Jobke 95aa9a8890 Check if imageflip is available
* imageflip() isn't available in PHP < 5.5
* fixes #14130
2015-02-16 17:01:21 +01:00
Morris Jobke 05e56711f3 Merge pull request #14253 from owncloud/console-execution-time-stable8
[backport-14243-stable8] console commands shall not be limited with respect to execution time
2015-02-16 16:55:13 +01:00
Lukas Reschke 5dd63bdd04 Bump RandomLib to 1.1.0 for stable8
Ref https://github.com/owncloud/3rdparty/pull/160
2015-02-16 16:41:31 +01:00
Thomas Müller 8bd2f2eb23 console commands shall not be limited with respect to execution time - fixes #14156 2015-02-16 15:36:53 +01:00
Lukas Reschke 676c91d4a3 Merge pull request #13987 from owncloud/group-share-collition-wrong-type-in-post-hook-stable8
[stable8] Do not overwrite the shareType so the post hook is still correct
2015-02-16 14:41:46 +01:00
Lukas Reschke a719f022fb Merge pull request #14198 from owncloud/backport-14086-stable8
[backport-14086-stable8]
2015-02-16 13:41:48 +01:00
Thomas Müller 47ceebbfc5 Merge pull request #14235 from owncloud/typoTurkish
fix typo
2015-02-16 09:52:28 +01:00
Volkan Gezer ae89229815 Update tr.json 2015-02-15 16:31:12 +01:00
Volkan Gezer 2885a84373 fix typo 2015-02-15 16:30:38 +01:00
RealRancor def1ffad23 Removed anchor in config.sample.php 2015-02-13 15:28:16 +01:00
Witali Rott 948ee0e398 App install behind a Proxy 2015-02-13 13:32:07 +01:00
Thomas Müller 4e9fd632ea Merge pull request #14168 from owncloud/backport/13771
generate valid human readable text for 0 - fixed #9342
2015-02-13 10:47:44 +01:00
Thomas Müller cc243e1296 generate valid human readable text for 0 - fixed #9342 2015-02-12 18:35:28 +01:00
Jörn Friedrich Dreyer d6c7f6f413 Merge pull request #14146 from owncloud/no-whitespace-from-themes-stable8
catch any whitespaces which might get written to the output buffer while...
2015-02-12 17:07:02 +01:00
Thomas Müller 662ebc6c80 catch any whitespaces which might get written to the output buffer while loading a theme 2015-02-12 11:25:01 +01:00
Morris Jobke 4f1f68ead8 Merge pull request #14041 from owncloud/stable8-app-upgrade-order
[Stable 8] app upgrade order
2015-02-12 11:02:19 +01:00
Thomas Müller ab456bed98 Merge pull request #14080 from owncloud/stable8-preview-hint
Add hint for troubleshooting MS Word previews
2015-02-11 21:17:39 +01:00
RealRancor 4825a4ca1e Add hint for troubleshooting MS Word previews 2015-02-11 01:16:33 +01:00
Vincent Petry 36cb41d15f Fix "other" app update stack 2015-02-10 11:56:51 +01:00
Arthur Schiwon 61eaf0e832 on ownCloud upgrade: upgrade all apps in order, load important ones 2015-02-10 11:56:47 +01:00
Morris Jobke e95d274f17 Merge pull request #14018 from owncloud/backport-13842
[stable8] check if cache files are readable
2015-02-10 09:32:14 +01:00
Arthur Schiwon 1740fb236e no fruitless count attempts, and notification should disappear 2015-02-10 00:07:55 +01:00
Jörn Friedrich Dreyer de0c16789e check if cache files are readable
:camel:case

readd is_file
2015-02-09 23:47:56 +01:00
Joas Schilling f99ca64adc Merge pull request #13983 from owncloud/tempmanager-check-handle-stable8
[stable8] Check directory handle before we use it
2015-02-09 17:06:19 +01:00
Joas Schilling 46186dc896 Add a test for the post_shared hook shareType 2015-02-09 16:24:19 +01:00
Joas Schilling d0fd28c97c Do not overwrite the shareType so the post hook is still correct 2015-02-09 16:24:04 +01:00
Robin Appelman c5a87c2a18 Check directory handle before we use it 2015-02-09 16:00:00 +01:00
RealRancor 85d695dbe8 external user app: Add note to enable it first 2015-02-07 20:11:58 +01:00
321 changed files with 8259 additions and 2551 deletions
+3 -1
View File
@@ -1,4 +1,4 @@
# Version: 8.0.0
# Version: 8.0.15
<IfModule mod_fcgid.c>
<IfModule mod_setenvif.c>
<IfModule mod_headers.c>
@@ -13,6 +13,8 @@ php_value post_max_size 513M
php_value memory_limit 512M
php_value mbstring.func_overload 0
php_value always_populate_raw_post_data -1
php_value default_charset 'UTF-8'
php_value output_buffering off
<IfModule mod_env.c>
SetEnv htaccessWorking true
</IfModule>
+23
View File
@@ -0,0 +1,23 @@
sudo: false
language: php
php:
- 5.4
branches:
only:
- master
- /^stable\d+(\.\d+)?$/
script:
- sh -c "if [ '$TC' = 'syntax' ]; then composer install && vendor/bin/parallel-lint --exclude vendor/jakub-onderka/ --exclude 3rdparty/patchwork/utf8/class/Patchwork/Utf8/Bootup/ --exclude vendor/composer/autoload_static.php --exclude 3rdparty/composer/autoload_static.php .; fi"
matrix:
include:
- php: 5.4
env: DB=sqlite;TC=syntax
- php: 5.5
env: DB=sqlite;TC=syntax
- php: 5.6
env: DB=sqlite;TC=syntax
fast_finish: true
+2
View File
@@ -3,3 +3,5 @@ post_max_size=513M
memory_limit=512M
mbstring.func_overload=0
always_populate_raw_post_data=-1
default_charset='UTF-8'
output_buffering=off
Vendored
+40
View File
@@ -0,0 +1,40 @@
#!groovy
node('SLAVE') {
stage 'Checkout'
checkout scm
sh '''git submodule update --init'''
stage 'JavaScript Testing'
sh '''./autotest-js.sh'''
step([$class: 'JUnitResultArchiver', testResults: 'tests/autotest-results-js.xml'])
stage 'PHPUnit'
sh '''
export NOCOVERAGE=1
unset USEDOCKER
phpenv local 5.6
./autotest.sh sqlite
phpenv local 5.4
./autotest.sh mysql
phpenv local 5.6
./autotest.sh pgsql
phpenv local 5.5
./autotest.sh oci
'''
step([$class: 'JUnitResultArchiver', testResults: 'tests/autotest-results-sqlite.xml'])
step([$class: 'JUnitResultArchiver', testResults: 'tests/autotest-results-mysql.xml'])
step([$class: 'JUnitResultArchiver', testResults: 'tests/autotest-results-oci.xml'])
step([$class: 'JUnitResultArchiver', testResults: 'tests/autotest-results-pgsql.xml'])
stage 'Files External Testing'
sh '''
phpenv local 5.6
export NOCOVERAGE=1
unset USEDOCKER
./autotest-external.sh sqlite webdav-ownCloud
'''
step([$class: 'JUnitResultArchiver', testResults: 'tests/autotest-external-results-sqlite-webdav-ownCloud.xml'])
}
+25 -3
View File
@@ -5,7 +5,7 @@ OCP\JSON::checkLoggedIn();
$l = \OC::$server->getL10N('files');
// Load the files
$dir = isset($_GET['dir']) ? $_GET['dir'] : '';
$dir = isset($_GET['dir']) ? (string)$_GET['dir'] : '';
$dir = \OC\Files\Filesystem::normalizePath($dir);
try {
@@ -22,10 +22,32 @@ try {
$sortAttribute = isset($_GET['sort']) ? $_GET['sort'] : 'name';
$sortDirection = isset($_GET['sortdirection']) ? ($_GET['sortdirection'] === 'desc') : false;
$mimetypeFilters = isset($_GET['mimetypes']) ? json_decode($_GET['mimetypes']) : '';
// make filelist
$files = [];
// Clean up duplicates from array
if (is_array($mimetypeFilters) && count($mimetypeFilters)) {
$mimetypeFilters = array_unique($mimetypeFilters);
if (!in_array('httpd/unix-directory', $mimetypeFilters)) {
// append folder filter to be able to browse folders
$mimetypeFilters[] = 'httpd/unix-directory';
}
// create filelist with mimetype filter - as getFiles only supports on
// mimetype filter at once we will filter this folder for each
// mimetypeFilter
foreach ($mimetypeFilters as $mimetypeFilter) {
$files = array_merge($files, \OCA\Files\Helper::getFiles($dir, $sortAttribute, $sortDirection, $mimetypeFilter));
}
// sort the files accordingly
$files = \OCA\Files\Helper::sortFiles($files, $sortAttribute, $sortDirection);
} else {
// create file list without mimetype filter
$files = \OCA\Files\Helper::getFiles($dir, $sortAttribute, $sortDirection);
}
$files = \OCA\Files\Helper::getFiles($dir, $sortAttribute, $sortDirection);
$files = \OCA\Files\Helper::populateTags($files);
$data['directory'] = $dir;
$data['files'] = \OCA\Files\Helper::formatFileInfos($files);
-8
View File
@@ -22,7 +22,6 @@ foreach ($users as $user) {
$eventSource->send('user', $user);
$scanner = new \OC\Files\Utils\Scanner($user, \OC::$server->getDatabaseConnection());
$scanner->listen('\OC\Files\Utils\Scanner', 'scanFile', array($listener, 'file'));
$scanner->listen('\OC\Files\Utils\Scanner', 'scanFolder', array($listener, 'folder'));
if ($force) {
$scanner->scan($dir);
} else {
@@ -50,13 +49,6 @@ class ScanListener {
$this->eventSource = $eventSource;
}
/**
* @param string $path
*/
public function folder($path) {
$this->eventSource->send('folder', $path);
}
public function file() {
$this->fileCount++;
if ($this->fileCount > $this->lastCount + 20) { //send a count update every 20 files
+4
View File
@@ -51,6 +51,10 @@ if (empty($_POST['dirToken'])) {
// The token defines the target directory (security reasons)
$path = \OC\Files\Filesystem::getPath($linkItem['file_source']);
if($path === null) {
OCP\JSON::error(array('data' => array_merge(array('message' => $l->t('Unable to set upload directory.')))));
die();
}
$dir = sprintf(
"/%s/%s",
$path,
+5 -4
View File
@@ -76,10 +76,10 @@ class Scan extends Command {
}
protected function execute(InputInterface $input, OutputInterface $output) {
$path = $input->getOption('path');
if ($path) {
$path = '/'.trim($path, '/');
list (, $user, ) = explode('/', $path, 3);
$inputPath = $input->getOption('path');
if ($inputPath) {
$inputPath = '/' . trim($inputPath, '/');
list (, $user,) = explode('/', $inputPath, 3);
$users = array($user);
} else if ($input->getOption('all')) {
$users = $this->userManager->search('');
@@ -98,6 +98,7 @@ class Scan extends Command {
if (is_object($user)) {
$user = $user->getUID();
}
$path = $inputPath ? $inputPath : '/' . $user;
if ($this->userManager->userExists($user)) {
$this->scanFiles($user, $path, $quiet, $output);
} else {
+5 -3
View File
@@ -63,7 +63,6 @@ class ApiController extends Controller {
* replace the actual tag selection.
*
* @NoAdminRequired
* @CORS
*
* @param string $path path
* @param array $tags array of tags
@@ -91,7 +90,6 @@ class ApiController extends Controller {
* Returns a list of all files tagged with the given tag.
*
* @NoAdminRequired
* @CORS
*
* @param array $tagName tag name to filter by
* @return DataResponse
@@ -102,7 +100,11 @@ class ApiController extends Controller {
foreach ($fileInfos as &$fileInfo) {
$file = \OCA\Files\Helper::formatFileInfo($fileInfo);
$parts = explode('/', dirname($fileInfo->getPath()), 4);
$file['path'] = '/' . $parts[3];
if(isset($parts[3])) {
$file['path'] = '/' . $parts[3];
} else {
$file['path'] = '/';
}
$file['tags'] = array($tagName);
$files[] = $file;
}
+1 -1
View File
@@ -39,7 +39,7 @@ $ftype=\OC_Helper::getSecureMimeType(\OC\Files\Filesystem::getMimeType( $filenam
header('Content-Type:'.$ftype);
OCP\Response::setContentDispositionHeader(basename($filename), 'attachment');
OCP\Response::disableCaching();
header('Content-Length: '.\OC\Files\Filesystem::filesize($filename));
OCP\Response::setContentLengthHeader(\OC\Files\Filesystem::filesize($filename));
OC_Util::obEnd();
\OC\Files\Filesystem::readfile( $filename );
+8 -3
View File
@@ -635,6 +635,8 @@
* @param filesArray array of file data (map)
*/
setFiles: function(filesArray) {
var self = this;
// detach to make adding multiple rows faster
this.files = filesArray;
@@ -655,7 +657,10 @@
this.updateSelectionSummary();
$(window).scrollTop(0);
this.$fileList.trigger(jQuery.Event("updated"));
this.$fileList.trigger(jQuery.Event('updated'));
_.defer(function() {
self.$el.closest('#app-content').trigger(jQuery.Event('apprendered'));
});
},
/**
* Creates a new table row element using the given file data.
@@ -947,7 +952,7 @@
mime: mime,
etag: fileData.etag,
callback: function(url) {
iconDiv.css('background-image', 'url(' + url + ')');
iconDiv.css('background-image', 'url("' + url + '")');
}
});
}
@@ -959,7 +964,7 @@
};
var previewUrl = this.generatePreviewUrl(urlSpec);
previewUrl = previewUrl.replace('(', '%28').replace(')', '%29');
iconDiv.css('background-image', 'url(' + previewUrl + ')');
iconDiv.css('background-image', 'url("' + previewUrl + '")');
}
}
return tr;
+1 -1
View File
@@ -124,7 +124,7 @@
var $target = $(ev.target);
var itemId = $target.closest('li').attr('data-id');
this.setActiveItem(itemId);
return false;
ev.preventDefault();
}
};
-10
View File
@@ -1,10 +0,0 @@
OC.L10N.register(
"files",
{
"_%n folder_::_%n folders_" : ["",""],
"_%n file_::_%n files_" : ["",""],
"_Uploading %n file_::_Uploading %n files_" : ["",""],
"_matches '{filter}'_::_match '{filter}'_" : ["",""],
"Download" : "Download"
},
"nplurals=2; plural=(n != 1);");
-8
View File
@@ -1,8 +0,0 @@
{ "translations": {
"_%n folder_::_%n folders_" : ["",""],
"_%n file_::_%n files_" : ["",""],
"_Uploading %n file_::_Uploading %n files_" : ["",""],
"_matches '{filter}'_::_match '{filter}'_" : ["",""],
"Download" : "Download"
},"pluralForm" :"nplurals=2; plural=(n != 1);"
}
+3 -2
View File
@@ -170,10 +170,11 @@ class Helper
* @param string $dir path to the directory
* @param string $sortAttribute attribute to sort on
* @param bool $sortDescending true for descending sort, false otherwise
* @param string $mimetypeFilter limit returned content to this mimetype or mimepart
* @return \OCP\Files\FileInfo[] files
*/
public static function getFiles($dir, $sortAttribute = 'name', $sortDescending = false) {
$content = \OC\Files\Filesystem::getDirectoryContent($dir);
public static function getFiles($dir, $sortAttribute = 'name', $sortDescending = false, $mimetypeFilter = '') {
$content = \OC\Files\Filesystem::getDirectoryContent($dir, $mimetypeFilter);
return self::sortFiles($content, $sortAttribute, $sortDescending);
}
@@ -0,0 +1,243 @@
<?php
/**
* Copyright (c) 2015 Lukas Reschke <lukas@owncloud.com>
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
namespace OCA\Files\Controller;
use OC\Files\FileInfo;
use OCP\AppFramework\Http;
use OC\Preview;
use OCP\Files\NotFoundException;
use OCP\Files\StorageNotAvailableException;
use Test\TestCase;
use OCP\IRequest;
use OCA\Files\Service\TagService;
use OCP\AppFramework\Http\DataResponse;
/**
* Class ApiController
*
* @package OCA\Files\Controller
*/
class ApiControllerTest extends TestCase {
/** @var string */
private $appName = 'files';
/** @var IRequest */
private $request;
/** @var TagService */
private $tagService;
/** @var ApiController */
private $apiController;
public function setUp() {
$this->request = $this->getMockBuilder('\OCP\IRequest')
->disableOriginalConstructor()
->getMock();
$this->tagService = $this->getMockBuilder('\OCA\Files\Service\TagService')
->disableOriginalConstructor()
->getMock();
$this->apiController = new ApiController(
$this->appName,
$this->request,
$this->tagService
);
}
public function testGetFilesByTagEmpty() {
$tagName = 'MyTagName';
$this->tagService->expects($this->once())
->method('getFilesByTag')
->with($this->equalTo([$tagName]))
->will($this->returnValue([]));
$expected = new DataResponse(['files' => []]);
$this->assertEquals($expected, $this->apiController->getFilesByTag([$tagName]));
}
public function testGetFilesByTagSingle() {
$tagName = 'MyTagName';
$fileInfo = new FileInfo(
'/root.txt',
$this->getMockBuilder('\OC\Files\Storage\Storage')
->disableOriginalConstructor()
->getMock(),
'/var/www/root.txt',
[
'mtime' => 55,
'mimetype' => 'application/pdf',
'size' => 1234,
'etag' => 'MyEtag',
],
$this->getMockBuilder('\OCP\Files\Mount\IMountPoint')
->disableOriginalConstructor()
->getMock()
);
$this->tagService->expects($this->once())
->method('getFilesByTag')
->with($this->equalTo([$tagName]))
->will($this->returnValue([$fileInfo]));
$expected = new DataResponse([
'files' => [
[
'id' => null,
'parentId' => null,
'date' => \OCP\Util::formatDate(55),
'mtime' => 55000,
'icon' => \OCA\Files\Helper::determineIcon($fileInfo),
'name' => 'root.txt',
'permissions' => null,
'mimetype' => 'application/pdf',
'size' => 1234,
'type' => 'file',
'etag' => 'MyEtag',
'path' => '/',
'tags' => [
[
'MyTagName'
]
],
],
],
]);
$this->assertEquals($expected, $this->apiController->getFilesByTag([$tagName]));
}
public function testGetFilesByTagMultiple() {
$tagName = 'MyTagName';
$fileInfo1 = new FileInfo(
'/root.txt',
$this->getMockBuilder('\OC\Files\Storage\Storage')
->disableOriginalConstructor()
->getMock(),
'/var/www/root.txt',
[
'mtime' => 55,
'mimetype' => 'application/pdf',
'size' => 1234,
'etag' => 'MyEtag',
],
$this->getMockBuilder('\OCP\Files\Mount\IMountPoint')
->disableOriginalConstructor()
->getMock()
);
$fileInfo2 = new FileInfo(
'/root.txt',
$this->getMockBuilder('\OC\Files\Storage\Storage')
->disableOriginalConstructor()
->getMock(),
'/var/www/some/sub.txt',
[
'mtime' => 999,
'mimetype' => 'application/binary',
'size' => 9876,
'etag' => 'SubEtag',
],
$this->getMockBuilder('\OCP\Files\Mount\IMountPoint')
->disableOriginalConstructor()
->getMock()
);
$this->tagService->expects($this->once())
->method('getFilesByTag')
->with($this->equalTo([$tagName]))
->will($this->returnValue([$fileInfo1, $fileInfo2]));
$expected = new DataResponse([
'files' => [
[
'id' => null,
'parentId' => null,
'date' => \OCP\Util::formatDate(55),
'mtime' => 55000,
'icon' => \OCA\Files\Helper::determineIcon($fileInfo1),
'name' => 'root.txt',
'permissions' => null,
'mimetype' => 'application/pdf',
'size' => 1234,
'type' => 'file',
'etag' => 'MyEtag',
'path' => '/',
'tags' => [
[
'MyTagName'
]
],
],
[
'id' => null,
'parentId' => null,
'date' => \OCP\Util::formatDate(999),
'mtime' => 999000,
'icon' => \OCA\Files\Helper::determineIcon($fileInfo2),
'name' => 'root.txt',
'permissions' => null,
'mimetype' => 'application/binary',
'size' => 9876,
'type' => 'file',
'etag' => 'SubEtag',
'path' => '/',
'tags' => [
[
'MyTagName'
]
],
]
],
]);
$this->assertEquals($expected, $this->apiController->getFilesByTag([$tagName]));
}
public function testUpdateFileTagsEmpty() {
$expected = new DataResponse([]);
$this->assertEquals($expected, $this->apiController->updateFileTags('/path.txt'));
}
public function testUpdateFileTagsWorking() {
$this->tagService->expects($this->once())
->method('updateFileTags')
->with('/path.txt', ['Tag1', 'Tag2']);
$expected = new DataResponse([
'tags' => [
'Tag1',
'Tag2'
],
]);
$this->assertEquals($expected, $this->apiController->updateFileTags('/path.txt', ['Tag1', 'Tag2']));
}
public function testUpdateFileTagsNotFoundException() {
$this->tagService->expects($this->once())
->method('updateFileTags')
->with('/path.txt', ['Tag1', 'Tag2'])
->will($this->throwException(new NotFoundException('My error message')));
$expected = new DataResponse('My error message', Http::STATUS_NOT_FOUND);
$this->assertEquals($expected, $this->apiController->updateFileTags('/path.txt', ['Tag1', 'Tag2']));
}
public function testUpdateFileTagsStorageNotAvailableException() {
$this->tagService->expects($this->once())
->method('updateFileTags')
->with('/path.txt', ['Tag1', 'Tag2'])
->will($this->throwException(new StorageNotAvailableException('My error message')));
$expected = new DataResponse('My error message', Http::STATUS_SERVICE_UNAVAILABLE);
$this->assertEquals($expected, $this->apiController->updateFileTags('/path.txt', ['Tag1', 'Tag2']));
}
public function testUpdateFileTagsStorageGenericException() {
$this->tagService->expects($this->once())
->method('updateFileTags')
->with('/path.txt', ['Tag1', 'Tag2'])
->will($this->throwException(new \Exception('My error message')));
$expected = new DataResponse('My error message', Http::STATUS_NOT_FOUND);
$this->assertEquals($expected, $this->apiController->updateFileTags('/path.txt', ['Tag1', 'Tag2']));
}
}
+1 -1
View File
@@ -65,7 +65,7 @@ class TagServiceTest extends \Test\TestCase {
->withAnyParameters()
->will($this->returnValue($user));
$this->root = \OC::$server->getUserFolder();
$this->root = \OC::$server->getUserFolder($this->user);
$this->tagger = \OC::$server->getTagManager()->load('files');
$this->tagService = new TagService(
-1
View File
@@ -18,7 +18,6 @@
<types>
<filesystem/>
</types>
<ocsid>166047</ocsid>
<dependencies>
<lib>openssl</lib>
</dependencies>
+1 -1
View File
@@ -1 +1 @@
0.7.1
0.7.2
-5
View File
@@ -1,5 +0,0 @@
<?php
$TRANSLATIONS = array(
"Saving..." => "Spašavam..."
);
$PLURAL_FORMS = "nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);";
-5
View File
@@ -1,5 +0,0 @@
<?php
$TRANSLATIONS = array(
"Saving..." => "Simpan..."
);
$PLURAL_FORMS = "nplurals=1; plural=0;";
-5
View File
@@ -1,5 +0,0 @@
<?php
$TRANSLATIONS = array(
"Saving..." => "Enregistra..."
);
$PLURAL_FORMS = "nplurals=2; plural=(n > 1);";
-5
View File
@@ -1,5 +0,0 @@
<?php
$TRANSLATIONS = array(
"personal settings" => "వ్యక్తిగత అమరికలు"
);
$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
+1 -1
View File
@@ -478,7 +478,7 @@ class Hooks {
list($ownerNew, $pathNew) = $util->getUidAndFilename($params['newpath']);
if ($util->isSystemWideMountPoint($pathNew)) {
if ($util->isSystemWideMountPoint($pathNew, $ownerNew)) {
$newKeysPath = 'files_encryption/keys/' . $pathNew;
} else {
$newKeysPath = $ownerNew . '/files_encryption/keys/' . $pathNew;
+1 -1
View File
@@ -187,7 +187,7 @@ class Keymanager {
$filePath_f = ltrim($filename, '/');
// in case of system wide mount points the keys are stored directly in the data directory
if ($util->isSystemWideMountPoint($filename)) {
if ($util->isSystemWideMountPoint($filename, $owner)) {
$keyPath = self::$keys_base_dir . $filePath_f . '/';
} else {
$keyPath = '/' . $owner . self::$keys_base_dir . $filePath_f . '/';
+17 -11
View File
@@ -1,5 +1,5 @@
<?php
/**
/**
* ownCloud
*
* @copyright (C) 2014 ownCloud, Inc.
@@ -35,6 +35,7 @@ class Migration {
public function __construct() {
$this->view = new \OC\Files\View();
$this->view->getUpdater()->disable();
$this->public_share_key_id = Helper::getPublicShareKeyId();
$this->recovery_key_id = Helper::getRecoveryKeyId();
}
@@ -50,7 +51,7 @@ class Migration {
$this->reorganizeFolderStructureForUser($user);
}
$offset += $limit;
} while(count($users) >= $limit);
} while (count($users) >= $limit);
}
public function reorganizeSystemFolderStructure() {
@@ -74,6 +75,10 @@ class Migration {
$this->view->deleteAll('/owncloud_private_key');
$this->view->deleteAll('/files_encryption/share-keys');
$this->view->deleteAll('/files_encryption/keyfiles');
$storage = $this->view->getMount('')->getStorage();
$storage->getScanner()->scan('files_encryption');
$storage->getCache()->remove('owncloud_private_key');
$storage->getCache()->remove('public-keys');
}
@@ -96,6 +101,7 @@ class Migration {
}
// delete old folders
$this->deleteOldKeys($user);
$this->view->getMount('/' . $user)->getStorage()->getScanner()->scan('files_encryption');
}
}
@@ -127,7 +133,7 @@ class Migration {
while (($oldPublicKey = readdir($dh)) !== false) {
if (!\OC\Files\Filesystem::isIgnoredDir($oldPublicKey)) {
$newPublicKey = substr($oldPublicKey, 0, strlen($oldPublicKey) - strlen('.public.key')) . '.publicKey';
$this->view->rename('public-keys/' . $oldPublicKey , 'files_encryption/public_keys/' . $newPublicKey);
$this->view->rename('public-keys/' . $oldPublicKey, 'files_encryption/public_keys/' . $newPublicKey);
}
}
closedir($dh);
@@ -141,7 +147,7 @@ class Migration {
while (($oldPrivateKey = readdir($dh)) !== false) {
if (!\OC\Files\Filesystem::isIgnoredDir($oldPrivateKey)) {
$newPrivateKey = substr($oldPrivateKey, 0, strlen($oldPrivateKey) - strlen('.private.key')) . '.privateKey';
$this->view->rename('owncloud_private_key/' . $oldPrivateKey , 'files_encryption/' . $newPrivateKey);
$this->view->rename('owncloud_private_key/' . $oldPrivateKey, 'files_encryption/' . $newPrivateKey);
}
}
closedir($dh);
@@ -149,10 +155,10 @@ class Migration {
}
private function renameUsersPrivateKey($user) {
$oldPrivateKey = $user . '/files_encryption/' . $user . '.private.key';
$newPrivateKey = substr($oldPrivateKey, 0, strlen($oldPrivateKey) - strlen('.private.key')) . '.privateKey';
$oldPrivateKey = $user . '/files_encryption/' . $user . '.private.key';
$newPrivateKey = substr($oldPrivateKey, 0, strlen($oldPrivateKey) - strlen('.private.key')) . '.privateKey';
$this->view->rename($oldPrivateKey, $newPrivateKey);
$this->view->rename($oldPrivateKey, $newPrivateKey);
}
private function getFileName($file, $trash) {
@@ -186,7 +192,7 @@ class Migration {
}
private function getFilePath($path, $user, $trash) {
$offset = $trash ? strlen($user . '/files_trashbin/keyfiles') : strlen($user . '/files_encryption/keyfiles');
$offset = $trash ? strlen($user . '/files_trashbin/keyfiles') : strlen($user . '/files_encryption/keyfiles');
return substr($path, $offset);
}
@@ -215,7 +221,7 @@ class Migration {
$extension = $this->getExtension($file, $trash);
$targetDir = $this->getTargetDir($user, $filePath, $filename, $extension, $trash);
$this->createPathForKeys($targetDir);
$this->view->copy($path . '/' . $file, $targetDir . '/fileKey');
$this->view->rename($path . '/' . $file, $targetDir . '/fileKey');
$this->renameShareKeys($user, $filePath, $filename, $targetDir, $trash);
}
}
@@ -258,10 +264,10 @@ class Migration {
if ($this->view->is_dir($oldShareKeyPath . '/' . $file)) {
continue;
} else {
if (substr($file, 0, strlen($filename) +1) === $filename . '.') {
if (substr($file, 0, strlen($filename) + 1) === $filename . '.') {
$uid = $this->getUidFromShareKey($file, $filename, $trash);
$this->view->copy($oldShareKeyPath . '/' . $file, $target . '/' . $uid . '.shareKey');
$this->view->rename($oldShareKeyPath . '/' . $file, $target . '/' . $uid . '.shareKey');
}
}
+6 -2
View File
@@ -299,7 +299,10 @@ class Proxy extends \OC_FileProxy {
public function postGetFileInfo($path, $data) {
// if path is a folder do nothing
if (\OCP\App::isEnabled('files_encryption') && $data !== false && array_key_exists('size', $data)) {
if (\OCP\App::isEnabled('files_encryption') &&
$data !== false &&
array_key_exists('size', $data) &&
$this->shouldEncrypt($path)) {
// Disable encryption proxy to prevent recursive calls
$proxyStatus = \OC_FileProxy::$enabled;
@@ -330,7 +333,8 @@ class Proxy extends \OC_FileProxy {
// if encryption is no longer enabled or if the files aren't migrated yet
// we return the default file size
if(!\OCP\App::isEnabled('files_encryption') ||
$util->getMigrationStatus() !== Util::MIGRATION_COMPLETED) {
$util->getMigrationStatus() !== Util::MIGRATION_COMPLETED ||
!$this->shouldEncrypt($path)) {
return $size;
}
+14 -6
View File
@@ -24,6 +24,7 @@
*/
namespace OCA\Files_Encryption;
use OC\User\NoUserException;
/**
* Class for utilities relating to encrypted file storage system
@@ -945,8 +946,14 @@ class Util {
) {
return true;
}
$util = new Util($this->view, $user);
return $util->ready();
try {
$util = new Util($this->view, $user);
return $util->ready();
} catch (NoUserException $e) {
\OCP\Util::writeLog('Encryption library',
'No User object for '.$user, \OCP\Util::DEBUG);
return false;
}
}
/**
@@ -1610,15 +1617,16 @@ class Util {
/**
* check if the file is stored on a system wide mount point
* @param string $path relative to /data/user with leading '/'
* @param string $uid
* @return boolean
*/
public function isSystemWideMountPoint($path) {
public function isSystemWideMountPoint($path, $uid) {
$normalizedPath = ltrim($path, '/');
if (\OCP\App::isEnabled("files_external")) {
$mounts = \OC_Mount_Config::getSystemMountPoints();
foreach ($mounts as $mount) {
if ($mount['mountpoint'] == substr($normalizedPath, 0, strlen($mount['mountpoint']))) {
if ($this->isMountPointApplicableToUser($mount)) {
if ($this->isMountPointApplicableToUser($mount, $uid)) {
return true;
}
}
@@ -1631,10 +1639,10 @@ class Util {
* check if mount point is applicable to user
*
* @param array $mount contains $mount['applicable']['users'], $mount['applicable']['groups']
* @param string $uid
* @return boolean
*/
protected function isMountPointApplicableToUser($mount) {
$uid = \OCP\User::getUser();
protected function isMountPointApplicableToUser($mount, $uid) {
$acceptedUids = array('all', $uid);
// check if mount point is applicable for the user
$intersection = array_intersect($acceptedUids, $mount['applicable']['users']);
+15 -9
View File
@@ -30,6 +30,7 @@ class Hooks extends TestCase {
const TEST_ENCRYPTION_HOOKS_USER1 = "test-encryption-hooks-user1.dot";
const TEST_ENCRYPTION_HOOKS_USER2 = "test-encryption-hooks-user2.dot";
const TEST_ENCRYPTION_HOOKS_USER3 = "test-encryption-hooks-user3.dot";
/** @var \OC\Files\View */
public $user1View; // view on /data/user1/files
@@ -91,6 +92,7 @@ class Hooks extends TestCase {
// cleanup test user
\OC_User::deleteUser(self::TEST_ENCRYPTION_HOOKS_USER1);
\OC_User::deleteUser(self::TEST_ENCRYPTION_HOOKS_USER2);
\OC_User::deleteUser(self::TEST_ENCRYPTION_HOOKS_USER3);
parent::tearDownAfterClass();
}
@@ -407,31 +409,35 @@ class Hooks extends TestCase {
$view = new \OC\Files\View();
// set user password for the first time
\OCA\Files_Encryption\Hooks::postCreateUser(array('uid' => 'newUser', 'password' => 'newUserPassword'));
\OC_User::createUser(self::TEST_ENCRYPTION_HOOKS_USER3, 'newUserPassword');
\OCA\Files_Encryption\Hooks::postCreateUser(array(
'uid' => self::TEST_ENCRYPTION_HOOKS_USER3,
'password' => 'newUserPassword')
);
$this->assertTrue($view->file_exists(\OCA\Files_Encryption\Keymanager::getPublicKeyPath() . '/newUser.publicKey'));
$this->assertTrue($view->file_exists('newUser/files_encryption/newUser.privateKey'));
$this->assertTrue($view->file_exists(\OCA\Files_Encryption\Keymanager::getPublicKeyPath() . '/'.self::TEST_ENCRYPTION_HOOKS_USER3.'.publicKey'));
$this->assertTrue($view->file_exists(self::TEST_ENCRYPTION_HOOKS_USER3.'/files_encryption/'.self::TEST_ENCRYPTION_HOOKS_USER3.'.privateKey'));
// check if we are able to decrypt the private key
$encryptedKey = \OCA\Files_Encryption\Keymanager::getPrivateKey($view, 'newUser');
$encryptedKey = \OCA\Files_Encryption\Keymanager::getPrivateKey($view, self::TEST_ENCRYPTION_HOOKS_USER3);
$privateKey = \OCA\Files_Encryption\Crypt::decryptPrivateKey($encryptedKey, 'newUserPassword');
$this->assertTrue(is_string($privateKey));
// change the password before the user logged-in for the first time,
// we can replace the encryption keys
\OCA\Files_Encryption\Hooks::setPassphrase(array('uid' => 'newUser', 'password' => 'passwordChanged'));
\OCA\Files_Encryption\Hooks::setPassphrase(array('uid' => self::TEST_ENCRYPTION_HOOKS_USER3, 'password' => 'passwordChanged'));
$encryptedKey = \OCA\Files_Encryption\Keymanager::getPrivateKey($view, 'newUser');
$encryptedKey = \OCA\Files_Encryption\Keymanager::getPrivateKey($view, self::TEST_ENCRYPTION_HOOKS_USER3);
$privateKey = \OCA\Files_Encryption\Crypt::decryptPrivateKey($encryptedKey, 'passwordChanged');
$this->assertTrue(is_string($privateKey));
// now create a files folder to simulate a already used account
$view->mkdir('/newUser/files');
$view->mkdir('/'.self::TEST_ENCRYPTION_HOOKS_USER3.'/files');
// change the password after the user logged in, now the password should not change
\OCA\Files_Encryption\Hooks::setPassphrase(array('uid' => 'newUser', 'password' => 'passwordChanged2'));
\OCA\Files_Encryption\Hooks::setPassphrase(array('uid' => self::TEST_ENCRYPTION_HOOKS_USER3, 'password' => 'passwordChanged2'));
$encryptedKey = \OCA\Files_Encryption\Keymanager::getPrivateKey($view, 'newUser');
$encryptedKey = \OCA\Files_Encryption\Keymanager::getPrivateKey($view, self::TEST_ENCRYPTION_HOOKS_USER3);
$privateKey = \OCA\Files_Encryption\Crypt::decryptPrivateKey($encryptedKey, 'passwordChanged2');
$this->assertFalse($privateKey);
+9 -2
View File
@@ -21,6 +21,7 @@
*/
namespace OCA\Files_Encryption\Tests;
use OC\HTTPHelper;
/**
* Class Share
@@ -44,6 +45,9 @@ class Share extends TestCase {
public $subfolder;
public $subsubfolder;
/** @var HTTPHelper */
private $oldHttpHelper;
public static function setUpBeforeClass() {
parent::setUpBeforeClass();
@@ -123,17 +127,20 @@ class Share extends TestCase {
$config = $this->getMockBuilder('\OCP\IConfig')
->disableOriginalConstructor()->getMock();
$certificateManager = $this->getMock('\OCP\ICertificateManager');
/** @var HTTPHelper | \PHPUnit_Framework_MockObject_MockObject $httpHelperMock */
$httpHelperMock = $this->getMockBuilder('\OC\HTTPHelper')
->setConstructorArgs(array($config, $certificateManager))
->getMock();
$httpHelperMock->expects($this->any())->method('post')->with($this->anything())->will($this->returnValue(array('success' => true, 'result' => "{'ocs' : { 'meta' : { 'statuscode' : 100 }}}")));
$httpHelperMock->expects($this->any())
->method('post')->with($this->anything())
->will($this->returnValue(array('success' => true, 'result' => '{"ocs" : { "meta" : { "statuscode" : 100 }}}')));
$this->registerHttpHelper($httpHelperMock);
}
/**
* Register an http helper mock for testing purposes.
* @param $httpHelper http helper mock
* @param HTTPHelper $httpHelper http helper mock
*/
private function registerHttpHelper($httpHelper) {
$this->oldHttpHelper = \OC::$server->query('HTTPHelper');
+3 -4
View File
@@ -587,9 +587,8 @@ class Util extends TestCase {
* @dataProvider dataProviderFortestIsMountPointApplicableToUser
*/
function testIsMountPointApplicableToUser($mount, $expectedResult) {
self::loginHelper(self::TEST_ENCRYPTION_UTIL_USER1);
$dummyClass = new DummyUtilClass($this->view, self::TEST_ENCRYPTION_UTIL_USER1);
$result = $dummyClass->testIsMountPointApplicableToUser($mount);
$result = $dummyClass->testIsMountPointApplicableToUser($mount, self::TEST_ENCRYPTION_UTIL_USER1);
$this->assertSame($expectedResult, $result);
}
@@ -663,7 +662,7 @@ class Util extends TestCase {
* dummy class extends \OCA\Files_Encryption\Util to access protected methods for testing
*/
class DummyUtilClass extends \OCA\Files_Encryption\Util {
public function testIsMountPointApplicableToUser($mount) {
return $this->isMountPointApplicableToUser($mount);
public function testIsMountPointApplicableToUser($mount, $uid) {
return $this->isMountPointApplicableToUser($mount, $uid);
}
}
+10 -2
View File
@@ -72,8 +72,16 @@ class Dropbox_OAuth_Curl extends Dropbox_OAuth {
if (strtoupper($method) == 'POST') {
curl_setopt($ch, CURLOPT_URL, $uri);
curl_setopt($ch, CURLOPT_POST, true);
// if (is_array($arguments))
// $arguments=http_build_query($arguments);
//if (is_array($arguments))
// $arguments=http_build_query($arguments);
if(is_array($arguments)) {
foreach ($arguments as $key => $value) {
if ($value[0] === '@') {
exit();
}
}
}
curl_setopt($ch, CURLOPT_POSTFIELDS, $arguments);
// $httpHeaders['Content-Length']=strlen($arguments);
} else {
+8 -3
View File
@@ -112,6 +112,11 @@ class smb {
function execute ($command, $purl, $regexp = NULL) {
if (strpos($command,';') !== false) {
trigger_error('Semicolon not supported in commands');
exit();
}
return smb::client ('-d 0 '
. escapeshellarg ('//' . $purl['host'] . '/' . $purl['share'])
. ' -c ' . escapeshellarg ($command), $purl, $regexp
@@ -319,14 +324,14 @@ class smb {
trigger_error('rename(): error in URL', E_USER_ERROR);
}
smb::clearstatcache ($url_from);
$cmd = '';
// check if target file exists
if (smb::url_stat($url_to)) {
// delete target file first
$cmd = 'del "' . $to['path'] . '"; ';
$cmd = 'del "' . $to['path'] . '"';
smb::execute($cmd, $to);
$replace = true;
}
$cmd .= 'rename "' . $from['path'] . '" "' . $to['path'] . '"';
$cmd = 'rename "' . $from['path'] . '" "' . $to['path'] . '"';
$result = smb::execute($cmd, $to);
if ($replace) {
// clear again, else the cache will return the info
+1
View File
@@ -14,6 +14,7 @@ if (isset($_POST['client_id']) && isset($_POST['client_secret']) && isset($_POST
$client->setClientSecret($_POST['client_secret']);
$client->setRedirectUri($_POST['redirect']);
$client->setScopes(array('https://www.googleapis.com/auth/drive'));
$client->setApprovalPrompt('force');
$client->setAccessType('offline');
if (isset($_POST['step'])) {
$step = $_POST['step'];
-2
View File
@@ -17,8 +17,6 @@
<types>
<filesystem/>
</types>
<ocsid>166048</ocsid>
<dependencies>
<owncloud min-version="8" />
</dependencies>
-6
View File
@@ -1,6 +0,0 @@
OC.L10N.register(
"files_external",
{
"Password" : "Secret Code"
},
"nplurals=2; plural=(n != 1);");
-4
View File
@@ -1,4 +0,0 @@
{ "translations": {
"Password" : "Secret Code"
},"pluralForm" :"nplurals=2; plural=(n != 1);"
}
+12
View File
@@ -490,6 +490,11 @@ class OC_Mount_Config {
return false;
}
if (isset($classOptions['objectstore'])) {
// objectstore cannot be set by client side
return false;
}
if (!isset($backends[$class])) {
// invalid backend
return false;
@@ -843,6 +848,13 @@ class OC_Mount_Config {
$mountPoint[$applicable][$mountPath]['priority']
= $data[$mountType][$applicable][$mountPath]['priority'];
}
// Persistent objectstore
if (isset($data[$mountType][$applicable][$mountPath])
&& isset($data[$mountType][$applicable][$mountPath]['objectstore'])
) {
$mountPoint[$applicable][$mountPath]['objectstore']
= $data[$mountType][$applicable][$mountPath]['objectstore'];
}
$data[$mountType][$applicable]
= array_merge($data[$mountType][$applicable], $mountPoint[$applicable]);
} else {
+6 -1
View File
@@ -100,7 +100,12 @@ class Dropbox extends \OC\Files\Storage\Common {
return $contents;
} else {
try {
$response = $this->dropbox->getMetaData($path, 'false');
$requestPath = $path;
if ($path === '.') {
$requestPath = '';
}
$response = $this->dropbox->getMetaData($requestPath, 'false');
if (!isset($response['is_deleted']) || !$response['is_deleted']) {
$this->metaData[$path] = $response;
return $response;
+2 -2
View File
@@ -37,13 +37,13 @@ class OwnCloud extends \OC\Files\Storage\DAV{
$host = substr($host, 0, $hostSlashPos);
}
if (substr($contextPath , 1) !== '/'){
if (substr($contextPath, -1) !== '/'){
$contextPath .= '/';
}
if (isset($params['root'])){
$root = $params['root'];
if (substr($root, 1) !== '/'){
if (substr($root, 0, 1) !== '/'){
$root = '/' . $root;
}
}
+10 -4
View File
@@ -18,13 +18,19 @@ class SMB_OC extends \OC\Files\Storage\SMB {
* @throws \Exception
*/
public function __construct($params) {
if (isset($params['host']) && \OC::$server->getSession()->exists('smb-credentials')) {
if (isset($params['host'])) {
$host=$params['host'];
$this->username_as_share = ($params['username_as_share'] === 'true');
$params_auth = json_decode(\OC::$server->getCrypto()->decrypt(\OC::$server->getSession()->get('smb-credentials')), true);
$user = \OC::$server->getSession()->get('loginname');
$password = $params_auth['password'];
$user = 'foo';
$password = 'bar';
if (\OC::$server->getSession()->exists('smb-credentials')) {
$params_auth = json_decode(\OC::$server->getCrypto()->decrypt(\OC::$server->getSession()->get('smb-credentials')), true);
$user = \OC::$server->getSession()->get('loginname');
$password = $params_auth['password'];
} else {
// assume we are testing from the admin section
}
$root=isset($params['root'])?$params['root']:'/';
$share = '';
+4 -1
View File
@@ -21,8 +21,11 @@ abstract class StreamWrapper extends Common {
}
public function rmdir($path) {
if ($this->file_exists($path) && $this->isDeletable($path)) {
if ($this->is_dir($path) && $this->isDeletable($path)) {
$dh = $this->opendir($path);
if (!is_resource($dh)) {
return false;
}
while (($file = readdir($dh)) !== false) {
if ($this->is_dir($path . '/' . $file)) {
$this->rmdir($path . '/' . $file);
@@ -68,6 +68,14 @@ class OwnCloudFunctions extends \Test\TestCase {
),
'http://testhost/testroot/remote.php/webdav/subdir/',
),
array(
array(
'host' => 'http://testhost/testroot/',
'root' => '/subdir',
'secure' => false
),
'http://testhost/testroot/remote.php/webdav/subdir/',
),
);
}
+10 -3
View File
@@ -21,6 +21,7 @@ if (OCA\Files_Sharing\Helper::isIncomingServer2serverShareEnabled() === false) {
$token = $_POST['token'];
$remote = $_POST['remote'];
$owner = $_POST['owner'];
$ownerDisplayName = $_POST['ownerDisplayName'];
$name = $_POST['name'];
$password = $_POST['password'];
@@ -30,6 +31,14 @@ if(!\OCP\Util::isValidFileName($name)) {
exit();
}
$currentUser = \OC::$server->getUserSession()->getUser()->getUID();
$currentServer = \OC::$server->getURLGenerator()->getAbsoluteURL('/');
if (\OC\Share\Helper::isSameUserOnSameServer($owner, $remote, $currentUser, $currentServer )) {
\OCP\JSON::error(array('data' => array('message' => $l->t('Not allowed to create a federated share with the same user server'))));
exit();
}
$externalManager = new \OCA\Files_Sharing\External\Manager(
\OC::$server->getDatabaseConnection(),
\OC\Files\Filesystem::getMountManager(),
@@ -38,14 +47,12 @@ $externalManager = new \OCA\Files_Sharing\External\Manager(
\OC::$server->getUserSession()->getUser()->getUID()
);
$name = OCP\Files::buildNotExistingFileName('/', $name);
// check for ssl cert
if (substr($remote, 0, 5) === 'https' and !OC_Util::getUrlContent($remote)) {
\OCP\JSON::error(array('data' => array('message' => $l->t('Invalid or untrusted SSL certificate'))));
exit;
} else {
$mount = $externalManager->addShare($remote, $token, $password, $name, $owner, true);
$mount = $externalManager->addShare($remote, $token, $password, $name, $ownerDisplayName, true);
/**
* @var \OCA\Files_Sharing\External\Storage $storage
@@ -46,6 +46,13 @@ $view = new \OC\Files\View('/' . $userId . '/files');
$pathId = $linkedItem['file_source'];
$path = $view->getPath($pathId);
if($path === null) {
\OC_Response::setStatus(\OC_Response::STATUS_NOT_FOUND);
\OC_Log::write('core-preview', 'Could not resolve file for shared item', OC_Log::WARN);
exit;
}
$pathInfo = $view->getFileInfo($path);
$sharedFile = null;
+9 -34
View File
@@ -335,7 +335,7 @@ class Local {
if(isset($params['_put']['permissions'])) {
return self::updatePermissions($share, $params);
} elseif (isset($params['_put']['password'])) {
return self::updatePassword($share, $params);
return self::updatePassword($params['id'], (int)$share['share_type'], $params['_put']['password']);
} elseif (isset($params['_put']['publicUpload'])) {
return self::updatePublicUpload($share, $params);
} elseif (isset($params['_put']['expireDate'])) {
@@ -446,47 +446,22 @@ class Local {
/**
* update password for public link share
* @param array $share information about the share
* @param array $params 'password'
* @param int $shareId
* @param int $shareType
* @param string $password
* @return \OC_OCS_Result
*/
private static function updatePassword($share, $params) {
$itemSource = $share['item_source'];
$itemType = $share['item_type'];
if( (int)$share['share_type'] !== \OCP\Share::SHARE_TYPE_LINK) {
private static function updatePassword($shareId, $shareType, $password) {
if($shareType !== \OCP\Share::SHARE_TYPE_LINK) {
return new \OC_OCS_Result(null, 400, "password protection is only supported for public shares");
}
$shareWith = isset($params['_put']['password']) ? $params['_put']['password'] : null;
if($shareWith === '') {
$shareWith = null;
}
$items = \OCP\Share::getItemShared($itemType, $itemSource);
$checkExists = false;
foreach ($items as $item) {
if($item['share_type'] === \OCP\Share::SHARE_TYPE_LINK) {
$checkExists = true;
$permissions = $item['permissions'];
}
}
if (!$checkExists) {
return new \OC_OCS_Result(null, 404, "share doesn't exists, can't change password");
if($password === '') {
$password = null;
}
try {
$result = \OCP\Share::shareItem(
$itemType,
$itemSource,
\OCP\Share::SHARE_TYPE_LINK,
$shareWith,
$permissions
);
$result = \OCP\Share::setPassword($shareId, $password);
} catch (\Exception $e) {
return new \OC_OCS_Result(null, 403, $e->getMessage());
}
-2
View File
@@ -64,8 +64,6 @@ class Server2Server {
$shareWith
);
$name = \OCP\Files::buildNotExistingFileName('/', $name);
try {
$externalManager->addShare($remote, $token, '', $name, $owner, false, $shareWith, $remoteId);
+1
View File
@@ -25,6 +25,7 @@
<field>
<name>remote_id</name>
<type>integer</type>
<default>-1</default>
<notnull>true</notnull>
<length>4</length>
</field>
+1 -1
View File
@@ -1 +1 @@
0.6.0
0.6.2
+4 -1
View File
@@ -42,7 +42,7 @@ class Application extends App {
$server->getAppConfig(),
$server->getConfig(),
$c->query('URLGenerator'),
$server->getUserManager(),
$c->query('UserManager'),
$server->getLogger(),
$server->getActivityManager()
);
@@ -65,6 +65,9 @@ class Application extends App {
$container->registerService('URLGenerator', function(SimpleContainer $c) use ($server){
return $server->getUrlGenerator();
});
$container->registerService('UserManager', function(SimpleContainer $c) use ($server){
return $server->getUserManager();
});
$container->registerService('IsIncomingShareEnabled', function(SimpleContainer $c) {
return Helper::isIncomingServer2serverShareEnabled();
});
+1 -1
View File
@@ -51,7 +51,7 @@ thead {
}
/* keep long file names in one line to not overflow download button on mobile */
.directDownload #download {
.directDownload #downloadFile {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
+2 -1
View File
@@ -19,7 +19,7 @@
*/
OCA.Sharing.showAddExternalDialog = function (share, passwordProtected, callback) {
var remote = share.remote;
var owner = share.owner;
var owner = share.ownerDisplayName || share.owner;
var name = share.name;
var remoteClean = (remote.substr(0, 8) === 'https://') ? remote.substr(8) : remote.substr(7);
@@ -92,6 +92,7 @@
remote: share.remote,
token: share.token,
owner: share.owner,
ownerDisplayName: share.ownerDisplayName || share.owner,
name: share.name,
password: password}, function(result) {
if (result.status === 'error') {
+8 -5
View File
@@ -88,8 +88,8 @@ OCA.Sharing.PublicApp = {
// dynamically load image previews
var params = {
x: $(document).width() * window.devicePixelRatio,
y: $(document).height() * window.devicePixelRatio,
x: Math.floor($(document).width() * window.devicePixelRatio),
y: Math.floor($(document).height() * window.devicePixelRatio),
a: 'true',
file: encodeURIComponent(this.initialDir + $('#filename').val()),
t: $('#sharingToken').val(),
@@ -147,6 +147,8 @@ OCA.Sharing.PublicApp = {
this.fileList.generatePreviewUrl = function (urlSpec) {
urlSpec.t = $('#dirToken').val();
urlSpec.y = Math.floor(36 * window.devicePixelRatio);
urlSpec.x = Math.floor(36 * window.devicePixelRatio);
return OC.generateUrl('/apps/files_sharing/ajax/publicpreview.php?') + $.param(urlSpec);
};
@@ -192,9 +194,10 @@ OCA.Sharing.PublicApp = {
var remote = $(this).find('input[type="text"]').val();
var token = $('#sharingToken').val();
var owner = $('#save').data('owner');
var ownerDisplayName = $('#save').data('owner-display-name');
var name = $('#save').data('name');
var isProtected = $('#save').data('protected') ? 1 : 0;
OCA.Sharing.PublicApp._saveToOwnCloud(remote, token, owner, name, isProtected);
OCA.Sharing.PublicApp._saveToOwnCloud(remote, token, owner, ownerDisplayName, name, isProtected);
});
$('#save #save-button').click(function () {
@@ -218,11 +221,11 @@ OCA.Sharing.PublicApp = {
this.fileList.changeDirectory(params.path || params.dir, false, true);
},
_saveToOwnCloud: function(remote, token, owner, name, isProtected) {
_saveToOwnCloud: function (remote, token, owner, ownerDisplayName, name, isProtected) {
var location = window.location.protocol + '//' + window.location.host + OC.webroot;
var url = remote + '/index.php/apps/files#' + 'remote=' + encodeURIComponent(location) // our location is the remote for the other server
+ "&token=" + encodeURIComponent(token) + "&owner=" + encodeURIComponent(owner) + "&name=" + encodeURIComponent(name) + "&protected=" + isProtected;
+ "&token=" + encodeURIComponent(token) + "&owner=" + encodeURIComponent(owner) +"&ownerDisplayName=" + encodeURIComponent(ownerDisplayName) + "&name=" + encodeURIComponent(name) + "&protected=" + isProtected;
if (remote.indexOf('://') > 0) {
+1 -1
View File
@@ -23,7 +23,7 @@ OC.L10N.register(
"Add remote share" : "Entfernte Freigabe hinzufügen",
"No ownCloud installation (7 or higher) found at {remote}" : "Keine OwnCloud-Installation (7 oder höher) auf {remote} gefunden",
"Invalid ownCloud url" : "Ungültige OwnCloud-URL",
"Share" : "Share",
"Share" : "Teilen",
"Shared by" : "Geteilt von ",
"A file or folder was shared from <strong>another server</strong>" : "Eine Datei oder ein Ordner wurde von <strong>einem anderen Server</strong> geteilt",
"A public shared file or folder was <strong>downloaded</strong>" : "Eine öffentliche geteilte Datei oder ein öffentlicher geteilter Ordner wurde <strong>heruntergeladen</strong>",
+1 -1
View File
@@ -21,7 +21,7 @@
"Add remote share" : "Entfernte Freigabe hinzufügen",
"No ownCloud installation (7 or higher) found at {remote}" : "Keine OwnCloud-Installation (7 oder höher) auf {remote} gefunden",
"Invalid ownCloud url" : "Ungültige OwnCloud-URL",
"Share" : "Share",
"Share" : "Teilen",
"Shared by" : "Geteilt von ",
"A file or folder was shared from <strong>another server</strong>" : "Eine Datei oder ein Ordner wurde von <strong>einem anderen Server</strong> geteilt",
"A public shared file or folder was <strong>downloaded</strong>" : "Eine öffentliche geteilte Datei oder ein öffentlicher geteilter Ordner wurde <strong>heruntergeladen</strong>",
-7
View File
@@ -1,7 +0,0 @@
OC.L10N.register(
"files_sharing",
{
"Password" : "Secret Code",
"Download" : "Download"
},
"nplurals=2; plural=(n != 1);");
-5
View File
@@ -1,5 +0,0 @@
{ "translations": {
"Password" : "Secret Code",
"Download" : "Download"
},"pluralForm" :"nplurals=2; plural=(n != 1);"
}
+29 -1
View File
@@ -22,6 +22,7 @@
namespace OC\Files\Cache;
use OC\User\NoUserException;
use OCP\Share_Backend_Collection;
/**
@@ -53,7 +54,12 @@ class Shared_Cache extends Cache {
}
$source = \OC_Share_Backend_File::getSource($target, $this->storage->getMountPoint(), $this->storage->getItemType());
if (isset($source['path']) && isset($source['fileOwner'])) {
\OC\Files\Filesystem::initMountPoints($source['fileOwner']);
try {
\OC\Files\Filesystem::initMountPoints($source['fileOwner']);
} catch(NoUserException $e) {
\OC::$server->getLogger()->warning('The user \'' . $source['uid_owner'] . '\' of a share can\'t be retrieved.', array('app' => 'files_sharing'));
return false;
}
$mounts = \OC\Files\Filesystem::getMountByNumericId($source['storage']);
if (is_array($mounts) and !empty($mounts)) {
$fullPath = $mounts[0]->getMountPoint() . $source['path'];
@@ -394,6 +400,28 @@ class Shared_Cache extends Cache {
return $result;
}
/**
* update the folder size and the size of all parent folders
*
* @param string|boolean $path
* @param array $data (optional) meta data of the folder
*/
public function correctFolderSize($path, $data = null) {
$this->calculateFolderSize($path, $data);
if ($path !== '') {
$parent = dirname($path);
if ($parent === '.' or $parent === '/') {
$parent = '';
}
$this->correctFolderSize($parent);
} else {
// bubble up to source cache
$sourceCache = $this->getSourceCache($path);
$parent = dirname($this->files[$path]);
$sourceCache->correctFolderSize($parent);
}
}
/**
* get the size of a folder and set it in the cache
*
@@ -44,6 +44,11 @@ class PublicAuth extends \Sabre\DAV\Auth\Backend\AbstractBasic {
return false;
}
if ((int)$linkItem['share_type'] === \OCP\Share::SHARE_TYPE_LINK &&
$this->config->getAppValue('core', 'shareapi_allow_public_upload', 'yes') !== 'yes') {
$this->share['permissions'] &= ~(\OCP\Constants::PERMISSION_CREATE | \OCP\Constants::PERMISSION_UPDATE);
}
// check if the share is password protected
if (isset($linkItem['share_with'])) {
if ($linkItem['share_type'] == \OCP\Share::SHARE_TYPE_LINK) {
@@ -17,12 +17,12 @@ use OC_Files;
use OC_Util;
use OCP;
use OCP\Template;
use OCP\JSON;
use OCP\Share;
use OCP\AppFramework\Controller;
use OCP\IRequest;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\AppFramework\Http\RedirectResponse;
use OCP\AppFramework\Http\NotFoundResponse;
use OC\URLGenerator;
use OC\AppConfig;
use OCP\ILogger;
@@ -60,7 +60,7 @@ class ShareController extends Controller {
* @param AppConfig $appConfig
* @param OCP\IConfig $config
* @param URLGenerator $urlGenerator
* @param OC\User\Manager $userManager
* @param OCP\IUserManager $userManager
* @param ILogger $logger
* @param OCP\Activity\IManager $activityManager
*/
@@ -70,7 +70,7 @@ class ShareController extends Controller {
AppConfig $appConfig,
OCP\IConfig $config,
URLGenerator $urlGenerator,
OC\User\Manager $userManager,
OCP\IUserManager $userManager,
ILogger $logger,
OCP\Activity\IManager $activityManager) {
parent::__construct($appName, $request);
@@ -113,7 +113,7 @@ class ShareController extends Controller {
public function authenticate($token, $password = '') {
$linkItem = Share::getShareByToken($token, false);
if($linkItem === false) {
return new TemplateResponse('core', '404', array(), 'guest');
return new NotFoundResponse();
}
$authenticate = Helper::authenticate($linkItem, $password);
@@ -139,18 +139,11 @@ class ShareController extends Controller {
// Check whether share exists
$linkItem = Share::getShareByToken($token, false);
if($linkItem === false) {
return new TemplateResponse('core', '404', array(), 'guest');
return new NotFoundResponse();
}
$shareOwner = $linkItem['uid_owner'];
$originalSharePath = null;
$rootLinkItem = OCP\Share::resolveReShare($linkItem);
if (isset($rootLinkItem['uid_owner'])) {
OCP\JSON::checkUserExists($rootLinkItem['uid_owner']);
OC_Util::tearDownFS();
OC_Util::setupFS($rootLinkItem['uid_owner']);
$originalSharePath = Filesystem::getPath($linkItem['file_source']);
}
$originalSharePath = $this->getPath($token);
// Share is password protected - check whether the user is permitted to access the share
if (isset($linkItem['share_with']) && !Helper::authenticate($linkItem)) {
@@ -161,12 +154,15 @@ class ShareController extends Controller {
if (Filesystem::isReadable($originalSharePath . $path)) {
$getPath = Filesystem::normalizePath($path);
$originalSharePath .= $path;
} else {
throw new OCP\Files\NotFoundException();
}
$file = basename($originalSharePath);
$shareTmpl = array();
$shareTmpl = [];
$shareTmpl['displayName'] = User::getDisplayName($shareOwner);
$shareTmpl['owner'] = $shareOwner;
$shareTmpl['filename'] = $file;
$shareTmpl['directory_path'] = $linkItem['file_target'];
$shareTmpl['mimetype'] = Filesystem::getMimeType($originalSharePath);
@@ -204,6 +200,7 @@ class ShareController extends Controller {
$shareTmpl['downloadURL'] = $this->urlGenerator->linkToRouteAbsolute('files_sharing.sharecontroller.downloadShare', array('token' => $token));
$shareTmpl['maxSizeAnimateGif'] = $this->config->getSystemValue('max_filesize_animated_gifs_public_sharing', 10);
$shareTmpl['previewEnabled'] = $this->config->getSystemValue('enable_previews', true);
return new TemplateResponse($this->appName, 'public', $shareTmpl, 'base');
}
@@ -230,26 +227,48 @@ class ShareController extends Controller {
}
}
$originalSharePath = self::getPath($token);
if (isset($originalSharePath) && Filesystem::isReadable($originalSharePath . $path)) {
$originalSharePath = Filesystem::normalizePath($originalSharePath . $path);
$type = \OC\Files\Filesystem::is_dir($originalSharePath) ? 'folder' : 'file';
$args = $type === 'folder' ? array('dir' => $originalSharePath) : array('dir' => dirname($originalSharePath), 'scrollto' => basename($originalSharePath));
$linkToFile = \OCP\Util::linkToAbsolute('files', 'index.php', $args);
$subject = $type === 'folder' ? Activity::SUBJECT_PUBLIC_SHARED_FOLDER_DOWNLOADED : Activity::SUBJECT_PUBLIC_SHARED_FILE_DOWNLOADED;
$this->activityManager->publishActivity(
'files_sharing', $subject, array($originalSharePath), '', array(), $originalSharePath,
$linkToFile, $linkItem['uid_owner'], Activity::TYPE_PUBLIC_LINKS, Activity::PRIORITY_MEDIUM);
}
$files_list = null;
if (!is_null($files)) { // download selected files
$files_list = json_decode($files);
// in case we get only a single file
if ($files_list === NULL) {
if ($files_list === null) {
$files_list = array($files);
}
}
$originalSharePath = self::getPath($token);
// Create the activities
if (isset($originalSharePath) && Filesystem::isReadable($originalSharePath . $path)) {
$originalSharePath = Filesystem::normalizePath($originalSharePath . $path);
$isDir = \OC\Files\Filesystem::is_dir($originalSharePath);
$activities = [];
if (!$isDir) {
// Single file public share
$activities[$originalSharePath] = Activity::SUBJECT_PUBLIC_SHARED_FILE_DOWNLOADED;
} else if (!empty($files_list)) {
// Only some files are downloaded
foreach ($files_list as $file) {
$filePath = Filesystem::normalizePath($originalSharePath . '/' . $file);
$isDir = \OC\Files\Filesystem::is_dir($filePath);
$activities[$filePath] = ($isDir) ? Activity::SUBJECT_PUBLIC_SHARED_FOLDER_DOWNLOADED : Activity::SUBJECT_PUBLIC_SHARED_FILE_DOWNLOADED;
}
} else {
// The folder is downloaded
$activities[$originalSharePath] = Activity::SUBJECT_PUBLIC_SHARED_FOLDER_DOWNLOADED;
}
foreach ($activities as $filePath => $subject) {
$this->activityManager->publishActivity(
'files_sharing', $subject, array($filePath), '', array(),
$filePath, '', $linkItem['uid_owner'], Activity::TYPE_PUBLIC_LINKS, Activity::PRIORITY_MEDIUM
);
}
}
// download selected files
if (!is_null($files)) {
// FIXME: The exit is required here because otherwise the AppFramework is trying to add headers as well
// after dispatching the request which results in a "Cannot modify header information" notice.
OC_Files::get($originalSharePath, $files_list, $_SERVER['REQUEST_METHOD'] == 'HEAD');
@@ -263,22 +282,29 @@ class ShareController extends Controller {
}
/**
* @param $token
* @return null|string
* @param string $token
* @return string Resolved file path of the token
* @throws \Exception In case share could not get properly resolved
*/
private function getPath($token) {
$linkItem = Share::getShareByToken($token, false);
$path = null;
if (is_array($linkItem) && isset($linkItem['uid_owner'])) {
// seems to be a valid share
$rootLinkItem = Share::resolveReShare($linkItem);
if (isset($rootLinkItem['uid_owner'])) {
JSON::checkUserExists($rootLinkItem['uid_owner']);
if(!$this->userManager->userExists($rootLinkItem['uid_owner'])) {
throw new \Exception('Owner of the share does not exist anymore');
}
OC_Util::tearDownFS();
OC_Util::setupFS($rootLinkItem['uid_owner']);
$path = Filesystem::getPath($linkItem['file_source']);
if(!empty($path) && Filesystem::isReadable($path)) {
return $path;
}
}
}
return $path;
throw new \Exception('No file found belonging to file.');
}
}
+87 -30
View File
@@ -9,6 +9,7 @@
namespace OCA\Files_Sharing\External;
use OC\Files\Filesystem;
use OCP\Files;
class Manager {
const STORAGE = '\OCA\Files_Sharing\External\Storage';
@@ -29,7 +30,7 @@ class Manager {
private $mountManager;
/**
* @var \OC\Files\Storage\StorageFactory
* @var \OCP\Files\Storage\IStorageFactory
*/
private $storageLoader;
@@ -41,12 +42,12 @@ class Manager {
/**
* @param \OCP\IDBConnection $connection
* @param \OC\Files\Mount\Manager $mountManager
* @param \OC\Files\Storage\StorageFactory $storageLoader
* @param \OCP\Files\Storage\IStorageFactory $storageLoader
* @param \OC\HTTPHelper $httpHelper
* @param string $uid
*/
public function __construct(\OCP\IDBConnection $connection, \OC\Files\Mount\Manager $mountManager,
\OC\Files\Storage\StorageFactory $storageLoader, \OC\HTTPHelper $httpHelper, $uid) {
\OCP\Files\Storage\IStorageFactory $storageLoader, \OC\HTTPHelper $httpHelper, $uid) {
$this->connection = $connection;
$this->mountManager = $mountManager;
$this->storageLoader = $storageLoader;
@@ -65,33 +66,64 @@ class Manager {
* @param boolean $accepted
* @param string $user
* @param int $remoteId
* @return mixed
* @return Mount|null
*/
public function addShare($remote, $token, $password, $name, $owner, $accepted=false, $user = null, $remoteId = -1) {
$user = $user ? $user : $this->uid;
$accepted = $accepted ? 1 : 0;
$name = Filesystem::normalizePath('/' . $name);
$mountPoint = Filesystem::normalizePath('/' . $name);
if (!$accepted) {
// To avoid conflicts with the mount point generation later,
// we only use a temporary mount point name here. The real
// mount point name will be generated when accepting the share,
// using the original share item name.
$tmpMountPointName = '{{TemporaryMountPointName#' . $name . '}}';
$mountPoint = $tmpMountPointName;
$hash = md5($tmpMountPointName);
$data = [
'remote' => $remote,
'share_token' => $token,
'password' => $password,
'name' => $name,
'owner' => $owner,
'user' => $user,
'mountpoint' => $mountPoint,
'mountpoint_hash' => $hash,
'accepted' => $accepted,
'remote_id' => $remoteId,
];
$i = 1;
while (!$this->connection->insertIfNotExist('*PREFIX*share_external', $data, ['user', 'mountpoint_hash'])) {
// The external share already exists for the user
$data['mountpoint'] = $tmpMountPointName . '-' . $i;
$data['mountpoint_hash'] = md5($data['mountpoint']);
$i++;
}
return null;
}
$mountPoint = Files::buildNotExistingFileName('/', $name);
$mountPoint = Filesystem::normalizePath('/' . $mountPoint);
$hash = md5($mountPoint);
$query = $this->connection->prepare('
INSERT INTO `*PREFIX*share_external`
(`remote`, `share_token`, `password`, `name`, `owner`, `user`, `mountpoint`, `mountpoint_hash`, `accepted`, `remote_id`)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
');
$hash = md5($mountPoint);
$query->execute(array($remote, $token, $password, $name, $owner, $user, $mountPoint, $hash, $accepted, $remoteId));
if ($accepted) {
$options = array(
'remote' => $remote,
'token' => $token,
'password' => $password,
'mountpoint' => $mountPoint,
'owner' => $owner
);
return $this->mountShare($options);
}
$options = array(
'remote' => $remote,
'token' => $token,
'password' => $password,
'mountpoint' => $mountPoint,
'owner' => $owner
);
return $this->mountShare($options);
}
private function setupMounts() {
@@ -124,7 +156,7 @@ class Manager {
*/
private function getShare($id) {
$getShare = $this->connection->prepare('
SELECT `remote`, `share_token`
SELECT `remote`, `remote_id`, `share_token`, `name`
FROM `*PREFIX*share_external`
WHERE `id` = ? AND `user` = ?');
$result = $getShare->execute(array($id, $this->uid));
@@ -142,12 +174,18 @@ class Manager {
$share = $this->getShare($id);
if ($share) {
$mountPoint = Files::buildNotExistingFileName('/', $share['name']);
$mountPoint = Filesystem::normalizePath('/' . $mountPoint);
$hash = md5($mountPoint);
$acceptShare = $this->connection->prepare('
UPDATE `*PREFIX*share_external`
SET `accepted` = ?
SET `accepted` = ?,
`mountpoint` = ?,
`mountpoint_hash` = ?
WHERE `id` = ? AND `user` = ?');
$acceptShare->execute(array(1, $id, $this->uid));
$this->sendFeedbackToRemote($share['remote'], $share['share_token'], $id, 'accept');
$acceptShare->execute(array(1, $mountPoint, $hash, $id, $this->uid));
$this->sendFeedbackToRemote($share['remote'], $share['share_token'], $share['remote_id'], 'accept');
}
}
@@ -164,7 +202,7 @@ class Manager {
$removeShare = $this->connection->prepare('
DELETE FROM `*PREFIX*share_external` WHERE `id` = ? AND `user` = ?');
$removeShare->execute(array($id, $this->uid));
$this->sendFeedbackToRemote($share['remote'], $share['share_token'], $id, 'decline');
$this->sendFeedbackToRemote($share['remote'], $share['share_token'], $share['remote_id'], 'decline');
}
}
@@ -173,13 +211,13 @@ class Manager {
*
* @param string $remote
* @param string $token
* @param int $id
* @param int $remoteId Share id on the remote host
* @param string $feedback
* @return boolean
*/
private function sendFeedbackToRemote($remote, $token, $id, $feedback) {
private function sendFeedbackToRemote($remote, $token, $remoteId, $feedback) {
$url = $remote . \OCP\Share::BASE_PATH_TO_SHARE_API . '/' . $id . '/' . $feedback . '?format=' . \OCP\Share::RESPONSE_FORMAT;
$url = rtrim($remote, '/') . \OCP\Share::BASE_PATH_TO_SHARE_API . '/' . $remoteId . '/' . $feedback . '?format=' . \OCP\Share::RESPONSE_FORMAT;
$fields = array('token' => $token);
$result = $this->httpHelper->post($url, $fields);
@@ -315,10 +353,29 @@ class Manager {
* @return array list of open server-to-server shares
*/
public function getOpenShares() {
$openShares = $this->connection->prepare('SELECT * FROM `*PREFIX*share_external` WHERE `accepted` = ? AND `user` = ?');
$result = $openShares->execute(array(0, $this->uid));
return $result ? $openShares->fetchAll() : array();
return $this->getShares(false);
}
}
/**
* return a list of shares for the user
*
* @param bool|null $accepted True for accepted only,
* false for not accepted,
* null for all shares of the user
* @return array list of open server-to-server shares
*/
private function getShares($accepted) {
$query = 'SELECT * FROM `*PREFIX*share_external` WHERE `user` = ?';
$parameters = [$this->uid];
if (!is_null($accepted)) {
$query .= ' AND `accepted` = ?';
$parameters[] = (int) $accepted;
}
$query .= ' ORDER BY `id` ASC';
$shares = $this->connection->prepare($query);
$result = $shares->execute($parameters);
return $result ? $shares->fetchAll() : [];
}
}
+3 -2
View File
@@ -70,7 +70,7 @@ class Storage extends DAV implements ISharedStorage {
'host' => $host,
'root' => $root,
'user' => $options['token'],
'password' => $options['password']
'password' => (string)$options['password']
));
}
@@ -237,7 +237,8 @@ class Storage extends DAV implements ISharedStorage {
$errorMessage = curl_error($ch);
curl_close($ch);
if (!empty($errorMessage)) {
throw new \Exception($errorMessage);
\OCP\Util::writeLog('files_sharing', 'Error getting remote share info: ' . $errorMessage, \OCP\Util::ERROR);
throw new StorageNotAvailableException($errorMessage);
}
switch ($status) {
+14 -1
View File
@@ -257,8 +257,21 @@ class Helper {
*/
public static function getShareFolder() {
$shareFolder = \OC::$server->getConfig()->getSystemValue('share_folder', '/');
$shareFolder = \OC\Files\Filesystem::normalizePath($shareFolder);
if (!\OC\Files\Filesystem::file_exists($shareFolder)) {
$dir = '';
$subdirs = explode('/', $shareFolder);
foreach ($subdirs as $subdir) {
$dir = $dir . '/' . $subdir;
if (!\OC\Files\Filesystem::is_dir($dir)) {
\OC\Files\Filesystem::mkdir($dir);
}
}
}
return $shareFolder;
return \OC\Files\Filesystem::normalizePath($shareFolder);
}
/**
@@ -11,6 +11,7 @@
namespace OCA\Files_Sharing\Middleware;
use OCP\App\IAppManager;
use OCP\AppFramework\Http\NotFoundResponse;
use OCP\AppFramework\Middleware;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\IConfig;
@@ -59,7 +60,7 @@ class SharingCheckMiddleware extends Middleware {
* @return TemplateResponse
*/
public function afterException($controller, $methodName, \Exception $exception){
return new TemplateResponse('core', '404', array(), 'guest');
return new NotFoundResponse();
}
/**
-27
View File
@@ -1,27 +0,0 @@
<?php
/**
* Copyright (c) 2014 Robin Appelman <icewind@owncloud.com>
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
namespace OCA\Files_Sharing;
use OC\Files\Cache\Cache;
class ReadOnlyCache extends Cache {
public function get($path) {
$data = parent::get($path);
$data['permissions'] &= (\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_SHARE);
return $data;
}
public function getFolderContents($path) {
$content = parent::getFolderContents($path);
foreach ($content as &$data) {
$data['permissions'] &= (\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_SHARE);
}
return $content;
}
}
+4 -1
View File
@@ -8,7 +8,9 @@
namespace OCA\Files_Sharing;
use OC\Files\Cache\Wrapper\CachePermissionsMask;
use OC\Files\Storage\Wrapper\Wrapper;
use OCP\Constants;
class ReadOnlyWrapper extends Wrapper {
public function isUpdatable($path) {
@@ -51,6 +53,7 @@ class ReadOnlyWrapper extends Wrapper {
if (!$storage) {
$storage = $this;
}
return new ReadOnlyCache($storage);
$sourceCache = $this->storage->getCache($path, $storage);
return new CachePermissionsMask($sourceCache, Constants::PERMISSION_READ | Constants::PERMISSION_SHARE);
}
}
+2 -2
View File
@@ -35,8 +35,8 @@ class SharedMount extends MountPoint implements MoveableMount {
$mountPoint = basename($share['file_target']);
$parent = dirname($share['file_target']);
while (!\OC\Files\Filesystem::is_dir($parent)) {
$parent = dirname($parent);
if (!\OC\Files\Filesystem::is_dir($parent)) {
$parent = Helper::getShareFolder();
}
$newMountPoint = \OCA\Files_Sharing\Helper::generateUniqueTarget(
+39 -19
View File
@@ -293,26 +293,34 @@ class Shared extends \OC\Files\Storage\Common implements ISharedStorage {
// we need the paths relative to data/user/files
$relPath1 = $this->getMountPoint() . '/' . $path1;
$relPath2 = $this->getMountPoint() . '/' . $path2;
$pathinfo = pathinfo($relPath1);
// check for update permissions on the share
if ($this->isUpdatable('')) {
$pathinfo = pathinfo($relPath1);
// for part files we need to ask for the owner and path from the parent directory because
// the file cache doesn't return any results for part files
if (isset($pathinfo['extension']) && $pathinfo['extension'] === 'part') {
list($user1, $path1) = \OCA\Files_Sharing\Helper::getUidAndFilename($pathinfo['dirname']);
$path1 = $path1 . '/' . $pathinfo['basename'];
} else {
list($user1, $path1) = \OCA\Files_Sharing\Helper::getUidAndFilename($relPath1);
$isPartFile = (isset($pathinfo['extension']) && $pathinfo['extension'] === 'part');
$targetExists = $this->file_exists($path2);
$sameFolder = (dirname($relPath1) === dirname($relPath2));
if ($targetExists || ($sameFolder && !$isPartFile)) {
// note that renaming a share mount point is always allowed
if (!$this->isUpdatable('')) {
return false;
}
} else {
if (!$this->isCreatable('')) {
return false;
}
$targetFilename = basename($relPath2);
list($user2, $path2) = \OCA\Files_Sharing\Helper::getUidAndFilename(dirname($relPath2));
$rootView = new \OC\Files\View('');
return $rootView->rename('/' . $user1 . '/files/' . $path1, '/' . $user2 . '/files/' . $path2 . '/' . $targetFilename);
}
return false;
// for part files we need to ask for the owner and path from the parent directory because
// the file cache doesn't return any results for part files
if ($isPartFile) {
list($user1, $path1) = \OCA\Files_Sharing\Helper::getUidAndFilename($pathinfo['dirname']);
$path1 = $path1 . '/' . $pathinfo['basename'];
} else {
list($user1, $path1) = \OCA\Files_Sharing\Helper::getUidAndFilename($relPath1);
}
$targetFilename = basename($relPath2);
list($user2, $path2) = \OCA\Files_Sharing\Helper::getUidAndFilename(dirname($relPath2));
$rootView = new \OC\Files\View('');
return $rootView->rename('/' . $user1 . '/files/' . $path1, '/' . $user2 . '/files/' . $path2 . '/' . $targetFilename);
}
public function copy($path1, $path2) {
@@ -343,13 +351,25 @@ class Shared extends \OC\Files\Storage\Common implements ISharedStorage {
case 'xb':
case 'a':
case 'ab':
$exists = $this->file_exists($path);
if ($exists && !$this->isUpdatable($path)) {
$creatable = $this->isCreatable($path);
$updatable = $this->isUpdatable($path);
// if neither permissions given, no need to continue
if (!$creatable && !$updatable) {
return false;
}
if (!$exists && !$this->isCreatable(dirname($path))) {
$exists = $this->file_exists($path);
// if a file exists, updatable permissions are required
if ($exists && !$updatable) {
return false;
}
// part file is allowed if !$creatable but the final file is $updatable
if (pathinfo($path, PATHINFO_EXTENSION) !== 'part') {
if (!$exists && !$creatable) {
return false;
}
}
}
$info = array(
'target' => $this->getMountPoint() . $path,
+2 -2
View File
@@ -145,10 +145,10 @@ class Shared_Updater {
$shareType = $params['shareType'];
if ($shareType === \OCP\Share::SHARE_TYPE_USER) {
self::correctUsersFolder($shareWith, '/');
self::correctUsersFolder($shareWith, $params['fileTarget']);
} elseif ($shareType === \OCP\Share::SHARE_TYPE_GROUP) {
foreach (\OC_Group::usersInGroup($shareWith) as $user) {
self::correctUsersFolder($user, '/');
self::correctUsersFolder($user, $params['fileTarget']);
}
}
}
+2 -1
View File
@@ -40,7 +40,8 @@ $server->addPlugin(new OC_Connector_Sabre_ExceptionLoggerPlugin('webdav'));
// wait with registering these until auth is handled and the filesystem is setup
$server->subscribeEvent('beforeMethod', function () use ($server, $objectTree, $authBackend) {
$share = $authBackend->getShare();
$owner = $share['uid_owner'];
$rootShare = \OCP\Share::resolveReShare($share);
$owner = $rootShare['uid_owner'];
$isWritable = $share['permissions'] & (\OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_CREATE);
$fileId = $share['file_source'];
+3 -3
View File
@@ -60,7 +60,7 @@ $previewSupported = OC\Preview::isMimeSupported($_['mimetype']) ? 'true' : 'fals
if ($_['server2serversharing']) {
?>
<span id="save" data-protected="<?php p($_['protected']) ?>"
data-owner="<?php p($_['displayName']) ?>" data-name="<?php p($_['filename']) ?>">
data-owner-display-name="<?php p($_['displayName']) ?>" data-owner="<?php p($_['owner']) ?>" data-name="<?php p($_['filename']) ?>">
<button id="save-button"><?php p($l->t('Add to your ownCloud')) ?></button>
<form class="save-form hidden" action="#">
<input type="text" id="remote_address" placeholder="example.com/owncloud"/>
@@ -80,7 +80,7 @@ $previewSupported = OC\Preview::isMimeSupported($_['mimetype']) ? 'true' : 'fals
<?php if (isset($_['folder'])): ?>
<?php print_unescaped($_['folder']); ?>
<?php else: ?>
<?php if (substr($_['mimetype'], 0, strpos($_['mimetype'], '/')) == 'video'): ?>
<?php if ($_['previewEnabled'] && substr($_['mimetype'], 0, strpos($_['mimetype'], '/')) == 'video'): ?>
<div id="imgframe">
<video tabindex="0" controls="" preload="none">
<source src="<?php p($_['downloadURL']); ?>" type="<?php p($_['mimetype']); ?>" />
@@ -91,7 +91,7 @@ $previewSupported = OC\Preview::isMimeSupported($_['mimetype']) ? 'true' : 'fals
<div id="imgframe"></div>
<?php endif; ?>
<div class="directDownload">
<a href="<?php p($_['downloadURL']); ?>" id="download" class="button">
<a href="<?php p($_['downloadURL']); ?>" id="downloadFile" class="button">
<img class="svg" alt="" src="<?php print_unescaped(OCP\image_path("core", "actions/download.svg")); ?>"/>
<?php p($l->t('Download %s', array($_['filename'])))?> (<?php p($_['fileSize']) ?>)
</a>
+41 -1
View File
@@ -851,7 +851,6 @@ class Test_Files_Sharing_Api extends TestCase {
$this->assertEquals('1', $newUserShare['permissions']);
// update password for link share
$this->assertTrue(empty($linkShare['share_with']));
$params = array();
@@ -876,6 +875,29 @@ class Test_Files_Sharing_Api extends TestCase {
$this->assertTrue(is_array($newLinkShare));
$this->assertTrue(!empty($newLinkShare['share_with']));
// Remove password for link share
$params = array();
$params['id'] = $linkShare['id'];
$params['_put'] = array();
$params['_put']['password'] = '';
$result = \OCA\Files_Sharing\API\Local::updateShare($params);
$this->assertTrue($result->succeeded());
$items = \OCP\Share::getItemShared('file', $linkShare['file_source']);
$newLinkShare = null;
foreach ($items as $item) {
if ($item['share_type'] === \OCP\Share::SHARE_TYPE_LINK) {
$newLinkShare = $item;
break;
}
}
$this->assertTrue(is_array($newLinkShare));
$this->assertTrue(empty($newLinkShare['share_with']));
\OCP\Share::unshare('file', $fileInfo['fileid'], \OCP\Share::SHARE_TYPE_USER,
\Test_Files_Sharing_Api::TEST_FILES_SHARING_API_USER2);
@@ -1008,6 +1030,24 @@ class Test_Files_Sharing_Api extends TestCase {
$this->assertTrue(is_array($updatedLinkShare));
$this->assertEquals($dateWithinRange->format('Y-m-d') . ' 00:00:00', $updatedLinkShare['expiration']);
// Try to remove expire date
$params = array();
$params['id'] = $linkShare['id'];
$params['_put'] = ['expireDate' => ''];
$result = \OCA\Files_Sharing\API\Local::updateShare($params);
$this->assertFalse($result->succeeded());
$items = \OCP\Share::getItemShared('file', $linkShare['file_source']);
$updatedLinkShare = reset($items);
// date shouldn't be changed
$this->assertTrue(is_array($updatedLinkShare));
$this->assertEquals($dateWithinRange->format('Y-m-d') . ' 00:00:00', $updatedLinkShare['expiration']);
// cleanup
$config->setAppValue('core', 'shareapi_default_expire_date', 'no');
$config->setAppValue('core', 'shareapi_enforce_expire_date', 'no');
@@ -12,6 +12,7 @@ namespace OCA\Files_Sharing\Controllers;
use OC\Files\Filesystem;
use OCA\Files_Sharing\Application;
use OCP\AppFramework\Http\NotFoundResponse;
use OCP\AppFramework\IAppContainer;
use OCP\Files;
use OCP\AppFramework\Http\RedirectResponse;
@@ -24,7 +25,7 @@ use OC\URLGenerator;
/**
* @package OCA\Files_Sharing\Controllers
*/
class ShareControllerTest extends \PHPUnit_Framework_TestCase {
class ShareControllerTest extends \Test\TestCase {
/** @var IAppContainer */
private $container;
@@ -40,6 +41,8 @@ class ShareControllerTest extends \PHPUnit_Framework_TestCase {
private $urlGenerator;
protected function setUp() {
parent::setUp();
$app = new Application();
$this->container = $app->getContainer();
$this->container['Config'] = $this->getMockBuilder('\OCP\IConfig')
@@ -49,6 +52,8 @@ class ShareControllerTest extends \PHPUnit_Framework_TestCase {
->disableOriginalConstructor()->getMock();
$this->container['URLGenerator'] = $this->getMockBuilder('\OC\URLGenerator')
->disableOriginalConstructor()->getMock();
$this->container['UserManager'] = $this->getMockBuilder('\OCP\IUserManager')
->disableOriginalConstructor()->getMock();
$this->urlGenerator = $this->container['URLGenerator'];
$this->shareController = $this->container['ShareController'];
@@ -89,6 +94,8 @@ class ShareControllerTest extends \PHPUnit_Framework_TestCase {
// Set old user
\OC_User::setUserId($this->oldUser);
\OC_Util::setupFS($this->oldUser);
parent::tearDown();
}
public function testShowAuthenticate() {
@@ -115,7 +122,7 @@ class ShareControllerTest extends \PHPUnit_Framework_TestCase {
public function testAuthenticate() {
// Test without a not existing token
$response = $this->shareController->authenticate('ThisTokenShouldHopefullyNeverExistSoThatTheUnitTestWillAlwaysPass :)');
$expectedResponse = new TemplateResponse('core', '404', array(), 'guest');
$expectedResponse = new NotFoundResponse();
$this->assertEquals($expectedResponse, $response);
// Test with a valid password
@@ -130,9 +137,14 @@ class ShareControllerTest extends \PHPUnit_Framework_TestCase {
}
public function testShowShare() {
$this->container['UserManager']->expects($this->exactly(2))
->method('userExists')
->with($this->user)
->will($this->returnValue(true));
// Test without a not existing token
$response = $this->shareController->showShare('ThisTokenShouldHopefullyNeverExistSoThatTheUnitTestWillAlwaysPass :)');
$expectedResponse = new TemplateResponse('core', '404', array(), 'guest');
$expectedResponse = new NotFoundResponse();
$this->assertEquals($expectedResponse, $response);
// Test with a password protected share and no authentication
@@ -146,6 +158,7 @@ class ShareControllerTest extends \PHPUnit_Framework_TestCase {
$response = $this->shareController->showShare($this->token);
$sharedTmplParams = array(
'displayName' => $this->user,
'owner' => $this->user,
'filename' => 'file1.txt',
'directory_path' => '/file1.txt',
'mimetype' => 'text/plain',
@@ -158,6 +171,7 @@ class ShareControllerTest extends \PHPUnit_Framework_TestCase {
'fileSize' => '33 B',
'nonHumanFileSize' => 33,
'maxSizeAnimateGif' => 10,
'previewEnabled' => true,
);
$expectedResponse = new TemplateResponse($this->container['AppName'], 'public', $sharedTmplParams, 'base');
$this->assertEquals($expectedResponse, $response);
@@ -170,4 +184,54 @@ class ShareControllerTest extends \PHPUnit_Framework_TestCase {
array('token' => $this->token)));
$this->assertEquals($expectedResponse, $response);
}
/**
* @expectedException \Exception
* @expectedExceptionMessage No file found belonging to file.
*/
public function testShowShareWithDeletedFile() {
$this->container['UserManager']->expects($this->once())
->method('userExists')
->with($this->user)
->will($this->returnValue(true));
$view = new View('/'. $this->user . '/files');
$view->unlink('file1.txt');
$linkItem = Share::getShareByToken($this->token, false);
\OC::$server->getSession()->set('public_link_authenticated', $linkItem['id']);
$this->shareController->showShare($this->token);
}
/**
* @expectedException \Exception
* @expectedExceptionMessage No file found belonging to file.
*/
public function testDownloadShareWithDeletedFile() {
$this->container['UserManager']->expects($this->once())
->method('userExists')
->with($this->user)
->will($this->returnValue(true));
$view = new View('/'. $this->user . '/files');
$view->unlink('file1.txt');
$linkItem = Share::getShareByToken($this->token, false);
\OC::$server->getSession()->set('public_link_authenticated', $linkItem['id']);
$this->shareController->downloadShare($this->token);
}
/**
* @expectedException \Exception
* @expectedExceptionMessage Owner of the share does not exist anymore
*/
public function testShowShareWithNotExistingUser() {
$this->container['UserManager']->expects($this->once())
->method('userExists')
->with($this->user)
->will($this->returnValue(false));
$linkItem = Share::getShareByToken($this->token, false);
\OC::$server->getSession()->set('public_link_authenticated', $linkItem['id']);
$this->shareController->showShare($this->token);
}
}
+216
View File
@@ -0,0 +1,216 @@
<?php
/**
* ownCloud
*
* @author Joas Schilling
* @copyright 2015 Joas Schilling <nickvergessen@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/>.
*
*/
namespace OCA\Files_Sharing\Tests\External;
use OC\Files\Storage\StorageFactory;
use OCA\Files_Sharing\External\Manager;
use OCA\Files_Sharing\Tests\TestCase;
class ManagerTest extends TestCase {
/** @var Manager **/
private $manager;
/** @var \OC\Files\Mount\Manager */
private $mountManager;
/** @var \PHPUnit_Framework_MockObject_MockObject */
private $httpHelper;
private $uid;
protected function setUp() {
parent::setUp();
$this->uid = $this->getUniqueID('user');
$this->mountManager = new \OC\Files\Mount\Manager();
$this->httpHelper = $httpHelper = $this->getMockBuilder('\OC\HTTPHelper')->disableOriginalConstructor()->getMock();
/** @var \OC\HTTPHelper $httpHelper */
$this->manager = new Manager(
\OC::$server->getDatabaseConnection(),
$this->mountManager,
new StorageFactory(),
$httpHelper,
$this->uid
);
}
public function testAddShare() {
$shareData1 = [
'remote' => 'http://localhost',
'token' => 'token1',
'password' => '',
'name' => '/SharedFolder',
'owner' => 'foobar',
'accepted' => false,
'user' => $this->uid,
];
$shareData2 = $shareData1;
$shareData2['token'] = 'token2';
$shareData3 = $shareData1;
$shareData3['token'] = 'token3';
// Add a share for "user"
$this->assertSame(null, call_user_func_array([$this->manager, 'addShare'], $shareData1));
$openShares = $this->manager->getOpenShares();
$this->assertCount(1, $openShares);
$this->assertExternalShareEntry($shareData1, $openShares[0], 1, '{{TemporaryMountPointName#' . $shareData1['name'] . '}}');
\Test_Helper::invokePrivate($this->manager, 'setupMounts');
$this->assertNotMount('SharedFolder');
$this->assertNotMount('{{TemporaryMountPointName#' . $shareData1['name'] . '}}');
// Add a second share for "user" with the same name
$this->assertSame(null, call_user_func_array([$this->manager, 'addShare'], $shareData2));
$openShares = $this->manager->getOpenShares();
$this->assertCount(2, $openShares);
$this->assertExternalShareEntry($shareData1, $openShares[0], 1, '{{TemporaryMountPointName#' . $shareData1['name'] . '}}');
// New share falls back to "-1" appendix, because the name is already taken
$this->assertExternalShareEntry($shareData2, $openShares[1], 2, '{{TemporaryMountPointName#' . $shareData2['name'] . '}}-1');
\Test_Helper::invokePrivate($this->manager, 'setupMounts');
$this->assertNotMount('SharedFolder');
$this->assertNotMount('{{TemporaryMountPointName#' . $shareData1['name'] . '}}');
$this->assertNotMount('{{TemporaryMountPointName#' . $shareData1['name'] . '}}-1');
$this->httpHelper->expects($this->at(0))
->method('post')
->with($this->stringStartsWith('http://localhost/ocs/v1.php/cloud/shares/' . $openShares[0]['remote_id']), $this->anything());
// Accept the first share
$this->manager->acceptShare($openShares[0]['id']);
// Check remaining shares - Accepted
$acceptedShares = \Test_Helper::invokePrivate($this->manager, 'getShares', [true]);
$this->assertCount(1, $acceptedShares);
$shareData1['accepted'] = true;
$this->assertExternalShareEntry($shareData1, $acceptedShares[0], 1, $shareData1['name']);
// Check remaining shares - Open
$openShares = $this->manager->getOpenShares();
$this->assertCount(1, $openShares);
$this->assertExternalShareEntry($shareData2, $openShares[0], 2, '{{TemporaryMountPointName#' . $shareData2['name'] . '}}-1');
\Test_Helper::invokePrivate($this->manager, 'setupMounts');
$this->assertMount($shareData1['name']);
$this->assertNotMount('{{TemporaryMountPointName#' . $shareData1['name'] . '}}');
$this->assertNotMount('{{TemporaryMountPointName#' . $shareData1['name'] . '}}-1');
// Add another share for "user" with the same name
$this->assertSame(null, call_user_func_array([$this->manager, 'addShare'], $shareData3));
$openShares = $this->manager->getOpenShares();
$this->assertCount(2, $openShares);
$this->assertExternalShareEntry($shareData2, $openShares[0], 2, '{{TemporaryMountPointName#' . $shareData2['name'] . '}}-1');
// New share falls back to the original name (no "-\d", because the name is not taken)
$this->assertExternalShareEntry($shareData3, $openShares[1], 3, '{{TemporaryMountPointName#' . $shareData3['name'] . '}}');
\Test_Helper::invokePrivate($this->manager, 'setupMounts');
$this->assertMount($shareData1['name']);
$this->assertNotMount('{{TemporaryMountPointName#' . $shareData1['name'] . '}}');
$this->assertNotMount('{{TemporaryMountPointName#' . $shareData1['name'] . '}}-1');
$this->httpHelper->expects($this->at(0))
->method('post')
->with($this->stringStartsWith('http://localhost/ocs/v1.php/cloud/shares/' . $openShares[1]['remote_id'] . '/decline'), $this->anything());
// Decline the third share
$this->manager->declineShare($openShares[1]['id']);
\Test_Helper::invokePrivate($this->manager, 'setupMounts');
$this->assertMount($shareData1['name']);
$this->assertNotMount('{{TemporaryMountPointName#' . $shareData1['name'] . '}}');
$this->assertNotMount('{{TemporaryMountPointName#' . $shareData1['name'] . '}}-1');
// Check remaining shares - Accepted
$acceptedShares = \Test_Helper::invokePrivate($this->manager, 'getShares', [true]);
$this->assertCount(1, $acceptedShares);
$shareData1['accepted'] = true;
$this->assertExternalShareEntry($shareData1, $acceptedShares[0], 1, $shareData1['name']);
// Check remaining shares - Open
$openShares = $this->manager->getOpenShares();
$this->assertCount(1, $openShares);
$this->assertExternalShareEntry($shareData2, $openShares[0], 2, '{{TemporaryMountPointName#' . $shareData2['name'] . '}}-1');
\Test_Helper::invokePrivate($this->manager, 'setupMounts');
$this->assertMount($shareData1['name']);
$this->assertNotMount('{{TemporaryMountPointName#' . $shareData1['name'] . '}}');
$this->assertNotMount('{{TemporaryMountPointName#' . $shareData1['name'] . '}}-1');
$this->httpHelper->expects($this->at(0))
->method('post')
->with($this->stringStartsWith('http://localhost/ocs/v1.php/cloud/shares/' . $openShares[0]['remote_id'] . '/decline'), $this->anything());
$this->httpHelper->expects($this->at(1))
->method('post')
->with($this->stringStartsWith('http://localhost/ocs/v1.php/cloud/shares/' . $acceptedShares[0]['remote_id'] . '/decline'), $this->anything());
$this->manager->removeUserShares($this->uid);
$this->assertEmpty(\Test_Helper::invokePrivate($this->manager, 'getShares', [null]), 'Asserting all shares for the user have been deleted');
$this->mountManager->clear();
\Test_Helper::invokePrivate($this->manager, 'setupMounts');
$this->assertNotMount($shareData1['name']);
$this->assertNotMount('{{TemporaryMountPointName#' . $shareData1['name'] . '}}');
$this->assertNotMount('{{TemporaryMountPointName#' . $shareData1['name'] . '}}-1');
}
/**
* @param array $expected
* @param array $actual
* @param int $share
* @param string $mountPoint
*/
protected function assertExternalShareEntry($expected, $actual, $share, $mountPoint) {
$this->assertEquals($expected['remote'], $actual['remote'], 'Asserting remote of a share #' . $share);
$this->assertEquals($expected['token'], $actual['share_token'], 'Asserting token of a share #' . $share);
$this->assertEquals($expected['name'], $actual['name'], 'Asserting name of a share #' . $share);
$this->assertEquals($expected['owner'], $actual['owner'], 'Asserting owner of a share #' . $share);
$this->assertEquals($expected['accepted'], (int) $actual['accepted'], 'Asserting accept of a share #' . $share);
$this->assertEquals($expected['user'], $actual['user'], 'Asserting user of a share #' . $share);
$this->assertEquals($mountPoint, $actual['mountpoint'], 'Asserting mountpoint of a share #' . $share);
}
private function assertMount($mountPoint) {
$mountPoint = rtrim($mountPoint, '/');
$mount = $this->mountManager->find($this->getFullPath($mountPoint));
$this->assertInstanceOf('\OCA\Files_Sharing\External\Mount', $mount);
$this->assertInstanceOf('\OCP\Files\Mount\IMountPoint', $mount);
$this->assertEquals($this->getFullPath($mountPoint), rtrim($mount->getMountPoint(), '/'));
$storage = $mount->getStorage();
$this->assertInstanceOf('\OCA\Files_Sharing\External\Storage', $storage);
}
private function assertNotMount($mountPoint) {
$mountPoint = rtrim($mountPoint, '/');
$mount = $this->mountManager->find($this->getFullPath($mountPoint));
if ($mount) {
$this->assertInstanceOf('\OCP\Files\Mount\IMountPoint', $mount);
$this->assertNotEquals($this->getFullPath($mountPoint), rtrim($mount->getMountPoint(), '/'));
} else {
$this->assertNull($mount);
}
}
private function getFullPath($path) {
return '/' . $this->uid . '/files' . $path;
}
}
+4 -2
View File
@@ -30,9 +30,11 @@ class Test_Files_Sharing_Helper extends TestCase {
function testSetGetShareFolder() {
$this->assertSame('/', \OCA\Files_Sharing\Helper::getShareFolder());
\OCA\Files_Sharing\Helper::setShareFolder('/Shared');
\OCA\Files_Sharing\Helper::setShareFolder('/Shared/Folder');
$this->assertSame('/Shared', \OCA\Files_Sharing\Helper::getShareFolder());
$sharedFolder = \OCA\Files_Sharing\Helper::getShareFolder();
$this->assertSame('/Shared/Folder', \OCA\Files_Sharing\Helper::getShareFolder());
$this->assertTrue(\OC\Files\Filesystem::is_dir($sharedFolder));
// cleanup
\OC::$server->getConfig()->deleteSystemValue('share_folder');
@@ -67,6 +67,7 @@ describe('OCA.Sharing external tests', function() {
remote: 'http://example.com/owncloud',
token: 'abcdefg',
owner: 'theowner',
ownerDisplayName: 'The Generous Owner',
name: 'the share name'
};
});
@@ -88,6 +89,7 @@ describe('OCA.Sharing external tests', function() {
remote: 'http://example.com/owncloud',
token: 'abcdefg',
owner: 'theowner',
ownerDisplayName: 'The Generous Owner',
name: 'the share name',
password: ''
});
@@ -104,6 +106,7 @@ describe('OCA.Sharing external tests', function() {
remote: 'http://example.com/owncloud',
token: 'abcdefg',
owner: 'theowner',
ownerDisplayName: 'The Generous Owner',
name: 'the share name',
password: 'thepassword'
});
@@ -148,6 +151,7 @@ describe('OCA.Sharing external tests', function() {
remote: 'http://example.com/owncloud',
token: 'abcdefg',
owner: 'theowner',
ownerDisplayName: 'The Generous Owner',
name: 'the share name'
};
});
+90
View File
@@ -0,0 +1,90 @@
<?php
/**
* ownCloud
*
* @author Robin Appelman
* @copyright 2015 Robin Appelman <icewind@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/>.
*
*/
namespace OCA\Files_sharing\Tests;
use OC\Files\View;
class Propagation extends TestCase {
public function testSizePropagationWhenOwnerChangesFile() {
$this->loginAsUser(self::TEST_FILES_SHARING_API_USER1);
$recipientView = new View('/' . self::TEST_FILES_SHARING_API_USER1 . '/files');
$this->loginAsUser(self::TEST_FILES_SHARING_API_USER2);
$ownerView = new View('/' . self::TEST_FILES_SHARING_API_USER2 . '/files');
$ownerView->mkdir('/sharedfolder/subfolder');
$ownerView->file_put_contents('/sharedfolder/subfolder/foo.txt', 'bar');
$sharedFolderInfo = $ownerView->getFileInfo('/sharedfolder', false);
\OCP\Share::shareItem('folder', $sharedFolderInfo->getId(), \OCP\Share::SHARE_TYPE_USER, self::TEST_FILES_SHARING_API_USER1, 31);
$ownerRootInfo = $ownerView->getFileInfo('', false);
$this->loginAsUser(self::TEST_FILES_SHARING_API_USER1);
$this->assertTrue($recipientView->file_exists('/sharedfolder/subfolder/foo.txt'));
$recipientRootInfo = $recipientView->getFileInfo('', false);
// when file changed as owner
$this->loginAsUser(self::TEST_FILES_SHARING_API_USER2);
$ownerView->file_put_contents('/sharedfolder/subfolder/foo.txt', 'foobar');
// size of recipient's root stays the same
$this->loginAsUser(self::TEST_FILES_SHARING_API_USER1);
$newRecipientRootInfo = $recipientView->getFileInfo('', false);
$this->assertEquals($recipientRootInfo->getSize(), $newRecipientRootInfo->getSize());
// size of owner's root increases
$this->loginAsUser(self::TEST_FILES_SHARING_API_USER2);
$newOwnerRootInfo = $ownerView->getFileInfo('', false);
$this->assertEquals($ownerRootInfo->getSize() + 3, $newOwnerRootInfo->getSize());
}
public function testSizePropagationWhenRecipientChangesFile() {
$this->loginAsUser(self::TEST_FILES_SHARING_API_USER1);
$recipientView = new View('/' . self::TEST_FILES_SHARING_API_USER1 . '/files');
$this->loginAsUser(self::TEST_FILES_SHARING_API_USER2);
$ownerView = new View('/' . self::TEST_FILES_SHARING_API_USER2 . '/files');
$ownerView->mkdir('/sharedfolder/subfolder');
$ownerView->file_put_contents('/sharedfolder/subfolder/foo.txt', 'bar');
$sharedFolderInfo = $ownerView->getFileInfo('/sharedfolder', false);
\OCP\Share::shareItem('folder', $sharedFolderInfo->getId(), \OCP\Share::SHARE_TYPE_USER, self::TEST_FILES_SHARING_API_USER1, 31);
$ownerRootInfo = $ownerView->getFileInfo('', false);
$this->loginAsUser(self::TEST_FILES_SHARING_API_USER1);
$this->assertTrue($recipientView->file_exists('/sharedfolder/subfolder/foo.txt'));
$recipientRootInfo = $recipientView->getFileInfo('', false);
// when file changed as recipient
$recipientView->file_put_contents('/sharedfolder/subfolder/foo.txt', 'foobar');
// size of recipient's root stays the same
$newRecipientRootInfo = $recipientView->getFileInfo('', false);
$this->assertEquals($recipientRootInfo->getSize(), $newRecipientRootInfo->getSize());
// size of owner's root increases
$this->loginAsUser(self::TEST_FILES_SHARING_API_USER2);
$newOwnerRootInfo = $ownerView->getFileInfo('', false);
$this->assertEquals($ownerRootInfo->getSize() + 3, $newOwnerRootInfo->getSize());
}
}
+9 -3
View File
@@ -141,14 +141,20 @@ class Test_Files_Sharing_Mount extends OCA\Files_sharing\Tests\TestCase {
self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
\OC\Files\Filesystem::rename($this->filename, "newFileName");
\OC\Files\Filesystem::rename($this->filename, $this->filename . '_renamed');
$this->assertTrue(\OC\Files\Filesystem::file_exists('newFileName'));
$this->assertTrue(\OC\Files\Filesystem::file_exists($this->filename . '_renamed'));
$this->assertFalse(\OC\Files\Filesystem::file_exists($this->filename));
self::loginHelper(self::TEST_FILES_SHARING_API_USER1);
$this->assertTrue(\OC\Files\Filesystem::file_exists($this->filename));
$this->assertFalse(\OC\Files\Filesystem::file_exists("newFileName"));
$this->assertFalse(\OC\Files\Filesystem::file_exists($this->filename . '_renamed'));
// rename back to original name
self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
\OC\Files\Filesystem::rename($this->filename . '_renamed', $this->filename);
$this->assertFalse(\OC\Files\Filesystem::file_exists($this->filename . '_renamed'));
$this->assertTrue(\OC\Files\Filesystem::file_exists($this->filename));
//cleanup
\OCP\Share::unshare('file', $fileinfo['fileid'], \OCP\Share::SHARE_TYPE_USER, self::TEST_FILES_SHARING_API_USER2);
+153 -2
View File
@@ -182,9 +182,8 @@ class Test_Files_Sharing_Storage extends OCA\Files_sharing\Tests\TestCase {
// for the share root we expect:
// the shared permissions (1)
// the delete permission (8), to enable unshare
// the update permission (2), to allow renaming of the mount point
$rootInfo = \OC\Files\Filesystem::getFileInfo($this->folder);
$this->assertSame(11, $rootInfo->getPermissions());
$this->assertSame(9, $rootInfo->getPermissions());
// for the file within the shared folder we expect:
// the shared permissions (1)
@@ -199,6 +198,158 @@ class Test_Files_Sharing_Storage extends OCA\Files_sharing\Tests\TestCase {
$this->assertTrue($result);
}
public function testFopenWithReadOnlyPermission() {
$this->view->file_put_contents($this->folder . '/existing.txt', 'foo');
$fileinfoFolder = $this->view->getFileInfo($this->folder);
$result = \OCP\Share::shareItem('folder', $fileinfoFolder['fileid'], \OCP\Share::SHARE_TYPE_USER,
self::TEST_FILES_SHARING_API_USER2, \OCP\Constants::PERMISSION_READ);
$this->assertTrue($result);
self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
$user2View = new \OC\Files\View('/' . self::TEST_FILES_SHARING_API_USER2 . '/files');
// part file should be forbidden
$handle = $user2View->fopen($this->folder . '/test.txt.part', 'w');
$this->assertFalse($handle);
// regular file forbidden
$handle = $user2View->fopen($this->folder . '/test.txt', 'w');
$this->assertFalse($handle);
// rename forbidden
$this->assertFalse($user2View->rename($this->folder . '/existing.txt', $this->folder . '/existing2.txt'));
// delete forbidden
$this->assertFalse($user2View->unlink($this->folder . '/existing.txt'));
//cleanup
self::loginHelper(self::TEST_FILES_SHARING_API_USER1);
$result = \OCP\Share::unshare('folder', $fileinfoFolder['fileid'], \OCP\Share::SHARE_TYPE_USER,
self::TEST_FILES_SHARING_API_USER2);
$this->assertTrue($result);
}
public function testFopenWithCreateOnlyPermission() {
$this->view->file_put_contents($this->folder . '/existing.txt', 'foo');
$fileinfoFolder = $this->view->getFileInfo($this->folder);
$result = \OCP\Share::shareItem('folder', $fileinfoFolder['fileid'], \OCP\Share::SHARE_TYPE_USER,
self::TEST_FILES_SHARING_API_USER2, \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_CREATE);
$this->assertTrue($result);
self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
$user2View = new \OC\Files\View('/' . self::TEST_FILES_SHARING_API_USER2 . '/files');
// create part file allowed
$handle = $user2View->fopen($this->folder . '/test.txt.part', 'w');
$this->assertNotFalse($handle);
fclose($handle);
// create regular file allowed
$handle = $user2View->fopen($this->folder . '/test-create.txt', 'w');
$this->assertNotFalse($handle);
fclose($handle);
// rename file never allowed
$this->assertFalse($user2View->rename($this->folder . '/test-create.txt', $this->folder . '/newtarget.txt'));
$this->assertFalse($user2View->file_exists($this->folder . '/newtarget.txt'));
// rename file not allowed if target exists
$this->assertFalse($user2View->rename($this->folder . '/newtarget.txt', $this->folder . '/existing.txt'));
// overwriting file not allowed
$handle = $user2View->fopen($this->folder . '/existing.txt', 'w');
$this->assertFalse($handle);
// overwrite forbidden (no update permission)
$this->assertFalse($user2View->rename($this->folder . '/test.txt.part', $this->folder . '/existing.txt'));
// delete forbidden
$this->assertFalse($user2View->unlink($this->folder . '/existing.txt'));
//cleanup
self::loginHelper(self::TEST_FILES_SHARING_API_USER1);
$result = \OCP\Share::unshare('folder', $fileinfoFolder['fileid'], \OCP\Share::SHARE_TYPE_USER,
self::TEST_FILES_SHARING_API_USER2);
$this->assertTrue($result);
}
public function testFopenWithUpdateOnlyPermission() {
$this->view->file_put_contents($this->folder . '/existing.txt', 'foo');
$fileinfoFolder = $this->view->getFileInfo($this->folder);
$result = \OCP\Share::shareItem('folder', $fileinfoFolder['fileid'], \OCP\Share::SHARE_TYPE_USER,
self::TEST_FILES_SHARING_API_USER2, \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE);
$this->assertTrue($result);
self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
$user2View = new \OC\Files\View('/' . self::TEST_FILES_SHARING_API_USER2 . '/files');
// create part file allowed
$handle = $user2View->fopen($this->folder . '/test.txt.part', 'w');
$this->assertNotFalse($handle);
fclose($handle);
// create regular file not allowed
$handle = $user2View->fopen($this->folder . '/test-create.txt', 'w');
$this->assertFalse($handle);
// rename part file not allowed to non-existing file
$this->assertFalse($user2View->rename($this->folder . '/test.txt.part', $this->folder . '/nonexist.txt'));
// rename part file allowed to target existing file
$this->assertTrue($user2View->rename($this->folder . '/test.txt.part', $this->folder . '/existing.txt'));
$this->assertTrue($user2View->file_exists($this->folder . '/existing.txt'));
// rename regular file allowed
$this->assertTrue($user2View->rename($this->folder . '/existing.txt', $this->folder . '/existing-renamed.txt'));
$this->assertTrue($user2View->file_exists($this->folder . '/existing-renamed.txt'));
// overwriting file directly is allowed
$handle = $user2View->fopen($this->folder . '/existing-renamed.txt', 'w');
$this->assertNotFalse($handle);
fclose($handle);
// delete forbidden
$this->assertFalse($user2View->unlink($this->folder . '/existing-renamed.txt'));
//cleanup
self::loginHelper(self::TEST_FILES_SHARING_API_USER1);
$result = \OCP\Share::unshare('folder', $fileinfoFolder['fileid'], \OCP\Share::SHARE_TYPE_USER,
self::TEST_FILES_SHARING_API_USER2);
$this->assertTrue($result);
}
public function testFopenWithDeleteOnlyPermission() {
$this->view->file_put_contents($this->folder . '/existing.txt', 'foo');
$fileinfoFolder = $this->view->getFileInfo($this->folder);
$result = \OCP\Share::shareItem('folder', $fileinfoFolder['fileid'], \OCP\Share::SHARE_TYPE_USER,
self::TEST_FILES_SHARING_API_USER2, \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_DELETE);
$this->assertTrue($result);
self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
$user2View = new \OC\Files\View('/' . self::TEST_FILES_SHARING_API_USER2 . '/files');
// part file should be forbidden
$handle = $user2View->fopen($this->folder . '/test.txt.part', 'w');
$this->assertFalse($handle);
// regular file forbidden
$handle = $user2View->fopen($this->folder . '/test.txt', 'w');
$this->assertFalse($handle);
// rename forbidden
$this->assertFalse($user2View->rename($this->folder . '/existing.txt', $this->folder . '/existing2.txt'));
// delete allowed
$this->assertTrue($user2View->unlink($this->folder . '/existing.txt'));
//cleanup
self::loginHelper(self::TEST_FILES_SHARING_API_USER1);
$result = \OCP\Share::unshare('folder', $fileinfoFolder['fileid'], \OCP\Share::SHARE_TYPE_USER,
self::TEST_FILES_SHARING_API_USER2);
$this->assertTrue($result);
}
function testMountSharesOtherUser() {
$folderInfo = $this->view->getFileInfo($this->folder);
$fileInfo = $this->view->getFileInfo($this->filename);
+36 -8
View File
@@ -115,14 +115,34 @@ class Test_Files_Sharing_Updater extends OCA\Files_sharing\Tests\TestCase {
\OC\Files\Filesystem::getLoader()->removeStorageWrapper('oc_trashbin');
}
public function shareFolderProvider() {
return [
['/'],
['/my_shares'],
];
}
/**
* if a file gets shared the etag for the recipients root should change
*
* @dataProvider shareFolderProvider
*
* @param string $shareFolder share folder to use
*/
function testShareFile() {
public function testShareFile($shareFolder) {
$config = \OC::$server->getConfig();
$oldShareFolder = $config->getSystemValue('share_folder');
$config->setSystemValue('share_folder', $shareFolder);
$this->loginHelper(self::TEST_FILES_SHARING_API_USER2);
$beforeShare = \OC\Files\Filesystem::getFileInfo('');
$etagBeforeShare = $beforeShare->getEtag();
$beforeShareRoot = \OC\Files\Filesystem::getFileInfo('');
$etagBeforeShareRoot = $beforeShareRoot->getEtag();
\OC\Files\Filesystem::mkdir($shareFolder);
$beforeShareDir = \OC\Files\Filesystem::getFileInfo($shareFolder);
$etagBeforeShareDir = $beforeShareDir->getEtag();
$this->loginHelper(self::TEST_FILES_SHARING_API_USER1);
$fileinfo = \OC\Files\Filesystem::getFileInfo($this->folder);
@@ -131,17 +151,25 @@ class Test_Files_Sharing_Updater extends OCA\Files_sharing\Tests\TestCase {
$this->loginHelper(self::TEST_FILES_SHARING_API_USER2);
$afterShare = \OC\Files\Filesystem::getFileInfo('');
$etagAfterShare = $afterShare->getEtag();
$afterShareRoot = \OC\Files\Filesystem::getFileInfo('');
$etagAfterShareRoot = $afterShareRoot->getEtag();
$this->assertTrue(is_string($etagBeforeShare));
$this->assertTrue(is_string($etagAfterShare));
$this->assertTrue($etagBeforeShare !== $etagAfterShare);
$afterShareDir = \OC\Files\Filesystem::getFileInfo($shareFolder);
$etagAfterShareDir = $afterShareDir->getEtag();
$this->assertTrue(is_string($etagBeforeShareRoot));
$this->assertTrue(is_string($etagBeforeShareDir));
$this->assertTrue(is_string($etagAfterShareRoot));
$this->assertTrue(is_string($etagAfterShareDir));
$this->assertTrue($etagBeforeShareRoot !== $etagAfterShareRoot);
$this->assertTrue($etagBeforeShareDir !== $etagAfterShareDir);
// cleanup
$this->loginHelper(self::TEST_FILES_SHARING_API_USER1);
$result = \OCP\Share::unshare('folder', $fileinfo->getId(), \OCP\Share::SHARE_TYPE_USER, self::TEST_FILES_SHARING_API_USER2);
$this->assertTrue($result);
$config->setSystemValue('share_folder', $oldShareFolder);
}
/**
-1
View File
@@ -18,5 +18,4 @@ To prevent a user from running out of disk space, the ownCloud Deleted files app
<documentation>
<user>user-trashbin</user>
</documentation>
<ocsid>166052</ocsid>
</info>
+1 -1
View File
@@ -1 +1 @@
0.6.2
0.6.3
-6
View File
@@ -1,6 +0,0 @@
<?php
$TRANSLATIONS = array(
"_%n folder_::_%n folders_" => array("",""),
"_%n file_::_%n files_" => array("","")
);
$PLURAL_FORMS = "nplurals=2; plural=(n > 1);";
-6
View File
@@ -1,6 +0,0 @@
<?php
$TRANSLATIONS = array(
"_%n folder_::_%n folders_" => array("",""),
"_%n file_::_%n files_" => array("","")
);
$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
-6
View File
@@ -1,6 +0,0 @@
<?php
$TRANSLATIONS = array(
"_%n folder_::_%n folders_" => array("",""),
"_%n file_::_%n files_" => array("","")
);
$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
-6
View File
@@ -1,6 +0,0 @@
<?php
$TRANSLATIONS = array(
"_%n folder_::_%n folders_" => array("",""),
"_%n file_::_%n files_" => array("","")
);
$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
-6
View File
@@ -1,6 +0,0 @@
<?php
$TRANSLATIONS = array(
"_%n folder_::_%n folders_" => array(""),
"_%n file_::_%n files_" => array("")
);
$PLURAL_FORMS = "nplurals=1; plural=0;";
-6
View File
@@ -1,6 +0,0 @@
<?php
$TRANSLATIONS = array(
"_%n folder_::_%n folders_" => array("",""),
"_%n file_::_%n files_" => array("","")
);
$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
-6
View File
@@ -1,6 +0,0 @@
<?php
$TRANSLATIONS = array(
"_%n folder_::_%n folders_" => array(""),
"_%n file_::_%n files_" => array("")
);
$PLURAL_FORMS = "nplurals=1; plural=0;";
-6
View File
@@ -1,6 +0,0 @@
<?php
$TRANSLATIONS = array(
"_%n folder_::_%n folders_" => array("",""),
"_%n file_::_%n files_" => array("","")
);
$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
-6
View File
@@ -1,6 +0,0 @@
<?php
$TRANSLATIONS = array(
"_%n folder_::_%n folders_" => array(""),
"_%n file_::_%n files_" => array("")
);
$PLURAL_FORMS = "nplurals=1; plural=0;";
-6
View File
@@ -1,6 +0,0 @@
<?php
$TRANSLATIONS = array(
"_%n folder_::_%n folders_" => array("",""),
"_%n file_::_%n files_" => array("","")
);
$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
+46 -5
View File
@@ -61,14 +61,55 @@ class Storage extends Wrapper {
self::$disableTrash = false;
}
/**
* Rename path1 to path2 by calling the wrapped storage.
*
* @param string $path1 first path
* @param string $path2 second path
*/
public function rename($path1, $path2) {
$result = $this->storage->rename($path1, $path2);
if ($result === false) {
// when rename failed, the post_rename hook isn't triggered,
// but we still want to reenable the trash logic
self::$disableTrash = false;
}
return $result;
}
/**
* Deletes the given file by moving it into the trashbin.
*
* @param string $path
* @param string $path path of file or folder to delete
*
* @return bool true if the operation succeeded, false otherwise
*/
public function unlink($path) {
return $this->doDelete($path, 'unlink');
}
/**
* Deletes the given folder by moving it into the trashbin.
*
* @param string $path path of folder to delete
*
* @return bool true if the operation succeeded, false otherwise
*/
public function rmdir($path) {
return $this->doDelete($path, 'rmdir');
}
/**
* Run the delete operation with the given method
*
* @param string $path path of file or folder to delete
* @param string $method either "unlink" or "rmdir"
*
* @return bool true if the operation succeeded, false otherwise
*/
private function doDelete($path, $method) {
if (self::$disableTrash) {
return $this->storage->unlink($path);
return call_user_func_array([$this->storage, $method], [$path]);
}
$normalized = Filesystem::normalizePath($this->mountPoint . '/' . $path);
$result = true;
@@ -81,14 +122,14 @@ class Storage extends Wrapper {
// in cross-storage cases the file will be copied
// but not deleted, so we delete it here
if ($result) {
$this->storage->unlink($path);
call_user_func_array([$this->storage, $method], [$path]);
}
} else {
$result = $this->storage->unlink($path);
$result = call_user_func_array([$this->storage, $method], [$path]);
}
unset($this->deletedFiles[$normalized]);
} else if ($this->storage->file_exists($path)) {
$result = $this->storage->unlink($path);
$result = call_user_func_array([$this->storage, $method], [$path]);
}
return $result;
+25 -15
View File
@@ -32,6 +32,13 @@ class Trashbin {
// unit: percentage; 50% of available disk space/quota
const DEFAULTMAXSIZE = 50;
/**
* Whether versions have already be rescanned during this PHP request
*
* @var bool
*/
private static $scannedVersions = false;
public static function getUidAndFilename($filename) {
$uid = \OC\Files\Filesystem::getOwner($filename);
\OC\Files\Filesystem::initMountPoints($uid);
@@ -146,11 +153,15 @@ class Trashbin {
$view = new \OC\Files\View('/' . $user);
// file has been deleted in between
if (!$view->file_exists('/files/' . $file_path)) {
if (is_null($ownerPath) || $ownerPath === '' || !$view->file_exists('/files/' . $file_path)) {
return true;
}
self::setUpTrash($user);
if ($owner !== $user) {
// also setup for owner
self::setUpTrash($owner);
}
$path_parts = pathinfo($file_path);
@@ -194,7 +205,7 @@ class Trashbin {
\OCP\Util::emitHook('\OCA\Files_Trashbin\Trashbin', 'post_moveToTrash', array('filePath' => \OC\Files\Filesystem::normalizePath($file_path),
'trashPath' => \OC\Files\Filesystem::normalizePath($filename . '.d' . $timestamp)));
$size += self::retainVersions($file_path, $filename, $timestamp);
$size += self::retainVersions($file_path, $filename, $owner, $ownerPath, $timestamp);
$size += self::retainEncryptionKeys($file_path, $filename, $timestamp);
// if owner !== user we need to also add a copy to the owners trash
@@ -221,13 +232,15 @@ class Trashbin {
*
* @param string $file_path path to original file
* @param string $filename of deleted file
* @param string $owner owner user id
* @param string $ownerPath path relative to the owner's home storage
* @param integer $timestamp when the file was deleted
*
* @return int size of stored versions
*/
private static function retainVersions($file_path, $filename, $timestamp) {
private static function retainVersions($file_path, $filename, $owner, $ownerPath, $timestamp) {
$size = 0;
if (\OCP\App::isEnabled('files_versions')) {
if (\OCP\App::isEnabled('files_versions') && !empty($ownerPath)) {
// disable proxy to prevent recursive calls
$proxyStatus = \OC_FileProxy::$enabled;
@@ -236,12 +249,6 @@ class Trashbin {
$user = \OCP\User::getUser();
$rootView = new \OC\Files\View('/');
list($owner, $ownerPath) = self::getUidAndFilename($file_path);
// file has been deleted in between
if (empty($ownerPath)) {
return 0;
}
if ($rootView->is_dir($owner . '/files_versions/' . $ownerPath)) {
$size += self::calculateSize(new \OC\Files\View('/' . $owner . '/files_versions/' . $ownerPath));
if ($owner !== $user) {
@@ -292,7 +299,7 @@ class Trashbin {
$util = new \OCA\Files_Encryption\Util($rootView, $user);
$baseDir = '/files_encryption/';
if (!$util->isSystemWideMountPoint($ownerPath)) {
if (!$util->isSystemWideMountPoint($ownerPath, $owner)) {
$baseDir = $owner . $baseDir;
}
@@ -466,7 +473,7 @@ class Trashbin {
$util = new \OCA\Files_Encryption\Util($rootView, $user);
$baseDir = '/files_encryption/';
if (!$util->isSystemWideMountPoint($ownerPath)) {
if (!$util->isSystemWideMountPoint($ownerPath, $owner)) {
$baseDir = $owner . $baseDir;
}
@@ -825,9 +832,12 @@ class Trashbin {
$versions = array();
//force rescan of versions, local storage may not have updated the cache
/** @var \OC\Files\Storage\Storage $storage */
list($storage, ) = $view->resolvePath('/');
$storage->getScanner()->scan('files_trashbin');
if (!self::$scannedVersions) {
/** @var \OC\Files\Storage\Storage $storage */
list($storage, ) = $view->resolvePath('/');
$storage->getScanner()->scan('files_trashbin/versions');
self::$scannedVersions = true;
}
if ($timestamp) {
// fetch for old versions
+286 -10
View File
@@ -54,6 +54,8 @@ class Storage extends \Test\TestCase {
$this->userView = new \OC\Files\View('/' . $this->user . '/files/');
$this->userView->file_put_contents('test.txt', 'foo');
$this->userView->mkdir('folder');
$this->userView->file_put_contents('folder/inside.txt', 'bar');
}
protected function tearDown() {
@@ -68,7 +70,7 @@ class Storage extends \Test\TestCase {
/**
* Test that deleting a file puts it into the trashbin.
*/
public function testSingleStorageDelete() {
public function testSingleStorageDeleteFile() {
$this->assertTrue($this->userView->file_exists('test.txt'));
$this->userView->unlink('test.txt');
list($storage,) = $this->userView->resolvePath('test.txt');
@@ -82,13 +84,35 @@ class Storage extends \Test\TestCase {
$this->assertEquals('test.txt', substr($name, 0, strrpos($name, '.')));
}
/**
* Test that deleting a folder puts it into the trashbin.
*/
public function testSingleStorageDeleteFolder() {
$this->assertTrue($this->userView->file_exists('folder/inside.txt'));
$this->userView->rmdir('folder');
list($storage,) = $this->userView->resolvePath('folder/inside.txt');
$storage->getScanner()->scan(''); // make sure we check the storage
$this->assertFalse($this->userView->getFileInfo('folder'));
// check if folder is in trashbin
$results = $this->rootView->getDirectoryContent($this->user . '/files_trashbin/files/');
$this->assertEquals(1, count($results));
$name = $results[0]->getName();
$this->assertEquals('folder', substr($name, 0, strrpos($name, '.')));
$results = $this->rootView->getDirectoryContent($this->user . '/files_trashbin/files/' . $name . '/');
$this->assertEquals(1, count($results));
$name = $results[0]->getName();
$this->assertEquals('inside.txt', $name);
}
/**
* Test that deleting a file from another mounted storage properly
* lands in the trashbin. This is a cross-storage situation because
* the trashbin folder is in the root storage while the mounted one
* isn't.
*/
public function testCrossStorageDelete() {
public function testCrossStorageDeleteFile() {
$storage2 = new Temporary(array());
\OC\Files\Filesystem::mount($storage2, array(), $this->user . '/files/substorage');
@@ -108,10 +132,42 @@ class Storage extends \Test\TestCase {
$this->assertEquals('subfile.txt', substr($name, 0, strrpos($name, '.')));
}
/**
* Test that deleting a folder from another mounted storage properly
* lands in the trashbin. This is a cross-storage situation because
* the trashbin folder is in the root storage while the mounted one
* isn't.
*/
public function testCrossStorageDeleteFolder() {
$storage2 = new Temporary(array());
\OC\Files\Filesystem::mount($storage2, array(), $this->user . '/files/substorage');
$this->userView->mkdir('substorage/folder');
$this->userView->file_put_contents('substorage/folder/subfile.txt', 'bar');
$storage2->getScanner()->scan('');
$this->assertTrue($storage2->file_exists('folder/subfile.txt'));
$this->userView->rmdir('substorage/folder');
$storage2->getScanner()->scan('');
$this->assertFalse($this->userView->getFileInfo('substorage/folder'));
$this->assertFalse($storage2->file_exists('folder/subfile.txt'));
// check if folder is in trashbin
$results = $this->rootView->getDirectoryContent($this->user . '/files_trashbin/files');
$this->assertEquals(1, count($results));
$name = $results[0]->getName();
$this->assertEquals('folder', substr($name, 0, strrpos($name, '.')));
$results = $this->rootView->getDirectoryContent($this->user . '/files_trashbin/files/' . $name . '/');
$this->assertEquals(1, count($results));
$name = $results[0]->getName();
$this->assertEquals('subfile.txt', $name);
}
/**
* Test that deleted versions properly land in the trashbin.
*/
public function testDeleteVersions() {
public function testDeleteVersionsOfFile() {
\OCA\Files_Versions\Hooks::connectHooks();
// trigger a version (multiple would not work because of the expire logic)
@@ -130,7 +186,156 @@ class Storage extends \Test\TestCase {
$results = $this->rootView->getDirectoryContent($this->user . '/files_trashbin/versions');
$this->assertEquals(1, count($results));
$name = $results[0]->getName();
$this->assertEquals('test.txt', substr($name, 0, strlen('test.txt')));
$this->assertEquals('test.txt.v', substr($name, 0, strlen('test.txt.v')));
// versions deleted
$results = $this->rootView->getDirectoryContent($this->user . '/files_versions/');
$this->assertEquals(0, count($results));
}
/**
* Test that deleted versions properly land in the trashbin.
*/
public function testDeleteVersionsOfFolder() {
\OCA\Files_Versions\Hooks::connectHooks();
// trigger a version (multiple would not work because of the expire logic)
$this->userView->file_put_contents('folder/inside.txt', 'v1');
$results = $this->rootView->getDirectoryContent($this->user . '/files_versions/folder/');
$this->assertEquals(1, count($results));
$this->userView->rmdir('folder');
// rescan trash storage
list($rootStorage,) = $this->rootView->resolvePath($this->user . '/files_trashbin');
$rootStorage->getScanner()->scan('');
// check if versions are in trashbin
$results = $this->rootView->getDirectoryContent($this->user . '/files_trashbin/versions');
$this->assertEquals(1, count($results));
$name = $results[0]->getName();
$this->assertEquals('folder.d', substr($name, 0, strlen('folder.d')));
// check if versions are in trashbin
$results = $this->rootView->getDirectoryContent($this->user . '/files_trashbin/versions/' . $name . '/');
$this->assertEquals(1, count($results));
$name = $results[0]->getName();
$this->assertEquals('inside.txt.v', substr($name, 0, strlen('inside.txt.v')));
// versions deleted
$results = $this->rootView->getDirectoryContent($this->user . '/files_versions/folder/');
$this->assertEquals(0, count($results));
}
/**
* Test that deleted versions properly land in the trashbin when deleting as share recipient.
*/
public function testDeleteVersionsOfFileAsRecipient() {
\OCA\Files_Versions\Hooks::connectHooks();
\OCA\Files_Sharing\Helper::registerHooks();
$this->userView->mkdir('share');
// trigger a version (multiple would not work because of the expire logic)
$this->userView->file_put_contents('share/test.txt', 'v1');
$this->userView->file_put_contents('share/test.txt', 'v2');
$results = $this->rootView->getDirectoryContent($this->user . '/files_versions/share/');
$this->assertEquals(1, count($results));
$recipientUser = $this->getUniqueId('recipient_');
\OC::$server->getUserManager()->createUser($recipientUser, $recipientUser);
$fileinfo = $this->userView->getFileInfo('share');
$this->assertTrue(\OCP\Share::shareItem('folder', $fileinfo['fileid'], \OCP\Share::SHARE_TYPE_USER,
$recipientUser, 31));
$this->loginAsUser($recipientUser);
// delete as recipient
$recipientView = new \OC\Files\View('/' . $recipientUser . '/files');
$recipientView->unlink('share/test.txt');
// rescan trash storage for both users
list($rootStorage,) = $this->rootView->resolvePath($this->user . '/files_trashbin');
$rootStorage->getScanner()->scan('');
// check if versions are in trashbin for both users
$results = $this->rootView->getDirectoryContent($this->user . '/files_trashbin/versions');
$this->assertEquals(1, count($results), 'Versions in owner\'s trashbin');
$name = $results[0]->getName();
$this->assertEquals('test.txt.v', substr($name, 0, strlen('test.txt.v')));
$results = $this->rootView->getDirectoryContent($recipientUser . '/files_trashbin/versions');
$this->assertEquals(1, count($results), 'Versions in recipient\'s trashbin');
$name = $results[0]->getName();
$this->assertEquals('test.txt.v', substr($name, 0, strlen('test.txt.v')));
// versions deleted
$results = $this->rootView->getDirectoryContent($this->user . '/files_versions/share/');
$this->assertEquals(0, count($results));
}
/**
* Test that deleted versions properly land in the trashbin when deleting as share recipient.
*/
public function testDeleteVersionsOfFolderAsRecipient() {
\OCA\Files_Versions\Hooks::connectHooks();
\OCA\Files_Sharing\Helper::registerHooks();
$this->userView->mkdir('share');
$this->userView->mkdir('share/folder');
// trigger a version (multiple would not work because of the expire logic)
$this->userView->file_put_contents('share/folder/test.txt', 'v1');
$this->userView->file_put_contents('share/folder/test.txt', 'v2');
$results = $this->rootView->getDirectoryContent($this->user . '/files_versions/share/folder/');
$this->assertEquals(1, count($results));
$recipientUser = $this->getUniqueId('recipient_');
\OC::$server->getUserManager()->createUser($recipientUser, $recipientUser);
$fileinfo = $this->userView->getFileInfo('share');
$this->assertTrue(\OCP\Share::shareItem('folder', $fileinfo['fileid'], \OCP\Share::SHARE_TYPE_USER,
$recipientUser, 31));
$this->loginAsUser($recipientUser);
// delete as recipient
$recipientView = new \OC\Files\View('/' . $recipientUser . '/files');
$recipientView->rmdir('share/folder');
// rescan trash storage
list($rootStorage,) = $this->rootView->resolvePath($this->user . '/files_trashbin');
$rootStorage->getScanner()->scan('');
// check if versions are in trashbin for owner
$results = $this->rootView->getDirectoryContent($this->user . '/files_trashbin/versions');
$this->assertEquals(1, count($results));
$name = $results[0]->getName();
$this->assertEquals('folder.d', substr($name, 0, strlen('folder.d')));
// check if file versions are in trashbin for owner
$results = $this->rootView->getDirectoryContent($this->user . '/files_trashbin/versions/' . $name . '/');
$this->assertEquals(1, count($results));
$name = $results[0]->getName();
$this->assertEquals('test.txt.v', substr($name, 0, strlen('test.txt.v')));
// check if versions are in trashbin for recipient
$results = $this->rootView->getDirectoryContent($recipientUser . '/files_trashbin/versions');
$this->assertEquals(1, count($results));
$name = $results[0]->getName();
$this->assertEquals('folder.d', substr($name, 0, strlen('folder.d')));
// check if file versions are in trashbin for recipient
$results = $this->rootView->getDirectoryContent($recipientUser . '/files_trashbin/versions/' . $name . '/');
$this->assertEquals(1, count($results));
$name = $results[0]->getName();
$this->assertEquals('test.txt.v', substr($name, 0, strlen('test.txt.v')));
// versions deleted
$results = $this->rootView->getDirectoryContent($recipientUser . '/files_versions/share/folder/');
$this->assertEquals(0, count($results));
}
/**
@@ -138,7 +343,7 @@ class Storage extends \Test\TestCase {
* storages. This is because rename() between storages would call
* unlink() which should NOT trigger the version deletion logic.
*/
public function testKeepFileAndVersionsWhenMovingBetweenStorages() {
public function testKeepFileAndVersionsWhenMovingFileBetweenStorages() {
\OCA\Files_Versions\Hooks::connectHooks();
$storage2 = new Temporary(array());
@@ -155,7 +360,7 @@ class Storage extends \Test\TestCase {
// move to another storage
$this->userView->rename('test.txt', 'substorage/test.txt');
$this->userView->file_exists('substorage/test.txt');
$this->assertTrue($this->userView->file_exists('substorage/test.txt'));
// rescan trash storage
list($rootStorage,) = $this->rootView->resolvePath($this->user . '/files_trashbin');
@@ -174,10 +379,51 @@ class Storage extends \Test\TestCase {
$this->assertEquals(0, count($results));
}
/**
* Test that versions are not auto-trashed when moving a file between
* storages. This is because rename() between storages would call
* unlink() which should NOT trigger the version deletion logic.
*/
public function testKeepFileAndVersionsWhenMovingFolderBetweenStorages() {
\OCA\Files_Versions\Hooks::connectHooks();
$storage2 = new Temporary(array());
\OC\Files\Filesystem::mount($storage2, array(), $this->user . '/files/substorage');
// trigger a version (multiple would not work because of the expire logic)
$this->userView->file_put_contents('folder/inside.txt', 'v1');
$results = $this->rootView->getDirectoryContent($this->user . '/files_trashbin/files');
$this->assertEquals(0, count($results));
$results = $this->rootView->getDirectoryContent($this->user . '/files_versions/folder/');
$this->assertEquals(1, count($results));
// move to another storage
$this->userView->rename('folder', 'substorage/folder');
$this->assertTrue($this->userView->file_exists('substorage/folder/inside.txt'));
// rescan trash storage
list($rootStorage,) = $this->rootView->resolvePath($this->user . '/files_trashbin');
$rootStorage->getScanner()->scan('');
// versions were moved too
$results = $this->rootView->getDirectoryContent($this->user . '/files_versions/substorage/folder/');
$this->assertEquals(1, count($results));
// check that nothing got trashed by the rename's unlink() call
$results = $this->rootView->getDirectoryContent($this->user . '/files_trashbin/files');
$this->assertEquals(0, count($results));
// check that versions were moved and not trashed
$results = $this->rootView->getDirectoryContent($this->user . '/files_trashbin/versions/');
$this->assertEquals(0, count($results));
}
/**
* Delete should fail is the source file cant be deleted
*/
public function testSingleStorageDeleteFail() {
public function testSingleStorageDeleteFileFail() {
/**
* @var \OC\Files\Storage\Temporary | \PHPUnit_Framework_MockObject_MockObject $storage
*/
@@ -186,9 +432,6 @@ class Storage extends \Test\TestCase {
->setMethods(['rename', 'unlink'])
->getMock();
$storage->expects($this->any())
->method('rename')
->will($this->returnValue(false));
$storage->expects($this->any())
->method('unlink')
->will($this->returnValue(false));
@@ -206,4 +449,37 @@ class Storage extends \Test\TestCase {
$results = $this->rootView->getDirectoryContent($this->user . '/files_trashbin/files/');
$this->assertEquals(0, count($results));
}
/**
* Delete should fail is the source folder cant be deleted
*/
public function testSingleStorageDeleteFolderFail() {
/**
* @var \OC\Files\Storage\Temporary | \PHPUnit_Framework_MockObject_MockObject $storage
*/
$storage = $this->getMockBuilder('\OC\Files\Storage\Temporary')
->setConstructorArgs([[]])
->setMethods(['rename', 'unlink', 'rmdir'])
->getMock();
$storage->expects($this->any())
->method('rmdir')
->will($this->returnValue(false));
$cache = $storage->getCache();
Filesystem::mount($storage, [], '/' . $this->user . '/files');
$this->userView->mkdir('folder');
$this->userView->file_put_contents('folder/test.txt', 'foo');
$this->assertTrue($storage->file_exists('folder/test.txt'));
$this->assertFalse($this->userView->rmdir('folder'));
$this->assertTrue($storage->file_exists('folder'));
$this->assertTrue($storage->file_exists('folder/test.txt'));
$this->assertTrue($cache->inCache('folder'));
$this->assertTrue($cache->inCache('folder/test.txt'));
// file should not be in the trashbin
$results = $this->rootView->getDirectoryContent($this->user . '/files_trashbin/files/');
$this->assertEquals(0, count($results));
}
}
+11 -7
View File
@@ -31,14 +31,18 @@ if($maxX === 0 || $maxY === 0) {
try {
list($user, $file) = \OCA\Files_Versions\Storage::getUidAndFilename($file);
$preview = new \OC\Preview($user, 'files_versions', $file.'.v'.$version);
$mimetype = \OC_Helper::getFileNameMimeType($file);
$preview->setMimetype($mimetype);
$preview->setMaxX($maxX);
$preview->setMaxY($maxY);
$preview->setScalingUp($scalingUp);
if (is_null($file)) {
\OC_Response::setStatus(404);
} else {
$preview = new \OC\Preview($user, 'files_versions', $file . '.v' . $version);
$mimetype = \OC_Helper::getFileNameMimeType($file);
$preview->setMimetype($mimetype);
$preview->setMaxX($maxX);
$preview->setMaxY($maxY);
$preview->setScalingUp($scalingUp);
$preview->showPreview();
$preview->showPreview();
}
}catch(\Exception $e) {
\OC_Response::setStatus(500);
\OC_Log::write('core', $e->getmessage(), \OC_Log::DEBUG);
-1
View File
@@ -18,5 +18,4 @@ In addition to the expiry of versions, ownClouds versions app makes certain n
<user>user-versions</user>
</documentation>
<default_enable/>
<ocsid>166053</ocsid>
</info>
+1 -1
View File
@@ -1 +1 @@
1.0.5
1.0.6
+1 -1
View File
@@ -38,7 +38,7 @@ $ftype = $view->getMimeType('/'.$uid.'/files/'.$filename);
header('Content-Type:'.$ftype);
OCP\Response::setContentDispositionHeader(basename($filename), 'attachment');
OCP\Response::disableCaching();
header('Content-Length: '.$view->filesize($versionName));
OCP\Response::setContentLengthHeader($view->filesize($versionName));
OC_Util::obEnd();

Some files were not shown because too many files have changed in this diff Show More