Over time, Jira instances accumulate a large number of saved filters. In many organizations, especially enterprise environments, some of these filters remain owned by users who have already left the company or whose accounts have been deactivated.
While this may seem harmless at first glance, inactive-user-owned filters can create several administrative and operational challenges — particularly when those filters are private.
This article demonstrates how to identify all private filters owned by inactive users using a simple ScriptRunner Groovy script for Jira Data Center.
The Script Retrieves all saved filters in Jira, checks whether the filter owner is inactive, identifies filters that are private (not shared with anyone), and generates a clean report with:
- Filter ID
- Filter name
- Owner information
- Direct URL to the filter
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.search.SearchRequestManager
def userManager = ComponentAccessor.userManager
def searchRequestManager = ComponentAccessor.getComponent(SearchRequestManager)
def baseUrl = ComponentAccessor.applicationProperties.getString("jira.baseurl")
def results = []
searchRequestManager.getAll().foreach { filter ->
def owner = filter.owner
if (!owner) {
return
}
def ownerUser = userManager.getUserByKey(owner.key)
if (!ownerUser) {
return
}
def ownerInactive = !ownerUser.active
// Private filter = no share permissions
def privateFilter = filter.permissions == null || filter.permissions.permissionSet.isEmpty()
if (ownerInactive && privateFilter) {
results << filter
}
}
if (!results) {
return "No private filters found where owner is inactive."
}
return results.collect { filter ->
def ownerUser = userManager.getUserByKey(filter.owner.key)
"""Filter ID: ${filter.id}
Filter Name: ${filter.name}
Owner: ${ownerUser.displayName}
Username: ${ownerUser.name}
User Key: ${ownerUser.key}
URL: ${baseUrl}/issues/?filter=${filter.id}
-----------------------------"""
}.join("\n")
After identifying these filters, administrators may choose to:
Jira administration is not only about creating projects and workflows, but it is also about maintaining a healthy and governable ecosystem.
Hope that will help someone. :)
Gor Greyan
1 comment