Allow using the account tracking without having to disable accounts
Enable the tracking-only functionality for the accounts tracking script
so that the Gerrit admin can purely keep track of who is using the
platform without having to necessarily automatically disable the
inactive users.
Change-Id: Ibc4c22235c7d9156d625f913a72fcf4936dbb339
diff --git a/admin/track-and-disable-inactive-users-1.3.groovy b/admin/track-and-disable-inactive-users-1.3.groovy
index 71dcfc4..551d619 100644
--- a/admin/track-and-disable-inactive-users-1.3.groovy
+++ b/admin/track-and-disable-inactive-users-1.3.groovy
@@ -123,6 +123,7 @@
final Set<Account.Id> ignoreAccountIds
final Set<AccountGroup.UUID> ignoreGroupIds
final boolean preloadAccounts
+ final boolean disableAccounts
private final PluginConfig config
@@ -140,6 +141,7 @@
ignoreAccountIds = ignoreAccountIdsFromConfig("ignoreAccountId")
ignoreGroupIds = ignoreGroupIdsFromConfig("ignoreGroup", groupCache)
preloadAccounts = config.getBoolean("preloadAccounts", true)
+ disableAccounts = config.getBoolean("disableAccounts", true)
logger.atInfo().log("Accounts ids ignored for inactivity: %s", ignoreAccountIds)
logger.atInfo().log("Group ids ignored for inactivity: %s", ignoreGroupIds)
@@ -226,6 +228,10 @@
}
private void disableAccount(Account.Id accountId) {
+ if (!autoDisableConfig.disableAccounts || autoDisableConfig.ignoreAccountIds.contains(accountId)) {
+ return
+ }
+
logger.atInfo().log("Automatically disabling user id: %d", accountId.get())
accountsUpdate.get().update(
"""Automatically disabling after inactivity
diff --git a/admin/track-and-disable-inactive-users.md b/admin/track-and-disable-inactive-users.md
index b79e635..a6db55d 100644
--- a/admin/track-and-disable-inactive-users.md
+++ b/admin/track-and-disable-inactive-users.md
@@ -53,6 +53,16 @@
Default: true.
+```plugin.@PLUGIN@.disableAccounts```
+: Allow to disable the users that have been evicted from the persistent cache because
+ of inactivity.
+
+ > **NOTE**: When this option is enabled, as soon as a user is evicted from the
+ > persistent cache is then flagged as inactive on All-Users and therefore will be
+ > unable to login or execute any operation until is manually reactivated.
+
+ Default: true.
+
```cache."@PLUGIN@.users_cache".maxAge```
: Maximum allowed inactivity time for user.
Value should use common time unit suffixes to express their setting: