UserService userService = UserServiceFactory.getUserService();
if (commandClass.isAnnotationPresent(NonAdmin.class) || userService.isUserAdmin() ||
util.isUserPermissionedForNamespace(userService.getCurrentUser(),
NamespaceManager.get())) {
Command command = injector.getInstance(commandClass);
command.setParams(jsonRpcRequest.getParams());
try {
JSONObject json = command.execute();
resp.setContentType("application/json; charset=UTF-8");
resp.getWriter().write(json.toString());
} catch (JSONException e) {
jsonExceptionHandler.send(resp, e);
} catch (IllegalArgumentException e) {