Allow admins to disable remote plugin installation
Some systems might prefer to block remote plugin installation, requiring the user to instead have access to the server's own $site_path/plugins directory before code can be injected into the installation. Change-Id: I16bd9de83e022a15767fd29ce9e2fb55674f103b
This commit is contained in:
committed by
Edwin Kempin
parent
a145270984
commit
fd03350b9e
@@ -17,6 +17,7 @@ package com.google.gerrit.server.plugins;
|
||||
import com.google.gerrit.extensions.registration.DynamicMap;
|
||||
import com.google.gerrit.extensions.restapi.AcceptsCreate;
|
||||
import com.google.gerrit.extensions.restapi.IdString;
|
||||
import com.google.gerrit.extensions.restapi.MethodNotAllowedException;
|
||||
import com.google.gerrit.extensions.restapi.ResourceNotFoundException;
|
||||
import com.google.gerrit.extensions.restapi.RestCollection;
|
||||
import com.google.gerrit.extensions.restapi.RestView;
|
||||
@@ -58,7 +59,10 @@ public class PluginsCollection implements
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public InstallPlugin create(TopLevelResource parent, IdString id)
|
||||
throws ResourceNotFoundException {
|
||||
throws ResourceNotFoundException, MethodNotAllowedException {
|
||||
if (!loader.isRemoteAdminEnabled()) {
|
||||
throw new MethodNotAllowedException("remote installation is disabled");
|
||||
}
|
||||
return new InstallPlugin(loader, id.get(), true /* created */);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user