Commit Graph

39 Commits

Author SHA1 Message Date
Morris Jobke d3d045dd5c
Remove unused import statements
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2018-02-14 16:55:43 +01:00
Roeland Jago Douma 4596423b14
Do not instantiate node when not needed
Use the lazy functions is possible. This avoids getting the node if not
required.

Possible fix for #7751

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-01-09 19:51:50 +01:00
Lukas Reschke 1c25919cf1
Proper handle null cases and default to true
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
2017-11-27 09:38:39 +01:00
Lukas Reschke 56a2512581
Add support for `\OCP\Share\IShare::getMailSend` back
This adds back the support for `\OCP\Share\IShare::getMailSend`, one example is creating bulk shares via API which where previously blocking due to the share notification emails.

Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
2017-11-27 09:38:39 +01:00
Morris Jobke 0eebff152a
Update license headers
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2017-11-06 16:56:19 +01:00
Roeland Jago Douma 5f227bd93b
More phpstorm inspection fixes
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2017-07-24 11:39:29 +02:00
Jan-Philipp Litza 0b066d9297 Fix 500 Internal Server Error on writing
In some not yet completely determined configurations, the following error could occur while writing a file:

Error: Call to a member function getUsers() on null
    /var/www/nextcloud/lib/private/Share20/Manager.php - line 1277: OC\Share20\DefaultShareProvider->getAccessList(Array, true)
    /var/www/nextcloud/lib/private/Share20/ShareHelper.php - line 51: OC\Share20\Manager->getAccessList(Object(OC\Files\Node\Folder), true, true)
    /var/www/nextcloud/apps/activity/lib/FilesHooks.php - line 616: OC\Share20\ShareHelper->getPathsForAccessList(Object(OC\Files\Node\File))
    /var/www/nextcloud/apps/activity/lib/FilesHooks.php - line 196: OCA\Activity\FilesHooks->getUserPathsFromPath('/path/to/file', 'user')
    /var/www/nextcloud/apps/activity/lib/FilesHooks.php - line 157: OCA\Activity\FilesHooks->addNotificationsForFileAction('/path/to/file', 'file_changed', 'changed_self', 'changed_by')
    /var/www/nextcloud/apps/activity/lib/FilesHooksStatic.php - line 55: OCA\Activity\FilesHooks->fileUpdate('/path/to/file')
    /var/www/nextcloud/lib/private/legacy/hook.php - line 106: OCA\Activity\FilesHooksStatic fileUpdate(Array)
    /var/www/nextcloud/lib/private/Files/View.php - line 1245: OC_Hook emit('OC_Filesystem', 'post_update', Array)
    /var/www/nextcloud/lib/private/Files/View.php - line 1173: OC\Files\View->runHooks(Array, '/path/to/file', true)
    /var/www/nextcloud/lib/private/Files/View.php - line 679: OC\Files\View->basicOperation('file_put_conten...', '/path/to/file', Array, '<?xml version="...')
    /var/www/nextcloud/lib/private/Files/Node/File.php - line 64: OC\Files\View->file_put_contents('/path/to/file', '<?xml version="...')
    [...]

Signed-off-by: Jan-Philipp Litza <janphilipp@litza.de>
2017-06-16 11:38:22 +02:00
Robin Appelman f707a40f19
filter missing groups in share provider
Signed-off-by: Robin Appelman <robin@icewind.nl>
2017-06-12 15:46:19 +02:00
Morris Jobke c54a59d51e
Remove unused use statements
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2017-04-22 19:23:31 -05:00
Joas Schilling 629b7c0fc3
Adjust docs and make !$currentAccess simpler
Signed-off-by: Joas Schilling <coding@schilljs.com>
2017-04-13 12:58:52 +02:00
Joas Schilling 5b57bb955b
Fix default share provider
Signed-off-by: Joas Schilling <coding@schilljs.com>
2017-04-13 12:58:52 +02:00
Joas Schilling 91e650791d
Return the paths for the users without setting them all up
Signed-off-by: Joas Schilling <coding@schilljs.com>
2017-04-13 12:58:50 +02:00
Roeland Jago Douma 12afd7d1d5
Add mail element to access list
* Each provider just returns what they have so adding an element won't
require changing everything
* Added tests

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2017-04-13 12:58:50 +02:00
Roeland Jago Douma 2cbac3357b
Offload acceslist creation to providers
* This allows for effective queries.
* Introduce currentAccess parameter to speciy if the users needs to have
currently acces (deleted incomming group share). (For notifications)

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2017-04-13 12:58:50 +02:00
Robin Appelman a555672f21
properly quota table names in getSharesInFolder
Signed-off-by: Robin Appelman <robin@icewind.nl>
2017-04-10 17:59:40 +02:00
Bjoern Schiessle 3323d01db1
update unit tests
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
2017-04-07 15:43:59 +02:00
Bjoern Schiessle b84fd7c361
set expire date for all share types
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
2017-04-03 10:29:32 +02:00
Bjoern Schiessle 0d5147bd49
add new password column to the share table in order to set passwords for share by mails
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
2017-04-03 10:20:49 +02:00
Vincent Petry 377fdf3860
Skip null groups in group manager (#26871) (#26956)
* Skip null groups in group manager (#26871)

* Skip null groups in group manager

* Also skip null groups in group manager's search function

* Add more group null checks in sharing code

* Add unit tests for null group safety in group manager

* Add unit tests for sharing code null group checks

* Added tests for null groups handling in sharing code

* Ignore moveShare optional repair in mount provider

In some cases, data is inconsistent in the oc_share table due to legacy
data. The mount provider might attempt to make it consistent but if the
target group does not exist any more it cannot work. In such case we
simply ignore the exception as it is not critical. Keeping the
exception would break user accounts as they would be unable to use
their filesystem.

* Adjust null group handing + tests

* Fix new group manager tests

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2017-03-17 00:07:03 -06:00
Andrius 708b62f223 Fix detecting deleted shares in object store
While using the object store, the shares, that are moved to trashbin were still detected as accessible and cause broken shares to be shown in file/folder listing.
2017-03-09 14:36:20 +02:00
phisch fc67606d39
commit transaction after select query
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
2016-12-16 17:44:33 +01:00
Robin Appelman 14a561ddad
always use numeric storage id in cacheentry
Signed-off-by: Robin Appelman <robin@icewind.nl>
2016-12-13 12:53:38 +01:00
Robin Appelman 5acbdf1e36
also work with group shares
Signed-off-by: Robin Appelman <robin@icewind.nl>
2016-11-17 23:30:50 +01:00
Robin Appelman 2f03fcab4a
let the share backend get the node cacheentry to save queries
Signed-off-by: Robin Appelman <robin@icewind.nl>
2016-11-17 18:48:38 +01:00
Roeland Jago Douma fc4d0a86ef
Fix merging backend results
* Merge share types correctly
* Filter share types
* Order share types

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2016-11-01 12:16:05 +01:00
Roeland Jago Douma 5a00870a2b
Stricter signature
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2016-10-31 20:19:14 +01:00
Robin Appelman 3692769b0a
Add getShareTypesInFolder to optimize folder listening
Signed-off-by: Robin Appelman <icewind@owncloud.com>
2016-10-31 15:55:40 +01:00
Morris Jobke e5fd9c1e1a Merge pull request #1640 from nextcloud/less_queries_group_share
More efficient group share resolving
2016-10-10 09:26:11 +02:00
Roeland Jago Douma 990f4a182d
More efficient group share resolving
When resolving a group share to the user group share we used to do this
on a per share basis. Now we try to do this for all group shares at
once. Of course still chunked.

Before: N incomming group shares this would mean 1 + N queries
Now: N incomming roups shares this would mean 1 + 1 queries

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2016-10-06 19:31:28 +02:00
Vincent Petry 626daabb56
Prefilter inaccessible shares in DefaultShareProvider::getSharedWith()
The DefaultShareProvider now does a DB-level check to find out whether
file_source is accessible at all (deleted file) or whether it's in the
trashbin of a home storage.

One small corner case where the home storage id is in md5 form cannot
be covered properly with this approach.

Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
2016-10-06 13:57:58 +02:00
Joas Schilling ba87db3fcc
Fix others 2016-07-21 18:13:57 +02:00
Lukas Reschke aba539703c
Update license headers 2016-05-26 19:57:24 +02:00
Björn Schießle 7b25839bd5
use share initiator as fall back to access the file
in case of federated re-shares the owner can be a remote user.
Therefore we can't always use to owner to access the local file
2016-05-20 21:15:15 +02:00
Roeland Jago Douma 6144ced7a0
Move post_removeFromGroup to shareManager
The last sharing hook to be moved over.

* Added unit tests
* Removed old tests that relied on old behaviour
* Removed old hooks.php
2016-04-13 15:00:12 +02:00
Roeland Douma 495a964ca2 Migrate post_groupDelete hook to share manager (#23841)
The hook now calls the share manager that will call the responsible
shareProvider to do the proper cleanup.

* Unit tests added

Again nothing should change it is just to cleanup old code
2016-04-12 09:46:25 +02:00
Roeland Jago Douma e0cee43cf0 Migrate post_userDelete hook to share manager
This makes the post_userDelete hook call the sharemanager. This will
cleanup to and from this user.

* All shares owned by this user
* All shares with this user (user)
* All custom group shares
* All link share initiated by this user (to avoid invisible link shares)

Unit tests are added for the defaultshare provider as well as the
federated share provider
2016-04-04 14:15:38 +02:00
Roeland Jago Douma da1dbb52e4 Remove dead function
This was used when we did not have lazy shares yet. Now that we no
longer support legacy shares this can go.
2016-03-23 07:58:17 +01:00
Roeland Jago Douma b26b8d17eb Remove support for old shares in the default share provider
In 9.0 we converted the old shares to the new shares. So for 9.1 we can
savely remove the fallback code.

This code was required when there was no initiator set.

* Fixed unit tests
2016-03-23 07:58:17 +01:00
Roeland Jago Douma c6edbfecbe Move (new) sharing over to composer autoloader 2016-03-20 14:12:36 +01:00