Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update user share must use correct expiration validation #26200

Merged
merged 1 commit into from
Mar 19, 2021

Conversation

PVince81
Copy link
Member

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".

Fixes #26197

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>
@@ -975,15 +975,15 @@ public function updateShare(IShare $share) {

if ($share->getExpirationDate() != $originalShare->getExpirationDate()) {
//Verify the expiration date
$this->validateExpirationDate($share);
$this->validateExpirationDateInternal($share);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the actual fix

$expirationDateUpdated = true;
}
} elseif ($share->getShareType() === IShare::TYPE_GROUP) {
$this->groupCreateChecks($share);

if ($share->getExpirationDate() != $originalShare->getExpirationDate()) {
//Verify the expiration date
$this->validateExpirationDate($share);
$this->validateExpirationDateInternal($share);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and here

@PVince81
Copy link
Member Author

/backport to stable21

@PVince81
Copy link
Member Author

/backport to stable20

@PVince81
Copy link
Member Author

/backport to stable19

@@ -459,7 +459,7 @@ protected function validateExpirationDateInternal(IShare $share) {
* @throws \InvalidArgumentException
* @throws \Exception
*/
protected function validateExpirationDate(IShare $share) {
protected function validateExpirationDateLink(IShare $share) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
protected function validateExpirationDateLink(IShare $share) {
protected function validateLinkExpirationDate(IShare $share) {

if that makes it a tad clearer. just an idea :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the other one is called validateLinkExpirationDateInternal so I'd have to rename it also everywhere...
nah... another time, but thanks for the suggestion

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Updating enforced expiration date validation mixed up between user and link shares
3 participants