Fix validation of plugin capability on REST view that handles PUT on collection

If a plugin has a REST collection that accepts PUT requests and the
REST view that handles these PUT requests is annotated with
@RequiresCapability to require a plugin capability then the validation
of this capability in Gerrit core fails since the plugin name is not
forwarded to the capability check. Because of the missing plugin name
the capability check is looking for a Gerrit core capability although
it should check for a plugin capability.

Change-Id: I9779bd04b4b849bd8c3646a3e226b07faf3e9cc3
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
This commit is contained in:
Edwin Kempin
2014-02-07 10:42:03 +01:00
parent 86fd992b32
commit f94e9bb866

View File

@@ -270,7 +270,7 @@ public class RestApiServlet extends HttpServlet {
|| "PUT".equals(req.getMethod()))) {
@SuppressWarnings("unchecked")
AcceptsCreate<RestResource> ac = (AcceptsCreate<RestResource>) c;
viewData = new ViewData(null, ac.create(rsrc, id));
viewData = new ViewData(viewData.pluginName, ac.create(rsrc, id));
status = SC_CREATED;
} else {
throw e;