mirror of
https://github.com/Telecominfraproject/wlan-cloud-ucentralsec.git
synced 2025-10-30 02:12:32 +00:00
Adding preferences.
This commit is contained in:
@@ -9,13 +9,13 @@ namespace OpenWifi {
|
|||||||
void Convert(const PreferencesRecord &R,SecurityObjects::Preferences &P ) {
|
void Convert(const PreferencesRecord &R,SecurityObjects::Preferences &P ) {
|
||||||
P.id = R.get<0>();
|
P.id = R.get<0>();
|
||||||
P.modified = R.get<1>();
|
P.modified = R.get<1>();
|
||||||
P.data = RESTAPI_utils::to_stringpair_array(R.get<2>());
|
OpenWifi::Types::from_string(R.get<2>(), P.data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Convert(const SecurityObjects::Preferences &P, PreferencesRecord &R ) {
|
void Convert(const SecurityObjects::Preferences &P, PreferencesRecord &R ) {
|
||||||
R.set<0>(P.id);
|
R.set<0>(P.id);
|
||||||
R.set<1>(P.modified);
|
R.set<1>(P.modified);
|
||||||
R.set<2>(RESTAPI_utils::to_string(P.data));
|
R.set<2>(OpenWifi::Types::to_string(P.data));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Storage::GetPreferences(std::string &Id, SecurityObjects::Preferences &P) {
|
bool Storage::GetPreferences(std::string &Id, SecurityObjects::Preferences &P) {
|
||||||
@@ -51,7 +51,7 @@ namespace OpenWifi {
|
|||||||
};
|
};
|
||||||
|
|
||||||
P.modified = time(nullptr);
|
P.modified = time(nullptr);
|
||||||
std::string Data = RESTAPI_utils::to_string(P.data);
|
std::string Data = OpenWifi::Types::to_string(P.data);
|
||||||
|
|
||||||
InsertOrUpdate << ConvertParams(InsertOrReplace),
|
InsertOrUpdate << ConvertParams(InsertOrReplace),
|
||||||
Poco::Data::Keywords::use(P.id),
|
Poco::Data::Keywords::use(P.id),
|
||||||
|
|||||||
@@ -263,7 +263,7 @@ sendsms() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
setpreferences() {
|
setpreferences() {
|
||||||
payload="{ \"data\" : [ { \"name\" : \"$1\" , \"value\" : \"$2\" }] }"
|
payload="{ \"data\" : [ [ \"$1\" , \"$2\" ] ] }"
|
||||||
curl ${FLAGS} -X PUT "https://${OWSEC}/api/v1/preferences" \
|
curl ${FLAGS} -X PUT "https://${OWSEC}/api/v1/preferences" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-H "Authorization: Bearer ${token}" \
|
-H "Authorization: Bearer ${token}" \
|
||||||
@@ -274,7 +274,7 @@ setpreferences() {
|
|||||||
getpreferences() {
|
getpreferences() {
|
||||||
curl ${FLAGS} -X GET "https://${OWSEC}/api/v1/preferences" \
|
curl ${FLAGS} -X GET "https://${OWSEC}/api/v1/preferences" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-H "Authorization: Bearer ${token}" ${result_file}
|
-H "Authorization: Bearer ${token}" > ${result_file}
|
||||||
jq < ${result_file}
|
jq < ${result_file}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user