Skip to content

Commit

Permalink
Merge branch 'main' of github.com:AntelopeIO/leap into gh-698-part2
Browse files Browse the repository at this point in the history
  • Loading branch information
greg7mdp committed Apr 11, 2023
2 parents 9aa412b + 13d484c commit 6457040
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ namespace eosio { namespace rest {
try {
auto res = self()->on_request(std::move(req));
if (!res)
not_found(target);
return not_found(target);
return *res;
} catch (std::exception& ex) { return server_error(ex.what()); }
}
Expand Down
14 changes: 7 additions & 7 deletions programs/cleos/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1050,29 +1050,29 @@ struct set_account_permission_subcommand {
struct set_action_permission_subcommand {
string accountStr;
string codeStr;
string typeStr;
string actionStr;
string requirementStr;

set_action_permission_subcommand(CLI::App* actionRoot) {
auto permissions = actionRoot->add_subcommand("permission", localized("Set parameters dealing with account permissions"));
permissions->add_option("account", accountStr, localized("The account to set/delete a permission authority for"))->required();
permissions->add_option("code", codeStr, localized("The account that owns the code for the action"))->required();
permissions->add_option("type", typeStr, localized("The type of the action"))->required();
permissions->add_option("requirement", requirementStr, localized("[delete] NULL, [set/update] The permission name require for executing the given action"))->required();
permissions->add_option("action", actionStr, localized("The name of the action [use ALL for all actions]"))->required();
permissions->add_option("requirement", requirementStr, localized("The permission name required for executing the given action [use NULL to delete]"))->required();

add_standard_transaction_options_plus_signing(permissions, "account@active");

permissions->callback([this] {
name account = name(accountStr);
name code = name(codeStr);
name type = name(typeStr);
bool is_delete = boost::iequals(requirementStr, "null");
name action = (actionStr == "ALL") ? name{} : name(actionStr);
bool is_delete = (requirementStr == "NULL");

if (is_delete) {
send_actions({create_unlinkauth(account, code, type)}, signing_keys_opt.get_keys());
send_actions({create_unlinkauth(account, code, action)}, signing_keys_opt.get_keys());
} else {
name requirement = name(requirementStr);
send_actions({create_linkauth(account, code, type, requirement)}, signing_keys_opt.get_keys());
send_actions({create_linkauth(account, code, action, requirement)}, signing_keys_opt.get_keys());
}
});
}
Expand Down
2 changes: 2 additions & 0 deletions tests/TestHarness/queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,8 @@ def processUrllibRequest(self, resource, command, payload={}, silentErrors=False
rtn = ex.read()
else:
unhandledEnumType(returnType)
elif returnType==ReturnType.raw:
return ex.code
else:
return None

Expand Down
2 changes: 1 addition & 1 deletion tests/nodeos_run_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,7 @@
trans=node.setPermission(testeraAccount, currencyAccount, pType, requirement, waitForTransBlock=True, exitOnError=True)

Print("remove permission")
requirement="null"
requirement="NULL"
trans=node.setPermission(testeraAccount, currencyAccount, pType, requirement, waitForTransBlock=True, exitOnError=True)

Print("Locking all wallets.")
Expand Down
2 changes: 2 additions & 0 deletions tests/plugin_http_api_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1352,6 +1352,8 @@ def test_prometheusApi(self) :
self.assertTrue(int(metrics["blocks_produced"]) > 1)
self.assertTrue(int(metrics["last_irreversible"]) > 1)

ret = self.nodeos.processUrllibRequest(resource, "m", returnType = ReturnType.raw, method="GET", silentErrors= True, endpoint=endpointPrometheus)
self.assertTrue(ret == 404)

def test_multipleRequests(self):
"""Test keep-alive ability of HTTP plugin. Handle multiple requests in a single session"""
Expand Down

0 comments on commit 6457040

Please sign in to comment.