- πΊπΈUnited States cgmonroe
Semi old request but in case anyone has a need like this there is a module that will do what the requestor asks for:
https://www.drupal.org/project/user_expire β
No need to add code to this module.
- π³π±Netherlands roderik Amsterdam,NL / Budapest,HU
Option to block accounts after a period of inactivity is indeed not something this module should do.
Then there's the "unblocking blocked users upon SAML login" part.
I can see some logic in the reasoning "the IdP is the source of all user data, including blocked-ness, Drupal shouldn't stand in the way of this" -- but it still feels like a can of worms to me. I'd have to see other people arguing for it too.
If you want this specific thing, for now I regard it as a custom-code scenario where you can have your own class extend SamlService and register that as 'samlauth.saml' service. Code to be something like:
protected function doLogin($unique_id, AccountInterface $account = NULL) { try { parent::doLogin($unique_id, $account); } catch (UserVisibleException $e) { if ($account && $e->getOriginalMessage() === 'Requested account is blocked.') { $account->activate(); parent::doLogin($unique_id, $account); $account->save(); // possibly duplicate save if synchronizeUserAttributes() saved it too } } }
While I was drafting up this code, I already saw the can of worms appearing. I assume you really want to do the
$account &&
part here... because I assume you only want to unblock blocked users that were already previously linked to a SAML login.