Commit Graph

294 Commits

Author SHA1 Message Date
Morris Jobke 0763a17332
Move federated_share_added into a typed event
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2020-07-23 08:33:17 +02:00
Roeland Jago Douma 43efac345e
Use the correct mountpoint to calculate
If we use the owners mount point this results in null. And then the rest
of the checks get called with null. Which doesn't work.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2020-07-09 11:14:44 +02:00
Joas Schilling db8267db26
Use the new method everywhere
Signed-off-by: Joas Schilling <coding@schilljs.com>
2020-07-03 10:59:43 +02:00
Daniel Kesselberg 4d44d6be2e
Replace Share with IShare and add missing return.
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
2020-06-26 10:57:55 +02:00
Joas Schilling 89ed2c37bf
Update share type constant usage
Signed-off-by: Joas Schilling <coding@schilljs.com>
2020-06-24 16:49:16 +02:00
Joas Schilling 95652d4469
Fix language in share notes email for users
Signed-off-by: Joas Schilling <coding@schilljs.com>
2020-06-23 22:01:40 +02:00
Joas Schilling 69eda9c0f6
Prevent harder to share your root
Signed-off-by: Joas Schilling <coding@schilljs.com>
2020-06-03 14:47:38 +02:00
Daniel Calviño Sánchez 45de42a6b8 Fix disabling send password by Talk without new password in mail shares
When "send password by Talk" was disabled in a mail share it was
possible to keep the same password as before, as it does not pose any
security issue (unlike keeping it when "send password by Talk" is
enabled, as in that case the password was already disclosed by mail).

However, if a mail share is updated but the password is not set again
only the hashed password will be available. In that case it would not
make sense to send the password by mail, so now the password must be
changed when disabling "send password by Talk".

Note that, even if explicitly setting the same password again along with
the "send password by Talk" property would work, this was also prevented
for simplicity.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2020-05-29 02:46:12 +02:00
Daniel Calviño Sánchez a426f84dbe Fix enabling send password by Talk with same password in mail shares
When "send password by Talk" is enabled in a mail share a new password
must be also set. However, when the passwords of the original and the
new share were compared it was not taken into account that the original
password is now hashed, while the new one is not (unless no new password
was sent, in which case the password of the original share was set in
the new share by the controller, but that was already prevented due to
both passwords being literally the same), so it was possible to set the
same password again.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2020-05-28 21:51:28 +02:00
Daniel Calviño Sánchez 7569590514 Fix enabling send password by Talk with empty password in link shares
When "send password by Talk" is enabled in a link share now a non empty
password is enforced.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2020-05-28 21:51:28 +02:00
Daniel Kesselberg 16da29caba
Remove group from excluded_groups_list after delete
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
2020-05-17 15:15:06 +02:00
Morris Jobke e3a2d069ae
Remove unused use statement
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2020-05-08 07:42:00 +02:00
Robin Appelman 756fe45493
get only groupids in default share backend
instead of getting the full group object and then only using the id anyway

Signed-off-by: Robin Appelman <robin@icewind.nl>
2020-05-04 17:42:28 +02:00
Christoph Wurst cb057829f7
Update license headers for 19
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-04-29 11:57:22 +02:00
Morris Jobke 1738e17e20
Merge pull request #19793 from nextcloud/bugfix/noid/link-to-federated-reshare
Fix resharing of federated shares that were created out of links
2020-04-27 11:05:34 +02:00
Roeland Jago Douma f4b8623d33
Allow specifying a default expiration date
This overrides the max expiration date.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2020-04-24 16:18:20 +02:00
Julius Härtl 5646f7c761
Link shares have reshare permission if outgoing federated shares are enabled
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2020-04-21 14:35:29 +02:00
Roeland Jago Douma bb4dedb015
Provide the proper language to the mailer
Else we can't properly translate the footer in the recipients e-mail
language.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2020-04-16 09:04:13 +02:00
Joas Schilling 0bd7382a44
Merge pull request #19936 from nextcloud/bugfix/noid/handle-unset-owner-in-sharing
Handle unset owner in sharing
2020-04-14 20:34:17 +02:00
Joas Schilling cde6d768de
Merge pull request #20181 from nextcloud/bugfix/noid/dont-break-on-path-null
Also bail out when the path is actually null
2020-04-14 18:56:58 +02:00
Christoph Wurst 28f8eb5dba
Add visibility to all constants
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-04-10 16:54:27 +02:00
Christoph Wurst caff1023ea
Format control structures, classes, methods and function
To continue this formatting madness, here's a tiny patch that adds
unified formatting for control structures like if and loops as well as
classes, their methods and anonymous functions. This basically forces
the constructs to start on the same line. This is not exactly what PSR2
wants, but I think we can have a few exceptions with "our" style. The
starting of braces on the same line is pracrically standard for our
code.

This also removes and empty lines from method/function bodies at the
beginning and end.

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-04-10 14:19:56 +02:00
Christoph Wurst 14c996d982
Use elseif instead of else if
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-04-10 10:35:09 +02:00
Christoph Wurst afbd9c4e6e
Unify function spacing to PSR2 recommendation
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-04-09 13:54:22 +02:00
Christoph Wurst 41b5e5923a
Use exactly one empty line after the namespace declaration
For PSR2

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-04-09 11:48:10 +02:00
Christoph Wurst 2fbad1ed72
Fix (array) indent style to always use one tab
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-04-09 10:16:08 +02:00
Christoph Wurst 1a9330cd69
Update the license headers for Nextcloud 19
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-03-31 14:52:54 +02:00
Christoph Wurst 463b388589
Merge pull request #20170 from nextcloud/techdebt/remove-unused-imports
Remove unused imports
2020-03-27 17:14:08 +01:00
Christoph Wurst b80ebc9674
Use the short array syntax, everywhere
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-03-26 16:34:56 +01:00
Joas Schilling 51d174a40b
Also bail out when the path is actually null
Apparently this can happen when a external mount was shared
that is later not available anymore

Signed-off-by: Joas Schilling <coding@schilljs.com>
2020-03-26 13:49:47 +01:00
Christoph Wurst 74936c49ea
Remove unused imports
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-03-25 22:08:08 +01:00
Julius Härtl 8edc824526 Expose enumeration config though share manager
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2020-03-20 10:43:56 +01:00
Roeland Jago Douma b944115a35
Update the target when it isempty after sharing
Hooks that listen to it (audit log) benefit from having the target
properly set.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2020-03-16 13:38:55 +01:00
Joas Schilling 186c7f1b4b
Handle unset owner in sharing
Signed-off-by: Joas Schilling <coding@schilljs.com>
2020-03-13 17:17:43 +01:00
Joas Schilling e97d643969
Strip of users home path from share api message
Signed-off-by: Joas Schilling <coding@schilljs.com>
2020-02-20 14:56:58 +01:00
Joas Schilling c5bc317681
Make sure the default share provider does not execute for other things
Signed-off-by: Joas Schilling <coding@schilljs.com>
2020-01-28 16:00:03 +01:00
Roeland Jago Douma fb6b84b5c9
Accept shares when you open mail
Fixes #18380

When you open a direct share to yourself. We should autoaccept the
share.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2020-01-06 16:48:21 +01:00
Roeland Jago Douma bb4264c565
config.php setting to always accept internal shares
Part of #18255

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2019-12-16 09:07:25 +01:00
Roeland Jago Douma 97deaf85b9
Merge pull request #17935 from nextcloud/feature/noid/public-auth-for-circles
adding share type circles
2019-12-11 12:37:54 +01:00
Christoph Wurst 5bf3d1bb38
Update license headers
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2019-12-05 15:38:45 +01:00
Maxence Lange 0f32f8119e using IShare::
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
2019-12-05 10:33:48 -01:00
Maxence Lange c1558af16d adding share type circles
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
2019-12-05 10:33:48 -01:00
Roeland Jago Douma 0c0ca45d50
Actualy return data
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2019-11-27 14:33:13 +01:00
Roeland Jago Douma 21d7383d95
Allow internal shares to have a default expiration date
* Needs admin UI
* Needs more checks
* Basics seem to work

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2019-11-27 14:33:11 +01:00
Christoph Wurst 1a886b1472
Add typed events for password_policy
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2019-11-27 09:56:12 +01:00
Roeland Jago Douma 68748d4f85
Some php-cs fixes
* Order the imports
* No leading slash on imports
* Empty line before namespace
* One line per import
* Empty after imports
* Emmpty line at bottom of file

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2019-11-22 20:52:10 +01:00
Roeland Jago Douma e16321368f
Fixes
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2019-11-18 16:11:03 +01:00
Joas Schilling e79ab7d0c5
The share manager knows which provider can accept shares
Signed-off-by: Joas Schilling <coding@schilljs.com>
2019-11-12 17:37:47 +01:00
Joas Schilling 520042bbd0
Allow to accept group shares
Signed-off-by: Joas Schilling <coding@schilljs.com>
2019-11-12 17:36:58 +01:00
Joas Schilling e96c9e0e4a
Add the notifier and the API endpoint for user shares
Signed-off-by: Joas Schilling <coding@schilljs.com>
2019-11-12 17:33:50 +01:00
Joas Schilling dcdbea54e6
Respect the accepted flag for group and user shares
Signed-off-by: Joas Schilling <coding@schilljs.com>
2019-11-12 17:13:38 +01:00
Christoph Wurst a767a2f0a3
Merge pull request #17735 from tcoupin/fix-reshare-circle
Fix reshare with circle
2019-11-04 23:40:03 +01:00
Roeland Jago Douma 8085ca4cc4
Get all shares as iterable
Sometimes we need all shares or rather a specific subset of shares but
creating dedicated functions is a pain. This just returns an iterable
object for all shares so we can loop over them without allocating all
the memory on the system.

It should not be used by any user called code. But in an occ command or
background job it is fine IMO.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2019-10-30 09:45:27 +01:00
Thibault Coupin 7cca169d98 Fix reshare with circle
Signed-off-by: Thibault Coupin <thibault.coupin@gmail.com>
2019-10-29 14:56:52 +01:00
Christoph Wurst a5869be60f Fix l10n in federated file sharing
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2019-09-19 12:57:45 +02:00
Joas Schilling 858b18e34a
Bye Spreed namespace, hello Talk!
Signed-off-by: Joas Schilling <coding@schilljs.com>
2019-09-05 15:32:58 +02:00
John Molakvoæ (skjnldsv) b557f52c22
Add expiration event for shares
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
2019-08-21 08:30:17 +02:00
Julius Härtl 22b81ac1e4
Fix permission check on incoming federated shares
Since federated shares have their permissions set on the node, we do not need
to check for parent share permissions. Otherwise reshares of incoming federated
have no permission variable defined and creating them will fail

Signed-off-by: Julius Härtl <jus@bitgrid.net>
2019-07-31 12:59:51 +02:00
Julius Härtl 857fae288c
Always set the display name for user shares
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2019-07-03 21:34:18 +02:00
Joas Schilling 85a80b05ac
Unify the permission checking in one place only
Signed-off-by: Joas Schilling <coding@schilljs.com>
2019-07-03 16:34:00 +02:00
Joas Schilling e4addbae3e
Better check reshare permissions when creating a share
Signed-off-by: Joas Schilling <coding@schilljs.com>
2019-07-03 14:00:13 +02:00
Roeland Jago Douma 2f5810f26e
Merge pull request #15832 from nextcloud/bugfix/noid/fulltext-search-groupfolders
Fix full text search for groupfolders
2019-06-25 21:43:37 +02:00
Christoph Wurst 3174012adf Add event dispatcher to OCP
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2019-06-25 10:02:27 +02:00
Morris Jobke 9dac9710e4 Fix full text search for groupfolders
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2019-06-17 12:52:22 -01:00
Morris Jobke ab7858d1a9 Update lib/private/Share20/Manager.php
tabulator change

Co-Authored-By: aignerat <46312655+aignerat@users.noreply.github.com>
2019-03-20 15:33:35 +00:00
Morris Jobke bb367f8cdd Update lib/private/Share20/Manager.php
fixed tabulator

Co-Authored-By: aignerat <46312655+aignerat@users.noreply.github.com>
2019-03-20 15:33:35 +00:00
Christian Aigner 03ee137804 groupname like username - allow share with both
Signed-off-by: Christian Aigner <christian.aigner@huemer-it.com>
2019-03-20 15:33:34 +00:00
Roeland Jago Douma 230dc505a1
Fix getting the access list on external storage
If a file is on external storage there is no owner. WHich means we can't
check. So just return an empty array then.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2019-03-19 15:38:52 +01:00
Morris Jobke 3f9cdeeb5f
Cleanup some PHPDoc leftovers and unused variables
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2019-03-06 15:43:56 +01:00
Joas Schilling f66c37bdb8
Correctly determinate the owner in case of shared external storages
Signed-off-by: Joas Schilling <coding@schilljs.com>
2019-02-18 10:57:12 +01:00
Christoph Wurst 7e3e3bed50
Fix typos and unused return values
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2019-01-30 16:08:46 +01:00
Bjoern Schiessle 8ed004d6ae
fix typo
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
2019-01-30 15:25:07 +01:00
Bjoern Schiessle ab01402599
log full exception
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
2019-01-30 15:25:07 +01:00
Bjoern Schiessle a94358062d
handle mail send error gracefully
log the error in case a notification mail of a new share couldn't
be send to the recipient and finish the share operation successfully

Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
2019-01-30 15:25:07 +01:00
Roeland Jago Douma 977e3959eb
Do not update child all child shares on group share update
Else we overwrite the whole share for link shares. Basically breaking
them.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-12-04 20:55:14 +01:00
Roeland Jago Douma 72b7c9ffa0
Merge pull request #12105 from nextcloud/using-resharing-right-to-display-shares
Shares are displayed to users with resharing rights
2018-11-04 21:08:11 +01:00
Maxence Lange 77b95ccd12
revert tests
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
2018-11-02 12:10:49 +01:00
Maxence Lange 68c44bb642
shares are displayed to users with resharing rights
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
2018-11-02 12:09:26 +01:00
Daniel Calviño Sánchez fe8a67f517 Store "sendPasswordByTalk" property of link shares in the database
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2018-11-02 01:57:48 +01:00
Bjoern Schiessle 5e90711600 allow to update lables for public link shares
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
2018-11-01 02:18:55 +01:00
Bjoern Schiessle f377a61f90 allow to add labels to shares
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
2018-11-01 02:15:07 +01:00
Roeland Jago Douma abbb946bbb Propegate hide download state in share provider
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-10-30 15:18:55 +01:00
Roeland Jago Douma bc960bae02 Extend IShare to show hide download state
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-10-30 15:18:55 +01:00
Joas Schilling ea21aa3f7a
Use numeric placeholders if there are multiple, so that RTL languages can operate better
Signed-off-by: Joas Schilling <coding@schilljs.com>
2018-10-09 14:32:14 +02:00
Robin Appelman 4c0cbdff36
tokens can't be valid local user names
this saves searching for shares on non-public link dav requests

Signed-off-by: Robin Appelman <robin@icewind.nl>
2018-08-16 21:27:57 +02:00
Daniel Calviño Sánchez 4b7fa4ac2e Add support for tokens in room shares
Tokens will be used to give access to a share to guests in public rooms.
Although the token itself is created in the provider of room shares and
no changes are needed for that, due to the code structure it is
necessary to explicitly call the provider from the manager when getting
a room share by token.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2018-08-08 14:25:44 +02:00
Daniel Calviño Sánchez d9458b303a Add support for room shares to the share manager
Room shares are implemented in an external app (Nextcloud Talk), so in
order to keep the share manager as isolated as possible from room share
specifics all the validity checks are done in the provider of room
shares. However, due to the code structure it is necessary to explicitly
check for room shares in "generalCreateChecks" to prevent an exception
from being thrown.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2018-08-08 14:25:43 +02:00
Daniel Calviño Sánchez 4ee839d69c Add provider for room shares
The RoomShareProvider is provided by the Talk app, so it is necessary to
check whether the app is available or not, and also whether the class
itself exists or not (just in case an older version of the app that did
not have support yet for room shares is being used).

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2018-08-08 14:25:43 +02:00
Daniel Calviño Sánchez d582a66bea Honour "sendPasswordByTalk" property in mail shares
When a password was set for a mail share an e-mail was sent to the
recipient with the password. Now the e-mail is no longer sent if the
password is meant to be sent by Talk.

However, before the e-mail was not sent when the share was updated but
the password was not changed. Now an e-mail is sent in that case too if
switching from a password sent by Talk to a password sent by mail.

On the other hand, when switching from a password sent by mail to a
password sent by Talk it is mandatory to change the password; otherwise
the recipient would already have access to the share without having to
call the sharer to verify her identity.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2018-07-24 13:56:29 +02:00
Daniel Calviño Sánchez 88600f4ecf Add "sendPasswordByTalk" property to shares
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2018-07-24 13:56:28 +02:00
Bjoern Schiessle eab4d96c4c
some small template fixes
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
2018-07-21 15:02:19 +02:00
Bjoern Schiessle 94c7052482
allow 'note' to be null
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
2018-07-21 15:02:19 +02:00
Bjoern Schiessle 2250dbec21
add a nice looking button as direct link to the sharre
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
2018-07-21 15:02:19 +02:00
Bjoern Schiessle b56ccef564
add direct link to the file for user/group shares
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
2018-07-21 15:02:18 +02:00
Bjoern Schiessle a29261175d
fix mail templates
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
2018-07-21 15:02:18 +02:00
Bjoern Schiessle 73b88deeb8
add note to share object when reading it from the db
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
2018-07-21 15:02:18 +02:00
Bjoern Schiessle c116d116fa
improve mail template and escape html code
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
2018-07-21 15:02:18 +02:00
Bjoern Schiessle a93f2a648b
allow to add a personal note to a share
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
2018-07-21 15:02:18 +02:00
Morris Jobke 82021b2b1b
Merge pull request #5280 from nextcloud/shared-with-display-name
sharedWithDisplayName & sharedWithAvatar
2018-07-13 17:29:57 +02:00
Bjoern Schiessle c668c5b997
fix selection of share provider
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
2018-07-12 19:42:36 +02:00