summaryrefslogtreecommitdiffstats
path: root/tests/lib/Share20/ManagerTest.php
Commit message (Collapse)AuthorAgeFilesLines
* Check style updateCarl Schwan2022-01-131-62/+62
| | | | Signed-off-by: Carl Schwan <carl@carlschwan.eu>
* Add unit test for share enumeration methodJoas Schilling2021-11-091-1/+79
| | | | Signed-off-by: Joas Schilling <coding@schilljs.com>
* Move common logic to share managerJoas Schilling2021-11-091-10/+25
| | | | Signed-off-by: Joas Schilling <coding@schilljs.com>
* Migrate HintException to OCPGary Kim2021-06-301-1/+1
| | | | Signed-off-by: Gary Kim <gary@garykim.dev>
* Merge pull request #26727 from nextcloud/group-exclude-link-shareMorris Jobke2021-05-211-10/+23
|\ | | | | Add option to exclude groups from creating link shares
| * load share settings from the share manager in more placesRobin Appelman2021-05-121-10/+23
| | | | | | | | Signed-off-by: Robin Appelman <robin@icewind.nl>
* | l10n: Fix testValdnet2021-05-201-23/+23
|/
* Fix test by defining pluralsJoas Schilling2021-04-201-1/+5
| | | | Signed-off-by: Joas Schilling <coding@schilljs.com>
* Separate settings for remote share expirationVincent Petry2021-04-151-70/+207
| | | | | | | Added separate settings for default and enforced expiration date for remote shares. Signed-off-by: Vincent Petry <vincent@nextcloud.com>
* Fix sharebymail testsJohn Molakvoæ (skjnldsv)2021-03-221-64/+64
| | | | Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
* Remove duplicated query for email sharesDaniel Calviño Sánchez2021-03-221-63/+79
| | | | | Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com> Signed-off-by: npmbuildbot-nextcloud[bot] <npmbuildbot-nextcloud[bot]@users.noreply.github.com>
* Merge pull request #23718 from nextcloud/already-shared-error-messageRoeland Jago Douma2021-03-191-4/+13
|\ | | | | expand 'path is already shared' error message
| * expand 'path is already shared' error messageRobin Appelman2021-03-151-4/+13
| | | | | | | | Signed-off-by: Robin Appelman <robin@icewind.nl>
* | Update user share must use correct expiration validationVincent Petry2021-03-181-40/+40
|/ | | | | | | | | | | 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>
* deleteChildren only returns arrayMaxence Lange2020-12-231-0/+4
| | | Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
* Extend dummy factory in testsJulius Härtl2020-12-091-0/+6
| | | | Signed-off-by: Julius Härtl <jus@bitgrid.net>
* Add unit tests for "validateExpirationDateInternal"Daniel Calviño Sánchez2020-11-161-0/+284
| | | | | | | They were copied and adjusted as needed from the tests for "validateExpirationDate". Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
* Add explicit time to test date for clarityDaniel Calviño Sánchez2020-11-121-3/+5
| | | | | | | 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>
* Add unit test for expiration date with date and with defaultDaniel Calviño Sánchez2020-11-121-0/+28
| | | | | | | 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>
* Fix unit test for expiration date without date but with defaultDaniel Calviño Sánchez2020-11-121-7/+5
| | | | | | | | | 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>
* Fix unit test method nameDaniel Calviño Sánchez2020-11-121-1/+1
| | | | Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
* Fix unit test for verifying enforced valid expiration date.Daniel Calviño Sánchez2020-11-121-0/+1
| | | | | | | 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>
* Fix unit test for verifying enforced expire date too far in the futureDaniel Calviño Sánchez2020-11-121-8/+5
| | | | | | | | | | | | 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>
* Add unit tests to enforce a relaxed default share expiration dateDaniel Calviño Sánchez2020-11-121-0/+21
| | | | Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
* Remove wrong and misleading commentDaniel Calviño Sánchez2020-11-121-2/+0
| | | | Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
* Remove extra spacesDaniel Calviño Sánchez2020-11-121-10/+6
| | | | Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
* Fix typo in variable nameDaniel Calviño Sánchez2020-11-121-129/+129
| | | | Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
* Fix typos in method namesDaniel Calviño Sánchez2020-11-121-9/+9
| | | | Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
* use file name instead of path in 'not allowed to share' messageRobin Appelman2020-10-291-3/+6
| | | | Signed-off-by: Robin Appelman <robin@icewind.nl>
* Format code to a single space around binary operatorsChristoph Wurst2020-10-051-3/+3
| | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* Use the correct mountpoint to calculateRoeland Jago Douma2020-07-091-0/+9
| | | | | | | 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>
* Update share type constant usageJoas Schilling2020-06-241-123/+123
| | | | Signed-off-by: Joas Schilling <coding@schilljs.com>
* Prevent harder to share your rootJoas Schilling2020-06-031-2/+4
| | | | Signed-off-by: Joas Schilling <coding@schilljs.com>
* Fix disabling send password by Talk without new password in mail sharesDaniel Calviño Sánchez2020-05-291-5/+79
| | | | | | | | | | | | | | | | | | 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>
* Fix enabling send password by Talk with same password in mail sharesDaniel Calviño Sánchez2020-05-281-4/+96
| | | | | | | | | | | | | 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>
* Fix enabling send password by Talk with empty password in link sharesDaniel Calviño Sánchez2020-05-281-0/+69
| | | | | | | 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>
* Merge pull request #19793 from nextcloud/bugfix/noid/link-to-federated-reshareMorris Jobke2020-04-271-18/+0
|\ | | | | Fix resharing of federated shares that were created out of links
| * Remove unneeded test since links have resharing permissions by defaultJulius Härtl2020-04-211-18/+0
| | | | | | | | Signed-off-by: Julius Härtl <jus@bitgrid.net>
* | Allow specifying a default expiration dateRoeland Jago Douma2020-04-241-0/+1
|/ | | | | | This overrides the max expiration date. Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* Format control structures, classes, methods and functionChristoph Wurst2020-04-101-22/+27
| | | | | | | | | | | | | | | 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>
* Unify function spacing to PSR2 recommendationChristoph Wurst2020-04-091-24/+24
| | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* Fix (array) indent style to always use one tabChristoph Wurst2020-04-091-9/+9
| | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* Use the shorter phpunit syntax for mocked return valuesChristoph Wurst2020-03-251-100/+100
| | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* Strip of users home path from share api messageJoas Schilling2020-02-201-0/+3
| | | | Signed-off-by: Joas Schilling <coding@schilljs.com>
* config.php setting to always accept internal sharesRoeland Jago Douma2019-12-161-43/+57
| | | | | | Part of #18255 Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* Merge pull request #17725 from nextcloud/enh/share_exp_internalRoeland Jago Douma2019-11-281-1/+2
|\ | | | | Allow internal shares to have a default expiration date
| * Fix testsRoeland Jago Douma2019-11-271-1/+2
| | | | | | | | Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* | Mode to modern phpunitRoeland Jago Douma2019-11-271-130/+130
| | | | | | | | Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* | Fix more testsRoeland Jago Douma2019-11-271-2/+2
| | | | | | | | Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* | Make phpunit8 compatibleRoeland Jago Douma2019-11-271-1/+1
|/ | | | Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>