Commit Graph

96 Commits (b78f3a57d1d05fb5f81ec8361139b64a3e54d7b0)

Author SHA1 Message Date
Gary Kim b78f3a57d1
Migrate HintException to OCP
Signed-off-by: Gary Kim <gary@garykim.dev>
3 years ago
Morris Jobke f1dbabd910
Merge pull request #26727 from nextcloud/group-exclude-link-share
Add option to exclude groups from creating link shares
3 years ago
Valdnet 1627eb45bb
l10n: Fix test 3 years ago
Robin Appelman b1dca57a1c
load share settings from the share manager in more places
Signed-off-by: Robin Appelman <robin@icewind.nl>
3 years ago
Joas Schilling 79ebc7f24c
Fix test by defining plurals
Signed-off-by: Joas Schilling <coding@schilljs.com>
3 years ago
Vincent Petry af61486aea
Separate settings for remote share expiration
Added separate settings for default and enforced expiration date for
remote shares.

Signed-off-by: Vincent Petry <vincent@nextcloud.com>
3 years ago
John Molakvoæ (skjnldsv) 15767643f2
Fix sharebymail tests
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
3 years ago
Daniel Calviño Sánchez f99876997a
Remove duplicated query for email shares
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Signed-off-by: npmbuildbot-nextcloud[bot] <npmbuildbot-nextcloud[bot]@users.noreply.github.com>
3 years ago
Roeland Jago Douma 1286848731
Merge pull request #23718 from nextcloud/already-shared-error-message
expand 'path is already shared' error message
3 years ago
Vincent Petry a9e3d2a10f
Update user share must use correct expiration validation
Updating a user or group share now uses the correct method for the
validation of the expiration date. Instead of using the one from links
it uses the one for internal shares.

To avoid future confusion, the method "validateExpirationDate" has been
renamed to "validateExpirationDateLink".

Signed-off-by: Vincent Petry <vincent@nextcloud.com>
3 years ago
Robin Appelman a550649708
expand 'path is already shared' error message
Signed-off-by: Robin Appelman <robin@icewind.nl>
3 years ago
Maxence Lange e0bafb7475
deleteChildren only returns array
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
3 years ago
Julius Härtl 85e6cbc87a
Extend dummy factory in tests
Signed-off-by: Julius Härtl <jus@bitgrid.net>
4 years ago
Daniel Calviño Sánchez 4d3cb1533e Add unit tests for "validateExpirationDateInternal"
They were copied and adjusted as needed from the tests for
"validateExpirationDate".

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
4 years ago
Daniel Calviño Sánchez baaaacd650 Add explicit time to test date for clarity
This shows in a clearer way that the expected expiration date is the
original one, but without time.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
4 years ago
Daniel Calviño Sánchez 578b57837a Add unit test for expiration date with date and with default
This adds back what was being actually tested in the unit test fixed in
the previous commit.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
4 years ago
Daniel Calviño Sánchez 70018ddabf Fix unit test for expiration date without date but with default
The expiration date was explicitly given, so it was not testing what it
should. Moreover, "link_defaultExpDays" needs to be mapped when testing
the default value (even if it will just fallback to the value of
"shareapi_expire_after_n_days").

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
4 years ago
Daniel Calviño Sánchez 3a53c2b6e5 Fix unit test method name
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
4 years ago
Daniel Calviño Sánchez e997f0fa46 Fix unit test for verifying enforced valid expiration date.
The enforced expiration date was not actually enabled, as for that
"shareapi_default_expire_date" needs to be explicitly set to "yes".

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
4 years ago
Daniel Calviño Sánchez 8f1fff40e8 Fix unit test for verifying enforced expire date too far in the future
The test should fail if no exception was thrown, and no exception was
thrown due to a missing configuration parameter. However, the use of
"addToAssertionCount(1)" made the test pass even if no exception was
thrown and, therefore, to silently fail.

Now the missing configuration parameter was added and the test will fail
if the expected exception is not thrown.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
4 years ago
Daniel Calviño Sánchez ec92e82571 Add unit tests to enforce a relaxed default share expiration date
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
4 years ago
Daniel Calviño Sánchez 4dbeab5cff Remove wrong and misleading comment
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
4 years ago
Daniel Calviño Sánchez 72f51422ec Remove extra spaces
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
4 years ago
Daniel Calviño Sánchez 7cfa2701b9 Fix typo in variable name
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
4 years ago
Daniel Calviño Sánchez c8dc51f0ba Fix typos in method names
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
4 years ago
Robin Appelman de7026f6e4
use file name instead of path in 'not allowed to share' message
Signed-off-by: Robin Appelman <robin@icewind.nl>
4 years ago
Christoph Wurst d9015a8c94
Format code to a single space around binary operators
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
4 years ago
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>
4 years ago
Joas Schilling 89ed2c37bf
Update share type constant usage
Signed-off-by: Joas Schilling <coding@schilljs.com>
4 years ago
Joas Schilling 69eda9c0f6
Prevent harder to share your root
Signed-off-by: Joas Schilling <coding@schilljs.com>
4 years ago
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>
4 years ago
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>
4 years ago
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>
4 years ago
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
4 years ago
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>
4 years ago
Julius Härtl 397ab1c3c5
Remove unneeded test since links have resharing permissions by default
Signed-off-by: Julius Härtl <jus@bitgrid.net>
4 years ago
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>
4 years ago
Christoph Wurst afbd9c4e6e
Unify function spacing to PSR2 recommendation
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
4 years ago
Christoph Wurst 2fbad1ed72
Fix (array) indent style to always use one tab
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
4 years ago
Christoph Wurst 2ee65f177e
Use the shorter phpunit syntax for mocked return values
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
4 years ago
Joas Schilling e97d643969
Strip of users home path from share api message
Signed-off-by: Joas Schilling <coding@schilljs.com>
4 years ago
Roeland Jago Douma bb4264c565
config.php setting to always accept internal shares
Part of #18255

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
5 years ago
Roeland Jago Douma 62dc320191
Merge pull request #17725 from nextcloud/enh/share_exp_internal
Allow internal shares to have a default expiration date
5 years ago
Roeland Jago Douma 3a7cf40aaa
Mode to modern phpunit
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
5 years ago
Roeland Jago Douma 078f4efb20
Fix tests
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
5 years ago
Roeland Jago Douma 8d4346d656
Fix more tests
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
5 years ago
Roeland Jago Douma c007ca624f
Make phpunit8 compatible
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
5 years ago
Christoph Wurst 1a886b1472
Add typed events for password_policy
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
5 years ago
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>
5 years ago
Daniel Calviño Sánchez 2f49806c20 Add unit tests for "getAllShares()"
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
5 years ago