mirror of
https://github.com/Telecominfraproject/wlan-cloud-ucentralsec.git
synced 2026-01-27 10:23:15 +00:00
Fixing framework.
This commit is contained in:
@@ -77,7 +77,7 @@ namespace OpenWifi {
|
||||
SecurityObjects::UserInfo NewUser;
|
||||
RESTAPI_utils::from_request(NewUser,*Request);
|
||||
if(NewUser.userRole == SecurityObjects::UNKNOWN || NewUser.userRole != SecurityObjects::SUBSCRIBER) {
|
||||
return BadRequest(RESTAPI::Errors::EntityMustExist);
|
||||
return BadRequest(RESTAPI::Errors::InvalidUserRole);
|
||||
}
|
||||
|
||||
Poco::toLowerInPlace(NewUser.email);
|
||||
@@ -110,7 +110,7 @@ namespace OpenWifi {
|
||||
NewUser.userTypeProprietaryInfo.mobiles.clear();
|
||||
NewUser.userTypeProprietaryInfo.authenticatorSecret.clear();
|
||||
|
||||
if(!StorageService()->SubDB().CreateUser(NewUser.email, NewUser)) {
|
||||
if(!StorageService()->SubDB().CreateUser(UserInfo_.userinfo.email, NewUser)) {
|
||||
Logger_.information(fmt::format("Could not add user '{}'.",NewUser.email));
|
||||
return BadRequest(RESTAPI::Errors::RecordNotCreated);
|
||||
}
|
||||
|
||||
@@ -1933,7 +1933,7 @@ namespace OpenWifi {
|
||||
return true;
|
||||
}
|
||||
|
||||
[[nodiscard]] inline const std::string & GetBinding(const std::string &Name, const std::string &Default) {
|
||||
[[nodiscard]] inline const std::string & GetBinding(const std::string &Name, const std::string &Default="") {
|
||||
auto E = Bindings_.find(Poco::toLower(Name));
|
||||
if (E == Bindings_.end())
|
||||
return Default;
|
||||
@@ -1986,6 +1986,14 @@ namespace OpenWifi {
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline bool AssignIfPresent(const Poco::JSON::Object::Ptr &O, const std::string &Field, double &Value) {
|
||||
if(O->has(Field)) {
|
||||
Value = (double) O->get(Field);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
inline void AddCORS() {
|
||||
auto Origin = Request->find("Origin");
|
||||
if (Origin != Request->end()) {
|
||||
|
||||
@@ -33,7 +33,8 @@ namespace ORM {
|
||||
FT_TEXT,
|
||||
FT_VARCHAR,
|
||||
FT_BLOB,
|
||||
FT_BOOLEAN
|
||||
FT_BOOLEAN,
|
||||
FT_REAL
|
||||
};
|
||||
|
||||
enum Indextype {
|
||||
@@ -110,6 +111,8 @@ namespace ORM {
|
||||
return "BYTEA";
|
||||
else
|
||||
return "BLOB";
|
||||
case FT_REAL:
|
||||
return "REAL";
|
||||
default:
|
||||
assert(false);
|
||||
|
||||
|
||||
@@ -84,6 +84,21 @@ namespace OpenWifi::RESTAPI::Errors {
|
||||
static const std::string VariableMustExist{"Specified variable does not exist."};
|
||||
static const std::string InvalidEntityType{"Invalid entity type."};
|
||||
static const std::string CannotDeleteSubEntity{"Cannot delete the default subscriber entity."};
|
||||
static const std::string OperatorIdMustExist{"Missing or bad Operator ID"};
|
||||
static const std::string CannotDeleteDefaultOperator{"Cannot delete the default operator."};
|
||||
static const std::string CannotCreateDefaultOperator{"Cannot create the default operator."};
|
||||
static const std::string InvalidRRM{"Invalid RRM value."};
|
||||
static const std::string InvalidIPAddresses{"Invalid IP addresses."};
|
||||
static const std::string InvalidBillingCode{"Empty of invalid billing code."};
|
||||
static const std::string InvalidBillingPeriod{"Invalid billing period."};
|
||||
static const std::string InvalidSubscriberId{"Invalid subscriber ID"};
|
||||
static const std::string InvalidContactId{"Invalid contact ID"};
|
||||
static const std::string InvalidLocationId{"Invalid location ID"};
|
||||
static const std::string InvalidContactType{"Invalid contact type"};
|
||||
static const std::string InvalidLocationType{"Invalid location type"};
|
||||
static const std::string InvalidOperatorId{"Invalid operator ID"};
|
||||
static const std::string InvalidServiceClassId{"Invalid service class ID"};
|
||||
static const std::string InvalidSubscriberDeviceId{"Invalid subscriber device ID"};
|
||||
}
|
||||
|
||||
namespace OpenWifi::RESTAPI::Protocol {
|
||||
|
||||
Reference in New Issue
Block a user