Allow SUBSCRIBER to delete herself.

This commit is contained in:
stephb9959
2022-03-08 10:53:07 -08:00
parent da1e33b09d
commit dea728234e
2 changed files with 23 additions and 14 deletions

View File

@@ -57,20 +57,26 @@ namespace OpenWifi {
Poco::Net::HTTPRequestHandler * RESTAPI_IntRouter(const char *Path, RESTAPIHandler::BindingMap &Bindings, Poco::Net::HTTPRequestHandler * RESTAPI_IntRouter(const char *Path, RESTAPIHandler::BindingMap &Bindings,
Poco::Logger & L, RESTAPI_GenericServer & S, uint64_t TransactionId) { Poco::Logger & L, RESTAPI_GenericServer & S, uint64_t TransactionId) {
return RESTAPI_Router_I< return RESTAPI_Router_I<
RESTAPI_users_handler, RESTAPI_oauth2_handler,
RESTAPI_user_handler, RESTAPI_users_handler,
RESTAPI_subuser_handler, RESTAPI_user_handler,
RESTAPI_subusers_handler, RESTAPI_system_command,
RESTAPI_system_command, RESTAPI_asset_server,
RESTAPI_action_links, RESTAPI_system_endpoints_handler,
RESTAPI_validate_token_handler, RESTAPI_action_links,
RESTAPI_validate_sub_token_handler, RESTAPI_avatar_handler,
RESTAPI_sms_handler, RESTAPI_subavatar_handler,
RESTAPI_preferences, RESTAPI_email_handler,
RESTAPI_subpreferences, RESTAPI_sms_handler,
RESTAPI_suboauth2_handler, RESTAPI_preferences,
RESTAPI_submfa_handler, RESTAPI_subpreferences,
RESTAPI_signup_handler RESTAPI_suboauth2_handler,
RESTAPI_subuser_handler,
RESTAPI_subusers_handler,
RESTAPI_submfa_handler,
RESTAPI_totp_handler,
RESTAPI_subtotp_handler,
RESTAPI_signup_handler
>(Path, Bindings, L, S, TransactionId); >(Path, Bindings, L, S, TransactionId);
} }
} }

View File

@@ -38,11 +38,14 @@ namespace OpenWifi {
} }
void RESTAPI_subuser_handler::DoDelete() { void RESTAPI_subuser_handler::DoDelete() {
std::cout << __LINE__ << std::endl;
std::string Id = GetBinding("id", ""); std::string Id = GetBinding("id", "");
std::cout << __LINE__ << std::endl;
if(Id.empty()) { if(Id.empty()) {
return BadRequest(RESTAPI::Errors::MissingUserID); return BadRequest(RESTAPI::Errors::MissingUserID);
} }
std::cout << __LINE__ << std::endl;
SecurityObjects::UserInfo TargetUser; SecurityObjects::UserInfo TargetUser;
if(!StorageService()->SubDB().GetUserById(Id,TargetUser)) { if(!StorageService()->SubDB().GetUserById(Id,TargetUser)) {
return NotFound(); return NotFound();