Do not automatically disable non-interactive users The "Service Accounts" (aka. non-interactive users) should not be automatically disabled by the script. Those accounts are used for CI and other integrations and may be dormant for some time, we should not increase Gerrit Admin workload by automatically disabling them. This could also lead to frustration when a "paused" service is back online but it doesn't work because their user was blocked. Additionally, bumps the script version number to 1.1, which results in file rename. Bug: Issue 338071090 Change-Id: Ia09d000c72be062b8a00fa634e3ef75c85aab3bc
diff --git a/admin/track-and-disable-inactive-users-1.0.groovy b/admin/track-and-disable-inactive-users-1.1.groovy similarity index 94% rename from admin/track-and-disable-inactive-users-1.0.groovy rename to admin/track-and-disable-inactive-users-1.1.groovy index 33ae335..2131aa4 100644 --- a/admin/track-and-disable-inactive-users-1.0.groovy +++ b/admin/track-and-disable-inactive-users-1.1.groovy
@@ -145,6 +145,9 @@ Accounts accounts @Inject + ServiceUserClassifier serviceUserClassifier + + @Inject @Named(TrackActiveUsersCache.NAME) Cache<Integer, Long> trackActiveUsersCache @@ -152,7 +155,11 @@ void start() { def currentMinutes = MILLISECONDS.toMinutes(System.currentTimeMillis()) accounts.all() - .findAll { it.account().isActive() && !trackActiveUsersCache.getIfPresent(it.account().id().get()) } + .findAll { + it.account().isActive() + && !serviceUserClassifier.isServiceUser(it.account().id() + && !trackActiveUsersCache.getIfPresent(it.account().id().get()) + } .each { trackActiveUsersCache.put(it.account().id().get(), currentMinutes) } }