Get list of all projects returned by JQL of a filter

Need to restrict filter from anyone (public) to projects returned by filter’s JQL
Is there a way to get this project id & name, so that it can restricted by removing public & resharing to those projects only

Any ideas appreciated. Thanks much in advance

Hi @Lokesh.char,

Which deployment option of Jira are you building for? Cloud, Server, or Data Center?

That will help with finding the right answer.

Hi @pvandevoorde, Its Data center
Would there any dependencies as Server & Data center are almost same.

You can run SearchProvider#search with collector (FieldHitCollector on DocumentConstants.PROJECT_ID might fit your use case).
Keep in mind that you’ll receive project ids from all issues that are currently returned for that JQL query, and you might need to implement logic to periodically update permissions if that’s required.