Bitbucket RepositoryService: findAll method doesn't return all repositories?

bitbucket-server
repository
plugin-development

#1

Replicating a community question: https://community.atlassian.com/t5/Bitbucket-questions/URGENT-Bitbucket-RepositoryService-findAll-method-doesn-t-return/qaq-p/992010

Details
I need to receive all repositories from Bitbucket. In order to do this I am using the RepositoryService which has a method called “findAll”. It’s described as follows:
“Find all repositories in the system.”
You can find said RepositoryService with the findAll method here.

Unfortunately this method doesn’t seem to return all repositories. It returns fewer repositories than my file system contains. If I use different endpoints to get all project repositories and all user repositories there are still fewer repositories than in the file system. All repositories on the file system are accessible but somehow aren’t found by the API, despite being found by the database and the file system.

Do any of you know which repositories findAll ignores? Is there a way to get every single repository?

Thank you in advance,

shady boy


#2

Try to finding repos inside a security context like to

securityService.withPermission(REPO_READ, "Find repos").call(() -> {
      repositoryService.findAll(...)
});