diff --git a/backend/src/engine.cpp b/backend/src/engine.cpp index 97116b0..2c803ff 100644 --- a/backend/src/engine.cpp +++ b/backend/src/engine.cpp @@ -315,7 +315,7 @@ std::vector BookStoreEngineClass::ExecuteMOdify( return std::vector({"Invalid"}); // debugPrint("successfully lexed modify"); // debugPrint("modify", new_ISBN, ' ', name, ' ', author, ' ', keyword, ' ', - // price); + // price); if (login_stack.empty() || user_data_base.GetPrevilege(login_stack.top().first) < 3) return std::vector({"Invalid"}); @@ -394,11 +394,19 @@ std::vector BookStoreEngineClass::ExecuteShowFinance( std::vector BookStoreEngineClass::ExecuteLog( const std::string &cmd, std::stack> &login_stack) { + static std::basic_regex log_regex( + R"(^ *log *$)", std::regex_constants::optimize); + if(!std::regex_match(cmd, log_regex)) + return std::vector({"Invalid"}); return std::vector(); } std::vector BookStoreEngineClass::ExecuteReport( const std::string &cmd, std::stack> &login_stack) { + static std::basic_regex report_regex( + R"(^ *report( +finance| +employee) *$)", std::regex_constants::optimize); + if (!std::regex_match(cmd, report_regex)) + return std::vector({"Invalid"}); return std::vector(); } \ No newline at end of file