Problem/Motivation

I recently had a requirement that the authorize links expire 24 hours after the first use rather than 24 hours after creation.

Proposed resolution

Add a 'Refresh' option to the Content type configuration tab that will extend a link’s expiration date based on first use.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Daniel Korte created an issue. See original summary.

daniel korte’s picture

Assigned: daniel korte » Unassigned
Status: Active » Needs review
StatusFileSize
new2.84 KB
daniel korte’s picture

Added the option to alter the expiration date after refresh.

tunic’s picture

Version: 7.x-1.x-dev » 2.x-dev
Status: Needs review » Needs work

That's a ver interesting feature, thanks for the patch. Unfortunately, it was not handled for along time. Current development is on the branch 2.x, Drupal 10 release.

rishabjasrotia made their first commit to this issue’s fork.

rishabjasrotia’s picture

Assigned: Unassigned » rishabjasrotia
Status: Needs work » Needs review
rishabjasrotia’s picture

StatusFileSize
new5.9 KB

D10 Patch.
@tunic please review!

tunic’s picture

Status: Needs review » Needs work

I the current approach is reusing the 'created' field in the database to set there the expiration date. Honestly, I'm not fan of reusing fields. I think we should take another approach. Either add a new a database field with expiration date or rename the 'created' field to 'expiration'. In both cases, the 'expiration' date should handled to hold the date the authkey should be refreshed.

So, for nodes with no expiration this field should be empty. For nodes with expiration configured, it will set to an expiration date calculated adding expiration time (1 day, 1 week, 1 year, etc) to the current date (or creation date, it should be the same when creating an authkey). During this time span, the authkey is valid, and once the expiration time is reached the authkey is regenerated.

Given that would interesting to have the creation time we can go with the option of creating a new field.

If there's a refresh configuration, whenever a node is accessed, the expiration time is changed with the value current data + refresh time. So, if the refresh time one day the expiration date is set to tomorrow.

Also, I would improve the messages in the form. For example, "After refreshing a link, the expiration date will be extended (or shortened) by this time length." is confusing me. Extended or shortened? I would say something like "After refreshing a link, a new expiration date will be set based on the expiration extension set. For example, if expiration extension is set to 1 day, when a node is accessed using its authkey the expiration time will be set to the next day.". I think that is clearer than current message.

What do think about this?

rishabjasrotia’s picture

Assigned: rishabjasrotia » Unassigned
rishabjasrotia’s picture

Assigned: Unassigned » rishabjasrotia