From a3e1cdecb7d6449b2d9f3ad88dbe57804bf3aa84 Mon Sep 17 00:00:00 2001 From: stephb9959 Date: Tue, 13 Jul 2021 22:20:00 -0700 Subject: [PATCH] Typos and security verification. --- build | 2 +- openpapi/ucentralsec/ucentralsec.yaml | 6 ++++++ src/RESTAPI_users_handler.cpp | 9 +++++++-- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/build b/build index d8263ee..e440e5c 100644 --- a/build +++ b/build @@ -1 +1 @@ -2 \ No newline at end of file +3 \ No newline at end of file diff --git a/openpapi/ucentralsec/ucentralsec.yaml b/openpapi/ucentralsec/ucentralsec.yaml index 3bdbfbe..d3cbf37 100644 --- a/openpapi/ucentralsec/ucentralsec.yaml +++ b/openpapi/ucentralsec/ucentralsec.yaml @@ -552,6 +552,12 @@ paths: schema: type: string required: false + - in: query + description: Return only the ids. + name: idOnly + schema: + type: boolean + required: false responses: 200: $ref: '#/components/schemas/UserList' diff --git a/src/RESTAPI_users_handler.cpp b/src/RESTAPI_users_handler.cpp index 285edfc..0e066d6 100644 --- a/src/RESTAPI_users_handler.cpp +++ b/src/RESTAPI_users_handler.cpp @@ -25,12 +25,17 @@ namespace uCentral { try { std::vector Users; InitQueryBlock(); + bool IdOnly = GetParameter("idOnly",false); if (Storage()->GetUsers(QB_.Offset, QB_.Limit, Users)) { Poco::JSON::Array ArrayObj; for (const auto &i : Users) { Poco::JSON::Object Obj; - i.to_json(Obj); - ArrayObj.add(Obj); + if(IdOnly) { + ArrayObj.add(i.Id); + } else { + i.to_json(Obj); + ArrayObj.add(Obj); + } } Poco::JSON::Object RetObj; RetObj.set(uCentral::RESTAPI::Protocol::USERS, ArrayObj);