Support an "expire if inactive" option

Created on 16 November 2022, almost 3 years ago
Updated 19 September 2024, about 1 year ago

Problem/Motivation

For security reasons, we would like to be able to expire roles for inactive users, separate from the "standard" role expiry.

Proposed resolution

Add a field to the "edit role" functionality (where "default duration" already lives) for "Inactive expiry for the role [rolename]". Help text could be something like "Enter a time span you want to set as the duration this role should be preserved from a user's last login, or leave blank to not expire this role due to inactivity." (followed by the same examples as "default duration")

When setting the role expiry when this is set, for the "leave the field blank" option:

  • if there is no default duration, instead of saying "this role will never expire" say something like "the role will only expire if the user is inactive for [period set]"
  • If there is a default duration, add at the end "or if the user is inactive for [period set], whichever comes first"

Remaining tasks

  1. Decide if this is a feature this module wants to take on.
  2. Decide if the proposed implementation is acceptable.
  3. Implement it. :)

User interface changes

See proposed resolution.

Feature request
Status

Active

Version

4.0

Component

Code

Created by

🇨🇦Canada kpaxman

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

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • This is still true for version 4.1. Therefore, I will try to implement this functionality

  • 🇩🇪Germany Anybody Porta Westfalica

    Maybe this should live in a submodule as it's not part of the core functionality?

  • 🇪🇸Spain rcodina Barcelona

    I agree, this should be a submodule.

  • 🇨🇦Canada kpaxman

    I'd prefer it to be behind an "enable feature" checkmark, FWIW, as someone who is running way too many modules already. :)

  • I will have some free time over the weekend and will complete this task.
    Yes, I also think it's better to put it in a submodule.

  • I'm sorry, I had a lot of unplanned work to do and didn't have any free time this weekend. I will definitely do it on the next one. But I would like to clarify if we are adding an “Inactive Expiration” field in the user creation form?

  • 🇪🇸Spain rcodina Barcelona

    @kuzyawkk You don't have to apologize. Just do it when you can. And if you can't, just leave the issue unassigned.

    On the other hand, as written in the issue description, we are adding another field in the role form (just under the current "Default duration for the role" field).

  • 🇪🇸Spain rcodina Barcelona

    I thinks this feature is implemented on https://www.drupal.org/project/user_expire Maybe this issue it's just about linking to this User Expire module in the project's page.

  • 🇨🇦Canada kpaxman

    Looking at the user_expire module page, but without trying it out, it seems that the difference is that that module locks the user out completely, where this request is just to remove a specified role. (For example, you want to expire their access to edit the site, but still be able to log in to fill in an authenticated form.)

  • 🇪🇸Spain rcodina Barcelona

    @kpaxman You are right.

  • Pipeline finished with Success
    11 months ago
    Total: 189s
    #308639
  • I have implemented the logic, but I'm sure I could have made a mistake somewhere or overlooked certain conditions.

  • Issue was unassigned.
  • Status changed to Needs work 10 months ago
  • 🇪🇸Spain rcodina Barcelona

    I've tested it and it doesn't work yet. We will need tests too.

  • Yes, that's good. I'll take a look at it over the weekend and make some adjustments.

  • Pipeline finished with Success
    3 days ago
    #602430
  • Pipeline finished with Failed
    1 day ago
    Total: 172s
    #603252
  • Pipeline finished with Success
    1 day ago
    Total: 194s
    #603293
  • Pipeline finished with Success
    1 day ago
    Total: 409s
    #603311
  • Status changed to Needs review 1 day ago
Production build 0.71.5 2024