I am trying to write a plugin that will act on all the repositories on a server when the plugin is enabled. RepositoryService.findAll is returning an empty result. Is there another call I can use to get a list of all of the repos on the server?
Community moderators have prevented the ability to post new answers.
Answering my own question - the plugin wasn't running under any secutiory context, so it was only seeing public repositories, which none existed. I had to run the findAll under with ADMIN privileges.
public void checkRepos() { securityService.withPermission(Permission.ADMIN," Enabling Hook").call(new UncheckedOperation<Boolean>() { @Override public Boolean perform() { PageRequest pageRequest = new PageRequestImpl(0,65536); Page<Repository> repoPages = repoService.findAll(pageRequest); for (Repository repo : repoPages.getValues()){ //Do my repo work here } return true; } }); }
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.