mirror of
https://github.com/Telecominfraproject/wlan-cloud-ucentralfms.git
synced 2025-10-30 18:27:54 +00:00
Compare commits
41 Commits
v2.3.0-RC1
...
release/v2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4d5cb5caf0 | ||
|
|
bd16c21df0 | ||
|
|
4a3274b169 | ||
|
|
88f7ab6bfa | ||
|
|
153d4ee11e | ||
|
|
21cb6ae297 | ||
|
|
a22acace01 | ||
|
|
8db90d4c36 | ||
|
|
c6a9b72872 | ||
|
|
e0507ceb82 | ||
|
|
afc8b942cb | ||
|
|
5737ab7c00 | ||
|
|
1b59208fa2 | ||
|
|
f5ee31bd8b | ||
|
|
9f9faafb1c | ||
|
|
dc9d155b78 | ||
|
|
b8a7a7aff9 | ||
|
|
3195679fee | ||
|
|
d1a9556b27 | ||
|
|
c45850b749 | ||
|
|
ab859d1f77 | ||
|
|
da5720cf8d | ||
|
|
9d32c0747b | ||
|
|
4c6fd11534 | ||
|
|
3e726e43c0 | ||
|
|
15ebb56fba | ||
|
|
1c4b659ac3 | ||
|
|
bc8b8f1d95 | ||
|
|
9bfc9c2f5a | ||
|
|
eb20ff33c2 | ||
|
|
41afaa9b3f | ||
|
|
a4b2862dbe | ||
|
|
14409ecb75 | ||
|
|
d716cbcf67 | ||
|
|
fc84e8c0bb | ||
|
|
26f566e678 | ||
|
|
0b23050dc3 | ||
|
|
fecfa3c042 | ||
|
|
758241cef9 | ||
|
|
b995275c85 | ||
|
|
a1dd0a6d4f |
@@ -1,5 +1,5 @@
|
|||||||
cmake_minimum_required(VERSION 3.13)
|
cmake_minimum_required(VERSION 3.13)
|
||||||
project(owfms VERSION 2.3.0)
|
project(owfms VERSION 2.4.0)
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
|
|
||||||
@@ -25,8 +25,18 @@ else()
|
|||||||
file(WRITE build ${BUILD_NUM})
|
file(WRITE build ${BUILD_NUM})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(BUILD_SHARED_LIBS 1)
|
find_package(Git QUIET)
|
||||||
add_definitions(-DAPP_VERSION="${CMAKE_PROJECT_VERSION}" -DBUILD_NUMBER="${BUILD_NUM}" -DAWS_CUSTOM_MEMORY_MANAGEMENT)
|
if(GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git")
|
||||||
|
execute_process(COMMAND ${GIT_EXECUTABLE} describe --always --tags
|
||||||
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
RESULT_VARIABLE GIT_RESULT
|
||||||
|
OUTPUT_VARIABLE GIT_HASH)
|
||||||
|
if(NOT GIT_RESULT EQUAL "0")
|
||||||
|
message(FATAL_ERROR "git describe --always --tags failed with ${GIT_RESULT}")
|
||||||
|
endif()
|
||||||
|
string(REGEX REPLACE "\n$" "" GIT_HASH "${GIT_HASH}")
|
||||||
|
endif()
|
||||||
|
add_definitions(-DAWS_CUSTOM_MEMORY_MANAGEMENT)
|
||||||
|
|
||||||
set(Boost_USE_STATIC_LIBS OFF)
|
set(Boost_USE_STATIC_LIBS OFF)
|
||||||
set(Boost_USE_MULTITHREADED ON)
|
set(Boost_USE_MULTITHREADED ON)
|
||||||
@@ -48,8 +58,11 @@ endif()
|
|||||||
|
|
||||||
include_directories(/usr/local/include /usr/local/opt/openssl/include src include/kafka /usr/local/opt/mysql-client/include)
|
include_directories(/usr/local/include /usr/local/opt/openssl/include src include/kafka /usr/local/opt/mysql-client/include)
|
||||||
|
|
||||||
|
configure_file(src/ow_version.h.in ${PROJECT_SOURCE_DIR}/src/ow_version.h @ONLY)
|
||||||
|
|
||||||
add_executable( owfms
|
add_executable( owfms
|
||||||
build
|
build
|
||||||
|
src/ow_version.h.in
|
||||||
src/framework/CountryCodes.h
|
src/framework/CountryCodes.h
|
||||||
src/framework/KafkaTopics.h
|
src/framework/KafkaTopics.h
|
||||||
src/framework/MicroService.h
|
src/framework/MicroService.h
|
||||||
|
|||||||
18
Dockerfile
18
Dockerfile
@@ -4,13 +4,14 @@ RUN apk add --update --no-cache \
|
|||||||
openssl openssh \
|
openssl openssh \
|
||||||
ncurses-libs \
|
ncurses-libs \
|
||||||
bash util-linux coreutils curl libcurl \
|
bash util-linux coreutils curl libcurl \
|
||||||
make cmake gcc g++ libstdc++ libgcc git zlib-dev \
|
make cmake gcc g++ libstdc++ libgcc git zlib-dev nlohmann-json \
|
||||||
openssl-dev boost-dev curl-dev util-linux-dev \
|
openssl-dev boost-dev curl-dev util-linux-dev \
|
||||||
unixodbc-dev postgresql-dev mariadb-dev \
|
unixodbc-dev postgresql-dev mariadb-dev \
|
||||||
librdkafka-dev
|
librdkafka-dev
|
||||||
|
|
||||||
RUN git clone https://github.com/stephb9959/poco /poco
|
RUN git clone https://github.com/stephb9959/poco /poco
|
||||||
RUN git clone https://github.com/stephb9959/cppkafka /cppkafka
|
RUN git clone https://github.com/stephb9959/cppkafka /cppkafka
|
||||||
|
RUN git clone https://github.com/pboettch/json-schema-validator /json-schema-validator
|
||||||
RUN git clone --recurse-submodules https://github.com/aws/aws-sdk-cpp /aws-sdk-cpp
|
RUN git clone --recurse-submodules https://github.com/aws/aws-sdk-cpp /aws-sdk-cpp
|
||||||
|
|
||||||
WORKDIR /aws-sdk-cpp
|
WORKDIR /aws-sdk-cpp
|
||||||
@@ -37,14 +38,24 @@ RUN cmake ..
|
|||||||
RUN cmake --build . --config Release -j8
|
RUN cmake --build . --config Release -j8
|
||||||
RUN cmake --build . --target install
|
RUN cmake --build . --target install
|
||||||
|
|
||||||
|
WORKDIR /json-schema-validator
|
||||||
|
RUN mkdir cmake-build
|
||||||
|
WORKDIR cmake-build
|
||||||
|
RUN cmake ..
|
||||||
|
RUN make
|
||||||
|
RUN make install
|
||||||
|
|
||||||
ADD CMakeLists.txt build /owfms/
|
ADD CMakeLists.txt build /owfms/
|
||||||
ADD cmake /owfms/cmake
|
ADD cmake /owfms/cmake
|
||||||
ADD src /owfms/src
|
ADD src /owfms/src
|
||||||
|
ADD .git /owfms/.git
|
||||||
|
|
||||||
WORKDIR /owfms
|
WORKDIR /owfms
|
||||||
RUN mkdir cmake-build
|
RUN mkdir cmake-build
|
||||||
WORKDIR /owfms/cmake-build
|
WORKDIR /owfms/cmake-build
|
||||||
RUN cmake ..
|
RUN cmake .. \
|
||||||
|
-Dcrypto_LIBRARY=/usr/lib/libcrypto.so \
|
||||||
|
-DBUILD_SHARED_LIBS=ON
|
||||||
RUN cmake --build . --config Release -j8
|
RUN cmake --build . --config Release -j8
|
||||||
|
|
||||||
FROM alpine
|
FROM alpine
|
||||||
@@ -59,7 +70,7 @@ RUN addgroup -S "$OWFMS_USER" && \
|
|||||||
RUN mkdir /openwifi
|
RUN mkdir /openwifi
|
||||||
RUN mkdir -p "$OWFMS_ROOT" "$OWFMS_CONFIG" && \
|
RUN mkdir -p "$OWFMS_ROOT" "$OWFMS_CONFIG" && \
|
||||||
chown "$OWFMS_USER": "$OWFMS_ROOT" "$OWFMS_CONFIG"
|
chown "$OWFMS_USER": "$OWFMS_ROOT" "$OWFMS_CONFIG"
|
||||||
RUN apk add --update --no-cache librdkafka curl-dev mariadb-connector-c libpq unixodbc su-exec gettext ca-certificates bash jq curl
|
RUN apk add --update --no-cache librdkafka curl-dev mariadb-connector-c libpq unixodbc su-exec gettext ca-certificates bash jq curl postgresql-client
|
||||||
|
|
||||||
COPY --from=builder /owfms/cmake-build/owfms /openwifi/owfms
|
COPY --from=builder /owfms/cmake-build/owfms /openwifi/owfms
|
||||||
COPY --from=builder /cppkafka/cmake-build/src/lib/* /lib/
|
COPY --from=builder /cppkafka/cmake-build/src/lib/* /lib/
|
||||||
@@ -69,6 +80,7 @@ COPY --from=builder /aws-sdk-cpp/cmake-build/aws-cpp-sdk-s3/libaws-cpp-sdk-s3.so
|
|||||||
|
|
||||||
COPY owfms.properties.tmpl /
|
COPY owfms.properties.tmpl /
|
||||||
COPY docker-entrypoint.sh /
|
COPY docker-entrypoint.sh /
|
||||||
|
COPY wait-for-postgres.sh /
|
||||||
RUN wget https://raw.githubusercontent.com/Telecominfraproject/wlan-cloud-ucentral-deploy/main/docker-compose/certs/restapi-ca.pem \
|
RUN wget https://raw.githubusercontent.com/Telecominfraproject/wlan-cloud-ucentral-deploy/main/docker-compose/certs/restapi-ca.pem \
|
||||||
-O /usr/local/share/ca-certificates/restapi-ca-selfsigned.pem
|
-O /usr/local/share/ca-certificates/restapi-ca-selfsigned.pem
|
||||||
|
|
||||||
|
|||||||
2
helm/.gitignore
vendored
2
helm/.gitignore
vendored
@@ -1 +1,3 @@
|
|||||||
*.swp
|
*.swp
|
||||||
|
Chart.lock
|
||||||
|
charts
|
||||||
|
|||||||
@@ -5,14 +5,14 @@ name: owfms
|
|||||||
version: 0.1.0
|
version: 0.1.0
|
||||||
dependencies:
|
dependencies:
|
||||||
- name: postgresql
|
- name: postgresql
|
||||||
repository: https://charts.bitnami.com/bitnami
|
repository: https://tip.jfrog.io/artifactory/tip-wlan-cloud-ucentral-helm/
|
||||||
version: 10.9.2
|
version: 10.9.2
|
||||||
condition: postgresql.enabled
|
condition: postgresql.enabled
|
||||||
- name: mysql
|
- name: mysql
|
||||||
repository: https://charts.bitnami.com/bitnami
|
repository: https://tip.jfrog.io/artifactory/tip-wlan-cloud-ucentral-helm/
|
||||||
version: 8.8.3
|
version: 8.8.3
|
||||||
condition: mysql.enabled
|
condition: mysql.enabled
|
||||||
- name: mariadb
|
- name: mariadb
|
||||||
repository: https://charts.bitnami.com/bitnami
|
repository: https://tip.jfrog.io/artifactory/tip-wlan-cloud-ucentral-helm/
|
||||||
version: 9.4.2
|
version: 9.4.2
|
||||||
condition: mariadb.enabled
|
condition: mariadb.enabled
|
||||||
|
|||||||
@@ -30,3 +30,13 @@ Create chart name and version as used by the chart label.
|
|||||||
{{- define "owfms.chart" -}}
|
{{- define "owfms.chart" -}}
|
||||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
|
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- define "owfms.ingress.apiVersion" -}}
|
||||||
|
{{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1" -}}
|
||||||
|
{{- print "networking.k8s.io/v1" -}}
|
||||||
|
{{- else if .Capabilities.APIVersions.Has "networking.k8s.io/v1beta1" -}}
|
||||||
|
{{- print "networking.k8s.io/v1beta1" -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- print "extensions/v1beta1" -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|||||||
@@ -24,6 +24,9 @@ spec:
|
|||||||
metadata:
|
metadata:
|
||||||
annotations:
|
annotations:
|
||||||
checksum/config: {{ include "owfms.config" . | sha256sum }}
|
checksum/config: {{ include "owfms.config" . | sha256sum }}
|
||||||
|
{{- with .Values.podAnnotations }}
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
labels:
|
labels:
|
||||||
app.kubernetes.io/name: {{ include "owfms.name" . }}
|
app.kubernetes.io/name: {{ include "owfms.name" . }}
|
||||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
{{- range $ingress, $ingressValue := .Values.ingresses }}
|
{{- range $ingress, $ingressValue := .Values.ingresses }}
|
||||||
{{- if $ingressValue.enabled }}
|
{{- if $ingressValue.enabled }}
|
||||||
---
|
---
|
||||||
apiVersion: extensions/v1beta1
|
apiVersion: {{ include "owfms.ingress.apiVersion" $root }}
|
||||||
kind: Ingress
|
kind: Ingress
|
||||||
metadata:
|
metadata:
|
||||||
name: {{ include "owfms.fullname" $root }}-{{ $ingress }}
|
name: {{ include "owfms.fullname" $root }}-{{ $ingress }}
|
||||||
@@ -36,9 +36,23 @@ spec:
|
|||||||
paths:
|
paths:
|
||||||
{{- range $ingressValue.paths }}
|
{{- range $ingressValue.paths }}
|
||||||
- path: {{ .path }}
|
- path: {{ .path }}
|
||||||
|
{{- if $root.Capabilities.APIVersions.Has "networking.k8s.io/v1" }}
|
||||||
|
pathType: {{ .pathType | default "ImplementationSpecific" }}
|
||||||
|
{{- end }}
|
||||||
backend:
|
backend:
|
||||||
|
{{- if $root.Capabilities.APIVersions.Has "networking.k8s.io/v1" }}
|
||||||
|
service:
|
||||||
|
name: {{ include "owfms.fullname" $root }}-{{ .serviceName }}
|
||||||
|
port:
|
||||||
|
{{- if kindIs "string" .servicePort }}
|
||||||
|
name: {{ .servicePort }}
|
||||||
|
{{- else }}
|
||||||
|
number: {{ .servicePort }}
|
||||||
|
{{- end }}
|
||||||
|
{{- else }}
|
||||||
serviceName: {{ include "owfms.fullname" $root }}-{{ .serviceName }}
|
serviceName: {{ include "owfms.fullname" $root }}-{{ .serviceName }}
|
||||||
servicePort: {{ .servicePort }}
|
servicePort: {{ .servicePort }}
|
||||||
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ fullnameOverride: ""
|
|||||||
images:
|
images:
|
||||||
owfms:
|
owfms:
|
||||||
repository: tip-tip-wlan-cloud-ucentral.jfrog.io/owfms
|
repository: tip-tip-wlan-cloud-ucentral.jfrog.io/owfms
|
||||||
tag: main
|
tag: v2.4.0
|
||||||
pullPolicy: Always
|
pullPolicy: Always
|
||||||
# regcred:
|
# regcred:
|
||||||
# registry: tip-tip-wlan-cloud-ucentral.jfrog.io
|
# registry: tip-tip-wlan-cloud-ucentral.jfrog.io
|
||||||
@@ -51,6 +51,7 @@ ingresses:
|
|||||||
- restapi.chart-example.local
|
- restapi.chart-example.local
|
||||||
paths:
|
paths:
|
||||||
- path: /
|
- path: /
|
||||||
|
pathType: ImplementationSpecific
|
||||||
serviceName: owfms
|
serviceName: owfms
|
||||||
servicePort: restapi
|
servicePort: restapi
|
||||||
|
|
||||||
@@ -93,6 +94,8 @@ tolerations: []
|
|||||||
|
|
||||||
affinity: {}
|
affinity: {}
|
||||||
|
|
||||||
|
podAnnotations: {}
|
||||||
|
|
||||||
persistence:
|
persistence:
|
||||||
enabled: true
|
enabled: true
|
||||||
# storageClassName: "-"
|
# storageClassName: "-"
|
||||||
|
|||||||
@@ -50,6 +50,16 @@ components:
|
|||||||
properties:
|
properties:
|
||||||
ErrorCode:
|
ErrorCode:
|
||||||
type: integer
|
type: integer
|
||||||
|
enum:
|
||||||
|
- 0 # Success
|
||||||
|
- 1 # PASSWORD_CHANGE_REQUIRED,
|
||||||
|
- 2 # INVALID_CREDENTIALS,
|
||||||
|
- 3 # PASSWORD_ALREADY_USED,
|
||||||
|
- 4 # USERNAME_PENDING_VERIFICATION,
|
||||||
|
- 5 # PASSWORD_INVALID,
|
||||||
|
- 6 # INTERNAL_ERROR,
|
||||||
|
- 7 # ACCESS_DENIED,
|
||||||
|
- 8 # INVALID_TOKEN
|
||||||
ErrorDetails:
|
ErrorDetails:
|
||||||
type: string
|
type: string
|
||||||
ErrorDescription:
|
ErrorDescription:
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
#include "StorageService.h"
|
#include "StorageService.h"
|
||||||
|
|
||||||
namespace OpenWifi {
|
namespace OpenWifi {
|
||||||
class AutoUpdater * AutoUpdater::instance_ = nullptr;
|
|
||||||
|
|
||||||
int AutoUpdater::Start() {
|
int AutoUpdater::Start() {
|
||||||
Running_ = true;
|
Running_ = true;
|
||||||
|
|||||||
@@ -20,9 +20,7 @@ class AutoUpdater : public SubSystemServer, Poco::Runnable {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static AutoUpdater *instance() {
|
static AutoUpdater *instance() {
|
||||||
if (instance_ == nullptr) {
|
static AutoUpdater *instance_ = new AutoUpdater;
|
||||||
instance_ = new AutoUpdater;
|
|
||||||
}
|
|
||||||
return instance_;
|
return instance_;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -38,7 +36,6 @@ class AutoUpdater : public SubSystemServer, Poco::Runnable {
|
|||||||
void reinitialize(Poco::Util::Application &self) final;
|
void reinitialize(Poco::Util::Application &self) final;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static AutoUpdater *instance_;
|
|
||||||
std::atomic_bool Running_=false;
|
std::atomic_bool Running_=false;
|
||||||
Poco::Thread Thr_;
|
Poco::Thread Thr_;
|
||||||
std::map<std::string,SerialCache> Cache_;
|
std::map<std::string,SerialCache> Cache_;
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
#include "DeviceCache.h"
|
#include "DeviceCache.h"
|
||||||
|
|
||||||
namespace OpenWifi {
|
namespace OpenWifi {
|
||||||
class DeviceCache *DeviceCache::instance_ = nullptr;
|
|
||||||
|
|
||||||
int DeviceCache::Start() {
|
int DeviceCache::Start() {
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -20,9 +20,7 @@ namespace OpenWifi {
|
|||||||
class DeviceCache : public SubSystemServer {
|
class DeviceCache : public SubSystemServer {
|
||||||
public:
|
public:
|
||||||
static DeviceCache *instance() {
|
static DeviceCache *instance() {
|
||||||
if (instance_ == nullptr) {
|
static DeviceCache *instance_ = new DeviceCache;
|
||||||
instance_ = new DeviceCache;
|
|
||||||
}
|
|
||||||
return instance_;
|
return instance_;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -34,7 +32,6 @@ namespace OpenWifi {
|
|||||||
bool GetDevice(const std::string &SerialNumber, DeviceCacheEntry & E);
|
bool GetDevice(const std::string &SerialNumber, DeviceCacheEntry & E);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static DeviceCache *instance_;
|
|
||||||
std::atomic_bool Running_=false;
|
std::atomic_bool Running_=false;
|
||||||
DeviceCacheMap DeviceCache_;
|
DeviceCacheMap DeviceCache_;
|
||||||
explicit DeviceCache() noexcept:
|
explicit DeviceCache() noexcept:
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
#include "FirmwareCache.h"
|
#include "FirmwareCache.h"
|
||||||
|
|
||||||
namespace OpenWifi {
|
namespace OpenWifi {
|
||||||
class FirmwareCache *FirmwareCache::instance_ = nullptr;
|
|
||||||
|
|
||||||
int FirmwareCache::Start() {
|
int FirmwareCache::Start() {
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -18,9 +18,7 @@ namespace OpenWifi {
|
|||||||
class FirmwareCache: public SubSystemServer {
|
class FirmwareCache: public SubSystemServer {
|
||||||
public:
|
public:
|
||||||
static FirmwareCache *instance() {
|
static FirmwareCache *instance() {
|
||||||
if (instance_ == nullptr) {
|
static FirmwareCache *instance_= new FirmwareCache;
|
||||||
instance_ = new FirmwareCache;
|
|
||||||
}
|
|
||||||
return instance_;
|
return instance_;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -32,7 +30,6 @@ namespace OpenWifi {
|
|||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static FirmwareCache *instance_;
|
|
||||||
std::atomic_bool Running_=false;
|
std::atomic_bool Running_=false;
|
||||||
FirmwareCacheMap Cache_;
|
FirmwareCacheMap Cache_;
|
||||||
explicit FirmwareCache() noexcept:
|
explicit FirmwareCache() noexcept:
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
#include "StorageService.h"
|
#include "StorageService.h"
|
||||||
|
|
||||||
namespace OpenWifi {
|
namespace OpenWifi {
|
||||||
class LatestFirmwareCache *LatestFirmwareCache::instance_ = nullptr;
|
|
||||||
|
|
||||||
int LatestFirmwareCache::Start() {
|
int LatestFirmwareCache::Start() {
|
||||||
StorageService()->PopulateLatestFirmwareCache();
|
StorageService()->PopulateLatestFirmwareCache();
|
||||||
|
|||||||
@@ -25,9 +25,7 @@ namespace OpenWifi {
|
|||||||
class LatestFirmwareCache : public SubSystemServer {
|
class LatestFirmwareCache : public SubSystemServer {
|
||||||
public:
|
public:
|
||||||
static LatestFirmwareCache *instance() {
|
static LatestFirmwareCache *instance() {
|
||||||
if (instance_ == nullptr) {
|
static LatestFirmwareCache *instance_ = new LatestFirmwareCache;
|
||||||
instance_ = new LatestFirmwareCache;
|
|
||||||
}
|
|
||||||
return instance_;
|
return instance_;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,7 +40,6 @@ namespace OpenWifi {
|
|||||||
bool IsLatest(const std::string &DeviceType, const std::string &Revision);
|
bool IsLatest(const std::string &DeviceType, const std::string &Revision);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static LatestFirmwareCache *instance_;
|
|
||||||
LatestFirmwareCacheMap Cache_;
|
LatestFirmwareCacheMap Cache_;
|
||||||
Types::StringSet RevisionSet_;
|
Types::StringSet RevisionSet_;
|
||||||
Types::StringSet DeviceSet_;
|
Types::StringSet DeviceSet_;
|
||||||
|
|||||||
@@ -15,7 +15,6 @@
|
|||||||
#include "LatestFirmwareCache.h"
|
#include "LatestFirmwareCache.h"
|
||||||
|
|
||||||
namespace OpenWifi {
|
namespace OpenWifi {
|
||||||
class ManifestCreator *ManifestCreator::instance_ = nullptr;
|
|
||||||
|
|
||||||
void ManifestCreator::run() {
|
void ManifestCreator::run() {
|
||||||
Running_ = true;
|
Running_ = true;
|
||||||
@@ -94,6 +93,11 @@ namespace OpenWifi {
|
|||||||
for(auto &[Release,BucketEntry]:BucketContent) {
|
for(auto &[Release,BucketEntry]:BucketContent) {
|
||||||
FMSObjects::Firmware F;
|
FMSObjects::Firmware F;
|
||||||
auto R = Release;
|
auto R = Release;
|
||||||
|
|
||||||
|
// skip staging releases.
|
||||||
|
if(BucketEntry.URI.find("-staging-")!=std::string::npos)
|
||||||
|
continue;
|
||||||
|
|
||||||
if(BucketEntry.Valid && !StorageService()->GetFirmwareByName(R,BucketEntry.Compatible,F)) {
|
if(BucketEntry.Valid && !StorageService()->GetFirmwareByName(R,BucketEntry.Compatible,F)) {
|
||||||
F.id = MicroService::instance().CreateUUID();
|
F.id = MicroService::instance().CreateUUID();
|
||||||
F.release = Release;
|
F.release = Release;
|
||||||
|
|||||||
@@ -31,9 +31,7 @@ namespace OpenWifi {
|
|||||||
class ManifestCreator : public SubSystemServer, Poco::Runnable {
|
class ManifestCreator : public SubSystemServer, Poco::Runnable {
|
||||||
public:
|
public:
|
||||||
static ManifestCreator *instance() {
|
static ManifestCreator *instance() {
|
||||||
if (instance_ == nullptr) {
|
static ManifestCreator *instance_ = new ManifestCreator;
|
||||||
instance_ = new ManifestCreator;
|
|
||||||
}
|
|
||||||
return instance_;
|
return instance_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,6 @@
|
|||||||
|
|
||||||
|
|
||||||
namespace OpenWifi {
|
namespace OpenWifi {
|
||||||
class NewConnectionHandler *NewConnectionHandler::instance_ = nullptr;
|
|
||||||
|
|
||||||
void NewConnectionHandler::run() {
|
void NewConnectionHandler::run() {
|
||||||
Running_ = true ;
|
Running_ = true ;
|
||||||
|
|||||||
@@ -15,9 +15,7 @@ namespace OpenWifi {
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
static NewConnectionHandler *instance() {
|
static NewConnectionHandler *instance() {
|
||||||
if (instance_ == nullptr) {
|
static NewConnectionHandler *instance_ = new NewConnectionHandler;
|
||||||
instance_ = new NewConnectionHandler;
|
|
||||||
}
|
|
||||||
return instance_;
|
return instance_;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -29,7 +27,6 @@ namespace OpenWifi {
|
|||||||
void ConnectionReceived( const std::string & Key, const std::string & Message);
|
void ConnectionReceived( const std::string & Key, const std::string & Message);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static NewConnectionHandler *instance_;
|
|
||||||
Poco::Thread Worker_;
|
Poco::Thread Worker_;
|
||||||
std::atomic_bool Running_ = false;
|
std::atomic_bool Running_ = false;
|
||||||
int ConnectionWatcherId_=0;
|
int ConnectionWatcherId_=0;
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ namespace OpenWifi::GWObjects {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Device::from_json(Poco::JSON::Object::Ptr Obj) {
|
bool Device::from_json(Poco::JSON::Object::Ptr &Obj) {
|
||||||
try {
|
try {
|
||||||
field_from_json(Obj,"serialNumber",SerialNumber);
|
field_from_json(Obj,"serialNumber",SerialNumber);
|
||||||
field_from_json(Obj,"deviceType",DeviceType);
|
field_from_json(Obj,"deviceType",DeviceType);
|
||||||
@@ -147,7 +147,7 @@ namespace OpenWifi::GWObjects {
|
|||||||
field_to_json(Obj,"attachFile", AttachDate);
|
field_to_json(Obj,"attachFile", AttachDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DefaultConfiguration::from_json(Poco::JSON::Object::Ptr Obj) {
|
bool DefaultConfiguration::from_json(Poco::JSON::Object::Ptr &Obj) {
|
||||||
try {
|
try {
|
||||||
field_from_json(Obj,"name",Name);
|
field_from_json(Obj,"name",Name);
|
||||||
field_from_json(Obj,"configuration",Configuration);
|
field_from_json(Obj,"configuration",Configuration);
|
||||||
@@ -166,7 +166,7 @@ namespace OpenWifi::GWObjects {
|
|||||||
field_to_json(Obj,"created", created);
|
field_to_json(Obj,"created", created);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BlackListedDevice::from_json(Poco::JSON::Object::Ptr Obj) {
|
bool BlackListedDevice::from_json(Poco::JSON::Object::Ptr &Obj) {
|
||||||
try {
|
try {
|
||||||
field_from_json(Obj,"serialNumber",serialNumber);
|
field_from_json(Obj,"serialNumber",serialNumber);
|
||||||
field_from_json(Obj,"author",author);
|
field_from_json(Obj,"author",author);
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ namespace OpenWifi::GWObjects {
|
|||||||
std::string DevicePassword;
|
std::string DevicePassword;
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
void to_json_with_status(Poco::JSON::Object &Obj) const;
|
void to_json_with_status(Poco::JSON::Object &Obj) const;
|
||||||
bool from_json(Poco::JSON::Object::Ptr Obj);
|
bool from_json(Poco::JSON::Object::Ptr &Obj);
|
||||||
void Print() const;
|
void Print() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -116,7 +116,7 @@ namespace OpenWifi::GWObjects {
|
|||||||
uint64_t Created;
|
uint64_t Created;
|
||||||
uint64_t LastModified;
|
uint64_t LastModified;
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
bool from_json(Poco::JSON::Object::Ptr Obj);
|
bool from_json(Poco::JSON::Object::Ptr &Obj);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct CommandDetails {
|
struct CommandDetails {
|
||||||
@@ -147,7 +147,7 @@ namespace OpenWifi::GWObjects {
|
|||||||
std::string author;
|
std::string author;
|
||||||
uint64_t created;
|
uint64_t created;
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
bool from_json(Poco::JSON::Object::Ptr Obj);
|
bool from_json(Poco::JSON::Object::Ptr &Obj);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct RttySessionDetails {
|
struct RttySessionDetails {
|
||||||
|
|||||||
@@ -10,27 +10,30 @@
|
|||||||
#include "RESTAPI_ProvObjects.h"
|
#include "RESTAPI_ProvObjects.h"
|
||||||
#include "framework/MicroService.h"
|
#include "framework/MicroService.h"
|
||||||
|
|
||||||
|
using OpenWifi::RESTAPI_utils::field_to_json;
|
||||||
|
using OpenWifi::RESTAPI_utils::field_from_json;
|
||||||
|
|
||||||
namespace OpenWifi::ProvObjects {
|
namespace OpenWifi::ProvObjects {
|
||||||
|
|
||||||
void ObjectInfo::to_json(Poco::JSON::Object &Obj) const {
|
void ObjectInfo::to_json(Poco::JSON::Object &Obj) const {
|
||||||
RESTAPI_utils::field_to_json(Obj,"id",id);
|
field_to_json(Obj,"id",id);
|
||||||
RESTAPI_utils::field_to_json(Obj,"name",name);
|
field_to_json(Obj,"name",name);
|
||||||
RESTAPI_utils::field_to_json(Obj,"description",description);
|
field_to_json(Obj,"description",description);
|
||||||
RESTAPI_utils::field_to_json(Obj,"created",created);
|
field_to_json(Obj,"created",created);
|
||||||
RESTAPI_utils::field_to_json(Obj,"modified",modified);
|
field_to_json(Obj,"modified",modified);
|
||||||
RESTAPI_utils::field_to_json(Obj,"notes",notes);
|
field_to_json(Obj,"notes",notes);
|
||||||
RESTAPI_utils::field_to_json(Obj,"tags",tags);
|
field_to_json(Obj,"tags",tags);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ObjectInfo::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
bool ObjectInfo::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
||||||
try {
|
try {
|
||||||
RESTAPI_utils::field_from_json(Obj,"id",id);
|
field_from_json(Obj,"id",id);
|
||||||
RESTAPI_utils::field_from_json(Obj,"name",name);
|
field_from_json(Obj,"name",name);
|
||||||
RESTAPI_utils::field_from_json(Obj,"description",description);
|
field_from_json(Obj,"description",description);
|
||||||
RESTAPI_utils::field_from_json(Obj,"created",created);
|
field_from_json(Obj,"created",created);
|
||||||
RESTAPI_utils::field_from_json(Obj,"modified",modified);
|
field_from_json(Obj,"modified",modified);
|
||||||
RESTAPI_utils::field_from_json(Obj,"notes",notes);
|
field_from_json(Obj,"notes",notes);
|
||||||
RESTAPI_utils::field_from_json(Obj,"tags",tags);
|
field_from_json(Obj,"tags",tags);
|
||||||
return true;
|
return true;
|
||||||
} catch(...) {
|
} catch(...) {
|
||||||
|
|
||||||
@@ -39,18 +42,18 @@ namespace OpenWifi::ProvObjects {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ManagementPolicyEntry::to_json(Poco::JSON::Object &Obj) const {
|
void ManagementPolicyEntry::to_json(Poco::JSON::Object &Obj) const {
|
||||||
RESTAPI_utils::field_to_json( Obj,"users",users);
|
field_to_json( Obj,"users",users);
|
||||||
RESTAPI_utils::field_to_json( Obj,"resources",resources);
|
field_to_json( Obj,"resources",resources);
|
||||||
RESTAPI_utils::field_to_json( Obj,"access",access);
|
field_to_json( Obj,"access",access);
|
||||||
RESTAPI_utils::field_to_json( Obj,"policy",policy);
|
field_to_json( Obj,"policy",policy);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ManagementPolicyEntry::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
bool ManagementPolicyEntry::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
||||||
try {
|
try {
|
||||||
RESTAPI_utils::field_from_json( Obj,"users",users);
|
field_from_json( Obj,"users",users);
|
||||||
RESTAPI_utils::field_from_json( Obj,"resources",resources);
|
field_from_json( Obj,"resources",resources);
|
||||||
RESTAPI_utils::field_from_json( Obj,"access",access);
|
field_from_json( Obj,"access",access);
|
||||||
RESTAPI_utils::field_from_json( Obj,"policy",policy);
|
field_from_json( Obj,"policy",policy);
|
||||||
return true;
|
return true;
|
||||||
} catch(...) {
|
} catch(...) {
|
||||||
|
|
||||||
@@ -60,17 +63,17 @@ namespace OpenWifi::ProvObjects {
|
|||||||
|
|
||||||
void ManagementPolicy::to_json(Poco::JSON::Object &Obj) const {
|
void ManagementPolicy::to_json(Poco::JSON::Object &Obj) const {
|
||||||
info.to_json(Obj);
|
info.to_json(Obj);
|
||||||
RESTAPI_utils::field_to_json(Obj, "entries", entries);
|
field_to_json(Obj, "entries", entries);
|
||||||
RESTAPI_utils::field_to_json(Obj, "inUse", inUse);
|
field_to_json(Obj, "inUse", inUse);
|
||||||
RESTAPI_utils::field_to_json(Obj, "entity", entity);
|
field_to_json(Obj, "entity", entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ManagementPolicy::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
bool ManagementPolicy::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
||||||
try {
|
try {
|
||||||
info.from_json(Obj);
|
info.from_json(Obj);
|
||||||
RESTAPI_utils::field_from_json(Obj, "entries", entries);
|
field_from_json(Obj, "entries", entries);
|
||||||
RESTAPI_utils::field_from_json(Obj, "inUse", inUse);
|
field_from_json(Obj, "inUse", inUse);
|
||||||
RESTAPI_utils::field_from_json(Obj, "entity", entity);
|
field_from_json(Obj, "entity", entity);
|
||||||
return true;
|
return true;
|
||||||
} catch(...) {
|
} catch(...) {
|
||||||
|
|
||||||
@@ -80,31 +83,31 @@ namespace OpenWifi::ProvObjects {
|
|||||||
|
|
||||||
void Entity::to_json(Poco::JSON::Object &Obj) const {
|
void Entity::to_json(Poco::JSON::Object &Obj) const {
|
||||||
info.to_json(Obj);
|
info.to_json(Obj);
|
||||||
RESTAPI_utils::field_to_json( Obj,"parent",parent);
|
field_to_json( Obj,"parent",parent);
|
||||||
RESTAPI_utils::field_to_json( Obj,"venues",venues);
|
field_to_json( Obj,"venues",venues);
|
||||||
RESTAPI_utils::field_to_json( Obj,"children",children);
|
field_to_json( Obj,"children",children);
|
||||||
RESTAPI_utils::field_to_json( Obj,"contacts",contacts);
|
field_to_json( Obj,"contacts",contacts);
|
||||||
RESTAPI_utils::field_to_json( Obj,"locations",locations);
|
field_to_json( Obj,"locations",locations);
|
||||||
RESTAPI_utils::field_to_json( Obj,"managementPolicy",managementPolicy);
|
field_to_json( Obj,"managementPolicy",managementPolicy);
|
||||||
RESTAPI_utils::field_to_json( Obj,"deviceConfiguration",deviceConfiguration);
|
field_to_json( Obj,"deviceConfiguration",deviceConfiguration);
|
||||||
RESTAPI_utils::field_to_json( Obj,"devices",devices);
|
field_to_json( Obj,"devices",devices);
|
||||||
RESTAPI_utils::field_to_json( Obj,"rrm",rrm);
|
field_to_json( Obj,"rrm",rrm);
|
||||||
RESTAPI_utils::field_to_json( Obj,"sourceIP",sourceIP);
|
field_to_json( Obj,"sourceIP",sourceIP);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Entity::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
bool Entity::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
||||||
try {
|
try {
|
||||||
info.from_json(Obj);
|
info.from_json(Obj);
|
||||||
RESTAPI_utils::field_from_json( Obj,"parent",parent);
|
field_from_json( Obj,"parent",parent);
|
||||||
RESTAPI_utils::field_from_json( Obj,"venues",venues);
|
field_from_json( Obj,"venues",venues);
|
||||||
RESTAPI_utils::field_from_json( Obj,"children",children);
|
field_from_json( Obj,"children",children);
|
||||||
RESTAPI_utils::field_from_json( Obj,"contacts",contacts);
|
field_from_json( Obj,"contacts",contacts);
|
||||||
RESTAPI_utils::field_from_json( Obj,"locations",locations);
|
field_from_json( Obj,"locations",locations);
|
||||||
RESTAPI_utils::field_from_json( Obj,"managementPolicy",managementPolicy);
|
field_from_json( Obj,"managementPolicy",managementPolicy);
|
||||||
RESTAPI_utils::field_from_json( Obj,"deviceConfiguration",deviceConfiguration);
|
field_from_json( Obj,"deviceConfiguration",deviceConfiguration);
|
||||||
RESTAPI_utils::field_from_json( Obj,"devices",devices);
|
field_from_json( Obj,"devices",devices);
|
||||||
RESTAPI_utils::field_from_json( Obj,"rrm",rrm);
|
field_from_json( Obj,"rrm",rrm);
|
||||||
RESTAPI_utils::field_from_json( Obj,"sourceIP",sourceIP);
|
field_from_json( Obj,"sourceIP",sourceIP);
|
||||||
return true;
|
return true;
|
||||||
} catch(...) {
|
} catch(...) {
|
||||||
|
|
||||||
@@ -113,14 +116,14 @@ namespace OpenWifi::ProvObjects {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DiGraphEntry::to_json(Poco::JSON::Object &Obj) const {
|
void DiGraphEntry::to_json(Poco::JSON::Object &Obj) const {
|
||||||
RESTAPI_utils::field_to_json( Obj,"parent",parent);
|
field_to_json( Obj,"parent",parent);
|
||||||
RESTAPI_utils::field_to_json( Obj,"child",child);
|
field_to_json( Obj,"child",child);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DiGraphEntry::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
bool DiGraphEntry::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
||||||
try {
|
try {
|
||||||
RESTAPI_utils::field_from_json( Obj,"parent",parent);
|
field_from_json( Obj,"parent",parent);
|
||||||
RESTAPI_utils::field_from_json( Obj,"child",child);
|
field_from_json( Obj,"child",child);
|
||||||
return true;
|
return true;
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
|
|
||||||
@@ -130,37 +133,37 @@ namespace OpenWifi::ProvObjects {
|
|||||||
|
|
||||||
void Venue::to_json(Poco::JSON::Object &Obj) const {
|
void Venue::to_json(Poco::JSON::Object &Obj) const {
|
||||||
info.to_json(Obj);
|
info.to_json(Obj);
|
||||||
RESTAPI_utils::field_to_json( Obj,"parent",parent);
|
field_to_json( Obj,"parent",parent);
|
||||||
RESTAPI_utils::field_to_json( Obj,"entity",entity);
|
field_to_json( Obj,"entity",entity);
|
||||||
RESTAPI_utils::field_to_json( Obj,"children",children);
|
field_to_json( Obj,"children",children);
|
||||||
RESTAPI_utils::field_to_json( Obj,"devices",devices);
|
field_to_json( Obj,"devices",devices);
|
||||||
RESTAPI_utils::field_to_json( Obj,"topology",topology);
|
field_to_json( Obj,"topology",topology);
|
||||||
RESTAPI_utils::field_to_json( Obj,"parent",parent);
|
field_to_json( Obj,"parent",parent);
|
||||||
RESTAPI_utils::field_to_json( Obj,"design",design);
|
field_to_json( Obj,"design",design);
|
||||||
RESTAPI_utils::field_to_json( Obj,"managementPolicy",managementPolicy);
|
field_to_json( Obj,"managementPolicy",managementPolicy);
|
||||||
RESTAPI_utils::field_to_json( Obj,"deviceConfiguration",deviceConfiguration);
|
field_to_json( Obj,"deviceConfiguration",deviceConfiguration);
|
||||||
RESTAPI_utils::field_to_json( Obj,"contact",contact);
|
field_to_json( Obj,"contact",contact);
|
||||||
RESTAPI_utils::field_to_json( Obj,"location",location);
|
field_to_json( Obj,"location",location);
|
||||||
RESTAPI_utils::field_to_json( Obj,"rrm",rrm);
|
field_to_json( Obj,"rrm",rrm);
|
||||||
RESTAPI_utils::field_to_json( Obj,"sourceIP",sourceIP);
|
field_to_json( Obj,"sourceIP",sourceIP);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Venue::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
bool Venue::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
||||||
try {
|
try {
|
||||||
info.from_json(Obj);
|
info.from_json(Obj);
|
||||||
RESTAPI_utils::field_from_json( Obj,"parent",parent);
|
field_from_json( Obj,"parent",parent);
|
||||||
RESTAPI_utils::field_from_json( Obj,"entity",entity);
|
field_from_json( Obj,"entity",entity);
|
||||||
RESTAPI_utils::field_from_json( Obj,"children",children);
|
field_from_json( Obj,"children",children);
|
||||||
RESTAPI_utils::field_from_json( Obj,"devices",devices);
|
field_from_json( Obj,"devices",devices);
|
||||||
RESTAPI_utils::field_from_json( Obj,"topology",topology);
|
field_from_json( Obj,"topology",topology);
|
||||||
RESTAPI_utils::field_from_json( Obj,"parent",parent);
|
field_from_json( Obj,"parent",parent);
|
||||||
RESTAPI_utils::field_from_json( Obj,"design",design);
|
field_from_json( Obj,"design",design);
|
||||||
RESTAPI_utils::field_from_json( Obj,"managementPolicy",managementPolicy);
|
field_from_json( Obj,"managementPolicy",managementPolicy);
|
||||||
RESTAPI_utils::field_from_json( Obj,"deviceConfiguration",deviceConfiguration);
|
field_from_json( Obj,"deviceConfiguration",deviceConfiguration);
|
||||||
RESTAPI_utils::field_from_json( Obj,"contact",contact);
|
field_from_json( Obj,"contact",contact);
|
||||||
RESTAPI_utils::field_from_json( Obj,"location",location);
|
field_from_json( Obj,"location",location);
|
||||||
RESTAPI_utils::field_from_json( Obj,"rrm",rrm);
|
field_from_json( Obj,"rrm",rrm);
|
||||||
RESTAPI_utils::field_from_json( Obj,"sourceIP",sourceIP);
|
field_from_json( Obj,"sourceIP",sourceIP);
|
||||||
return true;
|
return true;
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
|
|
||||||
@@ -169,16 +172,16 @@ namespace OpenWifi::ProvObjects {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void UserInfoDigest::to_json(Poco::JSON::Object &Obj) const {
|
void UserInfoDigest::to_json(Poco::JSON::Object &Obj) const {
|
||||||
RESTAPI_utils::field_to_json( Obj,"id",id);
|
field_to_json( Obj,"id",id);
|
||||||
RESTAPI_utils::field_to_json( Obj,"entity",loginId);
|
field_to_json( Obj,"entity",loginId);
|
||||||
RESTAPI_utils::field_to_json( Obj,"children",userType);
|
field_to_json( Obj,"children",userType);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UserInfoDigest::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
bool UserInfoDigest::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
||||||
try {
|
try {
|
||||||
RESTAPI_utils::field_from_json( Obj,"id",id);
|
field_from_json( Obj,"id",id);
|
||||||
RESTAPI_utils::field_from_json( Obj,"entity",loginId);
|
field_from_json( Obj,"entity",loginId);
|
||||||
RESTAPI_utils::field_from_json( Obj,"children",userType);
|
field_from_json( Obj,"children",userType);
|
||||||
return true;
|
return true;
|
||||||
} catch(...) {
|
} catch(...) {
|
||||||
}
|
}
|
||||||
@@ -187,17 +190,17 @@ namespace OpenWifi::ProvObjects {
|
|||||||
|
|
||||||
void ManagementRole::to_json(Poco::JSON::Object &Obj) const {
|
void ManagementRole::to_json(Poco::JSON::Object &Obj) const {
|
||||||
info.to_json(Obj);
|
info.to_json(Obj);
|
||||||
RESTAPI_utils::field_to_json( Obj,"managementPolicy",managementPolicy);
|
field_to_json( Obj,"managementPolicy",managementPolicy);
|
||||||
RESTAPI_utils::field_to_json( Obj,"users",users);
|
field_to_json( Obj,"users",users);
|
||||||
RESTAPI_utils::field_to_json( Obj,"entity",entity);
|
field_to_json( Obj,"entity",entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ManagementRole::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
bool ManagementRole::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
||||||
try {
|
try {
|
||||||
info.from_json(Obj);
|
info.from_json(Obj);
|
||||||
RESTAPI_utils::field_from_json( Obj,"managementPolicy",managementPolicy);
|
field_from_json( Obj,"managementPolicy",managementPolicy);
|
||||||
RESTAPI_utils::field_from_json( Obj,"users",users);
|
field_from_json( Obj,"users",users);
|
||||||
RESTAPI_utils::field_from_json( Obj,"entity",entity);
|
field_from_json( Obj,"entity",entity);
|
||||||
return true;
|
return true;
|
||||||
} catch(...) {
|
} catch(...) {
|
||||||
}
|
}
|
||||||
@@ -206,39 +209,39 @@ namespace OpenWifi::ProvObjects {
|
|||||||
|
|
||||||
void Location::to_json(Poco::JSON::Object &Obj) const {
|
void Location::to_json(Poco::JSON::Object &Obj) const {
|
||||||
info.to_json(Obj);
|
info.to_json(Obj);
|
||||||
RESTAPI_utils::field_to_json( Obj,"type",OpenWifi::ProvObjects::to_string(type));
|
field_to_json( Obj,"type",OpenWifi::ProvObjects::to_string(type));
|
||||||
RESTAPI_utils::field_to_json( Obj,"buildingName",buildingName);
|
field_to_json( Obj,"buildingName",buildingName);
|
||||||
RESTAPI_utils::field_to_json( Obj,"addressLines",addressLines);
|
field_to_json( Obj,"addressLines",addressLines);
|
||||||
RESTAPI_utils::field_to_json( Obj,"city",city);
|
field_to_json( Obj,"city",city);
|
||||||
RESTAPI_utils::field_to_json( Obj,"state",state);
|
field_to_json( Obj,"state",state);
|
||||||
RESTAPI_utils::field_to_json( Obj,"postal",postal);
|
field_to_json( Obj,"postal",postal);
|
||||||
RESTAPI_utils::field_to_json( Obj,"country",country);
|
field_to_json( Obj,"country",country);
|
||||||
RESTAPI_utils::field_to_json( Obj,"phones",phones);
|
field_to_json( Obj,"phones",phones);
|
||||||
RESTAPI_utils::field_to_json( Obj,"mobiles",mobiles);
|
field_to_json( Obj,"mobiles",mobiles);
|
||||||
RESTAPI_utils::field_to_json( Obj,"geoCode",geoCode);
|
field_to_json( Obj,"geoCode",geoCode);
|
||||||
RESTAPI_utils::field_to_json( Obj,"inUse",inUse);
|
field_to_json( Obj,"inUse",inUse);
|
||||||
RESTAPI_utils::field_to_json( Obj,"entity",entity);
|
field_to_json( Obj,"entity",entity);
|
||||||
RESTAPI_utils::field_to_json( Obj,"managementPolicy",managementPolicy);
|
field_to_json( Obj,"managementPolicy",managementPolicy);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Location::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
bool Location::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
||||||
try {
|
try {
|
||||||
info.from_json(Obj);
|
info.from_json(Obj);
|
||||||
std::string tmp_type;
|
std::string tmp_type;
|
||||||
RESTAPI_utils::field_from_json( Obj,"type", tmp_type);
|
field_from_json( Obj,"type", tmp_type);
|
||||||
type = location_from_string(tmp_type);
|
type = location_from_string(tmp_type);
|
||||||
RESTAPI_utils::field_from_json( Obj,"buildingName",buildingName);
|
field_from_json( Obj,"buildingName",buildingName);
|
||||||
RESTAPI_utils::field_from_json( Obj,"addressLines",addressLines);
|
field_from_json( Obj,"addressLines",addressLines);
|
||||||
RESTAPI_utils::field_from_json( Obj,"city",city);
|
field_from_json( Obj,"city",city);
|
||||||
RESTAPI_utils::field_from_json( Obj,"state",state);
|
field_from_json( Obj,"state",state);
|
||||||
RESTAPI_utils::field_from_json( Obj,"postal",postal);
|
field_from_json( Obj,"postal",postal);
|
||||||
RESTAPI_utils::field_from_json( Obj,"country",country);
|
field_from_json( Obj,"country",country);
|
||||||
RESTAPI_utils::field_from_json( Obj,"phones",phones);
|
field_from_json( Obj,"phones",phones);
|
||||||
RESTAPI_utils::field_from_json( Obj,"mobiles",mobiles);
|
field_from_json( Obj,"mobiles",mobiles);
|
||||||
RESTAPI_utils::field_from_json( Obj,"geoCode",geoCode);
|
field_from_json( Obj,"geoCode",geoCode);
|
||||||
RESTAPI_utils::field_from_json( Obj,"inUse",inUse);
|
field_from_json( Obj,"inUse",inUse);
|
||||||
RESTAPI_utils::field_from_json( Obj,"entity",entity);
|
field_from_json( Obj,"entity",entity);
|
||||||
RESTAPI_utils::field_from_json( Obj,"managementPolicy",managementPolicy);
|
field_from_json( Obj,"managementPolicy",managementPolicy);
|
||||||
return true;
|
return true;
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
|
|
||||||
@@ -248,43 +251,43 @@ namespace OpenWifi::ProvObjects {
|
|||||||
|
|
||||||
void Contact::to_json(Poco::JSON::Object &Obj) const {
|
void Contact::to_json(Poco::JSON::Object &Obj) const {
|
||||||
info.to_json(Obj);
|
info.to_json(Obj);
|
||||||
RESTAPI_utils::field_to_json( Obj,"type", to_string(type));
|
field_to_json( Obj,"type", to_string(type));
|
||||||
RESTAPI_utils::field_to_json( Obj,"title",title);
|
field_to_json( Obj,"title",title);
|
||||||
RESTAPI_utils::field_to_json( Obj,"salutation",salutation);
|
field_to_json( Obj,"salutation",salutation);
|
||||||
RESTAPI_utils::field_to_json( Obj,"firstname",firstname);
|
field_to_json( Obj,"firstname",firstname);
|
||||||
RESTAPI_utils::field_to_json( Obj,"lastname",lastname);
|
field_to_json( Obj,"lastname",lastname);
|
||||||
RESTAPI_utils::field_to_json( Obj,"initials",initials);
|
field_to_json( Obj,"initials",initials);
|
||||||
RESTAPI_utils::field_to_json( Obj,"visual",visual);
|
field_to_json( Obj,"visual",visual);
|
||||||
RESTAPI_utils::field_to_json( Obj,"mobiles",mobiles);
|
field_to_json( Obj,"mobiles",mobiles);
|
||||||
RESTAPI_utils::field_to_json( Obj,"phones",phones);
|
field_to_json( Obj,"phones",phones);
|
||||||
RESTAPI_utils::field_to_json( Obj,"primaryEmail",primaryEmail);
|
field_to_json( Obj,"primaryEmail",primaryEmail);
|
||||||
RESTAPI_utils::field_to_json( Obj,"secondaryEmail",secondaryEmail);
|
field_to_json( Obj,"secondaryEmail",secondaryEmail);
|
||||||
RESTAPI_utils::field_to_json( Obj,"accessPIN",accessPIN);
|
field_to_json( Obj,"accessPIN",accessPIN);
|
||||||
RESTAPI_utils::field_to_json( Obj,"inUse",inUse);
|
field_to_json( Obj,"inUse",inUse);
|
||||||
RESTAPI_utils::field_to_json( Obj,"entity",entity);
|
field_to_json( Obj,"entity",entity);
|
||||||
RESTAPI_utils::field_to_json( Obj,"managementPolicy",managementPolicy);
|
field_to_json( Obj,"managementPolicy",managementPolicy);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Contact::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
bool Contact::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
||||||
try {
|
try {
|
||||||
info.from_json(Obj);
|
info.from_json(Obj);
|
||||||
std::string tmp_type;
|
std::string tmp_type;
|
||||||
RESTAPI_utils::field_from_json( Obj,"type", tmp_type);
|
field_from_json( Obj,"type", tmp_type);
|
||||||
type = contact_from_string(tmp_type);
|
type = contact_from_string(tmp_type);
|
||||||
RESTAPI_utils::field_from_json( Obj,"title",title);
|
field_from_json( Obj,"title",title);
|
||||||
RESTAPI_utils::field_from_json( Obj,"salutation",salutation);
|
field_from_json( Obj,"salutation",salutation);
|
||||||
RESTAPI_utils::field_from_json( Obj,"firstname",firstname);
|
field_from_json( Obj,"firstname",firstname);
|
||||||
RESTAPI_utils::field_from_json( Obj,"lastname",lastname);
|
field_from_json( Obj,"lastname",lastname);
|
||||||
RESTAPI_utils::field_from_json( Obj,"initials",initials);
|
field_from_json( Obj,"initials",initials);
|
||||||
RESTAPI_utils::field_from_json( Obj,"visual",visual);
|
field_from_json( Obj,"visual",visual);
|
||||||
RESTAPI_utils::field_from_json( Obj,"mobiles",mobiles);
|
field_from_json( Obj,"mobiles",mobiles);
|
||||||
RESTAPI_utils::field_from_json( Obj,"phones",phones);
|
field_from_json( Obj,"phones",phones);
|
||||||
RESTAPI_utils::field_from_json( Obj,"primaryEmail",primaryEmail);
|
field_from_json( Obj,"primaryEmail",primaryEmail);
|
||||||
RESTAPI_utils::field_from_json( Obj,"secondaryEmail",secondaryEmail);
|
field_from_json( Obj,"secondaryEmail",secondaryEmail);
|
||||||
RESTAPI_utils::field_from_json( Obj,"accessPIN",accessPIN);
|
field_from_json( Obj,"accessPIN",accessPIN);
|
||||||
RESTAPI_utils::field_from_json( Obj,"inUse",inUse);
|
field_from_json( Obj,"inUse",inUse);
|
||||||
RESTAPI_utils::field_from_json( Obj,"entity",entity);
|
field_from_json( Obj,"entity",entity);
|
||||||
RESTAPI_utils::field_from_json( Obj,"managementPolicy",managementPolicy);
|
field_from_json( Obj,"managementPolicy",managementPolicy);
|
||||||
return true;
|
return true;
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
|
|
||||||
@@ -294,35 +297,35 @@ namespace OpenWifi::ProvObjects {
|
|||||||
|
|
||||||
void InventoryTag::to_json(Poco::JSON::Object &Obj) const {
|
void InventoryTag::to_json(Poco::JSON::Object &Obj) const {
|
||||||
info.to_json(Obj);
|
info.to_json(Obj);
|
||||||
RESTAPI_utils::field_to_json(Obj, "serialNumber", serialNumber);
|
field_to_json(Obj, "serialNumber", serialNumber);
|
||||||
RESTAPI_utils::field_to_json(Obj, "venue", venue);
|
field_to_json(Obj, "venue", venue);
|
||||||
RESTAPI_utils::field_to_json(Obj, "entity", entity);
|
field_to_json(Obj, "entity", entity);
|
||||||
RESTAPI_utils::field_to_json(Obj, "subscriber", subscriber);
|
field_to_json(Obj, "subscriber", subscriber);
|
||||||
RESTAPI_utils::field_to_json(Obj, "deviceType", deviceType);
|
field_to_json(Obj, "deviceType", deviceType);
|
||||||
RESTAPI_utils::field_to_json(Obj, "qrCode", qrCode);
|
field_to_json(Obj, "qrCode", qrCode);
|
||||||
RESTAPI_utils::field_to_json(Obj, "geoCode", geoCode);
|
field_to_json(Obj, "geoCode", geoCode);
|
||||||
RESTAPI_utils::field_to_json(Obj, "location", location);
|
field_to_json(Obj, "location", location);
|
||||||
RESTAPI_utils::field_to_json(Obj, "contact", contact);
|
field_to_json(Obj, "contact", contact);
|
||||||
RESTAPI_utils::field_to_json( Obj,"deviceConfiguration",deviceConfiguration);
|
field_to_json( Obj,"deviceConfiguration",deviceConfiguration);
|
||||||
RESTAPI_utils::field_to_json( Obj,"rrm",rrm);
|
field_to_json( Obj,"rrm",rrm);
|
||||||
RESTAPI_utils::field_to_json( Obj,"managementPolicy",managementPolicy);
|
field_to_json( Obj,"managementPolicy",managementPolicy);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool InventoryTag::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
bool InventoryTag::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
||||||
try {
|
try {
|
||||||
info.from_json(Obj);
|
info.from_json(Obj);
|
||||||
RESTAPI_utils::field_from_json( Obj,"serialNumber",serialNumber);
|
field_from_json( Obj,"serialNumber",serialNumber);
|
||||||
RESTAPI_utils::field_from_json( Obj,"venue",venue);
|
field_from_json( Obj,"venue",venue);
|
||||||
RESTAPI_utils::field_from_json( Obj,"entity",entity);
|
field_from_json( Obj,"entity",entity);
|
||||||
RESTAPI_utils::field_from_json( Obj,"subscriber",subscriber);
|
field_from_json( Obj,"subscriber",subscriber);
|
||||||
RESTAPI_utils::field_from_json( Obj,"deviceType",deviceType);
|
field_from_json( Obj,"deviceType",deviceType);
|
||||||
RESTAPI_utils::field_from_json(Obj, "qrCode", qrCode);
|
field_from_json(Obj, "qrCode", qrCode);
|
||||||
RESTAPI_utils::field_from_json( Obj,"geoCode",geoCode);
|
field_from_json( Obj,"geoCode",geoCode);
|
||||||
RESTAPI_utils::field_from_json( Obj,"location",location);
|
field_from_json( Obj,"location",location);
|
||||||
RESTAPI_utils::field_from_json( Obj,"contact",contact);
|
field_from_json( Obj,"contact",contact);
|
||||||
RESTAPI_utils::field_from_json( Obj,"deviceConfiguration",deviceConfiguration);
|
field_from_json( Obj,"deviceConfiguration",deviceConfiguration);
|
||||||
RESTAPI_utils::field_from_json( Obj,"rrm",rrm);
|
field_from_json( Obj,"rrm",rrm);
|
||||||
RESTAPI_utils::field_from_json( Obj,"managementPolicy",managementPolicy);
|
field_from_json( Obj,"managementPolicy",managementPolicy);
|
||||||
return true;
|
return true;
|
||||||
} catch(...) {
|
} catch(...) {
|
||||||
|
|
||||||
@@ -331,18 +334,18 @@ namespace OpenWifi::ProvObjects {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DeviceConfigurationElement::to_json(Poco::JSON::Object &Obj) const {
|
void DeviceConfigurationElement::to_json(Poco::JSON::Object &Obj) const {
|
||||||
RESTAPI_utils::field_to_json( Obj,"name", name);
|
field_to_json( Obj,"name", name);
|
||||||
RESTAPI_utils::field_to_json( Obj,"description", description);
|
field_to_json( Obj,"description", description);
|
||||||
RESTAPI_utils::field_to_json( Obj,"weight", weight);
|
field_to_json( Obj,"weight", weight);
|
||||||
RESTAPI_utils::field_to_json( Obj,"configuration", configuration);
|
field_to_json( Obj,"configuration", configuration);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DeviceConfigurationElement::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
bool DeviceConfigurationElement::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
||||||
try {
|
try {
|
||||||
RESTAPI_utils::field_from_json( Obj,"name",name);
|
field_from_json( Obj,"name",name);
|
||||||
RESTAPI_utils::field_from_json( Obj,"description",description);
|
field_from_json( Obj,"description",description);
|
||||||
RESTAPI_utils::field_from_json( Obj,"weight",weight);
|
field_from_json( Obj,"weight",weight);
|
||||||
RESTAPI_utils::field_from_json( Obj,"configuration",configuration);
|
field_from_json( Obj,"configuration",configuration);
|
||||||
return true;
|
return true;
|
||||||
} catch(...) {
|
} catch(...) {
|
||||||
|
|
||||||
@@ -352,27 +355,27 @@ namespace OpenWifi::ProvObjects {
|
|||||||
|
|
||||||
void DeviceConfiguration::to_json(Poco::JSON::Object &Obj) const {
|
void DeviceConfiguration::to_json(Poco::JSON::Object &Obj) const {
|
||||||
info.to_json(Obj);
|
info.to_json(Obj);
|
||||||
RESTAPI_utils::field_to_json( Obj,"managementPolicy",managementPolicy);
|
field_to_json( Obj,"managementPolicy",managementPolicy);
|
||||||
RESTAPI_utils::field_to_json( Obj,"deviceTypes",deviceTypes);
|
field_to_json( Obj,"deviceTypes",deviceTypes);
|
||||||
RESTAPI_utils::field_to_json( Obj,"configuration",configuration);
|
field_to_json( Obj,"configuration",configuration);
|
||||||
RESTAPI_utils::field_to_json( Obj,"inUse",inUse);
|
field_to_json( Obj,"inUse",inUse);
|
||||||
RESTAPI_utils::field_to_json( Obj,"variables",variables);
|
field_to_json( Obj,"variables",variables);
|
||||||
RESTAPI_utils::field_to_json( Obj,"rrm",rrm);
|
field_to_json( Obj,"rrm",rrm);
|
||||||
RESTAPI_utils::field_to_json( Obj,"firmwareUpgrade",firmwareUpgrade);
|
field_to_json( Obj,"firmwareUpgrade",firmwareUpgrade);
|
||||||
RESTAPI_utils::field_to_json( Obj,"firmwareRCOnly",firmwareRCOnly);
|
field_to_json( Obj,"firmwareRCOnly",firmwareRCOnly);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DeviceConfiguration::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
bool DeviceConfiguration::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
||||||
try {
|
try {
|
||||||
info.from_json(Obj);
|
info.from_json(Obj);
|
||||||
RESTAPI_utils::field_from_json( Obj,"managementPolicy",managementPolicy);
|
field_from_json( Obj,"managementPolicy",managementPolicy);
|
||||||
RESTAPI_utils::field_from_json( Obj,"deviceTypes",deviceTypes);
|
field_from_json( Obj,"deviceTypes",deviceTypes);
|
||||||
RESTAPI_utils::field_from_json( Obj,"configuration",configuration);
|
field_from_json( Obj,"configuration",configuration);
|
||||||
RESTAPI_utils::field_from_json( Obj,"inUse",inUse);
|
field_from_json( Obj,"inUse",inUse);
|
||||||
RESTAPI_utils::field_from_json( Obj,"variables",variables);
|
field_from_json( Obj,"variables",variables);
|
||||||
RESTAPI_utils::field_from_json( Obj,"rrm",rrm);
|
field_from_json( Obj,"rrm",rrm);
|
||||||
RESTAPI_utils::field_from_json( Obj,"firmwareUpgrade",firmwareUpgrade);
|
field_from_json( Obj,"firmwareUpgrade",firmwareUpgrade);
|
||||||
RESTAPI_utils::field_from_json( Obj,"firmwareRCOnly",firmwareRCOnly);
|
field_from_json( Obj,"firmwareRCOnly",firmwareRCOnly);
|
||||||
return true;
|
return true;
|
||||||
} catch(...) {
|
} catch(...) {
|
||||||
|
|
||||||
@@ -381,8 +384,8 @@ namespace OpenWifi::ProvObjects {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Report::to_json(Poco::JSON::Object &Obj) const {
|
void Report::to_json(Poco::JSON::Object &Obj) const {
|
||||||
RESTAPI_utils::field_to_json(Obj, "snapshot", snapShot);
|
field_to_json(Obj, "snapshot", snapShot);
|
||||||
RESTAPI_utils::field_to_json(Obj, "devices", tenants);
|
field_to_json(Obj, "devices", tenants);
|
||||||
};
|
};
|
||||||
|
|
||||||
void Report::reset() {
|
void Report::reset() {
|
||||||
@@ -390,16 +393,16 @@ namespace OpenWifi::ProvObjects {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ExpandedUseEntry::to_json(Poco::JSON::Object &Obj) const {
|
void ExpandedUseEntry::to_json(Poco::JSON::Object &Obj) const {
|
||||||
RESTAPI_utils::field_to_json(Obj, "uuid", uuid);
|
field_to_json(Obj, "uuid", uuid);
|
||||||
RESTAPI_utils::field_to_json(Obj, "name", name);
|
field_to_json(Obj, "name", name);
|
||||||
RESTAPI_utils::field_to_json(Obj, "description", description);
|
field_to_json(Obj, "description", description);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ExpandedUseEntry::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
bool ExpandedUseEntry::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
||||||
try {
|
try {
|
||||||
RESTAPI_utils::field_from_json( Obj,"uuid",uuid);
|
field_from_json( Obj,"uuid",uuid);
|
||||||
RESTAPI_utils::field_from_json( Obj,"name",name);
|
field_from_json( Obj,"name",name);
|
||||||
RESTAPI_utils::field_from_json( Obj,"description",description);
|
field_from_json( Obj,"description",description);
|
||||||
return true;
|
return true;
|
||||||
} catch(...) {
|
} catch(...) {
|
||||||
|
|
||||||
@@ -408,14 +411,14 @@ namespace OpenWifi::ProvObjects {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ExpandedUseEntryList::to_json(Poco::JSON::Object &Obj) const {
|
void ExpandedUseEntryList::to_json(Poco::JSON::Object &Obj) const {
|
||||||
RESTAPI_utils::field_to_json(Obj, "type", type);
|
field_to_json(Obj, "type", type);
|
||||||
RESTAPI_utils::field_to_json(Obj, "entries", entries);
|
field_to_json(Obj, "entries", entries);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ExpandedUseEntryList::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
bool ExpandedUseEntryList::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
||||||
try {
|
try {
|
||||||
RESTAPI_utils::field_from_json( Obj,"type",type);
|
field_from_json( Obj,"type",type);
|
||||||
RESTAPI_utils::field_from_json( Obj,"entries",entries);
|
field_from_json( Obj,"entries",entries);
|
||||||
return true;
|
return true;
|
||||||
} catch(...) {
|
} catch(...) {
|
||||||
|
|
||||||
@@ -424,12 +427,94 @@ namespace OpenWifi::ProvObjects {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ExpandedUseEntryMapList::to_json(Poco::JSON::Object &Obj) const {
|
void ExpandedUseEntryMapList::to_json(Poco::JSON::Object &Obj) const {
|
||||||
RESTAPI_utils::field_to_json(Obj, "entries", entries);
|
field_to_json(Obj, "entries", entries);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ExpandedUseEntryMapList::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
bool ExpandedUseEntryMapList::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
||||||
try {
|
try {
|
||||||
RESTAPI_utils::field_from_json( Obj,"entries",entries);
|
field_from_json( Obj,"entries",entries);
|
||||||
|
return true;
|
||||||
|
} catch(...) {
|
||||||
|
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void UserList::to_json(Poco::JSON::Object &Obj) const {
|
||||||
|
field_to_json(Obj, "list", list);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool UserList::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
||||||
|
try {
|
||||||
|
field_from_json(Obj, "list", list);
|
||||||
|
return true;
|
||||||
|
} catch(...) {
|
||||||
|
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ObjectACL::to_json(Poco::JSON::Object &Obj) const {
|
||||||
|
field_to_json(Obj, "users", users);
|
||||||
|
field_to_json(Obj, "access", access);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ObjectACL::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
||||||
|
try {
|
||||||
|
field_from_json(Obj, "users", users);
|
||||||
|
field_from_json(Obj, "access", access);
|
||||||
|
return true;
|
||||||
|
} catch(...) {
|
||||||
|
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ObjectACLList::to_json(Poco::JSON::Object &Obj) const {
|
||||||
|
field_to_json(Obj, "list", list);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ObjectACLList::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
||||||
|
try {
|
||||||
|
field_from_json(Obj, "list", list);
|
||||||
|
return true;
|
||||||
|
} catch(...) {
|
||||||
|
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Map::to_json(Poco::JSON::Object &Obj) const {
|
||||||
|
info.to_json(Obj);
|
||||||
|
field_to_json( Obj,"data",data);
|
||||||
|
field_to_json( Obj,"entity",entity);
|
||||||
|
field_to_json( Obj,"creator",creator);
|
||||||
|
field_to_json( Obj,"visibility",visibility);
|
||||||
|
field_to_json( Obj,"access",access);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Map::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
||||||
|
try {
|
||||||
|
info.from_json(Obj);
|
||||||
|
field_from_json( Obj,"data",data);
|
||||||
|
field_from_json( Obj,"entity",entity);
|
||||||
|
field_from_json( Obj,"creator",creator);
|
||||||
|
field_from_json( Obj,"visibility",visibility);
|
||||||
|
field_from_json( Obj,"access",access);
|
||||||
|
return true;
|
||||||
|
} catch(...) {
|
||||||
|
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MapList::to_json(Poco::JSON::Object &Obj) const {
|
||||||
|
field_to_json( Obj,"list",list);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool MapList::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
||||||
|
try {
|
||||||
|
field_from_json( Obj,"list",list);
|
||||||
return true;
|
return true;
|
||||||
} catch(...) {
|
} catch(...) {
|
||||||
|
|
||||||
@@ -438,13 +523,47 @@ namespace OpenWifi::ProvObjects {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool UpdateObjectInfo(const Poco::JSON::Object::Ptr &O, const SecurityObjects::UserInfo &U, ObjectInfo &I) {
|
bool UpdateObjectInfo(const Poco::JSON::Object::Ptr &O, const SecurityObjects::UserInfo &U, ObjectInfo &I) {
|
||||||
|
uint64_t Now = std::time(nullptr);
|
||||||
if(O->has("name"))
|
if(O->has("name"))
|
||||||
I.name = O->get("name").toString();
|
I.name = O->get("name").toString();
|
||||||
if(O->has("description"))
|
|
||||||
|
if(I.name.empty())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if(O->has("description"))
|
||||||
I.description = O->get("description").toString();
|
I.description = O->get("description").toString();
|
||||||
SecurityObjects::MergeNotes(O,U,I.notes);
|
SecurityObjects::MergeNotes(O,U,I.notes);
|
||||||
I.modified = std::time(nullptr);
|
SecurityObjects::NoteInfoVec N;
|
||||||
|
for(auto &i:I.notes) {
|
||||||
|
if(i.note.empty())
|
||||||
|
continue;
|
||||||
|
N.push_back(SecurityObjects::NoteInfo{.created=Now,.createdBy=U.email,.note=i.note});
|
||||||
|
}
|
||||||
|
I.modified = Now;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CreateObjectInfo(const Poco::JSON::Object::Ptr &O, const SecurityObjects::UserInfo &U, ObjectInfo &I) {
|
||||||
|
uint64_t Now = std::time(nullptr);
|
||||||
|
if(O->has("name"))
|
||||||
|
I.name = O->get("name").toString();
|
||||||
|
|
||||||
|
if(I.name.empty())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if(O->has("description"))
|
||||||
|
I.description = O->get("description").toString();
|
||||||
|
|
||||||
|
SecurityObjects::NoteInfoVec N;
|
||||||
|
for(auto &i:I.notes) {
|
||||||
|
if(i.note.empty())
|
||||||
|
continue;
|
||||||
|
N.push_back(SecurityObjects::NoteInfo{.created=Now,.createdBy=U.email,.note=i.note});
|
||||||
|
}
|
||||||
|
I.notes = N;
|
||||||
|
I.modified = I.created = Now;
|
||||||
|
I.id = MicroService::instance().CreateUUID();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -15,6 +15,13 @@
|
|||||||
|
|
||||||
namespace OpenWifi::ProvObjects {
|
namespace OpenWifi::ProvObjects {
|
||||||
|
|
||||||
|
enum FIRMWARE_UPGRADE_RULES {
|
||||||
|
dont_upgrade,
|
||||||
|
upgrade_inherit,
|
||||||
|
upgrade_release_only,
|
||||||
|
upgrade_latest
|
||||||
|
};
|
||||||
|
|
||||||
struct ObjectInfo {
|
struct ObjectInfo {
|
||||||
Types::UUID_t id;
|
Types::UUID_t id;
|
||||||
std::string name;
|
std::string name;
|
||||||
@@ -317,7 +324,50 @@ namespace OpenWifi::ProvObjects {
|
|||||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct UserList {
|
||||||
|
std::vector<std::string> list;
|
||||||
|
|
||||||
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ObjectACL {
|
||||||
|
UserList users;
|
||||||
|
std::string access;
|
||||||
|
|
||||||
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ObjectACLList {
|
||||||
|
std::vector<ObjectACL> list;
|
||||||
|
|
||||||
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Map {
|
||||||
|
ObjectInfo info;
|
||||||
|
std::string data;
|
||||||
|
std::string entity;
|
||||||
|
std::string creator;
|
||||||
|
std::string visibility;
|
||||||
|
ObjectACLList access;
|
||||||
|
|
||||||
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
|
};
|
||||||
|
|
||||||
|
struct MapList {
|
||||||
|
std::vector<Map> list;
|
||||||
|
|
||||||
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
|
};
|
||||||
|
|
||||||
bool UpdateObjectInfo(const Poco::JSON::Object::Ptr &O, const SecurityObjects::UserInfo &U, ObjectInfo &I);
|
bool UpdateObjectInfo(const Poco::JSON::Object::Ptr &O, const SecurityObjects::UserInfo &U, ObjectInfo &I);
|
||||||
|
bool CreateObjectInfo(const Poco::JSON::Object::Ptr &O, const SecurityObjects::UserInfo &U, ObjectInfo &I);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ namespace OpenWifi::SecurityObjects {
|
|||||||
field_to_json(Obj,"primary", primary);
|
field_to_json(Obj,"primary", primary);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MobilePhoneNumber::from_json(Poco::JSON::Object::Ptr Obj) {
|
bool MobilePhoneNumber::from_json(Poco::JSON::Object::Ptr &Obj) {
|
||||||
try {
|
try {
|
||||||
field_from_json(Obj,"number",number);
|
field_from_json(Obj,"number",number);
|
||||||
field_from_json(Obj,"verified",verified);
|
field_from_json(Obj,"verified",verified);
|
||||||
@@ -155,7 +155,7 @@ namespace OpenWifi::SecurityObjects {
|
|||||||
field_to_json(Obj,"method", method);
|
field_to_json(Obj,"method", method);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MfaAuthInfo::from_json(Poco::JSON::Object::Ptr Obj) {
|
bool MfaAuthInfo::from_json(Poco::JSON::Object::Ptr &Obj) {
|
||||||
try {
|
try {
|
||||||
field_from_json(Obj,"enabled",enabled);
|
field_from_json(Obj,"enabled",enabled);
|
||||||
field_from_json(Obj,"method",method);
|
field_from_json(Obj,"method",method);
|
||||||
@@ -171,7 +171,7 @@ namespace OpenWifi::SecurityObjects {
|
|||||||
field_to_json(Obj, "mfa", mfa);
|
field_to_json(Obj, "mfa", mfa);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UserLoginLoginExtensions::from_json(Poco::JSON::Object::Ptr Obj) {
|
bool UserLoginLoginExtensions::from_json(Poco::JSON::Object::Ptr &Obj) {
|
||||||
try {
|
try {
|
||||||
field_from_json(Obj,"mobiles",mobiles);
|
field_from_json(Obj,"mobiles",mobiles);
|
||||||
field_from_json(Obj,"mfa",mfa);
|
field_from_json(Obj,"mfa",mfa);
|
||||||
@@ -189,7 +189,7 @@ namespace OpenWifi::SecurityObjects {
|
|||||||
field_to_json(Obj, "method", method);
|
field_to_json(Obj, "method", method);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MFAChallengeRequest::from_json(Poco::JSON::Object::Ptr Obj) {
|
bool MFAChallengeRequest::from_json(Poco::JSON::Object::Ptr &Obj) {
|
||||||
try {
|
try {
|
||||||
field_from_json(Obj,"uuid",uuid);
|
field_from_json(Obj,"uuid",uuid);
|
||||||
field_from_json(Obj,"question",question);
|
field_from_json(Obj,"question",question);
|
||||||
@@ -208,7 +208,7 @@ namespace OpenWifi::SecurityObjects {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MFAChallengeResponse::from_json(Poco::JSON::Object::Ptr Obj) {
|
bool MFAChallengeResponse::from_json(Poco::JSON::Object::Ptr &Obj) {
|
||||||
try {
|
try {
|
||||||
field_from_json(Obj,"uuid",uuid);
|
field_from_json(Obj,"uuid",uuid);
|
||||||
field_from_json(Obj,"answer",answer);
|
field_from_json(Obj,"answer",answer);
|
||||||
@@ -387,11 +387,12 @@ namespace OpenWifi::SecurityObjects {
|
|||||||
field_to_json(Obj,"note", note);
|
field_to_json(Obj,"note", note);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NoteInfo::from_json(Poco::JSON::Object::Ptr Obj) {
|
bool NoteInfo::from_json(Poco::JSON::Object::Ptr &Obj) {
|
||||||
try {
|
try {
|
||||||
field_from_json(Obj,"created",created);
|
field_from_json(Obj,"created",created);
|
||||||
field_from_json(Obj,"createdBy",createdBy);
|
field_from_json(Obj,"createdBy",createdBy);
|
||||||
field_from_json(Obj,"note",note);
|
field_from_json(Obj,"note",note);
|
||||||
|
return true;
|
||||||
} catch(...) {
|
} catch(...) {
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -428,10 +429,11 @@ namespace OpenWifi::SecurityObjects {
|
|||||||
field_to_json<ResourceAccessType>(Obj,"access", access, ResourceAccessTypeToString);
|
field_to_json<ResourceAccessType>(Obj,"access", access, ResourceAccessTypeToString);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ProfileAction::from_json(Poco::JSON::Object::Ptr Obj) {
|
bool ProfileAction::from_json(Poco::JSON::Object::Ptr &Obj) {
|
||||||
try {
|
try {
|
||||||
field_from_json(Obj,"resource",resource);
|
field_from_json(Obj,"resource",resource);
|
||||||
field_from_json<ResourceAccessType>(Obj,"access",access,ResourceAccessTypeFromString );
|
field_from_json<ResourceAccessType>(Obj,"access",access,ResourceAccessTypeFromString );
|
||||||
|
return true;
|
||||||
} catch(...) {
|
} catch(...) {
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -447,7 +449,7 @@ namespace OpenWifi::SecurityObjects {
|
|||||||
field_to_json(Obj,"notes", notes);
|
field_to_json(Obj,"notes", notes);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SecurityProfile::from_json(Poco::JSON::Object::Ptr Obj) {
|
bool SecurityProfile::from_json(Poco::JSON::Object::Ptr &Obj) {
|
||||||
try {
|
try {
|
||||||
field_from_json(Obj,"id",id);
|
field_from_json(Obj,"id",id);
|
||||||
field_from_json(Obj,"name",name);
|
field_from_json(Obj,"name",name);
|
||||||
@@ -455,6 +457,7 @@ namespace OpenWifi::SecurityObjects {
|
|||||||
field_from_json(Obj,"policy",policy);
|
field_from_json(Obj,"policy",policy);
|
||||||
field_from_json(Obj,"role",role);
|
field_from_json(Obj,"role",role);
|
||||||
field_from_json(Obj,"notes",notes);
|
field_from_json(Obj,"notes",notes);
|
||||||
|
return true;
|
||||||
} catch(...) {
|
} catch(...) {
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -465,13 +468,51 @@ namespace OpenWifi::SecurityObjects {
|
|||||||
field_to_json(Obj, "profiles", profiles);
|
field_to_json(Obj, "profiles", profiles);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SecurityProfileList::from_json(Poco::JSON::Object::Ptr Obj) {
|
bool SecurityProfileList::from_json(Poco::JSON::Object::Ptr &Obj) {
|
||||||
try {
|
try {
|
||||||
field_from_json(Obj,"profiles",profiles);
|
field_from_json(Obj,"profiles",profiles);
|
||||||
|
return true;
|
||||||
} catch(...) {
|
} catch(...) {
|
||||||
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ActionLink::to_json(Poco::JSON::Object &Obj) const {
|
||||||
|
field_to_json(Obj,"id",id);
|
||||||
|
field_to_json(Obj,"action",action);
|
||||||
|
field_to_json(Obj,"userId",userId);
|
||||||
|
field_to_json(Obj,"actionTemplate",actionTemplate);
|
||||||
|
field_to_json(Obj,"variables",variables);
|
||||||
|
field_to_json(Obj,"locale",locale);
|
||||||
|
field_to_json(Obj,"message",message);
|
||||||
|
field_to_json(Obj,"sent",sent);
|
||||||
|
field_to_json(Obj,"created",created);
|
||||||
|
field_to_json(Obj,"expires",expires);
|
||||||
|
field_to_json(Obj,"completed",completed);
|
||||||
|
field_to_json(Obj,"canceled",canceled);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ActionLink::from_json(Poco::JSON::Object::Ptr &Obj) {
|
||||||
|
try {
|
||||||
|
field_from_json(Obj,"id",id);
|
||||||
|
field_from_json(Obj,"action",action);
|
||||||
|
field_from_json(Obj,"userId",userId);
|
||||||
|
field_from_json(Obj,"actionTemplate",actionTemplate);
|
||||||
|
field_from_json(Obj,"variables",variables);
|
||||||
|
field_from_json(Obj,"locale",locale);
|
||||||
|
field_from_json(Obj,"message",message);
|
||||||
|
field_from_json(Obj,"sent",sent);
|
||||||
|
field_from_json(Obj,"created",created);
|
||||||
|
field_from_json(Obj,"expires",expires);
|
||||||
|
field_from_json(Obj,"completed",completed);
|
||||||
|
field_from_json(Obj,"canceled",canceled);
|
||||||
|
return true;
|
||||||
|
} catch(...) {
|
||||||
|
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
#define UCENTRAL_RESTAPI_SECURITYOBJECTS_H
|
#define UCENTRAL_RESTAPI_SECURITYOBJECTS_H
|
||||||
|
|
||||||
#include "Poco/JSON/Object.h"
|
#include "Poco/JSON/Object.h"
|
||||||
#include "../framework/OpenWifiTypes.h"
|
#include "framework/OpenWifiTypes.h"
|
||||||
|
|
||||||
namespace OpenWifi::SecurityObjects {
|
namespace OpenWifi::SecurityObjects {
|
||||||
|
|
||||||
@@ -53,25 +53,25 @@ namespace OpenWifi::SecurityObjects {
|
|||||||
std::string createdBy;
|
std::string createdBy;
|
||||||
std::string note;
|
std::string note;
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
bool from_json(Poco::JSON::Object::Ptr Obj);
|
bool from_json(Poco::JSON::Object::Ptr &Obj);
|
||||||
};
|
};
|
||||||
typedef std::vector<NoteInfo> NoteInfoVec;
|
typedef std::vector<NoteInfo> NoteInfoVec;
|
||||||
|
|
||||||
struct MobilePhoneNumber {
|
struct MobilePhoneNumber {
|
||||||
std::string number;
|
std::string number;
|
||||||
bool verified;
|
bool verified = false;
|
||||||
bool primary;
|
bool primary = false;
|
||||||
|
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
bool from_json(Poco::JSON::Object::Ptr Obj);
|
bool from_json(Poco::JSON::Object::Ptr &Obj);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct MfaAuthInfo {
|
struct MfaAuthInfo {
|
||||||
bool enabled;
|
bool enabled = false;
|
||||||
std::string method;
|
std::string method;
|
||||||
|
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
bool from_json(Poco::JSON::Object::Ptr Obj);
|
bool from_json(Poco::JSON::Object::Ptr &Obj);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct UserLoginLoginExtensions {
|
struct UserLoginLoginExtensions {
|
||||||
@@ -79,17 +79,17 @@ namespace OpenWifi::SecurityObjects {
|
|||||||
struct MfaAuthInfo mfa;
|
struct MfaAuthInfo mfa;
|
||||||
|
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
bool from_json(Poco::JSON::Object::Ptr Obj);
|
bool from_json(Poco::JSON::Object::Ptr &Obj);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct MFAChallengeRequest {
|
struct MFAChallengeRequest {
|
||||||
std::string uuid;
|
std::string uuid;
|
||||||
std::string question;
|
std::string question;
|
||||||
std::string method;
|
std::string method;
|
||||||
uint64_t created;
|
uint64_t created = std::time(nullptr);
|
||||||
|
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
bool from_json(Poco::JSON::Object::Ptr Obj);
|
bool from_json(Poco::JSON::Object::Ptr &Obj);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct MFAChallengeResponse {
|
struct MFAChallengeResponse {
|
||||||
@@ -97,7 +97,7 @@ namespace OpenWifi::SecurityObjects {
|
|||||||
std::string answer;
|
std::string answer;
|
||||||
|
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
bool from_json(Poco::JSON::Object::Ptr Obj);
|
bool from_json(Poco::JSON::Object::Ptr &Obj);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct UserInfo {
|
struct UserInfo {
|
||||||
@@ -200,7 +200,7 @@ namespace OpenWifi::SecurityObjects {
|
|||||||
std::string resource;
|
std::string resource;
|
||||||
ResourceAccessType access;
|
ResourceAccessType access;
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
bool from_json(Poco::JSON::Object::Ptr Obj);
|
bool from_json(Poco::JSON::Object::Ptr &Obj);
|
||||||
};
|
};
|
||||||
typedef std::vector<ProfileAction> ProfileActionVec;
|
typedef std::vector<ProfileAction> ProfileActionVec;
|
||||||
|
|
||||||
@@ -212,14 +212,37 @@ namespace OpenWifi::SecurityObjects {
|
|||||||
std::string role;
|
std::string role;
|
||||||
NoteInfoVec notes;
|
NoteInfoVec notes;
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
bool from_json(Poco::JSON::Object::Ptr Obj);
|
bool from_json(Poco::JSON::Object::Ptr &Obj);
|
||||||
};
|
};
|
||||||
typedef std::vector<SecurityProfile> SecurityProfileVec;
|
typedef std::vector<SecurityProfile> SecurityProfileVec;
|
||||||
|
|
||||||
struct SecurityProfileList {
|
struct SecurityProfileList {
|
||||||
SecurityProfileVec profiles;
|
SecurityProfileVec profiles;
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
bool from_json(Poco::JSON::Object::Ptr Obj);
|
bool from_json(Poco::JSON::Object::Ptr &Obj);
|
||||||
|
};
|
||||||
|
|
||||||
|
enum LinkActions {
|
||||||
|
FORGOT_PASSWORD=1,
|
||||||
|
VERIFY_EMAIL
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ActionLink {
|
||||||
|
std::string id;
|
||||||
|
uint64_t action;
|
||||||
|
std::string userId;
|
||||||
|
std::string actionTemplate;
|
||||||
|
Types::StringPairVec variables;
|
||||||
|
std::string locale;
|
||||||
|
std::string message;
|
||||||
|
uint64_t sent=0;
|
||||||
|
uint64_t created=std::time(nullptr);
|
||||||
|
uint64_t expires=0;
|
||||||
|
uint64_t completed=0;
|
||||||
|
uint64_t canceled=0;
|
||||||
|
|
||||||
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
bool from_json(Poco::JSON::Object::Ptr &Obj);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,8 +10,6 @@
|
|||||||
|
|
||||||
namespace OpenWifi {
|
namespace OpenWifi {
|
||||||
|
|
||||||
class Storage *Storage::instance_ = nullptr;
|
|
||||||
|
|
||||||
int Storage::Start() {
|
int Storage::Start() {
|
||||||
std::lock_guard Guard(Mutex_);
|
std::lock_guard Guard(Mutex_);
|
||||||
|
|
||||||
|
|||||||
@@ -59,14 +59,12 @@ namespace OpenWifi {
|
|||||||
bool GenerateDeviceReport(FMSObjects::DeviceReport &Report);
|
bool GenerateDeviceReport(FMSObjects::DeviceReport &Report);
|
||||||
static std::string TrimRevision(const std::string &R);
|
static std::string TrimRevision(const std::string &R);
|
||||||
static Storage *instance() {
|
static Storage *instance() {
|
||||||
if (instance_ == nullptr) {
|
static Storage *instance_ = new Storage;
|
||||||
instance_ = new Storage;
|
|
||||||
}
|
|
||||||
return instance_;
|
return instance_;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static Storage *instance_;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
inline class Storage * StorageService() { return Storage::instance(); };
|
inline class Storage * StorageService() { return Storage::instance(); };
|
||||||
|
|||||||
2479
src/framework/ConfigurationValidator.cpp
Normal file
2479
src/framework/ConfigurationValidator.cpp
Normal file
File diff suppressed because it is too large
Load Diff
46
src/framework/ConfigurationValidator.h
Normal file
46
src/framework/ConfigurationValidator.h
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
//
|
||||||
|
// Created by stephane bourque on 2021-09-14.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef OWPROV_CONFIGURATIONVALIDATOR_H
|
||||||
|
#define OWPROV_CONFIGURATIONVALIDATOR_H
|
||||||
|
|
||||||
|
#include <nlohmann/json-schema.hpp>
|
||||||
|
#include "framework/MicroService.h"
|
||||||
|
|
||||||
|
using nlohmann::json;
|
||||||
|
using nlohmann::json_schema::json_validator;
|
||||||
|
|
||||||
|
namespace OpenWifi {
|
||||||
|
class ConfigurationValidator : public SubSystemServer {
|
||||||
|
public:
|
||||||
|
|
||||||
|
static ConfigurationValidator *instance() {
|
||||||
|
if(instance_== nullptr)
|
||||||
|
instance_ = new ConfigurationValidator;
|
||||||
|
return instance_;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Validate(const std::string &C, std::string &Error);
|
||||||
|
static void my_format_checker(const std::string &format, const std::string &value);
|
||||||
|
int Start() override;
|
||||||
|
void Stop() override;
|
||||||
|
void reinitialize(Poco::Util::Application &self) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
static ConfigurationValidator * instance_;
|
||||||
|
bool Initialized_=false;
|
||||||
|
bool Working_=false;
|
||||||
|
void Init();
|
||||||
|
std::unique_ptr<json_validator> Validator_=std::make_unique<json_validator>(nullptr, my_format_checker);
|
||||||
|
|
||||||
|
ConfigurationValidator():
|
||||||
|
SubSystemServer("configvalidator", "CFG-VALIDATOR", "config.validator") {
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
inline ConfigurationValidator * ConfigurationValidator() { return ConfigurationValidator::instance(); }
|
||||||
|
inline bool ValidateUCentralConfiguration(const std::string &C, std::string &Error) { return ConfigurationValidator::instance()->Validate(C, Error); }
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif //OWPROV_CONFIGURATIONVALIDATOR_H
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -47,13 +47,19 @@ namespace OpenWifi::RESTAPI::Errors {
|
|||||||
static const std::string IdMustBe0{"To create a user, you must set the ID to 0"};
|
static const std::string IdMustBe0{"To create a user, you must set the ID to 0"};
|
||||||
static const std::string InvalidUserRole{"Invalid userRole."};
|
static const std::string InvalidUserRole{"Invalid userRole."};
|
||||||
static const std::string InvalidEmailAddress{"Invalid email address."};
|
static const std::string InvalidEmailAddress{"Invalid email address."};
|
||||||
static const std::string InvalidPassword{"Invalid password."};
|
|
||||||
static const std::string PasswordRejected{"Password was rejected. This maybe an old password."};
|
static const std::string PasswordRejected{"Password was rejected. This maybe an old password."};
|
||||||
static const std::string InvalidIPRanges{"Invalid IP range specifications."};
|
static const std::string InvalidIPRanges{"Invalid IP range specifications."};
|
||||||
static const std::string InvalidLOrderBy{"Invalid orderBy specification."};
|
static const std::string InvalidLOrderBy{"Invalid orderBy specification."};
|
||||||
static const std::string NeedMobileNumber{"You must provide at least one validated phone number."};
|
static const std::string NeedMobileNumber{"You must provide at least one validated phone number."};
|
||||||
static const std::string BadMFAMethod{"MFA only supports sms or email."};
|
static const std::string BadMFAMethod{"MFA only supports sms or email."};
|
||||||
|
static const std::string InvalidCredentials{"Invalid credentials (username/password)."};
|
||||||
|
static const std::string InvalidPassword{"Password does not conform to basic password rules."};
|
||||||
|
static const std::string UserPendingVerification{"User access denied pending email verification."};
|
||||||
|
static const std::string PasswordMustBeChanged{"Password must be changed."};
|
||||||
|
static const std::string UnrecognizedRequest{"Ill-formed request. Please consult documentation."};
|
||||||
|
static const std::string MissingAuthenticationInformation{"Missing authentication information."};
|
||||||
|
static const std::string InsufficientAccessRights{"Insufficient access rights to complete the operation."};
|
||||||
|
static const std::string ExpiredToken{"Token has expired, user must login."};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif //OWPROV_RESTAPI_ERRORS_H
|
#endif //OWPROV_RESTAPI_ERRORS_H
|
||||||
|
|||||||
@@ -2,8 +2,7 @@
|
|||||||
// Created by stephane bourque on 2021-10-06.
|
// Created by stephane bourque on 2021-10-06.
|
||||||
//
|
//
|
||||||
|
|
||||||
#ifndef OPENWIFI_STORAGE_H
|
#pragma once
|
||||||
#define OPENWIFI_STORAGE_H
|
|
||||||
|
|
||||||
#include "Poco/Data/Session.h"
|
#include "Poco/Data/Session.h"
|
||||||
#include "Poco/Data/SessionPool.h"
|
#include "Poco/Data/SessionPool.h"
|
||||||
@@ -26,13 +25,6 @@ namespace OpenWifi {
|
|||||||
|
|
||||||
class StorageClass : public SubSystemServer {
|
class StorageClass : public SubSystemServer {
|
||||||
public:
|
public:
|
||||||
/* static StorageClass *instance() {
|
|
||||||
if (instance_ == nullptr) {
|
|
||||||
instance_ = new StorageClass;
|
|
||||||
}
|
|
||||||
return instance_;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
StorageClass() noexcept:
|
StorageClass() noexcept:
|
||||||
SubSystemServer("StorageClass", "STORAGE-SVR", "storage")
|
SubSystemServer("StorageClass", "STORAGE-SVR", "storage")
|
||||||
{
|
{
|
||||||
@@ -56,18 +48,18 @@ namespace OpenWifi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Stop() override {
|
void Stop() override {
|
||||||
|
Pool_->shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] inline std::string ComputeRange(uint64_t From, uint64_t HowMany) {
|
[[nodiscard]] inline std::string ComputeRange(uint64_t From, uint64_t HowMany) {
|
||||||
if(dbType_==sqlite) {
|
if(dbType_==sqlite) {
|
||||||
return " LIMIT " + std::to_string(From-1) + ", " + std::to_string(HowMany) + " ";
|
return " LIMIT " + std::to_string(From) + ", " + std::to_string(HowMany) + " ";
|
||||||
} else if(dbType_==pgsql) {
|
} else if(dbType_==pgsql) {
|
||||||
return " LIMIT " + std::to_string(HowMany) + " OFFSET " + std::to_string(From-1) + " ";
|
return " LIMIT " + std::to_string(HowMany) + " OFFSET " + std::to_string(From) + " ";
|
||||||
} else if(dbType_==mysql) {
|
} else if(dbType_==mysql) {
|
||||||
return " LIMIT " + std::to_string(HowMany) + " OFFSET " + std::to_string(From-1) + " ";
|
return " LIMIT " + std::to_string(HowMany) + " OFFSET " + std::to_string(From) + " ";
|
||||||
}
|
}
|
||||||
return " LIMIT " + std::to_string(HowMany) + " OFFSET " + std::to_string(From-1) + " ";
|
return " LIMIT " + std::to_string(HowMany) + " OFFSET " + std::to_string(From) + " ";
|
||||||
}
|
}
|
||||||
|
|
||||||
inline std::string ConvertParams(const std::string & S) const {
|
inline std::string ConvertParams(const std::string & S) const {
|
||||||
@@ -96,15 +88,13 @@ namespace OpenWifi {
|
|||||||
inline int Setup_PostgreSQL();
|
inline int Setup_PostgreSQL();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::unique_ptr<Poco::Data::SessionPool> Pool_;
|
Poco::SharedPtr<Poco::Data::SessionPool> Pool_;
|
||||||
std::unique_ptr<Poco::Data::SQLite::Connector> SQLiteConn_;
|
Poco::Data::SQLite::Connector SQLiteConn_;
|
||||||
std::unique_ptr<Poco::Data::PostgreSQL::Connector> PostgresConn_;
|
Poco::Data::PostgreSQL::Connector PostgresConn_;
|
||||||
std::unique_ptr<Poco::Data::MySQL::Connector> MySQLConn_;
|
Poco::Data::MySQL::Connector MySQLConn_;
|
||||||
DBType dbType_ = sqlite;
|
DBType dbType_ = sqlite;
|
||||||
};
|
};
|
||||||
|
|
||||||
// inline StorageClass * Storage() { return StorageClass::instance(); }
|
|
||||||
|
|
||||||
#ifdef SMALL_BUILD
|
#ifdef SMALL_BUILD
|
||||||
int Service::Setup_MySQL() { Daemon()->exit(Poco::Util::Application::EXIT_CONFIG); return 0; }
|
int Service::Setup_MySQL() { Daemon()->exit(Poco::Util::Application::EXIT_CONFIG); return 0; }
|
||||||
int Service::Setup_PostgreSQL() { Daemon()->exit(Poco::Util::Application::EXIT_CONFIG); return 0; }
|
int Service::Setup_PostgreSQL() { Daemon()->exit(Poco::Util::Application::EXIT_CONFIG); return 0; }
|
||||||
@@ -116,9 +106,8 @@ namespace OpenWifi {
|
|||||||
auto DBName = MicroService::instance().DataDir() + "/" + MicroService::instance().ConfigGetString("storage.type.sqlite.db");
|
auto DBName = MicroService::instance().DataDir() + "/" + MicroService::instance().ConfigGetString("storage.type.sqlite.db");
|
||||||
auto NumSessions = MicroService::instance().ConfigGetInt("storage.type.sqlite.maxsessions", 64);
|
auto NumSessions = MicroService::instance().ConfigGetInt("storage.type.sqlite.maxsessions", 64);
|
||||||
auto IdleTime = MicroService::instance().ConfigGetInt("storage.type.sqlite.idletime", 60);
|
auto IdleTime = MicroService::instance().ConfigGetInt("storage.type.sqlite.idletime", 60);
|
||||||
SQLiteConn_ = std::make_unique<Poco::Data::SQLite::Connector>();
|
SQLiteConn_.registerConnector();
|
||||||
SQLiteConn_->registerConnector();
|
Pool_ = Poco::SharedPtr<Poco::Data::SessionPool>(new Poco::Data::SessionPool(SQLiteConn_.name(), DBName, 4, NumSessions, IdleTime));
|
||||||
Pool_ = std::make_unique<Poco::Data::SessionPool>(SQLiteConn_->name(), DBName, 4, NumSessions, IdleTime);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -141,9 +130,8 @@ namespace OpenWifi {
|
|||||||
";port=" + Port +
|
";port=" + Port +
|
||||||
";compress=true;auto-reconnect=true";
|
";compress=true;auto-reconnect=true";
|
||||||
|
|
||||||
MySQLConn_ = std::make_unique<Poco::Data::MySQL::Connector>();
|
MySQLConn_.registerConnector();
|
||||||
MySQLConn_->registerConnector();
|
Pool_ = Poco::SharedPtr<Poco::Data::SessionPool>(new Poco::Data::SessionPool(MySQLConn_.name(), ConnectionStr, 4, NumSessions, IdleTime));
|
||||||
Pool_ = std::make_unique<Poco::Data::SessionPool>(MySQLConn_->name(), ConnectionStr, 4, NumSessions, IdleTime);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -168,14 +156,11 @@ namespace OpenWifi {
|
|||||||
" port=" + Port +
|
" port=" + Port +
|
||||||
" connect_timeout=" + ConnectionTimeout;
|
" connect_timeout=" + ConnectionTimeout;
|
||||||
|
|
||||||
PostgresConn_ = std::make_unique<Poco::Data::PostgreSQL::Connector>();
|
PostgresConn_.registerConnector();
|
||||||
PostgresConn_->registerConnector();
|
Pool_ = Poco::SharedPtr<Poco::Data::SessionPool>(new Poco::Data::SessionPool(PostgresConn_.name(), ConnectionStr, 4, NumSessions, IdleTime));
|
||||||
Pool_ = std::make_unique<Poco::Data::SessionPool>(PostgresConn_->name(), ConnectionStr, 4, NumSessions, IdleTime);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif //OPENWIFI_STORAGE_H
|
|
||||||
|
|||||||
13
src/ow_version.h.in
Normal file
13
src/ow_version.h.in
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
//
|
||||||
|
// Created by stephane bourque on 2021-12-06.
|
||||||
|
//
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
namespace OW_VERSION {
|
||||||
|
inline static const std::string VERSION{"@CMAKE_PROJECT_VERSION@"};
|
||||||
|
inline static const std::string BUILD{"@BUILD_NUM@"};
|
||||||
|
inline static const std::string HASH{"@GIT_HASH@"};
|
||||||
|
}
|
||||||
@@ -61,11 +61,11 @@ namespace OpenWifi {
|
|||||||
Poco::Data::Statement Insert(Sess);
|
Poco::Data::Statement Insert(Sess);
|
||||||
|
|
||||||
// find the older software and change to latest = 0
|
// find the older software and change to latest = 0
|
||||||
F.id = MicroService::instance().CreateUUID();
|
F.id = MicroService::CreateUUID();
|
||||||
if(LatestFirmwareCache()->AddToCache(F.deviceType,F.revision,F.id,F.imageDate)) {
|
if(LatestFirmwareCache()->AddToCache(F.deviceType,F.revision,F.id,F.imageDate)) {
|
||||||
F.latest = true ;
|
F.latest = true ;
|
||||||
Poco::Data::Statement Update(Sess);
|
Poco::Data::Statement Update(Sess);
|
||||||
std::string st{"UPDATE " + DBNAME_FIRMWARES + " SET latest=0 WHERE deviceType=? AND Latest=1"};
|
std::string st{"UPDATE " + DBNAME_FIRMWARES + " SET latest=false WHERE deviceType=? AND Latest=true"};
|
||||||
Update << ConvertParams(st),
|
Update << ConvertParams(st),
|
||||||
Poco::Data::Keywords::use(F.deviceType);
|
Poco::Data::Keywords::use(F.deviceType);
|
||||||
Update.execute();
|
Update.execute();
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ namespace OpenWifi {
|
|||||||
"location varchar, "
|
"location varchar, "
|
||||||
"uploader varchar, "
|
"uploader varchar, "
|
||||||
"digest varchar, "
|
"digest varchar, "
|
||||||
"latest int, "
|
"latest boolean, "
|
||||||
"notes text, "
|
"notes text, "
|
||||||
"created bigint"
|
"created bigint"
|
||||||
};
|
};
|
||||||
@@ -88,7 +88,7 @@ namespace OpenWifi {
|
|||||||
std::string,
|
std::string,
|
||||||
std::string,
|
std::string,
|
||||||
std::string,
|
std::string,
|
||||||
uint64_t,
|
bool,
|
||||||
std::string,
|
std::string,
|
||||||
uint64_t> FirmwaresRecord;
|
uint64_t> FirmwaresRecord;
|
||||||
typedef std::vector<FirmwaresRecord> FirmwaresRecordList;
|
typedef std::vector<FirmwaresRecord> FirmwaresRecordList;
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ namespace OpenWifi {
|
|||||||
|
|
||||||
bool Storage::AddHistory( std::string & SerialNumber, std::string &DeviceType, std::string & PreviousRevision, std::string & NewVersion) {
|
bool Storage::AddHistory( std::string & SerialNumber, std::string &DeviceType, std::string & PreviousRevision, std::string & NewVersion) {
|
||||||
FMSObjects::RevisionHistoryEntry History{
|
FMSObjects::RevisionHistoryEntry History{
|
||||||
.id = Daemon()->CreateUUID(),
|
.id = MicroService::CreateUUID(),
|
||||||
.serialNumber = SerialNumber,
|
.serialNumber = SerialNumber,
|
||||||
.fromRelease = PreviousRevision,
|
.fromRelease = PreviousRevision,
|
||||||
.toRelease = NewVersion,
|
.toRelease = NewVersion,
|
||||||
|
|||||||
26
wait-for-postgres.sh
Executable file
26
wait-for-postgres.sh
Executable file
@@ -0,0 +1,26 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# wait-for-postgres.sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
host="$1"
|
||||||
|
shift
|
||||||
|
|
||||||
|
export PGUSER=$(grep 'storage.type.postgresql.username' $OWFMS_CONFIG/owfms.properties | awk -F '= ' '{print $2}')
|
||||||
|
export PGPASSWORD=$(grep 'storage.type.postgresql.password' $OWFMS_CONFIG/owfms.properties | awk -F '= ' '{print $2}')
|
||||||
|
|
||||||
|
until psql -h "$host" -c '\q'; do
|
||||||
|
>&2 echo "Postgres is unavailable - sleeping"
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
|
||||||
|
>&2 echo "Postgres is up - executing command"
|
||||||
|
|
||||||
|
if [ "$1" = '/openwifi/owfms' -a "$(id -u)" = '0' ]; then
|
||||||
|
if [ "$RUN_CHOWN" = 'true' ]; then
|
||||||
|
chown -R "$OWFMS_USER": "$OWFMS_ROOT" "$OWFMS_CONFIG"
|
||||||
|
fi
|
||||||
|
exec su-exec "$OWFMS_USER" "$@"
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec "$@"
|
||||||
Reference in New Issue
Block a user