Refactor frequency session checking based on per user key-value

Created on 31 January 2024, 10 months ago

Problem/Motivation

Follow-up from πŸ› Wrong order of parameters in function agreement_user_update(EntityInterface $account) Fixed

When an agreement frequency is set to "Every login" and a user changes their password, this forces the user to agree again.

There was functionality in previous releases for Drupal 6 and Drupal 7 that auto-agreed. This functionality never worked in releases for Drupal 8 or greater because the User entity updates the session id after hook_ENTITY_TYPE_update().

Steps to reproduce

1. Update the default agreement frequency to 0
2. Log in as an unprivileged user account.
3. Accept the agreement
4. Visit the account form
5. Change the user password
6. The user is presented with the agreement again.

Proposed resolution

In order to work around this limitation in Drupal session handling, we probably need to refactor how agreement checking works. It may be a good idea to check once, store in key_value_expirable based on frequency, and use that instead per agreement type and user. This is going to cause a lot of changes internally in AgreementHandler

Remaining tasks

work on a refactor

User interface changes

No

API changes

Internal API only.

Data model changes

No, new storage only.

πŸ“Œ Task
Status

Needs work

Version

3.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States mradcliffe USA

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024