Commit Graph

89 Commits

Author SHA1 Message Date
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 f2c7ca4584
fixing tests + avoid duplicate in getFormattedShares()
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
2019-12-03 08:13:22 +01:00
Maxence Lange ccf7d87c11
integration tests
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
add tests on non-owner pov

Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
duplicate

Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
small fixes

Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
removed tags

Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
2019-12-03 08:10:27 +01:00
Maxence Lange 5794f14df9
Inherited Shares
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
working on users with resharing rights

Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
-getLogger()

Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
cleaning

Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
fix type

Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
Update SharingRightsException.php
2019-12-03 08:10:27 +01:00
Roeland Jago Douma c7d5b8fc49
Merge pull request #18079 from nextcloud/fixes/phpcs
Some php-cs fixes
2019-11-25 14:07:00 +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
waleczny 6e3ea09b1c
Get first element of nodes array
Geting first element of nodes array instead of element with key 0. In some cases key 0 not exists in this array ie. when file is shared from group folder with member of this group who have no permission to read this file.
2019-11-18 23:33:26 +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
John Molakvoæ (skjnldsv) 2fd057513a Fix current user edit/delete permissions
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
2019-10-29 13:20:08 +01:00
John Molakvoæ (skjnldsv) cc4362df4f Unify code to get shares of a file or also including subfiles
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
2019-10-25 21:41:12 +02:00
John Molakvoæ (skjnldsv) dbb6b4cbb9 Filter out duplicated shares before processing them
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
2019-10-25 21:41:12 +02:00
Daniel Calviño Sánchez 8098abee60 Do not return shares with the current user
Getting the shares of a file no longer returns shares with the current
user for consistency with the results when getting the shares including
subfiles.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2019-10-25 21:40:50 +02:00
Daniel Calviño Sánchez 1afefc2d9a Extract method to get all shares
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2019-10-25 21:39:49 +02:00
Daniel Calviño Sánchez 222e5a9a9f Add missing share types when getting shares of a file
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2019-10-25 21:39:49 +02:00
Daniel Calviño Sánchez 24febe1e41 Unify share type sorting when getting shares of a file or with subfiles
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2019-10-25 21:39:49 +02:00
Daniel Calviño Sánchez 0599536c82 Remove unneeded calls to "ShareManager::shareProviderExists()"
"ShareManager::getSharesBy()" already checks if the share provider
exists before returning the shares and, if the provider does not exist,
it returns an empty array. Therefore it is not needed to explicitly
check if the provider exists or not.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2019-10-25 21:39:49 +02:00
John Molakvoæ (skjnldsv) ff895abac0
Fix shares read permissions
A user with reshare permissions on a file is now able to get any share
of that file (just like the owner).

Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
2019-10-04 21:40:30 +02:00
John Molakvoæ (skjnldsv) b1069b29fa
Add checks for whether a user with access to a share can delete it
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
2019-10-04 19:25:11 +02:00
John Molakvoæ (skjnldsv) f02cff1304
Extract check for whether a user with access to a share can edit it
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
2019-10-04 19:25:11 +02:00
John Molakvoæ (skjnldsv) c49469c4d8
Prevent non owners to update others link shares
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
2019-10-04 08:19:07 +02:00
John Molakvoæ (skjnldsv) c8d50538b8
Use same settings for mail share as link shares
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
2019-10-04 08:19:07 +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
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 7aa26b28a8
Correctly check share permissions when updating a re-sub-share
Before this change the node you shared was checked for permissions.
This works when you reshare the folder that was shared with you.
However when you reshared a subfolder (e.g. as public link),
you could afterwards update the permissions and grant
create+update permissions although the share you receive was read-only.

Signed-off-by: Joas Schilling <coding@schilljs.com>
2019-06-27 15:27:30 +02:00
Maxence Lange 749fdab3b0 do not returns shared_with === currentUser
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
2019-04-01 11:17:05 -01:00
Maxence Lange 0166990f01 fixing share format
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
2019-03-31 10:40:14 -01:00
Maxence Lange efbadf0cf2 issue during last push
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
2019-03-31 10:40:14 -01:00
Maxence Lange 44c1feb938 returns reshares in API
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
2019-03-31 10:40:14 -01:00
Joas Schilling ee545d6840
Fix typo in "incoming"
Signed-off-by: Joas Schilling <coding@schilljs.com>
2018-12-05 11:27:38 +01:00
Roeland Jago Douma a343a60a68
Handle permission in update of share better
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-11-20 09:42:01 +01:00
Daniel Calviño Sánchez b2cc2d6023 Add "password" parameter to the response data of link shares
Due to legacy reasons the password of link shares was returned in the
"share_with" and "share_with_displayname" parameters of the response
data. Now a proper "password" parameter is returned too; the old
"share_with" and "share_with_displayname" parameters are kept, although
deprecated, and they will be removed in a future version of Nextcloud.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2018-11-06 23:48:28 +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 0fc8a0f58e
user can have his resharing rights revoked, yet seeing created shares
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
2018-11-02 12:10:49 +01:00
Maxence Lange 236a293f6a
check parents resharing rights
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
2018-11-02 12:10:48 +01:00
Maxence Lange 275cea5d9c
limit to circles moderator
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
2018-11-02 12:09:28 +01:00
Maxence Lange 72ad2d60b5
display shares to circles moderator
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
2018-11-02 12:09:28 +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 adf80aa8b3 Add sending the password by Talk for a link share to ShareAPIController
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
Bjoern Schiessle d0411b2369
allow to create multiple link shares via share api
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
2018-10-31 06:55:52 +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
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
Roeland Jago Douma 13b1cd5cb8
Allow userId to be null
Fixes #10852

A quick hack. Still ensures some type safety however now also accepts
null. Else we'd need to add a whole new layer of middlewares.

This can only happen when a guest user wants to access a controller that
requries the user_id.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-10-04 13:04:58 +02:00
Daniel Calviño Sánchez e2e6f23b67 Suppress Phan warnings about calling undeclared class methods
The DeletedShareAPIController and ShareAPIController helpers for room
shares are defined in Talk, so the classes do not exist when Talk is not
installed. Due to this when the object returned by "getRoomShareHelper"
is used Phan complains that the class is not declared.

This is not a problem, though, because when the class is not available
"getRoomShareHelper" throws an exception, which is then caught where
that method was called. Therefore now those warnings from Phan are
suppressed (it would be better to use "@phan-suppress-next-line"
instead, but it is not yet available in our Phan version).

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2018-08-08 14:25:44 +02:00
Daniel Calviño Sánchez 4ed7131e26 Add support for room shares to ShareAPIController
In some cases, the ShareAPIController requires explicit handling of each
type of share (for example, to format a share for a DataResponse). Room
shares are implemented in an external app (Nextcloud Talk), so in order
to keep the controller as isolated as possible from room share specifics
all that explicit handling is done in a helper class provided by the
Talk app.

In other cases it is just enough to call the share manager specifying a
room share type; note that the share manager is guarded against share
types for which there is no provider, so it is not necessary to
explicitly check that before passing room shares to the share manager.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2018-08-08 14:25:43 +02:00
Daniel Calviño Sánchez 7849630cef Add support for sending the password by Talk to ShareAPIController
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2018-07-24 14:04:17 +02:00
Bjoern Schiessle 72d2455577
return the as well note if we fetch a share
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
2018-07-21 15:02:19 +02:00