Source:
public HttpResponse doPlugins() { Jenkins.get().checkPermission(Jenkins.SYSTEM_READ); JSONArray response = new JSONArray(); Map<String,JSONObject> allPlugins = new HashMap<>(); for (PluginWrapper plugin : plugins) { JSONObject pluginInfo = new JSONObject(); pluginInfo.put("installed", true); pluginInfo.put("name", plugin.getShortName()); pluginInfo.put("title", plugin.getDisplayName()); pluginInfo.put("active", plugin.isActive()); pluginInfo.put("enabled", plugin.isEnabled()); pluginInfo.put("bundled", plugin.isBundled); pluginInfo.put("deleted", plugin.isDeleted()); pluginInfo.put("downgradable", plugin.isDowngradable()); pluginInfo.put("website", plugin.getUrl()); List<Dependency> dependencies = plugin.getDependencies(); if (dependencies != null && !dependencies.isEmpty()) { Map<String, String> dependencyMap = new HashMap<>(); for (Dependency dependency : dependencies) { dependencyMap.put(dependency.shortName, dependency.version); } pluginInfo.put("dependencies", dependencyMap); } else { pluginInfo.put("dependencies", Collections.emptyMap()); } response.add(pluginInfo); } for (UpdateSite site : Jenkins.get().getUpdateCenter().getSiteList()) { for (UpdateSite.Plugin plugin: site.getAvailables()) { JSONObject pluginInfo = allPlugins.get(plugin.name); if(pluginInfo == null) { pluginInfo = new JSONObject(); pluginInfo.put("installed", false); } pluginInfo.put("name", plugin.name); pluginInfo.put("title", plugin.getDisplayName()); pluginInfo.put("excerpt", plugin.excerpt); pluginInfo.put("site", site.getId()); pluginInfo.put("dependencies", plugin.dependencies); pluginInfo.put("website", plugin.wiki); response.add(pluginInfo); } } return hudson.util.HttpResponses.okJSON(response); }

Target:
public HttpResponse doPlugins() { Jenkins.get().checkPermission(Jenkins.ADMINISTER); JSONArray response = new JSONArray(); Map<String,JSONObject> allPlugins = new HashMap<>(); for (PluginWrapper plugin : plugins) { JSONObject pluginInfo = new JSONObject(); pluginInfo.put("installed", true); pluginInfo.put("name", plugin.getShortName()); pluginInfo.put("title", plugin.getDisplayName()); pluginInfo.put("active", plugin.isActive()); pluginInfo.put("enabled", plugin.isEnabled()); pluginInfo.put("bundled", plugin.isBundled); pluginInfo.put("deleted", plugin.isDeleted()); pluginInfo.put("downgradable", plugin.isDowngradable()); pluginInfo.put("website", plugin.getUrl()); List<Dependency> dependencies = plugin.getDependencies(); if (dependencies != null && !dependencies.isEmpty()) { Map<String, String> dependencyMap = new HashMap<>(); for (Dependency dependency : dependencies) { dependencyMap.put(dependency.shortName, dependency.version); } pluginInfo.put("dependencies", dependencyMap); } else { pluginInfo.put("dependencies", Collections.emptyMap()); } response.add(pluginInfo); } for (UpdateSite site : Jenkins.get().getUpdateCenter().getSiteList()) { for (UpdateSite.Plugin plugin: site.getAvailables()) { JSONObject pluginInfo = allPlugins.get(plugin.name); if(pluginInfo == null) { pluginInfo = new JSONObject(); pluginInfo.put("installed", false); } pluginInfo.put("name", plugin.name); pluginInfo.put("title", plugin.getDisplayName()); pluginInfo.put("excerpt", plugin.excerpt); pluginInfo.put("site", site.getId()); pluginInfo.put("dependencies", plugin.dependencies); pluginInfo.put("website", plugin.wiki); response.add(pluginInfo); } } return hudson.util.HttpResponses.okJSON(response); }