add PermissionCheck for Plugins

This commit is contained in:
Eduard Heimbuch
2019-07-10 08:21:05 +02:00
parent f008faabcb
commit 5c473792ef

View File

@@ -4,6 +4,7 @@ import com.webcohesion.enunciate.metadata.rs.ResponseCode;
import com.webcohesion.enunciate.metadata.rs.StatusCodes; import com.webcohesion.enunciate.metadata.rs.StatusCodes;
import com.webcohesion.enunciate.metadata.rs.TypeHint; import com.webcohesion.enunciate.metadata.rs.TypeHint;
import sonia.scm.plugin.PluginLoader; import sonia.scm.plugin.PluginLoader;
import sonia.scm.plugin.PluginPermissions;
import sonia.scm.plugin.PluginWrapper; import sonia.scm.plugin.PluginWrapper;
import sonia.scm.web.VndMediaType; import sonia.scm.web.VndMediaType;
@@ -47,7 +48,7 @@ public class PluginResource {
List<PluginWrapper> plugins = pluginLoader.getInstalledPlugins() List<PluginWrapper> plugins = pluginLoader.getInstalledPlugins()
.stream() .stream()
.collect(Collectors.toList()); .collect(Collectors.toList());
PluginPermissions.read().check();
return Response.ok(collectionMapper.map(plugins)).build(); return Response.ok(collectionMapper.map(plugins)).build();
} }
@@ -73,7 +74,7 @@ public class PluginResource {
.filter(plugin -> id.equals(plugin.getId())) .filter(plugin -> id.equals(plugin.getId()))
.map(mapper::map) .map(mapper::map)
.findFirst(); .findFirst();
PluginPermissions.read().check();
if (pluginDto.isPresent()) { if (pluginDto.isPresent()) {
return Response.ok(pluginDto.get()).build(); return Response.ok(pluginDto.get()).build();
} else { } else {