Skip to content

Fix missing token update when another field (e.g. last checked) changed - #29681

Closed
nickvergessen wants to merge 3 commits into
masterfrom
bugfix/29678/fix-token-update
Closed

Fix missing token update when another field (e.g. last checked) changed#29681
nickvergessen wants to merge 3 commits into
masterfrom
bugfix/29678/fix-token-update

Conversation

@nickvergessen

Copy link
Copy Markdown
Member

Signed-off-by: Joas Schilling <coding@schilljs.com>
@nickvergessen

Copy link
Copy Markdown
MemberAuthor

/backport to stable23

@nickvergessen

Copy link
Copy Markdown
MemberAuthor

/backport to stable22

@nickvergessennickvergessen mentioned this pull request Nov 12, 2021
Signed-off-by: Joas Schilling <coding@schilljs.com>
Comment threadlib/private/Authentication/Token/PublicKeyTokenProvider.php

@CarlSchwanCarlSchwan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Change make sense

Signed-off-by: Joas Schilling <coding@schilljs.com>
$token->setLastActivity($now);
$this->mapper->update($token);
} elseif (!empty($token->getUpdatedFields())) {
$this->mapper->update($token);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

while this fixes the issue it's weird that we do this regular update in a updateTokenActivity method, isn't it?

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Only alternate approach is to either bring the double update back, or to move the acivity time calculation to the session and make the "which update to use" decision there:

$this->tokenProvider->updateTokenActivity($dbToken);
returntrue;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think the double update is the subjectively cleanest as changes are written right where they are made

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Also fine by me

@nickvergessen

Copy link
Copy Markdown
MemberAuthor

Replaced by #29682

@szaimen
szaimen deleted the bugfix/29678/fix-token-update branch November 12, 2021 13:48
@MichaIngMichaIng removed this from the Nextcloud 24 milestone Jan 3, 2022
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

22.2.1 is very slow

4 participants

@nickvergessen@ChristophWurst@CarlSchwan@MichaIng