mirror of
https://github.com/Telecominfraproject/wlan-cloud-ucentralfms.git
synced 2025-11-01 11:17:46 +00:00
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
cmake_minimum_required(VERSION 3.13)
|
cmake_minimum_required(VERSION 3.13)
|
||||||
project(owfms VERSION 2.10.0)
|
project(owfms VERSION 2.11.0)
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
|
|
||||||
|
|||||||
@@ -14,8 +14,15 @@
|
|||||||
#include "framework/OpenWifiTypes.h"
|
#include "framework/OpenWifiTypes.h"
|
||||||
#include "framework/utils.h"
|
#include "framework/utils.h"
|
||||||
|
|
||||||
|
#include <RESTObjects/RESTAPI_SecurityObjects.h>
|
||||||
|
|
||||||
namespace OpenWifi::RESTAPI_utils {
|
namespace OpenWifi::RESTAPI_utils {
|
||||||
|
|
||||||
|
inline bool IsRootOrAdmin(const SecurityObjects::UserInfo &UI) {
|
||||||
|
return UI.userRole==SecurityObjects::ROOT ||
|
||||||
|
UI.userRole==SecurityObjects::ADMIN;
|
||||||
|
}
|
||||||
|
|
||||||
inline void EmbedDocument(const std::string &ObjName, Poco::JSON::Object &Obj,
|
inline void EmbedDocument(const std::string &ObjName, Poco::JSON::Object &Obj,
|
||||||
const std::string &ObjStr) {
|
const std::string &ObjStr) {
|
||||||
std::string D = ObjStr.empty() ? "{}" : ObjStr;
|
std::string D = ObjStr.empty() ? "{}" : ObjStr;
|
||||||
|
|||||||
@@ -27,6 +27,10 @@ namespace OpenWifi::Utils {
|
|||||||
std::all_of(Serial.begin(), Serial.end(), [](auto i) { return std::isxdigit(i); }));
|
std::all_of(Serial.begin(), Serial.end(), [](auto i) { return std::isxdigit(i); }));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] bool ValidSerialNumbers(const std::vector<std::string> &numbers) {
|
||||||
|
return std::all_of(numbers.begin(),numbers.end(),[](auto &number) {return ValidSerialNumber(number);});
|
||||||
|
}
|
||||||
|
|
||||||
[[nodiscard]] bool ValidUUID(const std::string &UUID) {
|
[[nodiscard]] bool ValidUUID(const std::string &UUID) {
|
||||||
if (UUID.size() > 36)
|
if (UUID.size() > 36)
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ namespace OpenWifi::Utils {
|
|||||||
};
|
};
|
||||||
|
|
||||||
[[nodiscard]] bool ValidSerialNumber(const std::string &Serial);
|
[[nodiscard]] bool ValidSerialNumber(const std::string &Serial);
|
||||||
|
[[nodiscard]] bool ValidSerialNumbers(const std::vector<std::string> &Serial);
|
||||||
[[nodiscard]] bool ValidUUID(const std::string &UUID);
|
[[nodiscard]] bool ValidUUID(const std::string &UUID);
|
||||||
[[nodiscard]] bool ValidHostname(const std::string &hostname);
|
[[nodiscard]] bool ValidHostname(const std::string &hostname);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user